|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace ghs\controllers;
|
|
|
|
|
|
+use bizGhs\expend\classes\ExpendBxClass;
|
|
|
use bizGhs\expend\classes\ExpendClass;
|
|
|
use bizGhs\shop\classes\MainClass;
|
|
|
use bizGhs\shop\classes\ShopAdminClass;
|
|
|
@@ -53,12 +54,23 @@ class ExpendController extends BaseController
|
|
|
try {
|
|
|
$list = ExpendClass::getAllByCondition(['mainId' => $this->mainId, 'bx' => 0, 'staffId' => $staffId], null, '*', null, true);
|
|
|
$total = 0;
|
|
|
+ $staff = $this->shopAdmin;
|
|
|
+ $bxData = [
|
|
|
+ 'mainId' => $this->mainId,
|
|
|
+ 'staffId' => $staff->id ?? 0,
|
|
|
+ 'staffName' => $staff->name ?? '',
|
|
|
+ ];
|
|
|
+ $bx = ExpendBxClass::add($bxData, true);
|
|
|
+ $bxId = $bx->id ?? 0;
|
|
|
foreach ($list as $it) {
|
|
|
$amount = $it->amount ?? 0;
|
|
|
$total = bcadd($total, $amount, 2);
|
|
|
$it->bx = 1;
|
|
|
+ $it->bxId = $bxId;
|
|
|
$it->save();
|
|
|
}
|
|
|
+ $bx->amount = $total;
|
|
|
+ $bx->save();
|
|
|
if (floatval($amount) != floatval($total)) {
|
|
|
util::fail('金额有问题,返回上页再进来');
|
|
|
}
|