diff --git a/app/Classes/Modules/Transactions/Processors/CreateInvoiceDocumentProcessor.php b/app/Classes/Modules/Transactions/Processors/CreateInvoiceDocumentProcessor.php index d6911b37..9596ae8e 100644 --- a/app/Classes/Modules/Transactions/Processors/CreateInvoiceDocumentProcessor.php +++ b/app/Classes/Modules/Transactions/Processors/CreateInvoiceDocumentProcessor.php @@ -54,6 +54,7 @@ class CreateInvoiceDocumentProcessor $brn = $supplier->documents->where('document_type', DocumentType::SSM_REGISTRATION)->first(); $documentDate = $supplier->segments->whereIn('id', [23])->first() ? \Carbon\Carbon::now() : $booking->created_at; $eInvoiceStartDate = Carbon::parse(env('E_INVOICE_START_DATE', '2025-07-01 00:00:00')); + $autoCountInvoiceId = ''; if ($booking) { $bookingCreatedDate = Carbon::parse($booking->created_at); @@ -66,6 +67,10 @@ class CreateInvoiceDocumentProcessor } if($document_type === DocumentType::EINVOICE){ + $metadata = $booking->attributesKVP()->where('key', 'AUTOCOUNT_DOCNO')->first(); + if($metadata){ + $autoCountInvoiceId = $metadata->value; + } $lastDayOfMonth = $documentDate->copy()->endOfMonth(); $documentDate = $lastDayOfMonth; } @@ -77,7 +82,7 @@ class CreateInvoiceDocumentProcessor $lowercaseDocumentType = strtolower($document_type); - $order_pdf = LaravelMpdf::loadView('pages.pdfs.' . $lowercaseDocumentType, ['transaction' => $transaction, 'po_order_transaction' => $purchaseOrder, 'supplier' => $supplier, 'voucher_redemption' => $voucherRedemption, 'current_paid_amount' => $currentPaidAmount, 'document_date' => $documentDate, 'brn' => $brn, 'autocountId' => null, 'booking' => $booking]); //cief todo: 90 - autocount id to be updated + $order_pdf = LaravelMpdf::loadView('pages.pdfs.' . $lowercaseDocumentType, ['transaction' => $transaction, 'po_order_transaction' => $purchaseOrder, 'supplier' => $supplier, 'voucher_redemption' => $voucherRedemption, 'current_paid_amount' => $currentPaidAmount, 'document_date' => $documentDate, 'brn' => $brn, 'autocountId' => $autoCountInvoiceId, 'booking' => $booking]); //cief todo: 90 - autocount id to be updated if($purchaseOrder && $purchaseOrder->booking->service_id === 4) { $purchaseOrderDocuments = $purchaseOrder->booking->documents()->where('document_type', DocumentType::ECOMMERCE_PURCHASE_ORDER)->get();