From 8b8ee50e45f62387f0fc0113c9446fd623711fef Mon Sep 17 00:00:00 2001 From: wahyuun Date: Tue, 21 Nov 2023 10:01:18 +0700 Subject: [PATCH] add getSCurveCarausell method --- app/Helpers/MasterFunctionsHelper.php | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index 53f0be8..8448e3c 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -106,6 +106,35 @@ class MasterFunctionsHelper } } } + public static function getSCurveCarausell($request) + { + $allGantt = []; + if (!is_int($request->gantt_id) && !is_int($request->project_id) && !is_int($request->period)) { + if (isset($request->gantt_id)) { + $allGantt[] = $request->gantt_id; + } else { + $allGantt[] = MasterFunctionsHelper::getLatestGantt($request->project_id); + } + } else { + $allGantt[] = MasterFunctionsHelper::getLatestGantt($request->project_id); + } + foreach ($allGantt as $gantt) { + if (!isset($gantt['last_gantt_id'])) { + $ganttId = $gantt; + } else { + $ganttId = $gantt['last_gantt_id']; + } + $gantt = VersionGantt::find($ganttId)->toArray(); + if (isset($gantt['calculation_type'])) { + if ($gantt['calculation_type'] == 'simple') { + // to do + return MasterFunctionsHelper::calculateProgressBasedOnSimple($gantt); + } else { + return MasterFunctionsHelper::calculateProgressBasedOnReportMaterial($gantt); + } + } + } + } public function getLinearSCurve($request) {