Browse Source

add material_id in reportactivitymaterial

pull/3/head
ibnu 2 years ago
parent
commit
83e04e3583
  1. 9
      app/Http/Controllers/AssignMaterialController.php

9
app/Http/Controllers/AssignMaterialController.php

@ -129,8 +129,8 @@ class AssignMaterialController extends Controller
AssignMaterial::raw('SUM(qty_planning) as qty_planning'),
"m.description as material_name",
"assign_material_to_activity.activity_id",
"assign_material_to_activity.type",
"assign_material_to_activity.material_id",
"assign_material_to_activity.type"
// "assign_material_to_activity.material_id",
)
->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id")
->groupBy("m.description")
@ -174,6 +174,11 @@ class AssignMaterialController extends Controller
->where('description', '=', $row->material_name)->first();
return $val_uom ? $val_uom->uom : null;
})
->addColumn('material_id', function($row){
$material_id =AssignMaterial::select('assign_material_to_activity.material_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();
return $material_id ? $material_id->material_id : null;
})
->addColumn('action', function($row){
$dataPlan = 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();

Loading…
Cancel
Save