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