|
|
|
@ -389,6 +389,7 @@ class ActivityController extends Controller
|
|
|
|
|
|
|
|
|
|
public function getCalculateCurvaS(Request $request) // for adw (plan & actual == date) |
|
|
|
|
{ |
|
|
|
|
DB::enableQueryLog(); |
|
|
|
|
$dataPayload = $request->all(); |
|
|
|
|
$allGantt = []; |
|
|
|
|
if(isset($dataPayload['gannt_id'])){ |
|
|
|
@ -445,10 +446,7 @@ class ActivityController extends Controller
|
|
|
|
|
$tempTtlPercentActual=0; |
|
|
|
|
|
|
|
|
|
$currentACWP = 0; |
|
|
|
|
$budgetControlACWP = 0; |
|
|
|
|
$currentProgressActivity = 0; |
|
|
|
|
$currentBCWP = 0; |
|
|
|
|
$budgetControlBCWP = 0; |
|
|
|
|
|
|
|
|
|
foreach ($period as $dt) { |
|
|
|
|
$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') |
|
|
|
|
->where('a.version_gantt_id', '=', $keyGantt['last_gantt_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(); |
|
|
|
|
/* dd($dt->format('Y-m-d')); */ |
|
|
|
|
dd($dataActualM); |
|
|
|
|
$dataTempPlan = []; |
|
|
|
|
$x = 0; |
|
|
|
|
$sumPercentagePlan=0; |
|
|
|
@ -529,14 +530,6 @@ class ActivityController extends Controller
|
|
|
|
|
'actual'=>$dataTempReport, |
|
|
|
|
); |
|
|
|
|
if(isset($dataPayload['period']) && $dataPayload['period'] == 'week'){ |
|
|
|
|
if($dt->format("w")==1){ |
|
|
|
|
if($totalACWP > 0 ){ |
|
|
|
|
$budgetControlACWP = $currentACWP + $totalACWP; |
|
|
|
|
} |
|
|
|
|
if($totalBCWP > 0 ){ |
|
|
|
|
$budgetControlBCWP = $currentBCWP + $totalBCWP; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$tempTtlPercentPlan+= $sumPercentagePlan; |
|
|
|
|
$tempTtlPercentActual+= $sumPercentageActual; |
|
|
|
|
$currentACWP += $totalACWP; |
|
|
|
@ -544,17 +537,6 @@ class ActivityController extends Controller
|
|
|
|
|
|
|
|
|
|
$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{ |
|
|
|
|
$tempPercentage[] = array(round($sumPercentagePlan,2), round($sumPercentageActual,2)); |
|
|
|
|
$tempDate[] = array($dt->format("Y-m-d"), 0, 0); |
|
|
|
@ -575,7 +557,7 @@ class ActivityController extends Controller
|
|
|
|
|
'gantt' => $keyGantt, |
|
|
|
|
]); |
|
|
|
|
} |
|
|
|
|
//$estimatedCost = $totalACWP > $totalRencanaBudget ? $totalACWP : $totalRencanaBudget; |
|
|
|
|
$estimatedCost = $totalACWP > $totalRencanaBudget ? $totalACWP : $totalRencanaBudget; |
|
|
|
|
|
|
|
|
|
$costDeviation = $totalRencanaBudget - $estimatedCost; |
|
|
|
|
if($costDeviation > 0){ |
|
|
|
|