dev-wahyun #15

Merged
farhantock merged 2 commits from dev-wahyun into staging 3 months ago
  1. 4
      app/Http/Controllers/DashboardBoDController.php
  2. 17
      app/Http/Controllers/ProjectController.php

4
app/Http/Controllers/DashboardBoDController.php

@ -66,11 +66,11 @@ class DashboardBoDController extends Controller
return response()->json([ return response()->json([
'data' => [ 'data' => [
'total_budget' => (int) ($totalBudgets->total_rencana_biaya ?? 0), 'total_budget' => $totalBudgets->total_value_proyek ?? 0,
'total_expenditure' => $totalExpenditure, 'total_expenditure' => $totalExpenditure,
'total_invoice' => $totalInvoice, 'total_invoice' => $totalInvoice,
'total_paid_invoice' => $totalPaidInvoice, 'total_paid_invoice' => $totalPaidInvoice,
'total_value_proyek' => $totalBudgets->total_value_proyek ?? 0, 'total_value_proyek' => (int) ($totalBudgets->total_rencana_biaya ?? 0),
'total_income_year' => $totalBudgets->total_income_year ?? 0 'total_income_year' => $totalBudgets->total_income_year ?? 0
] ]
], 200); ], 200);

17
app/Http/Controllers/ProjectController.php

@ -291,6 +291,23 @@ class ProjectController extends Controller
$builder = $dataBuilder['builder']; $builder = $dataBuilder['builder'];
$countBuilder = $dataBuilder['count']; $countBuilder = $dataBuilder['count'];
$dataGet = $builder->get(); $dataGet = $builder->get();
foreach($dataGet as $p) {
$project = Project::find($p->id);
if (!$project) continue;
$act = Activity::select('persentase_progress as total_progress')
->where([
['proyek_id', $p->id],
['parent_id', null]
])
->first();
if ($act) {
$project->persentase_progress = $act->total_progress;
} else {
$project->persentase_progress = 0;
}
$project->save();
}
$totalRecord = $countBuilder->count(); $totalRecord = $countBuilder->count();
return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet, 'totalRecord' => $totalRecord], 200); return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet, 'totalRecord' => $totalRecord], 200);
} }

Loading…
Cancel
Save