|
|
|
@ -130,15 +130,19 @@ class DashboardBoDController extends Controller
|
|
|
|
|
$projects = Project::where('mulai_proyek', 'like', $year)->get(); |
|
|
|
|
foreach($projects as $project) { |
|
|
|
|
$project->scurve = $this->getSCurve($project->id); |
|
|
|
|
try { |
|
|
|
|
if(@$project->scurve['difference'] > 0 && @$project->scurve['difference'] <= 5) |
|
|
|
|
$return['warning'] += 1; |
|
|
|
|
elseif(@$project->scurve['difference'] > 5 && @$project->scurve['difference'] <= 100) |
|
|
|
|
$return['behind-schedule'] += 1; |
|
|
|
|
elseif(@$project->scurve['difference'] == 0) |
|
|
|
|
$return['on-schedule'] += 1; |
|
|
|
|
} catch (\Error $e) { |
|
|
|
|
return response()->json(['msg' => $e->getMessage(), 'data' => $project], 200); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return response()->json(['data' => $return], 200); |
|
|
|
|
return response()->json(['data' => $return, 'q' => $projects], 200); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getTotalProjectScheduleHealthPerDivision($year = '%'){ |
|
|
|
@ -326,7 +330,8 @@ class DashboardBoDController extends Controller
|
|
|
|
|
if(!$alreadyHasReport) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
$minDate = Activity::where('version_gantt_id', $keyGantt['last_gantt_id'])->min("planned_start"); |
|
|
|
|
/* $minDate = Activity::where('version_gantt_id', $keyGantt['last_gantt_id'])->min("planned_start"); */ |
|
|
|
|
$minDate = Activity::where('version_gantt_id', $keyGantt['last_gantt_id'])->whereNull('parent_id')->pluck('start_date')->first(); |
|
|
|
|
|
|
|
|
|
$begin = new \DateTime($minDate.' Monday'); |
|
|
|
|
$maxDate = DB::table('assign_material_to_activity as ama') |
|
|
|
@ -379,15 +384,15 @@ class DashboardBoDController extends Controller
|
|
|
|
|
|
|
|
|
|
$sumPercentageActual=0; |
|
|
|
|
foreach ($dataActualM as $keyActualM) { |
|
|
|
|
try { |
|
|
|
|
$sumVolActual = DB::table('assign_material_to_activity') |
|
|
|
|
->select('activity_id', DB::raw('SUM(qty_planning) as ttl_qty_plan')) |
|
|
|
|
->where('activity_id', '=', $keyActualM->activity_id) |
|
|
|
|
->groupBy('activity_id') |
|
|
|
|
->first(); |
|
|
|
|
try { |
|
|
|
|
$sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; |
|
|
|
|
} catch (\DivisionByZeroError $e) { |
|
|
|
|
return response()->json(['message' => $e->getMessage()]); |
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
return response()->json(['message' => $e->getMessage(), 'q' => $sumVolActual]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|