mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
fix Proforma Invoice
This commit is contained in:
@@ -34,21 +34,25 @@
|
||||
return round($transaction->amount, 2);
|
||||
});
|
||||
|
||||
$average_currency_rate = $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->where('status', ApprovalStatus::COMPLETED)
|
||||
->get()
|
||||
->sum(function ($transaction) {
|
||||
return $transaction->currency_rate;
|
||||
}) / $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->where('status', ApprovalStatus::COMPLETED)
|
||||
->count();
|
||||
$totalPayment = 0;
|
||||
$average_currency_rate = $transaction->currency_rate;
|
||||
if ($paymentSum){
|
||||
$average_currency_rate = $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->where('status', ApprovalStatus::COMPLETED)
|
||||
->get()
|
||||
->sum(function ($transaction) {
|
||||
return $transaction->currency_rate;
|
||||
}) / $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->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 - $refundedAmount - $refundedServiceCharge;
|
||||
}
|
||||
?>
|
||||
|
||||
@foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail)
|
||||
@@ -87,13 +91,18 @@
|
||||
<td colspan="4"></td>
|
||||
<td class="right">Service Charges</td>
|
||||
<?php
|
||||
$serviceCharge = $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->where('status', ApprovalStatus::COMPLETED)
|
||||
->get()
|
||||
->sum(function ($transaction) {
|
||||
return $transaction->service_charge;
|
||||
});
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user