|
|
@@ -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;
|