From a6328fabd62bf786059ec38adde48a253bed6f30 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Fri, 1 Aug 2025 11:24:58 +0800 Subject: [PATCH] E-Invoice - Automapping Issues, AR Credit Note Report (Export) --- .../GenerateCreditNotePdfV2Logic.php | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/app/Classes/Modules/Transactions/ControllersLogic/GenerateCreditNotePdfV2Logic.php b/app/Classes/Modules/Transactions/ControllersLogic/GenerateCreditNotePdfV2Logic.php index 71cf667c..7168a175 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/GenerateCreditNotePdfV2Logic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/GenerateCreditNotePdfV2Logic.php @@ -88,7 +88,28 @@ class GenerateCreditNotePdfV2Logic if ($bookingCreatedDate->isAfter($eInvoiceStartDate)) { $eInvoiceStarted = true; } - // $eInvoiceStarted = false; //cief todo: 90 - for testing + + if($eInvoiceStarted) { + $eInvoiceStarted = false; //reset to re-evaluate second time + $autoCountInvoiceId = ''; + $autoCountEInvoiceValidationLink = ''; + + $metadata = $booking->attributesKVP()->where('key', KVPKey::AUTOCOUNT_DOCNO)->first(); + if($metadata){ + $autoCountInvoiceId = $metadata->value; + } + $metadata = $booking->attributesKVP()->where('key', KVPKey::AUTOCOUNT_EINVOICE_VALIDATION_LINK)->first(); + if($metadata){ + $autoCountEInvoiceValidationLink = $metadata->value; + } + + Log::info('autoCountInvoiceId: ' . $autoCountInvoiceId); + Log::info('autoCountEInvoiceValidationLink: ' . $autoCountEInvoiceValidationLink); + + if($autoCountInvoiceId && $autoCountEInvoiceValidationLink){ + $eInvoiceStarted = true; + } + } if($eInvoiceStarted) { @@ -103,7 +124,7 @@ class GenerateCreditNotePdfV2Logic } } else{ - Log::info('Based on booking created date, E-Credit Note not yet started'); + Log::info('Based on booking created date, E-Credit Note not yet started. / Not Yet Ready.'); } $pdf = LaravelMpdf::loadView($pdfTemplateName, ['transaction' => $transaction, 'booking' => $booking, 'supplier' => $supplier, 'date' => $date, 'brn' => $brn,]);