|
|
@@ -224,19 +224,27 @@ class CgRefundService extends BaseService
|
|
|
//采购单总金额还要减去退款
|
|
|
$currentRefund = bcadd($cg->refundPrice, $refundPrice, 2);
|
|
|
$cg->refundPrice = $currentRefund;
|
|
|
+
|
|
|
$currentActPrice = bcsub($cg->actPrice, $refundPrice, 2);
|
|
|
if ($currentActPrice < 0) {
|
|
|
util::fail('退款金额有问题!');
|
|
|
}
|
|
|
$cg->actPrice = $currentActPrice;
|
|
|
+
|
|
|
$currentRealPrice = bcsub($cg->realPrice, $refundPrice, 2);
|
|
|
if ($currentRealPrice < 0) {
|
|
|
util::fail('退款金额有问题,请排查');
|
|
|
}
|
|
|
- if ($currentRealPrice == 0) {
|
|
|
+ $cg->realPrice = $currentRealPrice;
|
|
|
+
|
|
|
+ $currentRemainDebt = bcsub($cg->remainDebtPrice, $refundPrice, 2);
|
|
|
+ if ($currentRemainDebt < 0) {
|
|
|
+ util::fail('退款金额有问题哦');
|
|
|
+ }
|
|
|
+ if ($currentRemainDebt == 0) {
|
|
|
$cg->debt = PurchaseClass::DEBT_NO;
|
|
|
}
|
|
|
- $cg->realPrice = $currentRealPrice;
|
|
|
+ $cg->remainDebtPrice = $currentRemainDebt;
|
|
|
$cg->save();
|
|
|
|
|
|
//门店应付总款减少
|
|
|
@@ -247,11 +255,9 @@ class CgRefundService extends BaseService
|
|
|
$main->mayPay = $currentMayPay;
|
|
|
$main->save();
|
|
|
|
|
|
-
|
|
|
//应付供应商款减少
|
|
|
\bizHd\ghs\classes\GhsClass::refundDebtAmountReduce($ghs, $cgRefund, $cg);
|
|
|
|
|
|
-
|
|
|
} elseif ($payWay == dict::getDict('payWay', 'balancePay')) {
|
|
|
|
|
|
//采购单总金额还要减去退款
|