|
|
|
@ -251,12 +251,18 @@ class ProjectController extends Controller
|
|
|
|
|
$d->scheduleHealth = $scheduleHealth; |
|
|
|
|
$d->progress = $progress; |
|
|
|
|
$d->lastGanttId = VersionGantt::where("proyek_id", $d->id)->orderBy('id', 'desc')->first()->id ?? null; |
|
|
|
|
$d->manpower = UserToProyek::where("proyek_id", $d->id)->count() ?? 0; |
|
|
|
|
$d->projectManager = DB::table('m_proyek') |
|
|
|
|
->join('m_users', 'm_users.id', '=', 'm_proyek.pm_id') |
|
|
|
|
->where('m_proyek.id', $d->id) |
|
|
|
|
->pluck('m_users.name') |
|
|
|
|
->first(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$totalPlannedCost = $data->sum('plannedCost'); |
|
|
|
|
$totalActualCost = $data->sum('actualCost'); |
|
|
|
|
// $manpowers = User::where('employee_type', 'employee')->count(); |
|
|
|
|
$manpowers = User::count(); |
|
|
|
|
$projectsOnDanger = Project::where('budget_health', 'danger')->count(); |
|
|
|
|
$projectPhases = ProjectPhase::orderBy('order', 'asc')->pluck('name'); |
|
|
|
|
$projectTypes = ProjectType::orderBy('id', 'asc')->pluck('name'); |
|
|
|
|
try { |
|
|
|
@ -288,6 +294,7 @@ class ProjectController extends Controller
|
|
|
|
|
'totalActualCost' => $totalActualCost, |
|
|
|
|
'totalRevenue' => $totalPlannedCost - $totalActualCost, |
|
|
|
|
'manpowers' => $manpowers, |
|
|
|
|
'projectsOnDanger'=> $projectsOnDanger, |
|
|
|
|
'projectPhases' => $projectPhases, |
|
|
|
|
'projectsByPhase' => $projectsByPhase, |
|
|
|
|
'projectTypes' => $projectTypes, |
|
|
|
|