Browse Source

Merge pull request 'dev-wahyu' (#306) from dev-wahyu into staging

Reviewed-on: ordo/adw-backend#306
pull/1/head
farhantock 1 year ago
parent
commit
95be6d8769
  1. 16
      app/Helpers/MasterFunctionsHelper.php
  2. 24
      app/Http/Controllers/ProjectController.php

16
app/Helpers/MasterFunctionsHelper.php

@ -560,15 +560,13 @@ class MasterFunctionsHelper
// if (new \DateTime($loopDay) < $today) { // if (new \DateTime($loopDay) < $today) {
// $statusCutOfDate = true; // $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')) { if (new \DateTime($loopDay . ' Friday') <= new \DateTime($today . ' Friday')) {
// $tempPercentageReal[] = round($tempTtlPercentActual, 2); // $tempPercentageReal[] = round($tempTtlPercentActual, 2);
$progressActualKomulatifWeek[] += round($tmpProgressActualWeek, 2); $progressActualKomulatifWeek[] += round($tmpProgressActualWeek, 2);
} }
$dateWeek[] = [$loopDay]; $dateWeek[] = [$loopDay];
}
// $progressPlanKomulatifWeek[] += $tmpProgressPlanWeek; // $progressPlanKomulatifWeek[] += $tmpProgressPlanWeek;
foreach ($dataPlanM as $keyPlanM) { foreach ($dataPlanM as $keyPlanM) {
# hitung untuk persentase progress planning # hitung untuk persentase progress planning
@ -1442,15 +1440,13 @@ class MasterFunctionsHelper
$dataActivityPlan = []; $dataActivityPlan = [];
$dataActivityActual = []; $dataActivityActual = [];
$today = date('Y-m-d'); $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')) { if (new \DateTime($loopDay . ' Friday') <= new \DateTime($today . ' Friday')) {
// $tempPercentageReal[] = round($tempTtlPercentActual, 2); // $tempPercentageReal[] = round($tempTtlPercentActual, 2);
$progressActualKomulatifWeek[] += round($tmpProgressActualWeek, 2); $progressActualKomulatifWeek[] += round($tmpProgressActualWeek, 2);
} }
$dateWeek[] = [$loopDay]; $dateWeek[] = [$loopDay];
}
// $progressPlanKomulatifWeek[] += $tmpProgressPlanWeek; // $progressPlanKomulatifWeek[] += $tmpProgressPlanWeek;
// if (count($dataPlanM) > 0 && count($dataPlanM[0]) > 0) { // if (count($dataPlanM) > 0 && count($dataPlanM[0]) > 0) {
foreach ($dataPlanM as $keyPlanM) { foreach ($dataPlanM as $keyPlanM) {

24
app/Http/Controllers/ProjectController.php

@ -620,17 +620,19 @@ class ProjectController extends Controller
// } // }
$plannedStart = Activity::where('version_gantt_id', $ganttId) $plannedStart = Activity::where('version_gantt_id', $ganttId)
->orderBy('planned_start') ->orderBy('planned_start')
->value('planned_start'); ->value('planned_start');
$plannedEnd = Activity::where('version_gantt_id', $ganttId) $plannedEnd = Activity::where('version_gantt_id', $ganttId)
->orderByDesc('planned_end') ->orderByDesc('planned_end')
->value('planned_end'); ->value('planned_end');
$result->header->start_date = $startDate; if (isset($result->header)) {
$result->header->end_date = $maxEndDate->end_date; $result->header->start_date = $startDate;
$result->header->planned_start = $plannedStart; $result->header->end_date = $maxEndDate->end_date;
$result->header->planned_end = $plannedEnd; $result->header->planned_start = $plannedStart;
return response()->json(['status' => 'success', 'code' => 200, 'data' => $result, 'gantt' => $ganttId], 200); $result->header->planned_end = $plannedEnd;
}
return response()->json(['status'=>'success','code'=> 200,'data'=>$result, 'gantt'=>$ganttId], 200);
} }
public function getOverdueActivities(Request $request) public function getOverdueActivities(Request $request)

Loading…
Cancel
Save