|
|
@@ -21,24 +21,42 @@ class ExpendController extends BaseController
|
|
|
{
|
|
|
ini_set('memory_limit', '2045M');
|
|
|
set_time_limit(0);
|
|
|
- $list = ExpendClass::getAllByCondition(['mainId' => $this->mainId, 'bx' => 0], null, '*', null);
|
|
|
+ $list = ExpendClass::getAllByCondition(['mainId' => $this->mainId], null, '*', null);
|
|
|
$arr = [];
|
|
|
+ $totalExpend = 0;
|
|
|
if (!empty($list)) {
|
|
|
foreach ($list as $expend) {
|
|
|
$staffId = $expend['staffId'] ?? 0;
|
|
|
$amount = $expend['amount'] ?? 0;
|
|
|
$staffName = $expend['staffName'] ?? '';
|
|
|
+ $bx = $expend['bx'] ?? 0;
|
|
|
+ $currentAmount = $amount;
|
|
|
+ if ($bx == 0) {
|
|
|
+ $hasAmount = 0;
|
|
|
+ $unAmount = $amount;
|
|
|
+ } else {
|
|
|
+ $hasAmount = $amount;
|
|
|
+ $unAmount = 0;
|
|
|
+ }
|
|
|
if (isset($arr[$staffId])) {
|
|
|
- $arr[$staffId]['amount'] = bcadd($arr[$staffId]['amount'], $amount);
|
|
|
+ //总支出
|
|
|
+ $arr[$staffId]['totalAmount'] = bcadd($arr[$staffId]['totalAmount'], $currentAmount);
|
|
|
+ //已报销
|
|
|
+ $arr[$staffId]['hasAmount'] = bcadd($arr[$staffId]['hasAmount'], $hasAmount);
|
|
|
+ //待报销
|
|
|
+ $arr[$staffId]['amount'] = bcadd($arr[$staffId]['amount'], $unAmount);
|
|
|
$arr[$staffId]['num'] = bcadd($arr[$staffId]['num'], 1);
|
|
|
} else {
|
|
|
- $arr[$staffId]['amount'] = $amount;
|
|
|
+ $arr[$staffId]['totalAmount'] = $currentAmount;
|
|
|
+ $arr[$staffId]['hasAmount'] = $hasAmount;
|
|
|
+ $arr[$staffId]['amount'] = $unAmount;
|
|
|
$arr[$staffId]['staffName'] = $staffName;
|
|
|
$arr[$staffId]['num'] = 1;
|
|
|
}
|
|
|
+ $totalExpend = bcadd($totalExpend, $currentAmount, 2);
|
|
|
}
|
|
|
}
|
|
|
- util::success(['list' => $arr]);
|
|
|
+ util::success(['list' => $arr, 'totalExpend' => $totalExpend]);
|
|
|
}
|
|
|
|
|
|
//报销金额 ssh 20240308
|