Browse Source

Merge pull request 'staging' (#26) from staging into master

Reviewed-on: ibnu/generic-ospro-backend#26
pull/1/head
farhantock 1 year ago
parent
commit
0b6c05e172
  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 // integrasi
public function getInvoiceOutstanding($year = '%') public function getInvoiceOutstanding($year = '%', $company_id, $all_project, $hierarchy)
{ {
$year = $this->interpolateYear($year); $year = $this->interpolateYear($year);
$projects = null;
if ($all_project) {
$projects = Project::where('mulai_proyek', 'like', $year) $projects = Project::where('mulai_proyek', 'like', $year)
/* ->orWhere('akhir_proyek', 'like', $year) */ ->where('company_id', $company_id)
->get(); ->get();
} else {
$projects = Project::where('mulai_proyek', 'like', $year)
->where('created_by_id', $hierarchy)
->get();
}
$return = []; $return = [];
foreach ($projects as $project) { foreach ($projects as $project) {
$resp = null; $resp = null;
if ($project->kode_sortname != "") { if ($project->kode_sortname != "") {
$resp = $this->getInvoiceIntegration($project->kode_sortname); // $resp = $this->getInvoiceIntegration($project->kode_sortname);
array_push($return, [ array_push($return, [
'project' => $project->nama, 'project' => $project->nama,
'project_code' => $project->kode_sortname, 'project_code' => $project->kode_sortname,
'invoiced' => $resp->data->total_invoice_amount ?? 0, 'invoiced' => 0,
'paid' => $resp->data->total_invoice_paid_amount ?? 0, 'paid' => 0,
'response' => $resp, '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->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-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-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-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'); $router->get('/dashboard/get-total-project-schedule-health-per-division/{year}/{company_id}/{all_project}/{hierarchy}', 'DashboardBoDController@getTotalProjectScheduleHealthPerDivision');

Loading…
Cancel
Save