Browse Source

update early warning to 20%

pull/1/head
farhantock 11 months ago
parent
commit
11cda6e40c
  1. 27
      app/Http/Controllers/DashboardBoDController.php

27
app/Http/Controllers/DashboardBoDController.php

@ -41,14 +41,14 @@ class DashboardBoDController extends Controller
private function getInvoiceIntegration($search) private function getInvoiceIntegration($search)
{ {
if(empty($search)) if (empty($search))
return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); return response()->json(['status' => 'error', 'message' => 'Empty query string!'], 400);
$url = str_replace("SEARCH", $search, config('api.adw').'/project_cost?project_no=SEARCH'); $url = str_replace("SEARCH", $search, config('api.adw') . '/project_cost?project_no=SEARCH');
$token = config('api.adw_token'); $token = config('api.adw_token');
$response = $this->curlReq($url, $token); $response = $this->curlReq($url, $token);
if(@$response->data->project_no == "") if (@$response->data->project_no == "")
return null; return null;
return $response; return $response;
@ -83,7 +83,6 @@ class DashboardBoDController extends Controller
$totalInvoice += $resp->data->total_invoice_amount ?? 0; $totalInvoice += $resp->data->total_invoice_amount ?? 0;
$totalPaidInvoice += $resp->data->total_invoice_paid_amount ?? 0; $totalPaidInvoice += $resp->data->total_invoice_paid_amount ?? 0;
} }
} }
return response()->json([ return response()->json([
@ -147,15 +146,13 @@ class DashboardBoDController extends Controller
} }
$selisihProgress = $planningProgress - $actualProgress; $selisihProgress = $planningProgress - $actualProgress;
try { try {
if ($selisihProgress > 0 && $selisihProgress <= 5){ if ($selisihProgress > 0 && $selisihProgress <= 20) {
$return['warning'] += 1; $return['warning'] += 1;
$projects[$index]->status = 'warning'; $projects[$index]->status = 'warning';
} } elseif ($selisihProgress == 0) {
elseif ($selisihProgress == 0){
$return['on-schedule'] += 1; $return['on-schedule'] += 1;
$projects[$index]->status = 'on-schedule'; $projects[$index]->status = 'on-schedule';
} } else {
else {
$return['behind-schedule'] += 1; $return['behind-schedule'] += 1;
$projects[$index]->status = 'behind-schedule'; $projects[$index]->status = 'behind-schedule';
} }
@ -191,13 +188,11 @@ class DashboardBoDController extends Controller
$actualProgress = !empty($actualArray) ? $actualArray[count($actualArray) - 1] : 0; $actualProgress = !empty($actualArray) ? $actualArray[count($actualArray) - 1] : 0;
} }
$selisihProgress = $planningProgress - $actualProgress; $selisihProgress = $planningProgress - $actualProgress;
if ($selisihProgress > 0 && $selisihProgress <= 5){ if ($selisihProgress > 0 && $selisihProgress <= 5) {
$warning++; $warning++;
} } elseif ($selisihProgress == 0) {
elseif ($selisihProgress == 0){
$onSchedule++; $onSchedule++;
} } else {
else {
$behindSchedule++; $behindSchedule++;
} }
} }
@ -294,7 +289,7 @@ class DashboardBoDController extends Controller
{ {
$year = $this->interpolateYear($year); $year = $this->interpolateYear($year);
$divisions = Divisi::select('id', 'name','parent','color') $divisions = Divisi::select('id', 'name', 'parent', 'color')
->with('children') ->with('children')
->whereNull('parent') ->whereNull('parent')
->get(); ->get();

Loading…
Cancel
Save