Browse Source

Merge pull request 'staging' (#281) from staging into master

Reviewed-on: ordo/adw-backend#281
pull/1/head
ibnu 1 year ago
parent
commit
521dc78ad7
  1. 6
      app/Http/Controllers/ActivityController.php

6
app/Http/Controllers/ActivityController.php

@ -697,9 +697,10 @@ class ActivityController extends Controller
'm_version_gantt.name_version',
DB::raw('user_names.user_name as user_name'),
DB::raw('SUM(report_activity_material.qty) as qty'),
DB::raw('SUM(assign_material_to_activity.qty_planning) as qty_planning'),
// DB::raw('SUM(assign_material_to_activity.qty_planning) as qty_planning'),
'assign_material_to_activity.id as join_third_id'
)
->addSelect(DB::raw('(SELECT SUM(assign_material_to_activity.qty_planning) FROM assign_material_to_activity WHERE assign_material_to_activity.activity_id = report_activity_material.activity_id) as qty_planning'))
->join('m_version_gantt', 'm_version_gantt.id', '=', 'selfTable.version_gantt_id')
->leftJoin('assign_hr_to_activity', 'assign_hr_to_activity.activity_id', '=', 'selfTable.id')
->leftJoin('report_activity_material', 'report_activity_material.activity_id', '=', 'selfTable.id')
@ -710,11 +711,12 @@ class ActivityController extends Controller
GROUP BY activity_id) as user_names'), function ($join) {
$join->on('user_names.activity_id', '=', 'selfTable.id');
})
->where('report_activity_material.assign_material_id', '=', DB::raw('assign_material_to_activity.id'))
->where('assign_material_to_activity.id', '=', DB::raw('report_activity_material.assign_material_id'))
->groupBy('selfTable.id')
->groupBy('m_version_gantt.name_version')
->groupBy('assign_material_to_activity.id')
->groupBy('user_names.user_name')
->groupBy('report_activity_material.activity_id')
->get();
return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet ], 200);
}

Loading…
Cancel
Save