From 51b879ca5047020bdeaae83395cd53fc923ba344 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Tue, 20 Jun 2023 13:30:31 +0700 Subject: [PATCH] Fix s curve calculation --- app/Helpers/MasterFunctionsHelper.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index 406020d..24cd2a1 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -246,6 +246,9 @@ class MasterFunctionsHelper { ->where('activity_id', '=', $keyActualM->activity_id) ->groupBy('activity_id') ->first(); + $sumReportActual = DB::table('report_activity_material') + ->where('activity_id', $keyActualM->activity_id) + ->sum('qty'); $reportCount = DB::table('report_activity_material')->where('activity_id', '=', $keyActualM->activity_id)->count(); $dataTempReport [$w]['activity_id'] = $keyActualM->activity_id; $dataTempReport [$w]['qty'] = $keyActualM->qty; @@ -269,7 +272,7 @@ class MasterFunctionsHelper { $sumPercentageActual+=$keyActualM->bobot_planning/$reportCount; // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; }else{ - if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ + if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1 || (int)$sumVolActual->ttl_qty_plan == (int)$sumReportActual){ $sumPercentageActual+=(($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning)*(95/100); // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; }else{