|
|
|
@ -514,15 +514,6 @@ class MasterFunctionsHelper
|
|
|
|
|
if (!Activity::where("version_gantt_id", $keyGantt['id'])->first()) |
|
|
|
|
return $dataFinal; |
|
|
|
|
|
|
|
|
|
// $alreadyHasReport = DB::table('report_activity_material as a') |
|
|
|
|
// ->select('a.id') |
|
|
|
|
// ->join('m_activity as b', 'b.id', '=', 'a.activity_id') |
|
|
|
|
// ->where('b.version_gantt_id', '=', $keyGantt['id']) |
|
|
|
|
// ->exists(); |
|
|
|
|
// note : delete this |
|
|
|
|
// if(!$alreadyHasReport) |
|
|
|
|
// return $dataFinal; |
|
|
|
|
|
|
|
|
|
$minDate = Activity::where('version_gantt_id', $keyGantt['id'])->whereNull('parent_id')->pluck('start_date')->first(); |
|
|
|
|
|
|
|
|
|
$begin = new \DateTime($minDate); |
|
|
|
@ -568,14 +559,6 @@ class MasterFunctionsHelper
|
|
|
|
|
$minSevenDays = new \Datetime($dt->format("Y-m-d")); |
|
|
|
|
$minSevenDays = $minSevenDays->modify('-7 day')->format("Y-m-d"); |
|
|
|
|
$tempDate[] = array($dt->format("Y-m-d")); |
|
|
|
|
// $dataPlanM = DB::table('assign_material_to_activity as ama') |
|
|
|
|
// ->select('ama.activity_id', 'ama.qty_planning', 'ama.plan_date', 'ama.start_activity', 'a.bobot_planning', 'a.biaya_actual', 'a.duration', 'a.persentase_progress') |
|
|
|
|
// ->join('m_activity as a', 'a.id', '=', 'ama.activity_id') |
|
|
|
|
// ->where('ama.proyek_id', '=', $keyGantt['proyek_id']) |
|
|
|
|
// ->where('a.version_gantt_id', '=', $keyGantt['id']) |
|
|
|
|
// ->whereDate('ama.plan_date', '<=',$dt->format("Y-m-d")) |
|
|
|
|
// ->whereDate('ama.plan_date', '>', $minSevenDays) |
|
|
|
|
// ->get(); |
|
|
|
|
|
|
|
|
|
$activities = DB::table('m_activity AS a') |
|
|
|
|
->join('assign_material_to_activity AS amta', 'amta.activity_id', '=', 'a.id') |
|
|
|
@ -1381,6 +1364,9 @@ class MasterFunctionsHelper
|
|
|
|
|
'plan' => $dataTempPlan, |
|
|
|
|
'actual' => $dataTempReport, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$today = new DateTime(); |
|
|
|
|
$date = new DateTime($dt->format("Y-m-d")); |
|
|
|
|
if (isset($dataPayload['period']) && $dataPayload['period'] == 'week') { |
|
|
|
|
$tempTtlPercentPlan += $sumPercentagePlan; |
|
|
|
|
$tempTtlPercentActual += $sumPercentageActual; |
|
|
|
@ -1394,15 +1380,19 @@ class MasterFunctionsHelper
|
|
|
|
|
$tempPercentage[] = array(round($tempTtlPercentPlan, 2), round($tempTtlPercentActual, 2)); |
|
|
|
|
$tempPercentagePlan[] = round($tempTtlPercentPlan, 2); |
|
|
|
|
$tempPercentagePlanWhr[] = ["weekly period", $tempPercentagePlan]; |
|
|
|
|
if ($date < $today) { |
|
|
|
|
$tempPercentageReal[] = round($tempTtlPercentActual, 2); |
|
|
|
|
} |
|
|
|
|
// if ($tempTtlPercentPlan >= 100 && $tempTtlPercentActual >= 100) { |
|
|
|
|
// break; |
|
|
|
|
// } |
|
|
|
|
} else { |
|
|
|
|
$tempPercentage[] = array(round($sumPercentagePlan, 2), round($sumPercentageActual, 2)); |
|
|
|
|
$tempPercentagePlan[] = round($sumPercentagePlan, 2); |
|
|
|
|
if ($date < $today) { |
|
|
|
|
$tempPercentageReal[] = round($sumPercentageActual, 2); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$tempDate[] = array($dt->format("Y-m-d")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|