shish il y a 3 ans
Parent
commit
8d24e50f13
1 fichiers modifiés avec 7 ajouts et 3 suppressions
  1. 7 3
      app-ghs/controllers/StatItemController.php

+ 7 - 3
app-ghs/controllers/StatItemController.php

@@ -85,9 +85,13 @@ class StatItemController extends BaseController
         foreach ($stat as $key => $val) {
             $profit = $val['gross'] ?? 0;
             $price = $val['amount'] ?? 0;
-            $mll = bcdiv($profit, $price, 3);
-            $mll = bcmul($mll, 100);
-            $mll = round($mll, 1);
+            if ($price > 0) {
+                $mll = bcdiv($profit, $price, 3);
+                $mll = bcmul($mll, 100);
+                $mll = round($mll, 1);
+            } else {
+                $mll = 0;
+            }
             $stat[$key]['mll'] = $mll;
         }
         $rank = 'num';