mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-24 15:04:19 +00:00
debug invoice pdf
This commit is contained in:
@@ -136,21 +136,25 @@
|
||||
@endsection
|
||||
|
||||
@php
|
||||
if (!extension_loaded('bcmath')) {
|
||||
throw new Exception('BCMath extension is not loaded.');
|
||||
}
|
||||
function calculateSubtotal($po_order_transaction, $currencyRate) {
|
||||
$subtotal = 0;
|
||||
$subtotal = "0";
|
||||
foreach ($po_order_transaction->transactionDetails as $transaction_detail) {
|
||||
$unitPrice = $transaction_detail->price / $currencyRate;
|
||||
$itemTotal = $unitPrice * $transaction_detail->quantity;
|
||||
$subtotal += $itemTotal;
|
||||
$unitPrice = bcdiv((string)$transaction_detail->price, (string)$currencyRate, 2);
|
||||
$itemTotal = bcmul($unitPrice, (string)$transaction_detail->quantity, 2);
|
||||
$subtotal = bcadd($subtotal, $itemTotal, 2);
|
||||
}
|
||||
return $subtotal;
|
||||
}
|
||||
|
||||
function getVoucherDiscount($voucher_redemption) {
|
||||
return $voucher_redemption ? $voucher_redemption->value * -1 : 0;
|
||||
return $voucher_redemption ? bcmul((string)$voucher_redemption->value, "-1", 2) : "0";
|
||||
}
|
||||
|
||||
function calculateTotalInvoice($subtotal, $service_charge, $tax, $voucherDiscount) {
|
||||
return $subtotal + $service_charge + $tax + $voucherDiscount;
|
||||
return bcadd(bcadd(bcadd($subtotal, $service_charge, 2), $tax, 2), $voucherDiscount, 2);
|
||||
}
|
||||
|
||||
@endphp
|
||||
|
||||
Reference in New Issue
Block a user