E-Invoice - Fix Submission Issue 002 B

This commit is contained in:
Dillon Ngo
2025-10-08 12:11:40 +08:00
parent 5aa8d9dec7
commit 29a16cf98f
3 changed files with 12 additions and 18 deletions
+2 -1
View File
@@ -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)),
@@ -65,7 +65,7 @@
<br>
<!-- Invoice Table -->
@include('pages.pdfs.purchase_order_table')
@include('pages.pdfs.e_invoice_purchase_order_table')
<br>
<div class="note">
@@ -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 @@
<td class="right">Service Charges</td>
<td class="right">{{ number_format($serviceCharge, 2) }}</td>
</tr>
@if($totalPayment && $refundedServiceCharge)
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Refunded Service Charges</td>
<?php
// if has payment, calculate and deduct the refund
if ($totalPayment) {
$serviceCharge = $serviceCharge - $refundedServiceCharge;
}
?>
<td class="right">-{{ number_format($refundedServiceCharge, 2) }}</td>
</tr>
@endif
@if($voucher_redemption)
<tr class="voucher">
<td colspan="4"></td>