Explorar o código

封装的报表类方法

gogs hai 1 mes
pai
achega
17cfbeb8c6

+ 2 - 2
app/Service/Statistic/StatisticCommonService.php

@@ -311,9 +311,9 @@ class StatisticCommonService extends Service
                 if(!isset($all_salary[$item['order_month']])) $all_salary[$item['order_month']] = 0;
                 $all_salary[$item['order_month']] += $total_salary;
                 $all_key_salary[$key] = 1;
-                $item_month_list[$item_key]['total_salary'] = $total_salary;
-
             }
+            $item_month_list[$item_key]['total_salary'] = $total_salary;
+            $item_month_list[$item_key]['total_hour'] = round($total_min/60,2);
             $item_month_list[$item_key]['total_min'] += $total_salary;
             // B. 计算工资分摊:(项目工时 / 月总工时) * 月工资
             if ($total_min > 0) {

+ 1 - 4
app/Service/StatisticService.php

@@ -197,14 +197,11 @@ class StatisticService extends StatisticCommonService
         foreach ($word_keys as $k=>$v){
             $counts[$k] = $employee_count;
         }
-//        var_dump($sums['allocated_salary']);
-//        var_dump($item_month_list);
-//        $sums($item_month_list);
         $item_month_list = collect($item_month_list)->transform(function ($item) use ($item_title_key_list, $item_code_key_list, $employee_key_list, &$sums, &$counts,$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['employee_title'] = $employee_key_list[$item['employee_id']] ?? "未知人员({$item['employee_id']})";
-            $item['total_hours'] = round($item['work_minutes'] / 60,2);
+//            $item['total_hours'] = round($item['work_minutes'] / 60,2);
             $item['total_salary'] = round($item['total_salary'] / 100,2);
             $key = $item['employee_id'] . '_' . $item['month'];
 //            // 如果不是最后一条