|
|
|
@ -288,42 +288,27 @@ class DashboardBoDController extends Controller
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
foreach ($divisions as $index => $division) { |
|
|
|
|
$scheduleData = new Collection(); |
|
|
|
|
$behindSchedule = $warning = $onSchedule = 0; |
|
|
|
|
|
|
|
|
|
$projects = Project::where('divisi_id', $division->id)->get(); |
|
|
|
|
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']; |
|
|
|
|
$planningProgress = !empty($planningArray) ? $planningArray[count($planningArray) - 1] : 0; |
|
|
|
|
$actualProgress = !empty($actualArray) ? $actualArray[count($actualArray) - 1] : 0; |
|
|
|
|
} |
|
|
|
|
$selisihProgress = $planningProgress - $actualProgress; |
|
|
|
|
if ($selisihProgress > 0 && $selisihProgress <= 5) { |
|
|
|
|
if ($project->schedule_health == 'warning') { |
|
|
|
|
$warning++; |
|
|
|
|
} elseif ($selisihProgress == 0) { |
|
|
|
|
} elseif ($project->schedule_health == 'on-schedule') { |
|
|
|
|
$onSchedule++; |
|
|
|
|
} else { |
|
|
|
|
} elseif ($project->schedule_health == 'behind-schedule') { |
|
|
|
|
$behindSchedule++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$scheduleData->prepend($behindSchedule, 'behindSchedule'); |
|
|
|
|
$scheduleData->prepend($warning, 'warning'); |
|
|
|
|
$scheduleData->prepend($onSchedule, 'onSchedule'); |
|
|
|
|
$divisions[$index]->scheduleData = $scheduleData; |
|
|
|
|
$division->scheduleData = [ |
|
|
|
|
'behindSchedule' => $behindSchedule, |
|
|
|
|
'warning' => $warning, |
|
|
|
|
'onSchedule' => $onSchedule, |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
return response()->json([ |
|
|
|
|
'data' => [ |
|
|
|
|
$divisions |
|
|
|
|
] |
|
|
|
|
], 200); |
|
|
|
|
|
|
|
|
|
return response()->json(['data' => $divisions], 200); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getTotalProjectPerBudgetHealth($role_name, $company_id, $all_project, $hierarchy) |
|
|
|
|