Browse Source

Merge pull request 'update func getInvoiceOutstanding' (#25) from Dev-Farhan into staging

Reviewed-on: ibnu/generic-ospro-backend#25
pull/1/head
farhantock 11 months ago
parent
commit
91ef83aea8
  1. 18
      app/Http/Controllers/DashboardBoDController.php
  2. 2
      routes/web.php

18
app/Http/Controllers/DashboardBoDController.php

@ -111,22 +111,30 @@ class DashboardBoDController extends Controller
}
// integrasi
public function getInvoiceOutstanding($year = '%')
public function getInvoiceOutstanding($year = '%', $company_id, $all_project, $hierarchy)
{
$year = $this->interpolateYear($year);
$projects = null;
if ($all_project) {
$projects = Project::where('mulai_proyek', 'like', $year)
/* ->orWhere('akhir_proyek', 'like', $year) */
->where('company_id', $company_id)
->get();
} else {
$projects = Project::where('mulai_proyek', 'like', $year)
->where('created_by_id', $hierarchy)
->get();
}
$return = [];
foreach ($projects as $project) {
$resp = null;
if ($project->kode_sortname != "") {
$resp = $this->getInvoiceIntegration($project->kode_sortname);
// $resp = $this->getInvoiceIntegration($project->kode_sortname);
array_push($return, [
'project' => $project->nama,
'project_code' => $project->kode_sortname,
'invoiced' => $resp->data->total_invoice_amount ?? 0,
'paid' => $resp->data->total_invoice_paid_amount ?? 0,
'invoiced' => 0,
'paid' => 0,
'response' => $resp,
]);
}

2
routes/web.php

@ -24,7 +24,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->group(['middleware' => ['auth', 'cors']], function () use ($router) {
$router->get('/dashboard/get-company-cashflow/{year}/{company_id}/{all_project}/{hierarchy}', 'DashboardBoDController@getCompanyCashFlow'); // project expenditure
$router->get('/dashboard/get-invoice-outstanding[/{year}]', 'DashboardBoDController@getInvoiceOutstanding'); // project invoice vs cash in
$router->get('/dashboard/get-invoice-outstanding/{year}/{company_id}/{all_project}/{hierarchy}', 'DashboardBoDController@getInvoiceOutstanding'); // project invoice vs cash in
$router->get('/dashboard/get-total-project-per-schedule-health/{year}/{company_id}/{all_project}/{hierarchy}', 'DashboardBoDController@getTotalProjectPerScheduleHealth');
$router->get('/dashboard/get-total-project-per-budget-health/{year}/{company_id}/{all_project}/{hierarchy}', 'DashboardBoDController@getTotalProjectPerBudgetHealth');
$router->get('/dashboard/get-total-project-schedule-health-per-division/{year}/{company_id}/{all_project}/{hierarchy}', 'DashboardBoDController@getTotalProjectScheduleHealthPerDivision');

Loading…
Cancel
Save