Browse Source

update fix curva

pull/1/head
ibnu 1 year ago
parent
commit
ba5447c3ff
  1. 28
      app/Helpers/MasterFunctionsHelper.php

28
app/Helpers/MasterFunctionsHelper.php

@ -514,15 +514,6 @@ class MasterFunctionsHelper
if (!Activity::where("version_gantt_id", $keyGantt['id'])->first()) if (!Activity::where("version_gantt_id", $keyGantt['id'])->first())
return $dataFinal; 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(); $minDate = Activity::where('version_gantt_id', $keyGantt['id'])->whereNull('parent_id')->pluck('start_date')->first();
$begin = new \DateTime($minDate); $begin = new \DateTime($minDate);
@ -568,14 +559,6 @@ class MasterFunctionsHelper
$minSevenDays = new \Datetime($dt->format("Y-m-d")); $minSevenDays = new \Datetime($dt->format("Y-m-d"));
$minSevenDays = $minSevenDays->modify('-7 day')->format("Y-m-d"); $minSevenDays = $minSevenDays->modify('-7 day')->format("Y-m-d");
$tempDate[] = array($dt->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') $activities = DB::table('m_activity AS a')
->join('assign_material_to_activity AS amta', 'amta.activity_id', '=', 'a.id') ->join('assign_material_to_activity AS amta', 'amta.activity_id', '=', 'a.id')
@ -1381,6 +1364,9 @@ class MasterFunctionsHelper
'plan' => $dataTempPlan, 'plan' => $dataTempPlan,
'actual' => $dataTempReport, 'actual' => $dataTempReport,
); );
$today = new DateTime();
$date = new DateTime($dt->format("Y-m-d"));
if (isset($dataPayload['period']) && $dataPayload['period'] == 'week') { if (isset($dataPayload['period']) && $dataPayload['period'] == 'week') {
$tempTtlPercentPlan += $sumPercentagePlan; $tempTtlPercentPlan += $sumPercentagePlan;
$tempTtlPercentActual += $sumPercentageActual; $tempTtlPercentActual += $sumPercentageActual;
@ -1394,14 +1380,18 @@ class MasterFunctionsHelper
$tempPercentage[] = array(round($tempTtlPercentPlan, 2), round($tempTtlPercentActual, 2)); $tempPercentage[] = array(round($tempTtlPercentPlan, 2), round($tempTtlPercentActual, 2));
$tempPercentagePlan[] = round($tempTtlPercentPlan, 2); $tempPercentagePlan[] = round($tempTtlPercentPlan, 2);
$tempPercentagePlanWhr[] = ["weekly period", $tempPercentagePlan]; $tempPercentagePlanWhr[] = ["weekly period", $tempPercentagePlan];
$tempPercentageReal[] = round($tempTtlPercentActual, 2); if ($date < $today) {
$tempPercentageReal[] = round($tempTtlPercentActual, 2);
}
// if ($tempTtlPercentPlan >= 100 && $tempTtlPercentActual >= 100) { // if ($tempTtlPercentPlan >= 100 && $tempTtlPercentActual >= 100) {
// break; // break;
// } // }
} else { } else {
$tempPercentage[] = array(round($sumPercentagePlan, 2), round($sumPercentageActual, 2)); $tempPercentage[] = array(round($sumPercentagePlan, 2), round($sumPercentageActual, 2));
$tempPercentagePlan[] = round($sumPercentagePlan, 2); $tempPercentagePlan[] = round($sumPercentagePlan, 2);
$tempPercentageReal[] = round($sumPercentageActual, 2); if ($date < $today) {
$tempPercentageReal[] = round($sumPercentageActual, 2);
}
} }
$tempDate[] = array($dt->format("Y-m-d")); $tempDate[] = array($dt->format("Y-m-d"));
} }

Loading…
Cancel
Save