mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-22 14:04:01 +00:00
revert fix invoice bugs
This commit is contained in:
@@ -73,22 +73,17 @@
|
||||
<tbody>
|
||||
@php
|
||||
$subtotal = "0";
|
||||
$voucherDiscount = $voucher_redemption ? bcmul((string)$voucher_redemption->value, "-1", 5) : "0";
|
||||
$displayedSubtotal = "0";
|
||||
$exactTotal = "0";
|
||||
$voucherDiscount = $voucher_redemption ? bcmul((string)$voucher_redemption->value, "-1", 2) : "0";
|
||||
$displayedSubtotal = 0;
|
||||
@endphp
|
||||
|
||||
@foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail)
|
||||
@php
|
||||
$exactUnitPrice = bcdiv($transaction_detail->price, $transaction->currency_rate, 5);
|
||||
$exactUnitPrice = bcdiv($transaction_detail->price, $transaction->currency_rate, 7);
|
||||
$itemTotal = bcmul($exactUnitPrice, $transaction_detail->quantity, 5);
|
||||
|
||||
// Round half to even for displayed item total
|
||||
$displayedItemTotal = round(bcmul($exactUnitPrice, $transaction_detail->quantity, 2), 2, PHP_ROUND_HALF_EVEN);
|
||||
|
||||
$displayedItemTotal = bcmul($exactUnitPrice, $transaction_detail->quantity, 2);
|
||||
$displayedSubtotal = bcadd($displayedSubtotal, $displayedItemTotal, 2);
|
||||
$subtotal = bcadd($subtotal, $itemTotal, 5);
|
||||
$exactTotal = bcadd($exactTotal, $displayedItemTotal, 5);
|
||||
@endphp
|
||||
<tr>
|
||||
<td width="5%" class="center top">{{ $key + 1 }}</td>
|
||||
@@ -135,17 +130,10 @@
|
||||
</tr>
|
||||
@endif
|
||||
@php
|
||||
// Calculate the totals with 5 decimal places
|
||||
$displayedTotal = bcadd(bcadd(bcadd($subtotal, $transaction->service_charge, 5), $transaction->tax, 5), $voucherDiscount, 5);
|
||||
$expectedTotal = bcadd(bcadd(bcadd($subtotal, $transaction->service_charge, 5), $transaction->tax, 5), $voucherDiscount, 5);
|
||||
|
||||
// Calculate the displayed totals with 2 decimal places
|
||||
$displayedTotal = bcadd(bcadd(bcadd($displayedSubtotal, $transaction->service_charge, 2), $transaction->tax, 2), $voucherDiscount, 2);
|
||||
|
||||
// Calculate the discrepancy
|
||||
$discrepancy = bcsub($expectedTotal, $displayedTotal, 5);
|
||||
|
||||
// Calculate the final total
|
||||
$total = bcadd($expectedTotal, $discrepancy, 5);
|
||||
$discrepancy = bcsub($displayedTotal, $expectedTotal, 5);
|
||||
$total = bcadd(bcadd(bcadd($subtotal, $transaction->service_charge, 5), $transaction->tax, 5), $voucherDiscount, 5);
|
||||
@endphp
|
||||
<tr>
|
||||
<td colspan="4"></td>
|
||||
|
||||
Reference in New Issue
Block a user