From c4baacd13cc77463765f8a3b6711becc988ca29e Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 2 Jun 2023 14:04:36 +0700 Subject: [PATCH 1/2] Display planning curve without report --- app/Helpers/MasterFunctionsHelper.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index 96311e1..f8d1c9f 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -88,7 +88,10 @@ class MasterFunctionsHelper { $dataFinal=[]; $dataPayload = []; - $dataPayload['period'] = 'week'; + $dataPayload['period'] = 'week'; + $totalACWP = 0; + $totalBCWP = 0; + $tempPercentage = []; $dataProject = Project::find($keyGantt['proyek_id']); $dataHeader = Activity::where('type_activity', 'header')->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['id'])->first(); @@ -110,9 +113,9 @@ class MasterFunctionsHelper { ->join('m_activity as b', 'b.id', '=', 'a.activity_id') ->where('b.version_gantt_id', '=', $keyGantt['id']) ->exists(); - - if(!$alreadyHasReport) - return $dataFinal; + // note : delete this + // if(!$alreadyHasReport) + // return $dataFinal; $minDate = Activity::where('version_gantt_id', $keyGantt['id'])->whereNull('parent_id')->pluck('start_date')->first(); From b86511c08b265fa63263f32cabd5d0a2a9dbdc2d Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 2 Jun 2023 14:13:11 +0700 Subject: [PATCH 2/2] Fix planning until today not entire project --- app/Helpers/MasterFunctionsHelper.php | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index f8d1c9f..d7b3536 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -120,22 +120,11 @@ class MasterFunctionsHelper { $minDate = Activity::where('version_gantt_id', $keyGantt['id'])->whereNull('parent_id')->pluck('start_date')->first(); $begin = new \DateTime($minDate.' Monday'); - if(isset($dataPayload['end_date'])){ - $maxDate = $dataPayload['end_date']; - $end = new \DateTime($maxDate. ' Friday'); - $end->modify('next Friday'); - /* $interval = \DateInterval::createFromDateString('1 day'); */ // should be using this but its bugged - $interval = new \DateInterval('P7D'); - } else { - $maxDate = DB::table('assign_material_to_activity as ama') - ->where("ama.proyek_id", $keyGantt['proyek_id']) - ->join('m_activity as a', 'a.id', '=', 'ama.activity_id') - ->where('a.version_gantt_id', '=', $keyGantt['id']) - ->max("plan_date"); // plan date overlapped with assign_material_to_activity's, it should be m_activity's - $end = new \DateTime($maxDate. ' Friday'); - $end->modify('next Friday'); - $interval = new \DateInterval('P7D'); - } + $maxDate = date('Y-m-d'); + $end = new \DateTime($maxDate. ' Friday'); + // $end->modify('next Friday'); + /* $interval = \DateInterval::createFromDateString('1 day'); */ // should be using this but its bugged + $interval = new \DateInterval('P7D'); $period = new \DatePeriod($begin, $interval, $end); $arr_ActualM = [];