shish 2 ani în urmă
părinte
comite
6b7624d19b
1 a modificat fișierele cu 6 adăugiri și 6 ștergeri
  1. 6 6
      biz-ghs/order/classes/OrderClearClass.php

+ 6 - 6
biz-ghs/order/classes/OrderClearClass.php

@@ -48,17 +48,17 @@ class OrderClearClass extends BaseClass
             return true;
         }
         $totalAmount = 0;
-        $totalMoney = 0;
         $need = [];
         foreach ($orderList as $order) {
             $orderId = $order->id ?? 0;
             $remainDebtPrice = $order->remainDebtPrice ?? 0;
-            $totalMoney = bcadd($totalMoney, $remainDebtPrice, 2);
-            if ($totalMoney > $customBalance) {
-                break;
+            $currentTotal = bcadd($totalAmount, $remainDebtPrice, 2);
+            if ($currentTotal > $customBalance) {
+                continue;
+            } else {
+                $totalAmount = bcadd($totalAmount, $remainDebtPrice, 2);
+                $need[] = ['id' => $orderId];
             }
-            $totalAmount = bcadd($totalAmount, $remainDebtPrice, 2);
-            $need[] = ['id' => $orderId];
         }
         if (empty($need)) {
             return true;