From cd2101a108fd41420fffd5fb30312a10ce90c06e Mon Sep 17 00:00:00 2001 From: wahyu Date: Wed, 20 Dec 2023 13:36:03 +0700 Subject: [PATCH] update report activity --- app/Http/Controllers/ReportActivityMaterialController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ReportActivityMaterialController.php b/app/Http/Controllers/ReportActivityMaterialController.php index d5fc160..44b228b 100644 --- a/app/Http/Controllers/ReportActivityMaterialController.php +++ b/app/Http/Controllers/ReportActivityMaterialController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Helpers\MasterFunctionsHelper; use Illuminate\Http\Request; +use Illuminate\Support\Facades\DB; use App\Models\ReportActivityMaterial; use App\Models\Activity; use App\Models\AssignMaterial; @@ -132,6 +133,7 @@ class ReportActivityMaterialController extends Controller public function datatables(Request $request){ $id_activity = $request->query('idAct'); + $id_am = $request->query('idAmi'); $type = $request->query('type'); $materialName = $request->query('materialName'); if($type == 'plan'){ @@ -143,7 +145,7 @@ class ReportActivityMaterialController extends Controller $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) - ->where('m.description', 'LIKE', '%' . $materialName . '%') + ->where('assign_material_to_activity.id', $id_am) ->orderBy('assign_material_to_activity.id', 'asc') ->get(); if ($baselineDuration > 0) { @@ -172,7 +174,7 @@ class ReportActivityMaterialController extends Controller ->join("m_req_material as m", "m.id", "=", "amta.material_id") ->join("m_users as u", "u.id", "=", "report_activity_material.user_id") ->where('report_activity_material.activity_id', $id_activity) - ->where('m.description', 'LIKE', '%' . $materialName . '%') + ->where('report_activity_material.assign_material_id', $id_am) ->orderBy('report_activity_material.report_date', 'asc') ->get(); if ($baselineDuration > 0) {