From 1b52345f54083f985f3f7755d94f3fa0c0041a4d Mon Sep 17 00:00:00 2001 From: ibnu Date: Tue, 5 Dec 2023 13:05:43 +0700 Subject: [PATCH 1/2] update fix quick --- app/Http/Controllers/ProjectController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 66f4724..62bd9ab 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -539,7 +539,7 @@ class ProjectController extends Controller if($result['type_proyek_id'] === 9) { // $actualEndExist = Activity::where('proyek_id', $id)->exists(); - // $query = Activity::where('proyek_id', $id); + $query = Activity::where('proyek_id', $id); $maxEndDate = Activity::where('proyek_id', $id)->select('end_date') ->orderBy('end_date', 'desc') ->first(); From aded36c0ae3f3e02ac4087727b0528eaec783201 Mon Sep 17 00:00:00 2001 From: ibnu Date: Tue, 12 Dec 2023 07:16:34 +0700 Subject: [PATCH 2/2] update for logic update status report on-progress, actual >= plan is 95, actual < plan is calculate --- .../Controllers/ReportActivityMaterialController.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ReportActivityMaterialController.php b/app/Http/Controllers/ReportActivityMaterialController.php index e451129..1712b5b 100644 --- a/app/Http/Controllers/ReportActivityMaterialController.php +++ b/app/Http/Controllers/ReportActivityMaterialController.php @@ -64,10 +64,18 @@ class ReportActivityMaterialController extends Controller } else { $sumAssignMaterial = AssignMaterial::where('activity_id', $request->activity_id)->sum('qty_planning'); $sumReportActivityMaterial = ReportActivityMaterial::where('activity_id', $request->activity_id)->sum('qty'); + // if actual >= plan + if ($sumReportActivityMaterial >= $sumAssignMaterial){ + $persentaseProgress = 95; + }else{ + // actual < plan + $persentaseProgress = $sumReportActivityMaterial/$sumAssignMaterial*100; + } + $dataUpdate = array( "actual_start" => null, - "actual_end" => null, - "persentase_progress" => $sumReportActivityMaterial/$sumAssignMaterial*100, + "actual_end" => null, + "persentase_progress" => $persentaseProgress, "updated_by" => $this->currentName ); if ($sumReportActivityMaterial > 0) {