Browse Source

毛利率

shish 3 years ago
parent
commit
ffa75c2a7f
1 changed files with 5 additions and 0 deletions
  1. 5 0
      biz-ghs/product/classes/ProductClass.php

+ 5 - 0
biz-ghs/product/classes/ProductClass.php

@@ -237,6 +237,11 @@ class ProductClass extends BaseClass
                 $list[$k]['skPrice'] = bcadd($v['discountPrice'], $currentAddPrice, 2);
             }
             $list[$k]['price'] = $price;
+            $cost = $v['cost'] ?? 0;
+            $profit = bcsub($price, $cost, 2);
+            $mll = bcdiv($profit, $cost, 3);
+            $mll = round($mll, 2);
+            $list[$k]['mll'] = $mll;
         }
         return $list;
     }