|
|
@ -389,6 +389,7 @@ class ActivityController extends Controller |
|
|
|
|
|
|
|
|
|
|
|
public function getCalculateCurvaS(Request $request) // for adw (plan & actual == date) |
|
|
|
public function getCalculateCurvaS(Request $request) // for adw (plan & actual == date) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
DB::enableQueryLog(); |
|
|
|
$dataPayload = $request->all(); |
|
|
|
$dataPayload = $request->all(); |
|
|
|
$allGantt = []; |
|
|
|
$allGantt = []; |
|
|
|
if(isset($dataPayload['gannt_id'])){ |
|
|
|
if(isset($dataPayload['gannt_id'])){ |
|
|
@ -445,10 +446,7 @@ class ActivityController extends Controller |
|
|
|
$tempTtlPercentActual=0; |
|
|
|
$tempTtlPercentActual=0; |
|
|
|
|
|
|
|
|
|
|
|
$currentACWP = 0; |
|
|
|
$currentACWP = 0; |
|
|
|
$budgetControlACWP = 0; |
|
|
|
|
|
|
|
$currentProgressActivity = 0; |
|
|
|
|
|
|
|
$currentBCWP = 0; |
|
|
|
$currentBCWP = 0; |
|
|
|
$budgetControlBCWP = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($period as $dt) { |
|
|
|
foreach ($period as $dt) { |
|
|
|
$dataPlanM = DB::table('assign_material_to_activity as ama') |
|
|
|
$dataPlanM = DB::table('assign_material_to_activity as ama') |
|
|
@ -463,8 +461,11 @@ class ActivityController extends Controller |
|
|
|
->join('m_activity as a', 'a.id', '=', 'ram.activity_id') |
|
|
|
->join('m_activity as a', 'a.id', '=', 'ram.activity_id') |
|
|
|
->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id']) |
|
|
|
->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id']) |
|
|
|
->where('a.proyek_id', '=', $keyGantt['proyek_id']) |
|
|
|
->where('a.proyek_id', '=', $keyGantt['proyek_id']) |
|
|
|
->whereDate('ram.report_date', $dt->format("Y-m-d")) |
|
|
|
/* ->whereDate('ram.report_date', $dt->format("Y-m-d")) */ |
|
|
|
|
|
|
|
->whereDate('ram.report_date', '2021-11-08') |
|
|
|
->get(); |
|
|
|
->get(); |
|
|
|
|
|
|
|
/* dd($dt->format('Y-m-d')); */ |
|
|
|
|
|
|
|
dd($dataActualM); |
|
|
|
$dataTempPlan = []; |
|
|
|
$dataTempPlan = []; |
|
|
|
$x = 0; |
|
|
|
$x = 0; |
|
|
|
$sumPercentagePlan=0; |
|
|
|
$sumPercentagePlan=0; |
|
|
@ -529,32 +530,13 @@ class ActivityController extends Controller |
|
|
|
'actual'=>$dataTempReport, |
|
|
|
'actual'=>$dataTempReport, |
|
|
|
); |
|
|
|
); |
|
|
|
if(isset($dataPayload['period']) && $dataPayload['period'] == 'week'){ |
|
|
|
if(isset($dataPayload['period']) && $dataPayload['period'] == 'week'){ |
|
|
|
if($dt->format("w")==1){ |
|
|
|
$tempTtlPercentPlan+= $sumPercentagePlan; |
|
|
|
if($totalACWP > 0 ){ |
|
|
|
$tempTtlPercentActual+= $sumPercentageActual; |
|
|
|
$budgetControlACWP = $currentACWP + $totalACWP; |
|
|
|
$currentACWP += $totalACWP; |
|
|
|
} |
|
|
|
$currentBCWP += $totalBCWP; |
|
|
|
if($totalBCWP > 0 ){ |
|
|
|
|
|
|
|
$budgetControlBCWP = $currentBCWP + $totalBCWP; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tempTtlPercentPlan+= $sumPercentagePlan; |
|
|
|
$tempPercentage[] = array(round($tempTtlPercentPlan,2), round($tempTtlPercentActual,2)); |
|
|
|
$tempTtlPercentActual+= $sumPercentageActual; |
|
|
|
$tempDate[] = array($dt->format("Y-m-d"), 0, 0); |
|
|
|
$currentACWP += $totalACWP; |
|
|
|
|
|
|
|
$currentBCWP += $totalBCWP; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tempPercentage[] = array(round($tempTtlPercentPlan,2), round($tempTtlPercentActual,2)); |
|
|
|
|
|
|
|
$tempDate[] = array($dt->format("Y-m-d"), 0, 0); |
|
|
|
|
|
|
|
}else if($dt->format("Y-m-d") == $end2->format("Y-m-d")) { |
|
|
|
|
|
|
|
$tempTtlPercentPlan+= $sumPercentagePlan; |
|
|
|
|
|
|
|
$tempTtlPercentActual+= $sumPercentageActual; |
|
|
|
|
|
|
|
$currentACWP += $totalACWP; |
|
|
|
|
|
|
|
$currentBCWP += $totalBCWP; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tempPercentage[] = array(round($tempTtlPercentPlan,2), round($tempTtlPercentActual,2)); |
|
|
|
|
|
|
|
$tempDate[] = array($dt->format("Y-m-d"), 0, 0); |
|
|
|
|
|
|
|
$tempTtlPercentPlan = 0; |
|
|
|
|
|
|
|
$tempTtlPercentActual = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
$tempPercentage[] = array(round($sumPercentagePlan,2), round($sumPercentageActual,2)); |
|
|
|
$tempPercentage[] = array(round($sumPercentagePlan,2), round($sumPercentageActual,2)); |
|
|
|
$tempDate[] = array($dt->format("Y-m-d"), 0, 0); |
|
|
|
$tempDate[] = array($dt->format("Y-m-d"), 0, 0); |
|
|
@ -575,7 +557,7 @@ class ActivityController extends Controller |
|
|
|
'gantt' => $keyGantt, |
|
|
|
'gantt' => $keyGantt, |
|
|
|
]); |
|
|
|
]); |
|
|
|
} |
|
|
|
} |
|
|
|
//$estimatedCost = $totalACWP > $totalRencanaBudget ? $totalACWP : $totalRencanaBudget; |
|
|
|
$estimatedCost = $totalACWP > $totalRencanaBudget ? $totalACWP : $totalRencanaBudget; |
|
|
|
|
|
|
|
|
|
|
|
$costDeviation = $totalRencanaBudget - $estimatedCost; |
|
|
|
$costDeviation = $totalRencanaBudget - $estimatedCost; |
|
|
|
if($costDeviation > 0){ |
|
|
|
if($costDeviation > 0){ |
|
|
|