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