Sfoglia il codice sorgente

封装的报表类方法

gogs 2 mesi fa
parent
commit
99da5837d5
1 ha cambiato i file con 4 aggiunte e 3 eliminazioni
  1. 4 3
      app/Service/BIService.php

+ 4 - 3
app/Service/BIService.php

@@ -58,24 +58,25 @@ class BIService extends Service
         $total = bcadd(bcadd($total_man, $total_zj,3), $total_other,3);
 
         //研发费用结构
+
         $rd = [
             0 => [
                 'title' => '人工费用',
-                'rate' => bcmul(bcdiv($total_man,$total,4),100,2),
+                'rate' => $total == 0 ? 0 : bcmul(bcdiv($total_man,$total,4),100,2),
                 'rate_unit' => '%',
                 'total' => $total_man,
                 'total_unit' => '¥',
             ],
             1 => [
                 'title' => '折旧费用',
-                'rate' => bcmul(bcdiv($total_zj,$total,4),100,2),
+                'rate' => $total == 0 ? 0 :bcmul(bcdiv($total_zj,$total,4),100,2),
                 'rate_unit' => '%',
                 'total' => $total_zj,
                 'total_unit' => '¥',
             ],
             2 => [
                 'title' => '费用报销',
-                'rate' => bcmul(bcdiv($total_other,$total,4),100,2),
+                'rate' => $total == 0 ? 0 :bcmul(bcdiv($total_other,$total,4),100,2),
                 'rate_unit' => '%',
                 'total' => $total_other,
                 'total_unit' => '¥',