From 29a16cf98f2d4cc1eb5d8dd239a9981e5af2b692 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Wed, 8 Oct 2025 12:11:40 +0800 Subject: [PATCH] E-Invoice - Fix Submission Issue 002 B --- app/Http/Resources/BookingResource.php | 3 ++- .../views/pages/pdfs/e_invoice.blade.php | 2 +- .../e_invoice_purchase_order_table.blade.php | 25 +++++++------------ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/app/Http/Resources/BookingResource.php b/app/Http/Resources/BookingResource.php index d8bcb6ec..5d8b3836 100644 --- a/app/Http/Resources/BookingResource.php +++ b/app/Http/Resources/BookingResource.php @@ -49,7 +49,8 @@ class BookingResource extends JsonResource 'marking' => $this->marking, 'amount' => $this->fix_amount, 'floating_amount' => floatval((App()->make(CalculatesBookingFloatingAmount::class))->execute($this->resource, $this->fix_currency_id)), - 'paid_amount' => floatval((App()->make(CalculatesBookingPayableAmount::class))->execute($this->resource, $this->fix_currency_id)) - floatval((App()->make(CalculatesBookingRefundAmount::class))->execute($this->resource, $this->fix_currency_id)), + 'paid_amount_with_refund' => floatval((App()->make(CalculatesBookingPayableAmount::class))->execute($this->resource, $this->fix_currency_id)) - floatval((App()->make(CalculatesBookingRefundAmount::class))->execute($this->resource, $this->fix_currency_id)), + 'paid_amount' => floatval((App()->make(CalculatesBookingPayableAmount::class))->execute($this->resource, $this->fix_currency_id)), 'outstanding_amount_with_refund' => $outStandingAmountWithRefund > 0 ? $outStandingAmountWithRefund : 0, 'refunded_amount' => floatval((App()->make(CalculatesBookingRefundAmount::class))->execute($this->resource, $this->fix_currency_id)), 'outstanding_amount' => floatval((App()->make(CalculatesBookingOutstanding::class))->execute($this->resource)), diff --git a/resources/views/pages/pdfs/e_invoice.blade.php b/resources/views/pages/pdfs/e_invoice.blade.php index cf3069ca..a5ea0cd5 100644 --- a/resources/views/pages/pdfs/e_invoice.blade.php +++ b/resources/views/pages/pdfs/e_invoice.blade.php @@ -65,7 +65,7 @@
- @include('pages.pdfs.purchase_order_table') + @include('pages.pdfs.e_invoice_purchase_order_table')
diff --git a/resources/views/pages/pdfs/e_invoice_purchase_order_table.blade.php b/resources/views/pages/pdfs/e_invoice_purchase_order_table.blade.php index 58d2ed7e..209ff33d 100644 --- a/resources/views/pages/pdfs/e_invoice_purchase_order_table.blade.php +++ b/resources/views/pages/pdfs/e_invoice_purchase_order_table.blade.php @@ -50,10 +50,11 @@ ->where('status', ApprovalStatus::COMPLETED) ->count(); - $refundedAmount = (App()->make(CalculatesBookingRefundAmount::class))->execute($booking, 1); - $refundedServiceCharge = (App()->make(CalculatesBookingRefundServiceCharge::class))->execute($booking, 1); + // $refundedAmount = (App()->make(CalculatesBookingRefundAmount::class))->execute($booking, 1); + // $refundedServiceCharge = (App()->make(CalculatesBookingRefundServiceCharge::class))->execute($booking, 1); - $totalPayment = $paymentSum - $refundedAmount - $refundedServiceCharge; + $totalPayment = $paymentSum; + // $totalPayment = $paymentSum - $refundedAmount - $refundedServiceCharge; } else{ $paymentSumRefund = $booking->transactions() @@ -71,6 +72,11 @@ @php $exactUnitPrice = ($currency_id) === 1 ? $transaction_detail->price : bcdiv($transaction_detail->price, $average_currency_rate, 7); $displayUnitPrice = round($exactUnitPrice, 2); + @endphp + + @continue($transaction_detail->product_name === 'Discount' && $displayUnitPrice < 0) + + @php $itemTotal = bcmul($exactUnitPrice, $transaction_detail->quantity, 5); $displayedItemTotal = round(bcmul($displayUnitPrice, $transaction_detail->quantity, 7), 2); $displayedSubtotal = bcadd($displayedSubtotal, $displayedItemTotal, 2); @@ -132,19 +138,6 @@ Service Charges {{ number_format($serviceCharge, 2) }} - @if($totalPayment && $refundedServiceCharge) - - - Refunded Service Charges - - -{{ number_format($refundedServiceCharge, 2) }} - - @endif @if($voucher_redemption)