|
|
@@ -41,6 +41,12 @@ class ExpendController extends BaseController
|
|
|
|
|
|
$list = ExpendClass::getAllByCondition($where, null, '*', null);
|
|
|
$arr = [];
|
|
|
+ $cat = [];
|
|
|
+ $map = dict::getDict('expendTypeMap');
|
|
|
+ foreach ($map as $id => $name) {
|
|
|
+ $cat[$id] = ['num' => 0, 'amount' => 0, 'name' => $name];
|
|
|
+ }
|
|
|
+
|
|
|
$totalExpend = 0;
|
|
|
if (!empty($list)) {
|
|
|
foreach ($list as $expend) {
|
|
|
@@ -48,6 +54,7 @@ class ExpendController extends BaseController
|
|
|
$amount = $expend['amount'] ?? 0;
|
|
|
$staffName = $expend['staffName'] ?? '';
|
|
|
$bx = $expend['bx'] ?? 0;
|
|
|
+ $type = $expend['type'] ?? 0;
|
|
|
$currentAmount = $amount;
|
|
|
if ($bx == 0) {
|
|
|
$hasAmount = 0;
|
|
|
@@ -72,9 +79,13 @@ class ExpendController extends BaseController
|
|
|
$arr[$staffId]['num'] = 1;
|
|
|
}
|
|
|
$totalExpend = bcadd($totalExpend, $currentAmount, 2);
|
|
|
+ if (isset($cat[$type])) {
|
|
|
+ $cat[$type]['num']++;
|
|
|
+ $cat[$type]['amount'] = bcadd($cat[$type]['amount'], $amount, 2);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- util::success(['list' => $arr, 'totalExpend' => $totalExpend]);
|
|
|
+ util::success(['list' => $arr, 'totalExpend' => $totalExpend, 'cat' => $cat]);
|
|
|
}
|
|
|
|
|
|
//报销汇总统计 ssh 20240308
|