Browse Source

update report analysis

pull/3/head
wahyu 1 year ago
parent
commit
4e03656f13
  1. 11
      app/Http/Controllers/ActivityController.php
  2. 2
      app/Http/Controllers/UserToActivityController.php

11
app/Http/Controllers/ActivityController.php

@ -534,7 +534,7 @@ class ActivityController extends Controller
->select('m_activity.name') ->select('m_activity.name')
->where('m_activity.proyek_id', $data['columns'][0]['value']) ->where('m_activity.proyek_id', $data['columns'][0]['value'])
->where('m_activity.type_activity', 'task') ->where('m_activity.type_activity', 'task')
->where('m_activity.persentase_progress', '>', 0) // ->where('m_activity.persentase_progress', '>', 0)
->groupByRaw('m_activity.name') ->groupByRaw('m_activity.name')
->get(); ->get();
return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet ], 200); return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet ], 200);
@ -544,14 +544,14 @@ class ActivityController extends Controller
{ {
$dataBuilder = $this->setUpPayload($request->all(), 'm_activity'); $dataBuilder = $this->setUpPayload($request->all(), 'm_activity');
$builder = $dataBuilder['builder']; $builder = $dataBuilder['builder'];
$dataGet = $builder->select( 'selfTable.name', 'persentase_progress', $dataGet = $builder->select( 'selfTable.name', 'persentase_progress', 'selfTable.start_date', 'selfTable.end_date', 'duration', 'assign_hr_to_activity.id',
'm_version_gantt.name_version', 'm_users.name as user_name', 'm_version_gantt.name_version', 'm_users.name as user_name',
DB::raw('SUM(report_activity_material.qty) as qty'), 'assign_material_to_activity.qty_planning', DB::raw('SUM(report_activity_material.qty) as qty'), 'assign_material_to_activity.qty_planning',
'assign_material_to_activity.id as join_third_id') 'assign_material_to_activity.id as join_third_id')
->join('m_version_gantt', 'm_version_gantt.id', '=', 'selfTable.version_gantt_id') ->join('m_version_gantt', 'm_version_gantt.id', '=', 'selfTable.version_gantt_id')
->join('assign_hr_to_activity', 'assign_hr_to_activity.activity_id', '=', 'selfTable.id') ->leftJoin('assign_hr_to_activity', 'assign_hr_to_activity.activity_id', '=', 'selfTable.id')
->join('m_users', 'assign_hr_to_activity.user_id', '=', 'm_users.id') ->leftJoin('m_users', 'assign_hr_to_activity.user_id', '=', 'm_users.id')
->join('report_activity_material', 'report_activity_material.activity_id', '=', 'selfTable.id') ->leftJoin('report_activity_material', 'report_activity_material.activity_id', '=', 'selfTable.id')
->join('assign_material_to_activity', 'assign_material_to_activity.activity_id', '=', 'selfTable.id') ->join('assign_material_to_activity', 'assign_material_to_activity.activity_id', '=', 'selfTable.id')
->groupBy("selfTable.id") ->groupBy("selfTable.id")
->groupBy("selfTable.name") ->groupBy("selfTable.name")
@ -560,6 +560,7 @@ class ActivityController extends Controller
->groupBy("m_users.name") ->groupBy("m_users.name")
->groupBy("assign_material_to_activity.qty_planning") ->groupBy("assign_material_to_activity.qty_planning")
->groupBy("assign_material_to_activity.id") ->groupBy("assign_material_to_activity.id")
->groupBy("assign_hr_to_activity.id")
->get(); ->get();
return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet ], 200); return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet ], 200);
} }

2
app/Http/Controllers/UserToActivityController.php

@ -138,6 +138,8 @@ class UserToActivityController extends Controller
$builder->addSelect(DB::raw('SUM(report_activity_material.qty) as volume_actual')); $builder->addSelect(DB::raw('SUM(report_activity_material.qty) as volume_actual'));
$builder->groupBy("m_activity.id"); $builder->groupBy("m_activity.id");
$builder->groupBy("selfTable.id"); $builder->groupBy("selfTable.id");
$builder->groupBy("selfTable.start_date");
$builder->groupBy("selfTable.end_date");
$builder->groupBy("m_users.name"); $builder->groupBy("m_users.name");
$builder->groupBy("assign_material_to_activity.id"); $builder->groupBy("assign_material_to_activity.id");
$builder->groupBy("m_version_gantt.name_version"); $builder->groupBy("m_version_gantt.name_version");

Loading…
Cancel
Save