|
|
|
@ -415,7 +415,22 @@ class ProjectController extends Controller
|
|
|
|
|
public function calculateSCurve(Request $request) |
|
|
|
|
{ |
|
|
|
|
$sCurve = Project::select('scurve')->where('id', $request->project_id)->first(); |
|
|
|
|
return response()->json(['status' => 'success', 'code' => 200, 'data' => json_decode($sCurve->scurve)], 200); |
|
|
|
|
$dcdScurve = json_decode($sCurve['scurve'],true); |
|
|
|
|
$dataScurve = $dcdScurve[0]['data']; |
|
|
|
|
$today = date('Y-m-d'); |
|
|
|
|
$progressPlanBar = 0; |
|
|
|
|
foreach($dataScurve['date'] as $index => $dateArray) { |
|
|
|
|
if (isset($dateArray[0])) { |
|
|
|
|
$date = $dateArray[0]; |
|
|
|
|
if($date <= $today) { |
|
|
|
|
if (isset($dataScurve['percentagePlan'][$index])) { |
|
|
|
|
$progressPlanBar = round($dataScurve['percentagePlan'][$index], 2); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$dcdScurve[0]['data']['progressPlanToDay'] = round($progressPlanBar,2); |
|
|
|
|
return response()->json(['status' => 'success', 'code' => 200, 'data' => $dcdScurve], 200); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function sCurveCommand(Request $request) |
|
|
|
|