Browse Source

Merge pull request 'Dev-Farhan' (#229) from Dev-Farhan into general

Reviewed-on: ordo/adw-backend#229
pull/3/head
farhantock 1 year ago
parent
commit
85631b9866
  1. 15
      app/Helpers/MasterFunctionsHelper.php

15
app/Helpers/MasterFunctionsHelper.php

@ -36,7 +36,8 @@ class MasterFunctionsHelper
return json_decode($output);
}
public static function countDays($ganttId, $start, $end){
public static function countDays($ganttId, $start, $end)
{
$dayOffs = VersionGantt::where('id', $ganttId)->first()->config_dayoff;
$diff = date_diff($start, $end);
$endCount = clone $end;
@ -206,7 +207,7 @@ class MasterFunctionsHelper
$end = new \DateTime($maxDate . ' Friday');
$end->modify('next Friday');
$end->modify('next Friday');
/* $interval = \DateInterval::createFromDateString('1 day'); */// should be using this but its bugged
/* $interval = \DateInterval::createFromDateString('1 day'); */ // should be using this but its bugged
$interval = new \DateInterval('P7D');
} else {
$actualMaxDate = DB::table('assign_material_to_activity as ama')
@ -514,7 +515,7 @@ class MasterFunctionsHelper
$end = new \DateTime($maxDate);
$end->modify('next Friday');
$end->modify('next Friday');
/* $interval = \DateInterval::createFromDateString('1 day'); */// should be using this but its bugged
/* $interval = \DateInterval::createFromDateString('1 day'); */ // should be using this but its bugged
$interval = new \DateInterval('P7D');
} else {
// $maxDate = DB::table('assign_material_to_activity as ama')
@ -673,7 +674,7 @@ class MasterFunctionsHelper
$sumPercentageActual += $keyActualM->bobot_planning / $reportCount;
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual;
} else {
if ( $actual >= 1 || (int) $sumVolActual->ttl_qty_plan == (int) $sumReportActual) {
if ($actual >= 1 || (int) $sumVolActual->ttl_qty_plan == (int) $sumReportActual) {
$sumPercentageActual += ($actual * $keyActualM->bobot_planning) * (95 / 100);
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual;
} else {
@ -712,9 +713,6 @@ class MasterFunctionsHelper
// if ($tempTtlPercentPlan >= 100)
// $tempTtlPercentPlan = 100;
if ($tempTtlPercentPlan >= 100)
$tempTtlPercentPlan = 100;
$currentACWP += $totalACWP;
$currentBCWP += $totalBCWP;
@ -820,7 +818,7 @@ class MasterFunctionsHelper
if (isset($dataPayload['end_date'])) {
$maxDate = $dataPayload['end_date'];
$end = new \DateTime($maxDate);
/* $interval = \DateInterval::createFromDateString('1 day'); */// should be using this but its bugged
/* $interval = \DateInterval::createFromDateString('1 day'); */ // should be using this but its bugged
$interval = new \DateInterval('P7D');
} else {
// $maxDate = DB::table('assign_material_to_activity as ama')
@ -1009,5 +1007,4 @@ class MasterFunctionsHelper
return $dataFinal;
}
}

Loading…
Cancel
Save