|
|
@ -9,9 +9,11 @@ use App\Models\HierarchyFtth; |
|
|
|
use Illuminate\Support\Facades\DB; |
|
|
|
use Illuminate\Support\Facades\DB; |
|
|
|
use Illuminate\Support\Facades\Log; |
|
|
|
use Illuminate\Support\Facades\Log; |
|
|
|
|
|
|
|
|
|
|
|
class MasterFunctionsHelper { |
|
|
|
class MasterFunctionsHelper |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
public static function curlReq($url, $token = ""){ |
|
|
|
public static function curlReq($url, $token = "") |
|
|
|
|
|
|
|
{ |
|
|
|
if (!$token) |
|
|
|
if (!$token) |
|
|
|
$token = config('api.adw_token'); |
|
|
|
$token = config('api.adw_token'); |
|
|
|
|
|
|
|
|
|
|
@ -34,7 +36,8 @@ class MasterFunctionsHelper { |
|
|
|
return json_decode($output); |
|
|
|
return json_decode($output); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getLatestGantt($id){ |
|
|
|
public function getLatestGantt($id) |
|
|
|
|
|
|
|
{ |
|
|
|
$maxGanttId = VersionGantt::where("proyek_id", $id)->max("id"); |
|
|
|
$maxGanttId = VersionGantt::where("proyek_id", $id)->max("id"); |
|
|
|
if (!$maxGanttId) { |
|
|
|
if (!$maxGanttId) { |
|
|
|
$data = array( |
|
|
|
$data = array( |
|
|
@ -50,7 +53,8 @@ class MasterFunctionsHelper { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// dipake di dashboard project & bod |
|
|
|
// dipake di dashboard project & bod |
|
|
|
public function getSCurve($request){ |
|
|
|
public function getSCurve($request) |
|
|
|
|
|
|
|
{ |
|
|
|
$allGantt = []; |
|
|
|
$allGantt = []; |
|
|
|
if (!is_int($request)) { |
|
|
|
if (!is_int($request)) { |
|
|
|
$dataPayload = $request->all(); |
|
|
|
$dataPayload = $request->all(); |
|
|
@ -83,7 +87,8 @@ class MasterFunctionsHelper { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getLinearSCurve($request){ |
|
|
|
public function getLinearSCurve($request) |
|
|
|
|
|
|
|
{ |
|
|
|
$ftths = HierarchyFtth::where('project_id', $request->project_id)->get(); |
|
|
|
$ftths = HierarchyFtth::where('project_id', $request->project_id)->get(); |
|
|
|
$ttlProgress = 0; |
|
|
|
$ttlProgress = 0; |
|
|
|
$ttlPlanning = 0; |
|
|
|
$ttlPlanning = 0; |
|
|
@ -210,6 +215,7 @@ class MasterFunctionsHelper { |
|
|
|
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"); |
|
|
|
|
|
|
|
$tempDate[] = array($dt->format("Y-m-d")); |
|
|
|
// $dataPlanM = DB::table('assign_material_to_activity as ama') |
|
|
|
// $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') |
|
|
|
// ->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') |
|
|
|
// ->join('m_activity as a', 'a.id', '=', 'ama.activity_id') |
|
|
@ -392,7 +398,6 @@ class MasterFunctionsHelper { |
|
|
|
$tempPercentagePlan[] = round($sumPercentagePlan, 2); |
|
|
|
$tempPercentagePlan[] = round($sumPercentagePlan, 2); |
|
|
|
$tempPercentageReal[] = round($sumPercentageActual, 2); |
|
|
|
$tempPercentageReal[] = round($sumPercentageActual, 2); |
|
|
|
} |
|
|
|
} |
|
|
|
$tempDate[] = array($dt->format("Y-m-d")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
@ -423,7 +428,8 @@ class MasterFunctionsHelper { |
|
|
|
"percentagePlan" => $tempPercentagePlan, |
|
|
|
"percentagePlan" => $tempPercentagePlan, |
|
|
|
"percentageReal" => $tempPercentageReal, |
|
|
|
"percentageReal" => $tempPercentageReal, |
|
|
|
"data_details" => $arr_ActualM, |
|
|
|
"data_details" => $arr_ActualM, |
|
|
|
"budget_control" =>array("current_budget"=> $totalRencanaBudget, |
|
|
|
"budget_control" => array( |
|
|
|
|
|
|
|
"current_budget" => $totalRencanaBudget, |
|
|
|
"acwp" => round($totalACWP, 0), |
|
|
|
"acwp" => round($totalACWP, 0), |
|
|
|
"bcwp" => round($totalBCWP, 0), |
|
|
|
"bcwp" => round($totalBCWP, 0), |
|
|
|
"rem_to_complete" => ($totalRencanaBudget - round($totalACWP, 0)), |
|
|
|
"rem_to_complete" => ($totalRencanaBudget - round($totalACWP, 0)), |
|
|
@ -698,7 +704,8 @@ class MasterFunctionsHelper { |
|
|
|
"percentagePlan" => $tempPercentagePlan, |
|
|
|
"percentagePlan" => $tempPercentagePlan, |
|
|
|
"percentageReal" => $tempPercentageReal, |
|
|
|
"percentageReal" => $tempPercentageReal, |
|
|
|
"data_details" => $arr_ActualM, |
|
|
|
"data_details" => $arr_ActualM, |
|
|
|
"budget_control" =>array("current_budget"=> $totalRencanaBudget, |
|
|
|
"budget_control" => array( |
|
|
|
|
|
|
|
"current_budget" => $totalRencanaBudget, |
|
|
|
"acwp" => round($totalACWP, 0), |
|
|
|
"acwp" => round($totalACWP, 0), |
|
|
|
"bcwp" => round($totalBCWP, 0), |
|
|
|
"bcwp" => round($totalBCWP, 0), |
|
|
|
"rem_to_complete" => ($totalRencanaBudget - round($totalACWP, 0)), |
|
|
|
"rem_to_complete" => ($totalRencanaBudget - round($totalACWP, 0)), |
|
|
@ -717,7 +724,8 @@ class MasterFunctionsHelper { |
|
|
|
return $dataFinal; |
|
|
|
return $dataFinal; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function calculateProgressBasedOnSimple($keyGantt){ |
|
|
|
public function calculateProgressBasedOnSimple($keyGantt) |
|
|
|
|
|
|
|
{ |
|
|
|
DB::enableQueryLog(); |
|
|
|
DB::enableQueryLog(); |
|
|
|
|
|
|
|
|
|
|
|
$dataFinal = []; |
|
|
|
$dataFinal = []; |
|
|
@ -923,7 +931,8 @@ class MasterFunctionsHelper { |
|
|
|
"percentagePlan" => $tempPercentagePlan, |
|
|
|
"percentagePlan" => $tempPercentagePlan, |
|
|
|
"percentageReal" => $tempPercentageReal, |
|
|
|
"percentageReal" => $tempPercentageReal, |
|
|
|
"data_details" => $arr_ActualM, |
|
|
|
"data_details" => $arr_ActualM, |
|
|
|
"budget_control" =>array("current_budget"=> $totalRencanaBudget, |
|
|
|
"budget_control" => array( |
|
|
|
|
|
|
|
"current_budget" => $totalRencanaBudget, |
|
|
|
"acwp" => round($totalACWP, 0), |
|
|
|
"acwp" => round($totalACWP, 0), |
|
|
|
"bcwp" => round($totalBCWP, 0), |
|
|
|
"bcwp" => round($totalBCWP, 0), |
|
|
|
"rem_to_complete" => ($totalRencanaBudget - round($totalACWP, 0)), |
|
|
|
"rem_to_complete" => ($totalRencanaBudget - round($totalACWP, 0)), |
|
|
|