|
@@ -260,11 +260,11 @@ class PurchaseOrderClass extends BaseClass
|
|
|
$main->save();
|
|
$main->save();
|
|
|
|
|
|
|
|
//采购增加
|
|
//采购增加
|
|
|
- $shop->cgFinish += 1;
|
|
|
|
|
- $shop->totalPurchaseOrder += 1;
|
|
|
|
|
- $currentTotalPurchase = bcadd($shop->totalPurchase, $currentPrice, 2);
|
|
|
|
|
- $shop->totalPurchase = $currentTotalPurchase;
|
|
|
|
|
- $shop->save();
|
|
|
|
|
|
|
+ $main->cgFinish += 1;
|
|
|
|
|
+ $main->totalPurchaseOrder += 1;
|
|
|
|
|
+ $currentTotalPurchase = bcadd($main->totalPurchase, $currentPrice, 2);
|
|
|
|
|
+ $main->totalPurchase = $currentTotalPurchase;
|
|
|
|
|
+ $main->save();
|
|
|
|
|
|
|
|
//供应商资产增加
|
|
//供应商资产增加
|
|
|
$ghsId = $data['ghsId'] ?? 0;
|
|
$ghsId = $data['ghsId'] ?? 0;
|
|
@@ -289,8 +289,16 @@ class PurchaseOrderClass extends BaseClass
|
|
|
//门店应收客户款增加
|
|
//门店应收客户款增加
|
|
|
$ghsShopId = $ghs->shopId;
|
|
$ghsShopId = $ghs->shopId;
|
|
|
$ghsShop = ShopClass::getLockById($ghsShopId);
|
|
$ghsShop = ShopClass::getLockById($ghsShopId);
|
|
|
- $currentMayGathering = bcadd($ghsShop->mayGathering, $currentPrice, 2);
|
|
|
|
|
- $ghsShop->mayGathering = $currentMayGathering;
|
|
|
|
|
|
|
+ if (empty($ghsShop)) {
|
|
|
|
|
+ util::fail('没有找到门店');
|
|
|
|
|
+ }
|
|
|
|
|
+ $ghsMainId = $ghsShop->mainId ?? 0;
|
|
|
|
|
+ $ghsMain = \bizGhs\shop\classes\MainClass::getLockById($ghsMainId);
|
|
|
|
|
+ if (empty($ghsMain)) {
|
|
|
|
|
+ util::fail('没有main信息');
|
|
|
|
|
+ }
|
|
|
|
|
+ $currentMayGathering = bcadd($ghsMain->mayGathering, $currentPrice, 2);
|
|
|
|
|
+ $ghsMain->mayGathering = $currentMayGathering;
|
|
|
|
|
|
|
|
//客户资产增加
|
|
//客户资产增加
|
|
|
$customId = $ghs->customId;
|
|
$customId = $ghs->customId;
|
|
@@ -301,16 +309,16 @@ class PurchaseOrderClass extends BaseClass
|
|
|
$custom->isDebt = CustomClass::IS_DEBT_YES;
|
|
$custom->isDebt = CustomClass::IS_DEBT_YES;
|
|
|
$custom->debtAmount = bcadd($custom->debtAmount, $currentPrice, 2);
|
|
$custom->debtAmount = bcadd($custom->debtAmount, $currentPrice, 2);
|
|
|
if ($custom->debtNum == 0) {
|
|
if ($custom->debtNum == 0) {
|
|
|
- $ghsShop->mayGatheringNum += 1;
|
|
|
|
|
|
|
+ $ghsMain->mayGatheringNum += 1;
|
|
|
}
|
|
}
|
|
|
- $ghsShop->save();
|
|
|
|
|
|
|
+ $ghsMain->save();
|
|
|
$custom->debtNum += 1;
|
|
$custom->debtNum += 1;
|
|
|
$custom->buyNum += 1;
|
|
$custom->buyNum += 1;
|
|
|
$custom->buyAmount = bcadd($custom->buyAmount, $currentPrice, 2);
|
|
$custom->buyAmount = bcadd($custom->buyAmount, $currentPrice, 2);
|
|
|
$custom->save();
|
|
$custom->save();
|
|
|
|
|
|
|
|
//当天和当月支出统计
|
|
//当天和当月支出统计
|
|
|
- StatOutClass::updateOrInsert($shop, $currentPrice);
|
|
|
|
|
|
|
+ StatOutClass::updateOrInsert($main, $shop, $currentPrice);
|
|
|
//支出流水
|
|
//支出流水
|
|
|
$payWay = dict::getDict('payWay', 'unknown');
|
|
$payWay = dict::getDict('payWay', 'unknown');
|
|
|
$capitalType = dict::getDict('capitalType', 'ghsPurchase', 'id');
|
|
$capitalType = dict::getDict('capitalType', 'ghsPurchase', 'id');
|