E-Invoice - Fix a problem Regenerating E-Invoice does not pick up latest data

This commit is contained in:
Dillon Ngo
2025-10-09 16:26:44 +08:00
parent 1dd54e1500
commit ec5d584f3c
2 changed files with 3 additions and 2 deletions
@@ -81,7 +81,8 @@ class GenerateCreditNotePdfV2Logic
}
$supplier = $this->fetchesCompany->execute(['id' => $transaction->receiver]);
$brn = $supplier->documents->where('document_type', DocumentType::SSM_REGISTRATION)->first();
// $brn = $supplier->documents->where('document_type', DocumentType::SSM_REGISTRATION)->first(); //wrong
$brn = $supplier->documents()->where('document_type', DocumentType::SSM_REGISTRATION)->latest()->first();
$eInvoiceStarted = false;
$eInvoiceStartDate = Carbon::parse(env('E_INVOICE_START_DATE', '2025-07-01 00:00:00'));