E-Invoice - Enhancement to allow EInvoice to be generated for cases with refund

This commit is contained in:
Dillon Ngo
2025-10-02 09:36:43 +08:00
parent 4d36f69b3e
commit 844697c885
@@ -105,6 +105,22 @@
<tfoot>
@php
$subtotalWithDiscount = bcsub($subtotal, $voucherDiscount, 5);
if (!$totalPayment) {
$serviceCharge = $transaction->service_charge;
}
else {
$serviceCharge = $booking->transactions()
->where('type', TransactionType::PAYMENT)
->where('status', ApprovalStatus::COMPLETED)
->get()
->sum(function ($transaction) {
return $transaction->service_charge;
});
}
if ($paymentSumRefund && $displayedSubtotal === 0){
$subtotal = bcsub($paymentSumRefund, $serviceCharge, 5);
$displayedSubtotal = bcsub($paymentSumRefund, $serviceCharge, 2);
}
@endphp
<tr class="subtotal">
<td colspan="4"></td>
@@ -114,20 +130,6 @@
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Service Charges</td>
<?php
if (!$totalPayment) {
$serviceCharge = $transaction->service_charge;
}
else {
$serviceCharge = $booking->transactions()
->where('type', TransactionType::PAYMENT)
->where('status', ApprovalStatus::COMPLETED)
->get()
->sum(function ($transaction) {
return $transaction->service_charge;
});
}
?>
<td class="right">{{ number_format($serviceCharge, 2) }}</td>
</tr>
@if($totalPayment && $refundedServiceCharge)