|
|
@ -169,16 +169,6 @@ class AssignMaterialController extends Controller |
|
|
|
->get(); |
|
|
|
->get(); |
|
|
|
return Datatables::of($data) |
|
|
|
return Datatables::of($data) |
|
|
|
->addIndexColumn() |
|
|
|
->addIndexColumn() |
|
|
|
// ->addColumn('qty_planning', function($row){ |
|
|
|
|
|
|
|
// $val_qty_act = AssignMaterial::select(ReportActivityMaterial::raw('SUM(ram.qty) as qty_sum'),"m.description as material_name1","m.id") |
|
|
|
|
|
|
|
// ->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") |
|
|
|
|
|
|
|
// ->join("report_activity_material as ram", "ram.assign_material_id", "=", "assign_material_to_activity.id") |
|
|
|
|
|
|
|
// ->groupBy("m.description") |
|
|
|
|
|
|
|
// ->groupBy("m.id") |
|
|
|
|
|
|
|
// ->where("m.description", strval($row->material_name)) |
|
|
|
|
|
|
|
// ->where("ram.activity_id", $row->activity_id)->first(); |
|
|
|
|
|
|
|
// return $val_qty_act ? $val_qty_act->qty_sum : '-'; |
|
|
|
|
|
|
|
// }) |
|
|
|
|
|
|
|
->addColumn('status_activity', function ($row) { |
|
|
|
->addColumn('status_activity', function ($row) { |
|
|
|
$val_status = AssignMaterial::select("status_activity") |
|
|
|
$val_status = AssignMaterial::select("status_activity") |
|
|
|
->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') |
|
|
@ -186,6 +176,11 @@ class AssignMaterialController extends Controller |
|
|
|
->where("assign_material_to_activity.activity_id", $row->activity_id)->first(); |
|
|
|
->where("assign_material_to_activity.activity_id", $row->activity_id)->first(); |
|
|
|
return $val_status ? $val_status->status_activity : null; |
|
|
|
return $val_status ? $val_status->status_activity : null; |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
->addColumn('qty_sum', function($row){ |
|
|
|
|
|
|
|
$val_qty_actual = ReportActivityMaterial::where("report_activity_material.assign_material_id", $row->id) |
|
|
|
|
|
|
|
->sum("qty"); |
|
|
|
|
|
|
|
return $val_qty_actual ? $val_qty_actual : null; |
|
|
|
|
|
|
|
}) |
|
|
|
->addColumn('start_activity', function ($row) { |
|
|
|
->addColumn('start_activity', function ($row) { |
|
|
|
$val_start = AssignMaterial::select("start_activity") |
|
|
|
$val_start = AssignMaterial::select("start_activity") |
|
|
|
->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') |
|
|
@ -200,11 +195,11 @@ class AssignMaterialController extends Controller |
|
|
|
->where("assign_material_to_activity.activity_id", $row->activity_id)->first(); |
|
|
|
->where("assign_material_to_activity.activity_id", $row->activity_id)->first(); |
|
|
|
return $val_finish ? $val_finish->finish_activity : null; |
|
|
|
return $val_finish ? $val_finish->finish_activity : null; |
|
|
|
}) |
|
|
|
}) |
|
|
|
->addColumn('uom', function ($row) { |
|
|
|
// ->addColumn('uom', function ($row) { |
|
|
|
$val_uom = RequestMaterial::select("uom") |
|
|
|
// $val_uom = RequestMaterial::select("uom") |
|
|
|
->where('description', '=', $row->material_name)->first(); |
|
|
|
// ->where('description', '=', $row->material_name)->first(); |
|
|
|
return $val_uom ? $val_uom->uom : null; |
|
|
|
// return $val_uom ? $val_uom->uom : null; |
|
|
|
}) |
|
|
|
// }) |
|
|
|
->addColumn('assign_material_id', function ($row) { |
|
|
|
->addColumn('assign_material_id', function ($row) { |
|
|
|
$assignMaterial = AssignMaterial::select('assign_material_to_activity.id')->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") |
|
|
|
$assignMaterial = AssignMaterial::select('assign_material_to_activity.id')->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") |
|
|
|
->where('activity_id', $row->activity_id)->where('m.description', $row->material_name)->first(); |
|
|
|
->where('activity_id', $row->activity_id)->where('m.description', $row->material_name)->first(); |
|
|
|