|
|
@@ -238,13 +238,13 @@ class ProductClass extends BaseClass
|
|
|
}
|
|
|
$list[$k]['price'] = $price;
|
|
|
$cost = $v['cost'] ?? 0;
|
|
|
- if ($cost == 0) {
|
|
|
- $mll = 0;
|
|
|
- } else {
|
|
|
+ if ($price > 0) {
|
|
|
$profit = bcsub($price, $cost, 2);
|
|
|
$mll = bcdiv($profit, $price, 3);
|
|
|
$mll = bcmul($mll, 100);
|
|
|
$mll = round($mll, 1);
|
|
|
+ }else{
|
|
|
+ $mll = 0;
|
|
|
}
|
|
|
$list[$k]['mll'] = $mll;
|
|
|
}
|
|
|
@@ -282,6 +282,18 @@ class ProductClass extends BaseClass
|
|
|
$list[$k]['skPrice'] = bcadd($v['discountPrice'], $currentAddPrice, 2);
|
|
|
}
|
|
|
$list[$k]['price'] = $price;
|
|
|
+
|
|
|
+ $cost = $v['cost'] ?? 0;
|
|
|
+ if ($price > 0) {
|
|
|
+ $profit = bcsub($price, $cost, 2);
|
|
|
+ $mll = bcdiv($profit, $price, 3);
|
|
|
+ $mll = bcmul($mll, 100);
|
|
|
+ $mll = round($mll, 1);
|
|
|
+ } else {
|
|
|
+ $mll = 0;
|
|
|
+ }
|
|
|
+ $list[$k]['mll'] = $mll;
|
|
|
+
|
|
|
}
|
|
|
return $list;
|
|
|
}
|