|
|
@ -809,5 +809,25 @@ class ProjectController extends Controller |
|
|
|
return response()->json(['status'=>'success', 'data'=> $response, 'code'=>200], 200); |
|
|
|
return response()->json(['status'=>'success', 'data'=> $response, 'code'=>200], 200); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getReportDistribution(Request $request){ |
|
|
|
|
|
|
|
$payload = $request->all(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(empty($payload['project_id']) || !is_int((int)$payload['project_id'])) |
|
|
|
|
|
|
|
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$reports = DB::table('assign_material_to_activity as ama') |
|
|
|
|
|
|
|
->select('u.name', 'a.name as activity_name', 'ama.qty_planning', 'rm.description as material_name', 'rm.uom as material_unit', |
|
|
|
|
|
|
|
'ram.lat', 'ram.lon', 'ram.description as report_notes', 'ram.report_date') |
|
|
|
|
|
|
|
->join('report_activity_material as ram', 'ram.assign_material_id', '=', 'ama.id') |
|
|
|
|
|
|
|
->join('m_req_material as rm', 'rm.id', '=', 'ama.material_id') |
|
|
|
|
|
|
|
->join('m_activity as a', 'a.id', '=', 'ama.activity_id') |
|
|
|
|
|
|
|
->join('m_users as u', 'u.id', '=', 'ram.user_id') |
|
|
|
|
|
|
|
->where('ama.proyek_id', '=', $payload['project_id']) |
|
|
|
|
|
|
|
->whereNotNull('ram.lat') |
|
|
|
|
|
|
|
->whereBetween('ram.report_date', [$payload['start_date'], $payload['end_date']]) |
|
|
|
|
|
|
|
->get(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return response()->json(['status'=>'success', 'code'=> 200, 'data'=> $reports], 200); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|