tambah field barang kes dalam laporan outstanding
This commit is contained in:
@@ -46,10 +46,17 @@ class OutstandingController extends Controller
|
|||||||
|
|
||||||
// Query outstanding summary for each branch
|
// Query outstanding summary for each branch
|
||||||
$summary_Outstanding_data = array_map(function ($db_connection) use ($endDate) {
|
$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
|
// SAG LAMA
|
||||||
$queryLama = Gadai::on($db_connection)
|
$queryLama = Gadai::on($db_connection)
|
||||||
->selectRaw('COUNT(norujukan) as total_gadaian, SUM(pinjaman) as sum_pinjaman')
|
->selectRaw('COUNT(norujukan) as total_gadaian, SUM(pinjaman) as sum_pinjaman')
|
||||||
->where('tagbaru', 0)
|
->where('tagbaru', 0)
|
||||||
|
->where('tagpalsu', 0)
|
||||||
->where('sttebus', '');
|
->where('sttebus', '');
|
||||||
|
|
||||||
// SAG BARU
|
// SAG BARU
|
||||||
@@ -64,12 +71,14 @@ class OutstandingController extends Controller
|
|||||||
->where('sttebus', '');
|
->where('sttebus', '');
|
||||||
|
|
||||||
if (!empty($endDate)) {
|
if (!empty($endDate)) {
|
||||||
|
$queryKes->where('t_gadai', '<=', $endDate);
|
||||||
$queryLama->where('t_gadai', '<=', $endDate);
|
$queryLama->where('t_gadai', '<=', $endDate);
|
||||||
$queryBaru->where('t_gadai', '<=', $endDate);
|
$queryBaru->where('t_gadai', '<=', $endDate);
|
||||||
$queryAll->where('t_gadai', '<=', $endDate);
|
$queryAll->where('t_gadai', '<=', $endDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_merge(
|
return array_merge(
|
||||||
|
$queryKes->first()->toArray(),
|
||||||
$queryLama->first()->toArray(),
|
$queryLama->first()->toArray(),
|
||||||
$queryBaru->first()->toArray(),
|
$queryBaru->first()->toArray(),
|
||||||
$queryAll->first()->toArray()
|
$queryAll->first()->toArray()
|
||||||
|
|||||||
Reference in New Issue
Block a user