From d2d3d6bad871bb4e44a4494bcc60ac292f1d2e98 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Wed, 7 Jun 2023 13:57:46 +0700 Subject: [PATCH] Fix dashboard error --- 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 5a1f77e..04f3076 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -192,7 +192,10 @@ class MasterFunctionsHelper { try { $dataTempPlan [$x]['percentage'] = ($keyPlanM->qty_planning/$sumVolPlan->ttl_qty_plan)*$keyPlanM->bobot_planning; $sumPercentagePlan+=($keyPlanM->qty_planning/$sumVolPlan->ttl_qty_plan)*$keyPlanM->bobot_planning; - $totalBCWP += (((($keyPlanM->persentase_progress*$keyPlanM->bobot_planning)/100)/$keyPlanM->duration)* $totalRencanaBudget)/100; + if(isset($keyPlanM->duration) && $keyPlanM->duration > 0) + $totalBCWP += (((($keyPlanM->persentase_progress*$keyPlanM->bobot_planning)/100)/$keyPlanM->duration)* $totalRencanaBudget)/100; + else + $totalBCWP = 0; $dataTempPlan [$x]['totalBCWP'] = $totalBCWP; } catch (\DivisionByZeroError $e) { return response()->json(['message' => $e->getMessage()]);