@ -99,7 +99,16 @@ class AssignMaterialController extends Controller
public function datatables(Request $request){
$id_activity = $request->query('idact');
$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")->where('assign_material_to_activity.activity_id', $id_activity)->get();
$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")
@ -111,7 +120,13 @@ class AssignMaterialController extends Controller
public function datatablesForReportActivity(Request $request){
$id_activity = $request->query('idact');
$data = AssignMaterial::select(AssignMaterial::raw('SUM(qty_planning) as qty_planning'), "m.description as material_name", "assign_material_to_activity.activity_id as activity_id")
$data =
AssignMaterial::select(
AssignMaterial::raw(
'SUM(qty_planning) as qty_planning'),
"m.description as material_name",
"assign_material_to_activity.activity_id as activity_id"
)
->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id")