|
|
@@ -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 = [];
|