mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-29 01:13:59 +00:00
fix invoice
This commit is contained in:
@@ -18,6 +18,26 @@
|
||||
$currency_id = $transaction->owner->fix_currency_id;
|
||||
@endphp
|
||||
|
||||
<?php
|
||||
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingRefundAmount;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
|
||||
$booking = $po_order_transaction->owner;
|
||||
$paymentSum = $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->where('status', ApprovalStatus::COMPLETED)
|
||||
->get()
|
||||
->sum(function ($transaction) {
|
||||
return round($transaction->amount, 2);
|
||||
});
|
||||
|
||||
$refundedAmount = (App()->make(CalculatesBookingRefundAmount::class))->calculateRefundAmount($booking, $booking->fix_currency_id);
|
||||
|
||||
$totalPayment = $paymentSum - $refundedAmount;
|
||||
?>
|
||||
|
||||
@foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail)
|
||||
@php
|
||||
$exactUnitPrice = ($currency_id) === 1 ? $transaction_detail->price : bcdiv($transaction_detail->price, $transaction->currency_rate, 7);
|
||||
@@ -55,10 +75,9 @@
|
||||
<td class="right">Service Charges</td>
|
||||
<?php
|
||||
$serviceCharge = $transaction->service_charge;
|
||||
if (isset($current_paid_amount)) {
|
||||
$refundedServiceCharge = $subtotal + $serviceCharge - $current_paid_amount;
|
||||
$serviceCharge = $serviceCharge - $refundedServiceCharge - $voucherDiscount;
|
||||
}
|
||||
$current_paid_amount = $totalPayment;
|
||||
$refundedServiceCharge = $subtotal + $serviceCharge - $current_paid_amount;
|
||||
$serviceCharge = $serviceCharge - $refundedServiceCharge - $voucherDiscount;
|
||||
?>
|
||||
<td class="right">{{ number_format($serviceCharge, 2) }}</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user