|
|
@ -179,7 +179,7 @@ class DashboardBoDController extends Controller |
|
|
|
], 200); |
|
|
|
], 200); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getTotalProjectPerScheduleHealth($year = '%') |
|
|
|
public function getTotalProjectPerScheduleHealth($year = '%', $company_id, $all_project, $hierarchy) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$year = $this->interpolateYear($year); |
|
|
|
$year = $this->interpolateYear($year); |
|
|
|
|
|
|
|
|
|
|
@ -189,7 +189,17 @@ class DashboardBoDController extends Controller |
|
|
|
'on-schedule' => 0, |
|
|
|
'on-schedule' => 0, |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
$projects = Project::where('mulai_proyek', 'like', $year)->get(); |
|
|
|
$projects = null; |
|
|
|
|
|
|
|
if ($all_project) { |
|
|
|
|
|
|
|
$projects = Project::where('mulai_proyek', 'like', $year) |
|
|
|
|
|
|
|
->where('company_id', $company_id) |
|
|
|
|
|
|
|
->get(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$projects = Project::where('mulai_proyek', 'like', $year) |
|
|
|
|
|
|
|
->where('created_by_id', $hierarchy) |
|
|
|
|
|
|
|
->get(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
foreach ($projects as $index => $project) { |
|
|
|
foreach ($projects as $index => $project) { |
|
|
|
$project->scurve = MasterFunctionsHelper::getSCurve($project->id); |
|
|
|
$project->scurve = MasterFunctionsHelper::getSCurve($project->id); |
|
|
|
$selisihProgress = 0; |
|
|
|
$selisihProgress = 0; |
|
|
@ -319,15 +329,23 @@ class DashboardBoDController extends Controller |
|
|
|
], 200); |
|
|
|
], 200); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getTotalProjectPerPhase($year = '%') |
|
|
|
public function getTotalProjectPerPhase($year = '%', $company_id, $all_project, $hierarchy) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$year = $this->interpolateYear($year); |
|
|
|
$year = $this->interpolateYear($year); |
|
|
|
$projectPhases = ProjectPhase::orderBy('order')->get(); |
|
|
|
$projectPhases = ProjectPhase::orderBy('order')->get(); |
|
|
|
foreach ($projectPhases as $phase) { |
|
|
|
foreach ($projectPhases as $phase) { |
|
|
|
$phase->totalProject = Project::where('phase_id', $phase->id) |
|
|
|
|
|
|
|
->where('mulai_proyek', 'like', $year) |
|
|
|
if ($all_project) { |
|
|
|
/* ->orWhere('akhir_proyek', 'like', $year) */ |
|
|
|
$phase->totalProject = Project::where('phase_id', $phase->id) |
|
|
|
->count(); |
|
|
|
->where('mulai_proyek', 'like', $year) |
|
|
|
|
|
|
|
->where('company_id', $company_id) |
|
|
|
|
|
|
|
->count(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$phase->totalProject = Project::where('phase_id', $phase->id) |
|
|
|
|
|
|
|
->where('mulai_proyek', 'like', $year) |
|
|
|
|
|
|
|
->where('created_by_id', $hierarchy) |
|
|
|
|
|
|
|
->count(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return response()->json([ |
|
|
|
return response()->json([ |
|
|
|
'data' => [ |
|
|
|
'data' => [ |
|
|
|