class ReportActivityMaterialController extends Controller
class ReportActivityMaterialController extends Controller
{
{
@ -114,12 +116,22 @@ class ReportActivityMaterialController extends Controller
$type = $request->query('type');
$type = $request->query('type');
$materialName = $request->query('materialName');
$materialName = $request->query('materialName');
if($type == 'plan'){
if($type == 'plan'){
$activity = Activity::findOrFail($id_activity);
$baselineDuration = 0;
if (isset($activity->planned_start) && isset($activity->planned_end)) {
$baselineDuration = MasterFunctionsHelper::countDays($activity->version_gantt_id, new DateTime($activity->planned_start), new DateTime($activity->planned_end));
}
$data = AssignMaterial::select("assign_material_to_activity.*","m.description as material_name", "m.uom as uom")
$data = AssignMaterial::select("assign_material_to_activity.*","m.description as material_name", "m.uom as uom")
->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id")
->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id")
@ -131,7 +143,12 @@ class ReportActivityMaterialController extends Controller
})
})
->rawColumns(['action'])->make(true);
->rawColumns(['action'])->make(true);
}else{
}else{
$data = ReportActivityMaterial::select("report_activity_material.*", "u.name as human_resource", "amta.status_activity")
$activity = Activity::findOrFail($id_activity);
$baselineDuration = 0;
if (isset($activity->planned_start) && isset($activity->planned_end)) {
$baselineDuration = MasterFunctionsHelper::countDays($activity->version_gantt_id, new DateTime($activity->planned_start), new DateTime($activity->planned_end));
}
$data = ReportActivityMaterial::select("report_activity_material.*", "u.name as human_resource", "amta.status_activity", "amta.qty_planning")
->join("assign_material_to_activity as amta", "amta.id", "=", "report_activity_material.assign_material_id")
->join("assign_material_to_activity as amta", "amta.id", "=", "report_activity_material.assign_material_id")
->join("m_req_material as m", "m.id", "=", "amta.material_id")
->join("m_req_material as m", "m.id", "=", "amta.material_id")
->join("m_users as u", "u.id", "=", "report_activity_material.user_id")
->join("m_users as u", "u.id", "=", "report_activity_material.user_id")
@ -139,6 +156,11 @@ class ReportActivityMaterialController extends Controller