Merged in izzati-feat-report-kpi (pull request #227)

update ringkasan harian untuk KPI jawatan PC
This commit is contained in:
izzati zulkifli
2024-10-16 06:43:55 +00:00
3 changed files with 36 additions and 1 deletions
@@ -24,6 +24,17 @@ class RingkasanHarianController extends Controller
return response()->json($reports);
}
public function getLaporanCawanganKPI(string $kod_cawangan, Request $request)
{
$reportRingkasanHarianService = new ReportRingkasanHarianService($kod_cawangan, $request);
$reports = [
'reportRingkasanHarianKPI' => $reportRingkasanHarianService->getLaporanCawanganKPI(),
];
return response()->json($reports);
}
public function getSummaryLaporanRingkasanHarian()
{
return json_encode(Helper::getActiveCawangan());
@@ -1411,4 +1411,28 @@ class RingkasanHarianService
return $panjar;
}
public function getLaporanCawanganKPI()
{
$laporan_harian = [];
$total_gadai = Gadai::on($this->connectionCawangan)->whereDate('t_gadai', '>=', $this->startDate)->whereDate('t_gadai', '<=', $this->endDate)->sum('pinjaman');
$bilangan_gadai = Gadai::on($this->connectionCawangan)->whereDate('t_gadai', '>=', $this->startDate)->whereDate('t_gadai', '<=', $this->endDate)->where('pinjaman', '>', 0)->count();
$bilangan_customer_baru = $this->getBilanganCustomerBaru();
$total_keuntungan_online = $this->getTotalKeuntunganOnline();
$upahsimpankaunter = $this->getUpahSimpanKaunter();
$keuntungansebenarkaunter = $this->getKeuntunganSebenarKaunter();
array_push($laporan_harian, [
'total_gadai' => $total_gadai,
'bilangan_gadai' => $bilangan_gadai,
'bilangan_customer_baru' => $bilangan_customer_baru,
'total_keuntungan_online' => $total_keuntungan_online,
'upahsimpankaunter' => $upahsimpankaunter,
'keuntungansebenarkaunter' => $keuntungansebenarkaunter,
]);
return response()->json($laporan_harian);
}
}
+1 -1
View File
@@ -878,7 +878,7 @@ $router->group(['prefix'=>'lelong'], function () use ($router){
$router->get('get/listbatchlelongT/{kodcaw}',['uses'=>'LelongController@showAllLelongByCawanganBatchnoT']);
$router->get('get/listlelongbybatchT/{kodcaw}/{batchno}',['uses'=>'LelongController@showAllLelongByCawanganbyBatchnoT']);
$router->get('get/upahtawarruqbytarikh',['uses'=>'TebusController@upahTawarruqByTarikh']);
$router->get('ringkasan-harian/{kod_cawangan}', ['uses' => 'Reports\RingkasanHarianController@getLaporanCawangan']);
$router->get('ringkasan-harian/{kod_cawangan}', ['uses' => 'Reports\RingkasanHarianController@getLaporanCawanganKPI']);
});