shish 2 years ago
parent
commit
7461b90046
1 changed files with 14 additions and 0 deletions
  1. 14 0
      app-ghs/controllers/ExpendController.php

+ 14 - 0
app-ghs/controllers/ExpendController.php

@@ -190,6 +190,17 @@ class ExpendController extends BaseController
             }
             $staffName = $staff->name ?? '';
             $ptStyle = dict::getDict('ptStyle', 'ghs');
+            $bxId = 0;
+            if ($bx == 1) {
+                $bxData = [
+                    'mainId' => $this->mainId,
+                    'staffId' => $getStaffId,
+                    'staffName' => $staffName,
+                    'remark' => '登记时已报销',
+                ];
+                $bx = ExpendBxClass::add($bxData, true);
+                $bxId = $bx->id ?? 0;
+            }
             $expendData = [
                 'type' => $type,
                 'amount' => $amount,
@@ -200,8 +211,11 @@ class ExpendController extends BaseController
                 'ptStyle' => $ptStyle,
                 'payWay' => $payWay,
                 'bx' => $bx,
+                'bxId' => $bxId,
             ];
             ExpendClass::add($expendData);
+            $bx->amount = $amount;
+            $bx->save();
             $transaction->commit();
             util::complete();
         } catch (\Exception $e) {