diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index 2c66323..00bf709 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -311,7 +311,7 @@ class MasterFunctionsHelper ->groupBy('activity_id') ->first(); $weekCount = $keyPlanM->duration / 7; - $weeklyPlan = $sumVolPlan->ttl_qty_plan / $weekCount; + $weeklyPlan = $weekCount > 0 ? $sumVolPlan->ttl_qty_plan / $weekCount : 0; $weeklyProgress = $weeklyPlan / $sumVolPlan->ttl_qty_plan * $keyPlanM->bobot_planning; $dataTempPlan[$x]['activity_id'] = $keyPlanM->id; $dataTempPlan[$x]['bobot_planning'] = $keyPlanM->bobot_planning; diff --git a/app/Http/Controllers/DashboardBoDController.php b/app/Http/Controllers/DashboardBoDController.php index 2de808e..deb8065 100644 --- a/app/Http/Controllers/DashboardBoDController.php +++ b/app/Http/Controllers/DashboardBoDController.php @@ -136,6 +136,9 @@ class DashboardBoDController extends Controller foreach ($projects as $index => $project) { $project->scurve = MasterFunctionsHelper::getSCurve($project->id); $selisihProgress = 0; + $planningProgress = 0; + $actualProgress = 0; + if ($project->scurve && $project->scurve[0]) { $planningArray = $project->scurve[0]['data']['percentagePlan']; $actualArray = $project->scurve[0]['data']['percentageReal']; @@ -178,6 +181,9 @@ class DashboardBoDController extends Controller foreach ($projects as $project) { $project->scurve = MasterFunctionsHelper::getSCurve($project->id); $selisihProgress = 0; + $planningProgress = 0; + $actualProgress = 0; + if ($project->scurve && $project->scurve[0]) { $planningArray = $project->scurve[0]['data']['percentagePlan']; $actualArray = $project->scurve[0]['data']['percentageReal'];