fix: update hasil laporan export dan controller
This commit is contained in:
@@ -30,10 +30,20 @@ class LaporanHasilPenilaianJaminanInternalExternalExport implements FromCollecti
|
||||
|
||||
// Apply date range filter if provided
|
||||
if ($this->request->has('start_date') || $this->request->has('end_date')) {
|
||||
$query->whereBetween('tanggal_permohonan', [
|
||||
$this->request->start_date ?? '1900-01-01',
|
||||
$this->request->end_date ?? now()->toDateString()
|
||||
]);
|
||||
$startDate = $this->request->start_date ?? '1900-01-01';
|
||||
$endDate = $this->request->end_date ?? now()->toDateString();
|
||||
|
||||
$query->where(function ($q) use ($startDate, $endDate) {
|
||||
|
||||
$q->whereHas('penilaian', function ($q2) use ($startDate, $endDate) {
|
||||
$q2->whereBetween('tanggal_kunjungan', [$startDate, $endDate]);
|
||||
});
|
||||
|
||||
// OR check if has penawaran with date in range
|
||||
$q->orWhereHas('penawaran', function ($q3) use ($startDate, $endDate) {
|
||||
$q3->whereBetween('tanggal_penilaian_sebelumnya', [$startDate, $endDate]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Apply branch filter if provided
|
||||
|
||||
Reference in New Issue
Block a user