|
@@ -276,12 +276,13 @@ class StatisticService extends Service
|
|
|
// 聚合求和
|
|
// 聚合求和
|
|
|
DB::raw("SUM(total_work_min) as total_work")
|
|
DB::raw("SUM(total_work_min) as total_work")
|
|
|
)
|
|
)
|
|
|
- ->groupBy("order_month", "item_id", "device_id")->toArray();
|
|
|
|
|
|
|
+ ->groupBy( DB::raw("FROM_UNIXTIME(order_time, '%Y-%m')"), "item_id", "device_id")->get()->toArray();
|
|
|
//查询所有人员工资
|
|
//查询所有人员工资
|
|
|
$monthly_dd_order_ids = MonthlyDdOrder::Clear($user, $data)->where('del_time', 0)->where("month", ">=", $month_start)->where("month", "<", $month_end)
|
|
$monthly_dd_order_ids = MonthlyDdOrder::Clear($user, $data)->where('del_time', 0)->where("month", ">=", $month_start)->where("month", "<", $month_end)
|
|
|
->pluck('id')->toArray();
|
|
->pluck('id')->toArray();
|
|
|
$monthly_dd_order_key_list = MonthlyDdOrder::Clear($user, $data)->where('del_time', 0)->where("month", ">=", $month_start)->where("month", "<", $month_end)
|
|
$monthly_dd_order_key_list = MonthlyDdOrder::Clear($user, $data)->where('del_time', 0)->where("month", ">=", $month_start)->where("month", "<", $month_end)
|
|
|
- ->pluck(DB::raw("FROM_UNIXTIME(month, '%Y-%m') as month"), 'id')->toArray();
|
|
|
|
|
|
|
+ ->select('id', DB::raw("FROM_UNIXTIME(month, '%Y-%m') as month_str"))
|
|
|
|
|
+ ->pluck("month_str", 'id')->toArray();
|
|
|
$month_device_salary = MonthlyDdOrderDetails::wherein('main_id', $monthly_dd_order_ids)
|
|
$month_device_salary = MonthlyDdOrderDetails::wherein('main_id', $monthly_dd_order_ids)
|
|
|
->select("device_id", "depreciation_amount", "main_id")
|
|
->select("device_id", "depreciation_amount", "main_id")
|
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
@@ -354,7 +355,7 @@ class StatisticService extends Service
|
|
|
$device_original_value_key_list = $device->wherein('id', $device_ids)->pluck("original_value", "id")->toArray();
|
|
$device_original_value_key_list = $device->wherein('id', $device_ids)->pluck("original_value", "id")->toArray();
|
|
|
|
|
|
|
|
$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) {
|
|
$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) {
|
|
|
- $item['item_title'] = $item_key_list[$item_title_key_list['item_id']] ?? "未知项目({$item['item_id']})";
|
|
|
|
|
|
|
+ $item['item_title'] = $item_key_list[$item['item_id']] ?? "未知项目({$item['item_id']})";
|
|
|
$item['item_code'] = $item_code_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['device_title'] = $device_key_list[$item['device_id']] ?? "未知人员({$item['device_id']})";
|
|
|
$item['device_original'] = $device_original_value_key_list[$item['device_id']] ?? "未知人员({$item['device_id']})";
|
|
$item['device_original'] = $device_original_value_key_list[$item['device_id']] ?? "未知人员({$item['device_id']})";
|