diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index b6bbe50..f34ff36 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -560,15 +560,13 @@ class MasterFunctionsHelper // if (new \DateTime($loopDay) < $today) { // $statusCutOfDate = true; // } - if (new \DateTime($loopDay) == new \DateTime($loopDay . ' Friday')) { - - $progressPlanKomulatifWeek[] += round($tmpProgressPlanWeek, 2); + + $progressPlanKomulatifWeek[] += round($tmpProgressPlanWeek,2); if (new \DateTime($loopDay . ' Friday') <= new \DateTime($today . ' Friday')) { // $tempPercentageReal[] = round($tempTtlPercentActual, 2); $progressActualKomulatifWeek[] += round($tmpProgressActualWeek, 2); } - $dateWeek[] = [$loopDay]; - } + $dateWeek[] = [$loopDay]; // $progressPlanKomulatifWeek[] += $tmpProgressPlanWeek; foreach ($dataPlanM as $keyPlanM) { # hitung untuk persentase progress planning @@ -1442,15 +1440,13 @@ class MasterFunctionsHelper $dataActivityPlan = []; $dataActivityActual = []; $today = date('Y-m-d'); - if (new \DateTime($loopDay) == new \DateTime($loopDay . ' Friday')) { - - $progressPlanKomulatifWeek[] += round($tmpProgressPlanWeek, 2); + + $progressPlanKomulatifWeek[] += round($tmpProgressPlanWeek,2); if (new \DateTime($loopDay . ' Friday') <= new \DateTime($today . ' Friday')) { // $tempPercentageReal[] = round($tempTtlPercentActual, 2); $progressActualKomulatifWeek[] += round($tmpProgressActualWeek, 2); } - $dateWeek[] = [$loopDay]; - } + $dateWeek[] = [$loopDay]; // $progressPlanKomulatifWeek[] += $tmpProgressPlanWeek; // if (count($dataPlanM) > 0 && count($dataPlanM[0]) > 0) { foreach ($dataPlanM as $keyPlanM) { diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 74dfd8d..79315a3 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -620,17 +620,19 @@ class ProjectController extends Controller // } - $plannedStart = Activity::where('version_gantt_id', $ganttId) - ->orderBy('planned_start') - ->value('planned_start'); - $plannedEnd = Activity::where('version_gantt_id', $ganttId) - ->orderByDesc('planned_end') - ->value('planned_end'); - $result->header->start_date = $startDate; - $result->header->end_date = $maxEndDate->end_date; - $result->header->planned_start = $plannedStart; - $result->header->planned_end = $plannedEnd; - return response()->json(['status' => 'success', 'code' => 200, 'data' => $result, 'gantt' => $ganttId], 200); + $plannedStart = Activity::where('version_gantt_id', $ganttId) + ->orderBy('planned_start') + ->value('planned_start'); + $plannedEnd = Activity::where('version_gantt_id', $ganttId) + ->orderByDesc('planned_end') + ->value('planned_end'); + if (isset($result->header)) { + $result->header->start_date = $startDate; + $result->header->end_date = $maxEndDate->end_date; + $result->header->planned_start = $plannedStart; + $result->header->planned_end = $plannedEnd; + } + return response()->json(['status'=>'success','code'=> 200,'data'=>$result, 'gantt'=>$ganttId], 200); } public function getOverdueActivities(Request $request)