debug invoice pdf

This commit is contained in:
Omair Saleh
2023-08-10 17:03:21 +08:00
parent 5528811cc1
commit d6ce774770
2 changed files with 47 additions and 0 deletions
@@ -167,5 +167,28 @@
</tr>
</table>
</htmlpagefooter>
@php
function calculateSubtotal($po_order_transaction, $currencyRate) {
$subtotal = "0";
foreach ($po_order_transaction->transactionDetails as $transaction_detail) {
$unitPrice = bcdiv((string)$transaction_detail->price, (string)$currencyRate, 5);
$itemTotal = bcmul($unitPrice, (string)$transaction_detail->quantity, 5);
$subtotal = bcadd($subtotal, $itemTotal, 5);
}
return $subtotal;
}
function getVoucherDiscount($voucher_redemption) {
return $voucher_redemption ? bcmul((string)$voucher_redemption->value, "-1", 2) : "0";
}
function roundUp($number, $decimals) {
$factor = pow(10, $decimals);
if ($number > 0) {
return ceil($number * $factor) / $factor;
} else {
return floor($number * $factor) / $factor;
}
}
@endphp
@endsection
@@ -175,4 +175,28 @@
</tr>
</table>
</htmlpagefooter>
@php
function calculateSubtotal($po_order_transaction, $currencyRate) {
$subtotal = "0";
foreach ($po_order_transaction->transactionDetails as $transaction_detail) {
$unitPrice = bcdiv((string)$transaction_detail->price, (string)$currencyRate, 5);
$itemTotal = bcmul($unitPrice, (string)$transaction_detail->quantity, 5);
$subtotal = bcadd($subtotal, $itemTotal, 5);
}
return $subtotal;
}
function getVoucherDiscount($voucher_redemption) {
return $voucher_redemption ? bcmul((string)$voucher_redemption->value, "-1", 2) : "0";
}
function roundUp($number, $decimals) {
$factor = pow(10, $decimals);
if ($number > 0) {
return ceil($number * $factor) / $factor;
} else {
return floor($number * $factor) / $factor;
}
}
@endphp
@endsection