Browse Source

Merge pull request 'update logic duration 0' (#263) from dev-ibnu into staging

Reviewed-on: ordo/adw-backend#263
pull/1/head
ibnu 11 months ago
parent
commit
3393230a07
  1. 21
      app/Helpers/MasterFunctionsHelper.php

21
app/Helpers/MasterFunctionsHelper.php

@ -534,7 +534,7 @@ class MasterFunctionsHelper
->where('version_gantt_id', $keyGantt['id'])
->whereDate('planned_start', '<=', $loopDay)
->whereDate('planned_end', '>=', $loopDay)
->select('name', 'bobot_planning', 'biaya_actual', 'duration', 'persentase_progress', 'id')
->select('name', 'bobot_planning', 'biaya_actual', 'duration', 'persentase_progress', 'id', 'planned_start', 'planned_end')
->get();
$dataActualM = DB::table('report_activity_material as ram')
@ -559,19 +559,28 @@ class MasterFunctionsHelper
$progressActualKomulatifWeek[] += round($tmpProgressActualWeek,2);
}
$dateWeek[] = [$loopDay];
// $tmpProgressPlanWeek = 0;
// $tmpProgressActualWeek = 0;
}
// $progressPlanKomulatifWeek[] += $tmpProgressPlanWeek;
foreach ($dataPlanM as $keyPlanM) {
# hitung untuk persentase progress planning
if($keyPlanM->duration == 0){
$duration = 2;
}
// $startPlan = new DateTime($keyPlanM->planned_start);
// $endPlan = new DateTime($keyPlanM->planned_end);
// $interval = $startPlan->diff($endPlan);
// // Mengambil hasil selisih hari
// $duration = $interval->days;
$progressPlanWeek = $keyPlanM->bobot_planning / $duration;
$dataActivityPlan[] = array(
'progressPlanDay' => $keyPlanM->bobot_planning / $keyPlanM->duration,
'progressPlanDay' => $progressPlanWeek,
'name' => $keyPlanM->name,
'bobot_p' => $keyPlanM->bobot_planning,
'duration' => $keyPlanM->duration
);
$tmpProgressPlanWeek += $keyPlanM->bobot_planning / $keyPlanM->duration;
$tmpProgressPlanWeek += $progressPlanWeek;
}
// hitung progress actual
@ -618,7 +627,7 @@ class MasterFunctionsHelper
"proyek_name" => $dataProject->nama,
"data" => ["date" => $dateWeek,
"percentagePlan" => $progressPlanKomulatifWeek,
"percentageActual" => $progressActualKomulatifWeek,
"percentageReal" => $progressActualKomulatifWeek,
"data_details" => $dataActivityPlanDate
],

Loading…
Cancel
Save