Browse Source

Fix project by schedule health

pull/3/head
Wahyu Ramadhan 2 years ago
parent
commit
18780a09c3
  1. 14
      app/Http/Controllers/DashboardBoDController.php

14
app/Http/Controllers/DashboardBoDController.php

@ -127,13 +127,19 @@ class DashboardBoDController extends Controller
$projects = Project::where('mulai_proyek', 'like', $year)->get();
foreach($projects as $project) {
$project->scurve = MasterFunctionsHelper::getSCurve($project->id);
$project->scurve = MasterFunctionsHelper::getSCurve($project->id);
$selisihProgress = 0;
if($project->scurve && $project->scurve[0]){
$planningProgress = $project->scurve[0]['data']['percentagePlan'][count($project->scurve[0]['data']['percentagePlan'])-1];
$actualProgress = $project->scurve[0]['data']['percentageReal'][count($project->scurve[0]['data']['percentageReal'])-1];
}
$selisihProgress = $planningProgress - $actualProgress;
try {
if(@$project->scurve['difference'] > 0 && @$project->scurve['difference'] <= 5)
if($selisihProgress > 0 && $selisihProgress <= 5)
$return['warning'] += 1;
elseif(@$project->scurve['difference'] > 5 && @$project->scurve['difference'] <= 100)
elseif($selisihProgress > 5 && $selisihProgress <= 100)
$return['behind-schedule'] += 1;
elseif(@$project->scurve['difference'] == 0)
elseif($selisihProgress == 0)
$return['on-schedule'] += 1;
} catch (\Error $e) {
return response()->json(['msg' => $e->getMessage(), 'data' => $project], 200);

Loading…
Cancel
Save