|
|
@ -200,7 +200,8 @@ class MasterFunctionsHelper |
|
|
|
->where('a.version_gantt_id', '=', $keyGantt['id']) |
|
|
|
->where('a.version_gantt_id', '=', $keyGantt['id']) |
|
|
|
->max("a.planned_end"); // plan date overlapped with assign_material_to_activity's, it should be m_activity' |
|
|
|
->max("a.planned_end"); // plan date overlapped with assign_material_to_activity's, it should be m_activity' |
|
|
|
$maxDate = max(new \DateTime($plannedMaxDate), new \DateTime($actualMaxDate)); |
|
|
|
$maxDate = max(new \DateTime($plannedMaxDate), new \DateTime($actualMaxDate)); |
|
|
|
$end = $maxDate; |
|
|
|
$end = new \DateTime($maxDate->format('Y-m-d') . ' Friday'); |
|
|
|
|
|
|
|
$end->modify('next Friday'); |
|
|
|
$interval = new \DateInterval('P7D'); |
|
|
|
$interval = new \DateInterval('P7D'); |
|
|
|
} |
|
|
|
} |
|
|
|
$period = new \DatePeriod($begin, $interval, $end); |
|
|
|
$period = new \DatePeriod($begin, $interval, $end); |
|
|
@ -604,6 +605,12 @@ class MasterFunctionsHelper |
|
|
|
->where('activity_id', '=', $keyActualM->activity_id) |
|
|
|
->where('activity_id', '=', $keyActualM->activity_id) |
|
|
|
->groupBy('activity_id') |
|
|
|
->groupBy('activity_id') |
|
|
|
->first(); |
|
|
|
->first(); |
|
|
|
|
|
|
|
if (!isset($sumVolActual)) { |
|
|
|
|
|
|
|
$sumVolActual = (object) [ |
|
|
|
|
|
|
|
'activity_id' => $keyActualM->activity_id, |
|
|
|
|
|
|
|
'ttl_qty_plan' => "0" |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
} |
|
|
|
$sumReportActual = DB::table('report_activity_material') |
|
|
|
$sumReportActual = DB::table('report_activity_material') |
|
|
|
->where('activity_id', $keyActualM->activity_id) |
|
|
|
->where('activity_id', $keyActualM->activity_id) |
|
|
|
->sum('qty'); |
|
|
|
->sum('qty'); |
|
|
@ -623,18 +630,29 @@ class MasterFunctionsHelper |
|
|
|
->where('activity_id', '=', $keyActualM->activity_id) |
|
|
|
->where('activity_id', '=', $keyActualM->activity_id) |
|
|
|
->orderBy('status_activity', 'ASC') |
|
|
|
->orderBy('status_activity', 'ASC') |
|
|
|
->first(); |
|
|
|
->first(); |
|
|
|
$dataTempReport[$w]['percentage'] = ($keyActualM->qty / $sumVolActual->ttl_qty_plan) * $keyActualM->bobot_planning; |
|
|
|
if (!isset($checkStatusActivity)) { |
|
|
|
|
|
|
|
$checkStatusActivity = (object) [ |
|
|
|
|
|
|
|
'activity_id' => $keyActualM->activity_id, |
|
|
|
|
|
|
|
'status_activity' => 'open' |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($sumVolActual->ttl_qty_plan == "0") { |
|
|
|
|
|
|
|
$actual = 0; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$actual = $keyActualM->qty / $sumVolActual->ttl_qty_plan; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$dataTempReport[$w]['percentage'] = $actual * $keyActualM->bobot_planning; |
|
|
|
// $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; |
|
|
|
// $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; |
|
|
|
// if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ |
|
|
|
// if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ |
|
|
|
if ($checkStatusActivity->status_activity == 'done') { |
|
|
|
if ($checkStatusActivity->status_activity == 'done') { |
|
|
|
$sumPercentageActual += $keyActualM->bobot_planning / $reportCount; |
|
|
|
$sumPercentageActual += $keyActualM->bobot_planning / $reportCount; |
|
|
|
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; |
|
|
|
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if ($keyActualM->qty / $sumVolActual->ttl_qty_plan >= 1 || (int) $sumVolActual->ttl_qty_plan == (int) $sumReportActual) { |
|
|
|
if ( $actual >= 1 || (int) $sumVolActual->ttl_qty_plan == (int) $sumReportActual) { |
|
|
|
$sumPercentageActual += (($keyActualM->qty / $sumVolActual->ttl_qty_plan) * $keyActualM->bobot_planning) * (95 / 100); |
|
|
|
$sumPercentageActual += ($actual * $keyActualM->bobot_planning) * (95 / 100); |
|
|
|
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; |
|
|
|
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$sumPercentageActual += ($keyActualM->qty / $sumVolActual->ttl_qty_plan) * $keyActualM->bobot_planning; |
|
|
|
$sumPercentageActual += $actual * $keyActualM->bobot_planning; |
|
|
|
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; |
|
|
|
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|