Browse Source

bugfix

pull/3/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
87893310a6
  1. 54
      app/Http/Controllers/ProjectController.php

54
app/Http/Controllers/ProjectController.php

@ -381,7 +381,9 @@ class ProjectController extends Controller
/* ->join('m_activity as a', 'a.id', '=', 'ama.activity_id') */ /* ->join('m_activity as a', 'a.id', '=', 'ama.activity_id') */
/* ->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id']) */ /* ->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id']) */
/* ->min("plan_date"); */ /* ->min("plan_date"); */
$minDate = Activity::where('version_gantt_id', $keyGantt['last_gantt_id'])->min("planned_start"); /* $minDate = Activity::where('version_gantt_id', $keyGantt['last_gantt_id'])->min("planned_start"); */
$minDate = Activity::where('version_gantt_id', $keyGantt['last_gantt_id'])->whereNull('parent_id')->pluck('start_date')->first();
/* print_r($minDate); exit(); */
$begin = new \DateTime($minDate.' Monday'); $begin = new \DateTime($minDate.' Monday');
if(isset($dataPayload['end_date'])){ if(isset($dataPayload['end_date'])){
@ -402,7 +404,6 @@ class ProjectController extends Controller
$arr_ActualM = []; $arr_ActualM = [];
$tempDate = []; $tempDate = [];
$tempPercentage = [];
$tempPercentagePlan = []; $tempPercentagePlan = [];
$tempPercentagePlanWhr = []; $tempPercentagePlanWhr = [];
$tempPercentageReal = []; $tempPercentageReal = [];
@ -415,6 +416,7 @@ class ProjectController extends Controller
/* foreach($period as $x){ */ /* foreach($period as $x){ */
/* echo $x->format("Y-m-d")."\n"; */ /* echo $x->format("Y-m-d")."\n"; */
/* } exit(); */ /* } exit(); */
foreach ($period as $dt) { foreach ($period as $dt) {
$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");
@ -532,27 +534,27 @@ class ProjectController extends Controller
} }
/* print_r($tempDate); exit(); */ /* print_r($tempDate); exit(); */
/* try { */ try {
/* if(round($totalACWP,0) > $totalRencanaBudget){ */ if(round($totalACWP,0) > $totalRencanaBudget){
/* $estimatedCost = round($totalACWP,0)+0; */ $estimatedCost = round($totalACWP,0)+0;
/* }else{ */ }else{
/* $estimatedCost = ($totalRencanaBudget+0); */ $estimatedCost = ($totalRencanaBudget+0);
/* } */ }
/* } catch (\DivisionByZeroError $e) { */ } catch (\DivisionByZeroError $e) {
/* return response()->json([ */ return response()->json([
/* 'message' => $e->getMessage(), */ 'message' => $e->getMessage(),
/* "line" => 566, */ "line" => 566,
/* '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){
/* $potential = "SAVING"; */ $potential = "SAVING";
/* } else { */ } else {
/* $potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN"; */ $potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN";
/* } */ }
$dataResponse = array( $dataResponse = array(
"date" =>$tempDate, "date" =>$tempDate,
@ -565,9 +567,9 @@ class ProjectController extends Controller
"bcwp" => round($totalBCWP,0), "bcwp" => round($totalBCWP,0),
"rem_to_complete" => ($totalRencanaBudget - round($totalACWP,0)), "rem_to_complete" => ($totalRencanaBudget - round($totalACWP,0)),
"add_cost_to_complete" => 0, "add_cost_to_complete" => 0,
/* "estimated_at_completion" => $estimatedCost, */ "estimated_at_completion" => $estimatedCost,
/* "cost_deviation" => $costDeviation, */ "cost_deviation" => $costDeviation,
/* "potential" => $potential, */ "potential" => $potential,
) )
); );

Loading…
Cancel
Save