Browse Source

detail viewed

pull/3/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
4f99572a7e
  1. 39
      app/Http/Controllers/DashboardBoDController.php
  2. 2
      routes/web.php

39
app/Http/Controllers/DashboardBoDController.php

@ -2,13 +2,15 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Project;
use App\Models\Activity; use App\Models\Activity;
use App\Models\VersionGantt; use App\Models\AssignMaterial;
use App\Models\Divisi; use App\Models\Divisi;
use App\Models\Project;
use App\Models\ProjectPhase; use App\Models\ProjectPhase;
use App\Models\AssignMaterial;
use App\Models\ReportActivityMaterial; use App\Models\ReportActivityMaterial;
use App\Models\User;
use App\Models\UserToVersionGantt;
use App\Models\VersionGantt;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
@ -421,8 +423,8 @@ class DashboardBoDController extends Controller
$difference = $plannedPercentage - $progressPercentage; $difference = $plannedPercentage - $progressPercentage;
$dataResponse = array( $dataResponse = array(
'planned' => $plannedPercentage, 'planned' => $plannedPercentage == false ? 0 : $plannedPercentage,
'progress' => $progressPercentage, 'progress' => $progressPercentage == false ? 0 : $progressPercentage,
'difference' => $difference, 'difference' => $difference,
); );
@ -441,5 +443,32 @@ class DashboardBoDController extends Controller
return $data; return $data;
} }
public function getDetailExpenditure($year = '%'){
$year = $this->interpolateYear($year);
$projects = Project::where('mulai_proyek', 'like', $year)
/* ->orWhere('akhir_proyek', 'like', $year) */
->get();
foreach($projects as $project){
$lastGantt = $this->getLatestGantt($project->id);
if($project->kode_sortname != ""){
$resp = $this->getInvoiceIntegration($project->kode_sortname);
$project->invoice = [
'invoiced' => $resp->data->total_invoice_amount ?? 0,
'paid' => $resp->data->total_invoice_paid_amount ?? 0,
];
}
$project->pm = User::find($project->pm_id);
/* $project->header = Activity::where('proyek_id', $project->id)->where('version_gantt_id', $lastGantt['last_gantt_id'])->whereNull('parent_id')->first(); */
$project->scurve = $this->getSCurve($project->id);
$project->manPowers = UserToVersionGantt::where('version_gantt_id', $lastGantt['last_gantt_id'])->count();
}
return response()->json([
'data' => $projects,
'total_manpowers' => User::count()
], 200);
}
} }

2
routes/web.php

@ -32,6 +32,7 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout
$router->get('/dashboard/get-total-project-per-phase[/{year}]', 'DashboardBoDController@getTotalProjectPerPhase'); $router->get('/dashboard/get-total-project-per-phase[/{year}]', 'DashboardBoDController@getTotalProjectPerPhase');
$router->get('/dashboard/get-total-project-per-division[/{year}]', 'DashboardBoDController@getTotalProjectPerDivision'); $router->get('/dashboard/get-total-project-per-division[/{year}]', 'DashboardBoDController@getTotalProjectPerDivision');
$router->get('/dashboard/get-total-project-value-per-division[/{year}]', 'DashboardBoDController@getTotalProjectValuePerDivision'); $router->get('/dashboard/get-total-project-value-per-division[/{year}]', 'DashboardBoDController@getTotalProjectValuePerDivision');
$router->get('/dashboard/get-detail-expenditure[/{year}]', 'DashboardBoDController@getDetailExpenditure');
$router->post('/role/search', 'RoleController@search'); $router->post('/role/search', 'RoleController@search');
$router->post('/role/add', 'RoleController@add'); $router->post('/role/add', 'RoleController@add');
@ -66,7 +67,6 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout
$router->post('/project/get-overdue-activities', 'ProjectController@getOverdueActivities'); $router->post('/project/get-overdue-activities', 'ProjectController@getOverdueActivities');
$router->post('/project/get-integration-invoice', 'ProjectController@getInvoiceIntegration'); $router->post('/project/get-integration-invoice', 'ProjectController@getInvoiceIntegration');
$router->post('/project/get-report-distribution', 'ProjectController@getReportDistribution'); $router->post('/project/get-report-distribution', 'ProjectController@getReportDistribution');
/* $router->get('/project/get-progress/{id}/{date?}', 'ProjectController@getProgress'); */
/* $router->get('/project/get-expenditure/{id}/{date?}', 'ProjectController@getExpenditure'); */ /* $router->get('/project/get-expenditure/{id}/{date?}', 'ProjectController@getExpenditure'); */
/* $router->get('/project/get-total-expenditure/{id}', 'ProjectController@getTotalExpenditure'); */ /* $router->get('/project/get-total-expenditure/{id}', 'ProjectController@getTotalExpenditure'); */

Loading…
Cancel
Save