gogs пре 2 месеци
родитељ
комит
2b011c90b7
1 измењених фајлова са 9 додато и 4 уклоњено
  1. 9 4
      app/Service/StatisticService.php

+ 9 - 4
app/Service/StatisticService.php

@@ -700,12 +700,17 @@ class StatisticService extends Service
         $month_employee_list = $collect->transform(function ($item, $index) use (&$employee_count,&$all_salary) {
 
             // 如果不是最后一条
+
             $key = $item['employee_id'] . '_' . $item['month'];
-            if (--$employee_count[$key] > 0) {
-                $all_salary[$key] -= $item['allocated_salary'];
-            } else {
-                $item['allocated_salary'] = $all_salary[$key];
+            if(!isset($all_salary[$key])) $item['allocated_salary'] = 0;
+            else{
+                if (--$employee_count[$key] > 0) {
+                    $all_salary[$key] -= $item['allocated_salary'];
+                } else {
+                    $item['allocated_salary'] = $all_salary[$key];
+                }
             }
+
             return $item;
         })->all();
         $return_item_list = [];