|
|
@@ -190,17 +190,6 @@ 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,
|
|
|
@@ -213,9 +202,23 @@ class ExpendController extends BaseController
|
|
|
'bx' => $bx,
|
|
|
'bxId' => $bxId,
|
|
|
];
|
|
|
- ExpendClass::add($expendData);
|
|
|
- $bx->amount = $amount;
|
|
|
- $bx->save();
|
|
|
+ $respond = ExpendClass::add($expendData, true);
|
|
|
+
|
|
|
+ if ($bx == 1) {
|
|
|
+ $bxData = [
|
|
|
+ 'mainId' => $this->mainId,
|
|
|
+ 'staffId' => $getStaffId,
|
|
|
+ 'staffName' => $staffName,
|
|
|
+ 'remark' => '登记时已报销',
|
|
|
+ ];
|
|
|
+ $bxInfo = ExpendBxClass::add($bxData, true);
|
|
|
+ $bxId = $bxInfo->id ?? 0;
|
|
|
+ $bxInfo->amount = $amount;
|
|
|
+ $bxInfo->save();
|
|
|
+ $respond->bxId = $bxId;
|
|
|
+ $respond->save();
|
|
|
+ }
|
|
|
+
|
|
|
$transaction->commit();
|
|
|
util::complete();
|
|
|
} catch (\Exception $e) {
|