From 69d2855e70b665a7e7e1cfdabdf14abb37536885 Mon Sep 17 00:00:00 2001 From: ibnu Date: Sat, 20 May 2023 10:24:19 +0700 Subject: [PATCH] update curva S same to progress gantt --- app/Helpers/MasterFunctionsHelper.php | 45 ++++++++++++++++++--------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index ebd5efa..96a61d2 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -223,17 +223,27 @@ class MasterFunctionsHelper { ->first(); $dataTempReport [$w]['percentage'] = ($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; // $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; - if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ + // if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ if($checkStatusActivity->status_activity == 'done'){ $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; + // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; }else{ - $sumPercentageActual+=(($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning)*(95/100); + if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ + $sumPercentageActual+=(($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning)*(95/100); + // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; + }else{ + $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; + // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; + } } - // }else if($checkStatusActivity->status_activity == 'done'){ - // $sumPercentageActual+=0; - }else{ - $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; - } + // }else { + // if($checkStatusActivity->status_activity == 'done'){ + // $sumPercentageActual+=($keyActualM->qty/$keyActualM->qty)*$keyActualM->bobot_planning; + // }else{ + // $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; + // } + // } + $totalACWP += $keyActualM->biaya_actual/$keyActualM->duration; } catch (\DivisionByZeroError $e) { @@ -246,7 +256,7 @@ class MasterFunctionsHelper { $arr_ActualM[] = array( 'date'=>$dt->format("Y-m-d"), 'percentPlan'=>$sumPercentagePlan, - 'percentActual'=>$sumPercentageActual, + 'percentActual'=> $sumPercentageActual, 'plan'=>$dataTempPlan, 'actual'=>$dataTempReport, ); @@ -254,12 +264,19 @@ class MasterFunctionsHelper { $tempTtlPercentPlan+= $sumPercentagePlan; $tempTtlPercentActual+= $sumPercentageActual; - if($tempTtlPercentPlan >= 100 || $tempTtlPercentActual >= 100){ - if($tempTtlPercentActual >= 100) - $tempTtlPercentActual = 100; + // if($tempTtlPercentPlan >= 100 || $tempTtlPercentActual >= $keyGantt['progress'];){ + // if($tempTtlPercentActual >= 100) + // $tempTtlPercentActual = 100; + // if($tempTtlPercentPlan >= 100) + // $tempTtlPercentPlan = 100; + + if($tempTtlPercentActual >= $keyGantt['progress']) + $tempTtlPercentActual = $keyGantt['progress']; if($tempTtlPercentPlan >= 100) $tempTtlPercentPlan = 100; - } + // $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual + + // } $currentACWP += $totalACWP; $currentBCWP += $totalBCWP; @@ -304,8 +321,8 @@ class MasterFunctionsHelper { $dataResponse = array( "date" =>$tempDate, "percentage" =>$tempPercentage, - "percentagePlan" => $tempPercentagePlan, - "percentageReal" => $tempPercentageReal, + "percentagePlan" => $tempPercentagePlan, + "percentageReal" => $tempPercentageReal, "data_details" =>$arr_ActualM, "budget_control" =>array("current_budget"=> $totalRencanaBudget, "acwp" => round($totalACWP,0),