Merged in izzati-feat-laporan-baki-lelong (pull request #310)

update query baki lelong
This commit is contained in:
izzati zulkifli
2025-06-11 07:23:53 +00:00
2 changed files with 9 additions and 3 deletions
@@ -126,7 +126,10 @@ public function getSummaryLaporanBakiLelongBelumTuntut(Request $request)
sum(lelong.cajlelong) as sum_cajlelong,
sum(lelong.hargajual) as sum_hargajual,
sum(lelong.baki) as sum_baki'))
->whereNull('lelong.trkhtuntut')
->where(function ($query) use ($request) {
$query->whereNull('lelong.trkhtuntut')
->orWhere('lelong.trkhtuntut', '>', $request->endDate); // or use a specific date: '2025-06-01'
})
->where('lelong.baki', '>', 0.00);
+5 -2
View File
@@ -256,7 +256,7 @@ class LelonganService
public function getCawanganReportBakiLelongBelumTuntut()
{
$cawangan_connection = Cawangan::where('kodcaw', $this->kod_cawangan)->first()->mysql;
$endDate = $this->endDate;
$query_total_lelongan = Lelong::on($cawangan_connection)
->join('gadai', 'gadai.norujukan', '=', 'lelong.norujukan') // Joining gadai table
->select(
@@ -272,7 +272,10 @@ class LelonganService
'gadai.bakipjm', // Fetch pinjaman from gadai
'gadai.marhun' // Fetch marhun from gadai
)
->whereNull('lelong.trkhtuntut')
->where(function ($query) use ($endDate) {
$query->whereNull('lelong.trkhtuntut')
->orWhere('lelong.trkhtuntut', '>', $endDate); // or use a specific date: '2025-06-01'
})
->where('lelong.baki', '>', 0.00);
$query_total_lelongan->when(!empty($this->startDate) and !empty($this->endDate), function ($q) {