shish 3 лет назад
Родитель
Сommit
92e001ef0a
1 измененных файлов с 7 добавлено и 3 удалено
  1. 7 3
      biz-ghs/product/classes/ProductClass.php

+ 7 - 3
biz-ghs/product/classes/ProductClass.php

@@ -238,9 +238,13 @@ class ProductClass extends BaseClass
             }
             $list[$k]['price'] = $price;
             $cost = $v['cost'] ?? 0;
-            $profit = bcsub($price, $cost, 2);
-            $mll = bcdiv($profit, $cost, 3);
-            $mll = round($mll, 2);
+            if ($cost == 0) {
+                $mll = 0;
+            } else {
+                $profit = bcsub($price, $cost, 2);
+                $mll = bcdiv($profit, $cost, 3);
+                $mll = round($mll, 2);
+            }
             $list[$k]['mll'] = $mll;
         }
         return $list;