Przeglądaj źródła

封装的报表类方法

gogs 1 miesiąc temu
rodzic
commit
8a19957a83

+ 1 - 0
app/Service/Statistic/StatisticCommonService.php

@@ -416,6 +416,7 @@ class StatisticCommonService extends Service
                 }
             } else {
                 if($v['type'] == "day")   $item[$v['value']] = $sum[$k][$key];
+                if($v['type'] == "ratio")   $item[$v['value']] =round($sum[$k][$key] / 100, 4);
                 else $item[$v['value']] = round($sum[$k][$key] / 100, 2);
             }
 

+ 8 - 8
app/Service/StatisticService.php

@@ -240,12 +240,12 @@ class StatisticService extends StatisticCommonService
         $collect = collect($item_month_list);
 
         $word_keys = [
-            "total_depreciation" =>
-                [
-                    "key" => "allocated_depreciation",
-                    "value" => "allocated_depreciation",
-                    "type" => "money",
-                ],
+//            "total_depreciation" =>
+//                [
+//                    "key" => "allocated_depreciation",
+//                    "value" => "allocated_depreciation",
+//                    "type" => "money",
+//                ],
             "total_hours" =>
                 [
                     "key" => "hours",
@@ -271,12 +271,12 @@ class StatisticService extends StatisticCommonService
         }
         $device_total_depreciation['ratio'] = [];
 
-//        dd($item_month_list);
         $item_month_list = collect($item_month_list)->transform(function ($item) use ($item_title_key_list, $item_code_key_list, $device_key_list, $device_original_value_key_list, &$device_total_depreciation, &$device_counts,&$rate_list,$word_keys) {
             $item['item_title'] = $item_title_key_list[$item['item_id']] ?? "未知项目({$item['item_id']})";
             $item['item_code'] = $item_code_key_list[$item['item_id']] ?? "未知项目({$item['item_id']})";
             $item['device_title'] = $device_key_list[$item['device_id']] ?? "未知人员({$item['device_id']})";
-            $item['allocated_depreciatio'] = $item['allocated_depreciation'];
+            $item['allocated_depreciatio'] = round($item['allocated_depreciation']/100,2);
+            $item['total_depreciatio'] =  round($item['total_depreciation']/100,2);
             $item['device_original'] = $device_original_value_key_list[$item['device_id']] ?? "未知人员({$item['device_id']})";
             $item['hours'] = round($item['work_minutes'] / 60, 1);
             $item['total_hours'] = round($item['total_min'] / 60, 1);