Browse Source

Merge pull request 'staging' (#264) from staging into master

Reviewed-on: ordo/adw-backend#264
pull/1/head
ibnu 1 year ago
parent
commit
bed1cc4097
  1. 23
      app/Helpers/MasterFunctionsHelper.php

23
app/Helpers/MasterFunctionsHelper.php

@ -534,7 +534,7 @@ class MasterFunctionsHelper
->where('version_gantt_id', $keyGantt['id']) ->where('version_gantt_id', $keyGantt['id'])
->whereDate('planned_start', '<=', $loopDay) ->whereDate('planned_start', '<=', $loopDay)
->whereDate('planned_end', '>=', $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(); ->get();
$dataActualM = DB::table('report_activity_material as ram') $dataActualM = DB::table('report_activity_material as ram')
@ -558,20 +558,29 @@ class MasterFunctionsHelper
// $tempPercentageReal[] = round($tempTtlPercentActual, 2); // $tempPercentageReal[] = round($tempTtlPercentActual, 2);
$progressActualKomulatifWeek[] += round($tmpProgressActualWeek,2); $progressActualKomulatifWeek[] += round($tmpProgressActualWeek,2);
} }
$dateWeek[] = [$loopDay]; $dateWeek[] = [$loopDay];
// $tmpProgressPlanWeek = 0;
// $tmpProgressActualWeek = 0;
} }
// $progressPlanKomulatifWeek[] += $tmpProgressPlanWeek; // $progressPlanKomulatifWeek[] += $tmpProgressPlanWeek;
foreach ($dataPlanM as $keyPlanM) { foreach ($dataPlanM as $keyPlanM) {
# hitung untuk persentase progress planning # 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( $dataActivityPlan[] = array(
'progressPlanDay' => $keyPlanM->bobot_planning / $keyPlanM->duration, 'progressPlanDay' => $progressPlanWeek,
'name' => $keyPlanM->name, 'name' => $keyPlanM->name,
'bobot_p' => $keyPlanM->bobot_planning, 'bobot_p' => $keyPlanM->bobot_planning,
'duration' => $keyPlanM->duration 'duration' => $keyPlanM->duration
); );
$tmpProgressPlanWeek += $keyPlanM->bobot_planning / $keyPlanM->duration; $tmpProgressPlanWeek += $progressPlanWeek;
} }
// hitung progress actual // hitung progress actual
@ -618,7 +627,7 @@ class MasterFunctionsHelper
"proyek_name" => $dataProject->nama, "proyek_name" => $dataProject->nama,
"data" => ["date" => $dateWeek, "data" => ["date" => $dateWeek,
"percentagePlan" => $progressPlanKomulatifWeek, "percentagePlan" => $progressPlanKomulatifWeek,
"percentageActual" => $progressActualKomulatifWeek, "percentageReal" => $progressActualKomulatifWeek,
"data_details" => $dataActivityPlanDate "data_details" => $dataActivityPlanDate
], ],

Loading…
Cancel
Save