From 88151c2f49f8be05c37825d4399f75579de9aa37 Mon Sep 17 00:00:00 2001 From: wahyu Date: Thu, 12 Oct 2023 09:27:10 +0700 Subject: [PATCH] prorate total cost for gantt --- app/Http/Controllers/ProjectController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 75ecec4..f5b921b 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -466,12 +466,16 @@ class ProjectController extends Controller } public function getInvoiceIntegration(Request $request) { + $ganttCount = VersionGantt::where('proyek_id', $request->id)->count(); $search = urlencode($request->search); if(empty($search)) return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); $url = str_replace("SEARCH", $search, config('api.adw').'/project_cost?project_no=SEARCH'); $response = MasterFunctionsHelper::curlReq($url); + if (isset($request->gantt_id)) { + $response->data->total_cost = $response->data->total_cost / $ganttCount; + } return response()->json(['status'=>'success', 'data'=> $response, 'code'=>200], 200); }