|
|
@@ -48,15 +48,15 @@ class CustomController extends Controller
|
|
|
$customId = $custom['id'] ?? 0;
|
|
|
$where = ['customId' => $customId, 'debt' => 1];
|
|
|
$orderList = OrderClass::getAllByCondition($where, 'addTime DESC', '*');
|
|
|
- if (empty($orderList)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
$ghsOrderDebtAmount = 0;
|
|
|
- foreach ($orderList as $order) {
|
|
|
- $actPrice = $order['actPrice'] ?? 0;
|
|
|
- $ghsOrderDebtAmount = bcadd($ghsOrderDebtAmount, $actPrice, 2);
|
|
|
+ if (!empty($orderList)) {
|
|
|
+ foreach ($orderList as $order) {
|
|
|
+ $actPrice = $order['actPrice'] ?? 0;
|
|
|
+ $ghsOrderDebtAmount = bcadd($ghsOrderDebtAmount, $actPrice, 2);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
$ghsId = $custom['ghsId'] ?? 0;
|
|
|
|
|
|
$ghs = \bizHd\ghs\classes\GhsClass::getById($ghsId);
|
|
|
@@ -64,9 +64,14 @@ class CustomController extends Controller
|
|
|
$where = ['ghsId' => $ghsId, 'debt' => PurchaseClass::DEBT_YES];
|
|
|
$cgList = PurchaseClass::getAllByCondition($where, 'addTime DESC', '*');
|
|
|
$hdCgOrderDebtAmount = 0;
|
|
|
- foreach ($cgList as $cg) {
|
|
|
- $actPrice = $cg['actPrice'] ?? 0;
|
|
|
- $hdCgOrderDebtAmount = bcadd($hdCgOrderDebtAmount, $actPrice, 2);
|
|
|
+ if (!empty($cgList)) {
|
|
|
+ foreach ($cgList as $cg) {
|
|
|
+ $actPrice = $cg['actPrice'] ?? 0;
|
|
|
+ $hdCgOrderDebtAmount = bcadd($hdCgOrderDebtAmount, $actPrice, 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if($ghsOrderDebtAmount < 0 || $hdCgOrderDebtAmount < 0 ){
|
|
|
+ noticeUtil::push("!!!!!!!供应商 {$ghsId} 客户id {$customId} 出现负数 $ghsOrderDebtAmount $hdCgOrderDebtAmount", '15280215347');
|
|
|
}
|
|
|
$ghsOrderDebtAmount = floatval($ghsOrderDebtAmount);
|
|
|
$hdCgOrderDebtAmount = floatval($hdCgOrderDebtAmount);
|