Browse Source

update estimated finish

pull/3/head
wahyuun 1 year ago
parent
commit
2923ec649f
  1. 15
      app/Http/Controllers/ProjectController.php

15
app/Http/Controllers/ProjectController.php

@ -45,7 +45,7 @@ class ProjectController extends Controller
{ {
$this->validate($request, [ $this->validate($request, [
'nama' => 'required', 'nama' => 'required',
'mulai_proyek' => 'required', 'mulai_proyek' => 'required',
'akhir_proyek' => 'required', 'akhir_proyek' => 'required',
'rencana_biaya' => 'required', 'rencana_biaya' => 'required',
'type_proyek_id' => 'required' 'type_proyek_id' => 'required'
@ -519,12 +519,12 @@ class ProjectController extends Controller
if (isset($s_curve)) { if (isset($s_curve)) {
$result->header = Activity::whereNull('parent_id')->where("proyek_id", $id)->first(); $result->header = Activity::whereNull('parent_id')->where("proyek_id", $id)->first();
$actualStartExist = Activity::where('proyek_id', $id)->whereNotNull('actual_start')->exists(); $actualStartExist = Activity::where('proyek_id', $id)->whereNotNull('actual_start')->exists();
$actualEndExist = Activity::where('proyek_id', $id)->whereNotNull('actual_end')->exists(); $actualEndExist = Activity::where('proyek_id', $id)->exists();
$query = Activity::where('proyek_id', $id); $query = Activity::where('proyek_id', $id);
} else { } else {
$result->header = Activity::whereNull('parent_id')->where("proyek_id", $id)->where("version_gantt_id", $ganttId)->first(); $result->header = Activity::whereNull('parent_id')->where("proyek_id", $id)->where("version_gantt_id", $ganttId)->first();
$actualStartExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_start')->exists(); $actualStartExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_start')->exists();
$actualEndExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_end')->exists(); $actualEndExist = Activity::where('version_gantt_id', $ganttId)->exists();
$query = Activity::where('version_gantt_id', $ganttId); $query = Activity::where('version_gantt_id', $ganttId);
} }
@ -533,11 +533,10 @@ class ProjectController extends Controller
} else { } else {
$startDate = $query->orderBy('start_date')->value('start_date'); $startDate = $query->orderBy('start_date')->value('start_date');
} }
if($actualEndExist)
if ($actualEndExist) { {
$endDate = $query->orderByDesc('actual_end')->value('end_date'); $maxEndDate = $query->max('id');
} else { $endDate = $query->where('id',$maxEndDate)->first()->end_date;
$endDate = $query->orderByDesc('end_date')->value('end_date');
} }
$plannedStart = Activity::where('version_gantt_id', $ganttId) $plannedStart = Activity::where('version_gantt_id', $ganttId)

Loading…
Cancel
Save