diff --git a/app/Classes/Modules/Transactions/Processors/CreateInvoiceTransactionProcessor.php b/app/Classes/Modules/Transactions/Processors/CreateInvoiceTransactionProcessor.php
index 7f105dc8..6aab9afd 100644
--- a/app/Classes/Modules/Transactions/Processors/CreateInvoiceTransactionProcessor.php
+++ b/app/Classes/Modules/Transactions/Processors/CreateInvoiceTransactionProcessor.php
@@ -206,4 +206,28 @@ class CreateInvoiceTransactionProcessor
// CreatePerfexCRMInvoice::dispatch($invoice_transaction, $purchaseOrder, $supplier);
// }
}
+
+ public 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;
+ }
+
+ public function getVoucherDiscount($voucher_redemption) {
+ return $voucher_redemption ? bcmul((string)$voucher_redemption->value, "-1", 2) : "0";
+ }
+
+ public function roundUp($number, $decimals)
+ {
+ $factor = pow(10, $decimals);
+ if ($number > 0) {
+ return ceil($number * $factor) / $factor;
+ } else {
+ return floor($number * $factor) / $factor;
+ }
+ }
}
diff --git a/resources/views/pages/pdfs/deliver_order.blade.php b/resources/views/pages/pdfs/deliver_order.blade.php
index b58fd066..e1676631 100644
--- a/resources/views/pages/pdfs/deliver_order.blade.php
+++ b/resources/views/pages/pdfs/deliver_order.blade.php
@@ -167,28 +167,5 @@
- @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
diff --git a/resources/views/pages/pdfs/invoice.blade.php b/resources/views/pages/pdfs/invoice.blade.php
index 066fb971..57868e15 100644
--- a/resources/views/pages/pdfs/invoice.blade.php
+++ b/resources/views/pages/pdfs/invoice.blade.php
@@ -160,28 +160,4 @@
Account Name: CIEF Worldwide Sdn Bhd
Account No: 564892103405
- @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
diff --git a/resources/views/pages/pdfs/purchase_order.blade.php b/resources/views/pages/pdfs/purchase_order.blade.php
index 220b0ae5..93d736a6 100644
--- a/resources/views/pages/pdfs/purchase_order.blade.php
+++ b/resources/views/pages/pdfs/purchase_order.blade.php
@@ -175,28 +175,4 @@
- @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