|
|
@@ -226,16 +226,16 @@ class StatisticService extends Service
|
|
|
//查询所有项目人员的工时比例
|
|
|
//汇总每个人每个月工资
|
|
|
$salary_map = [];
|
|
|
- $all_salary = [];
|
|
|
+// $all_salary = [];
|
|
|
foreach ($month_employee_salary as $val) {
|
|
|
$month = $monthly_ps_order_key_list[$val['main_id']] ?? '';
|
|
|
if ($month) {
|
|
|
$salary_map[$val['employee_id'] . '_' . $month] = $val['salary'];
|
|
|
}
|
|
|
- if(!isset( $all_salary[$val['employee_id']])){
|
|
|
- $all_salary[$val['employee_id']] = 0;
|
|
|
- }
|
|
|
- $all_salary[$val['employee_id']] += $val['salary'];
|
|
|
+// if(!isset($all_salary[$val['employee_id']])){
|
|
|
+// $all_salary[$val['employee_id']] = 0;
|
|
|
+// }
|
|
|
+// $all_salary[$val['employee_id']] += $val['salary'];
|
|
|
|
|
|
}
|
|
|
// 2. 计算每个员工在每个月的全月总工时
|
|
|
@@ -285,12 +285,12 @@ class StatisticService extends Service
|
|
|
unset($item_month_list[$k]['work_minutes']);
|
|
|
}
|
|
|
|
|
|
- $collect = collect($item_month_list);
|
|
|
- $employee_count = $collect->groupBy('employee_id')
|
|
|
- ->map(function ($group) {
|
|
|
- return $group->count(); // 统计每个分组里的数量
|
|
|
- })
|
|
|
- ->toArray();
|
|
|
+// $collect = collect($item_month_list);
|
|
|
+// $employee_count = $collect->groupBy('employee_id')
|
|
|
+// ->map(function ($group) {
|
|
|
+// return $group->count(); // 统计每个分组里的数量
|
|
|
+// })
|
|
|
+// ->toArray();
|
|
|
|
|
|
$item_month_list = collect($item_month_list)->sortBy('month')->values()->all();
|
|
|
$items = collect($item_month_list)->pluck('item_id')->unique()->values()->all();
|
|
|
@@ -303,16 +303,16 @@ class StatisticService extends Service
|
|
|
$employee = Employee::Clear($user, $data);
|
|
|
$employee_key_list = $employee->wherein('id', $employee_ids)->pluck("title", "id")->toArray();
|
|
|
|
|
|
- $item_month_list = collect($item_month_list)->transform(function ($item,$index) use ($item_title_key_list, $item_code_key_list, $employee_key_list,&$employee_count,&$all_salary) {
|
|
|
+ $item_month_list = collect($item_month_list)->transform(function ($item) use ($item_title_key_list, $item_code_key_list, $employee_key_list) {
|
|
|
$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']})";
|
|
|
- if(--$employee_count[$item['employee_id']] > 0){
|
|
|
- $all_salary[$item['employee_id']] -= $item['total_salary'];
|
|
|
- }else{
|
|
|
- $item['total_salary'] = $all_salary[$item['employee_id']];
|
|
|
- }
|
|
|
- return $item;
|
|
|
+// if(--$employee_count[$item['employee_id']] > 0){
|
|
|
+// $all_salary[$item['employee_id']] -= $item['total_salary'];
|
|
|
+// }else{
|
|
|
+// $item['total_salary'] = $all_salary[$item['employee_id']];
|
|
|
+// }
|
|
|
+// return $item;
|
|
|
})->all();
|
|
|
return [true, $item_month_list];
|
|
|
}
|