|
|
@@ -3,6 +3,7 @@
|
|
|
namespace bizGhs\order\classes;
|
|
|
|
|
|
use biz\ghs\classes\GhsClass;
|
|
|
+use biz\shop\classes\ShopClass;
|
|
|
use bizGhs\custom\classes\CustomClass;
|
|
|
use common\components\orderSn;
|
|
|
use common\components\util;
|
|
|
@@ -71,6 +72,17 @@ class OrderClearClass extends BaseClass
|
|
|
$custom->debtNum = $num;
|
|
|
$custom->save();
|
|
|
|
|
|
+ //客户门店应付供货商款减少
|
|
|
+ $customShopId = $custom->shopId;
|
|
|
+ $customShop = ShopClass::getLockById($customShopId);
|
|
|
+ if (empty($customShop)) {
|
|
|
+ util::fail('没有找到客户门店');
|
|
|
+ }
|
|
|
+ $currentMayPay = bcsub($customShop->mayPay, $amount, 2);
|
|
|
+ $customShop->mayPay = $currentMayPay;
|
|
|
+ $customShop->save();
|
|
|
+
|
|
|
+
|
|
|
$orderSn = orderSn::getPurchaseClearSn();
|
|
|
$clearData = [
|
|
|
'prePrice' => $amount,
|
|
|
@@ -106,6 +118,14 @@ class OrderClearClass extends BaseClass
|
|
|
$ghs->debtNum = $num;
|
|
|
$ghs->debt = $remainAmount > 0 ? 2 : 1;
|
|
|
$ghs->save();
|
|
|
+
|
|
|
+ //供货商的门店应收客户款减少
|
|
|
+ $shopId = $ghs->shopId;
|
|
|
+ $shop = ShopClass::getLockById($shopId);
|
|
|
+ $currentGathering = bcsub($shop->mayGathering, $amount, 2);
|
|
|
+ $shop->mayGathering = $currentGathering;
|
|
|
+ $shop->save();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|