tambah field barang kes dalam laporan outstanding

This commit is contained in:
Nur Izzati
2026-02-22 14:13:19 +08:00
parent a337b6cfa4
commit edcc0dc0d4
@@ -46,10 +46,17 @@ class OutstandingController extends Controller
// Query outstanding summary for each branch
$summary_Outstanding_data = array_map(function ($db_connection) use ($endDate) {
// SAG KES
$queryKes = Gadai::on($db_connection)
->selectRaw('COUNT(norujukan) as total_gadaian_kes, SUM(pinjaman) as sum_pinjaman_kes')
->where('tagbaru', 0)
->where('tagpalsu', 1)
->where('sttebus', '');
// SAG LAMA
$queryLama = Gadai::on($db_connection)
->selectRaw('COUNT(norujukan) as total_gadaian, SUM(pinjaman) as sum_pinjaman')
->where('tagbaru', 0)
->where('tagpalsu', 0)
->where('sttebus', '');
// SAG BARU
@@ -64,12 +71,14 @@ class OutstandingController extends Controller
->where('sttebus', '');
if (!empty($endDate)) {
$queryKes->where('t_gadai', '<=', $endDate);
$queryLama->where('t_gadai', '<=', $endDate);
$queryBaru->where('t_gadai', '<=', $endDate);
$queryAll->where('t_gadai', '<=', $endDate);
}
return array_merge(
$queryKes->first()->toArray(),
$queryLama->first()->toArray(),
$queryBaru->first()->toArray(),
$queryAll->first()->toArray()