@qrwise/pos-calculations 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -83,7 +83,7 @@ function calculateTotals(input) {
83
83
  let vat = format2(vatNet * 0.12);
84
84
  const isSpecial = discountRate > 0;
85
85
  const isAddVat = isAddVatAfterDiscount(input.discountType);
86
- const discounted = format2(discountRate / 100 * -vatNet);
86
+ const discounted = format2(discountRate * -vatNet);
87
87
  if (isSpecial) {
88
88
  vatNet = format2(vatNet + discounted);
89
89
  if (!isAddVat) {
@@ -122,7 +122,7 @@ function calculateTotals(input) {
122
122
  vat,
123
123
  serviceCharge,
124
124
  togoCharge,
125
- totalAmount,
125
+ totalAmount: format2(totalAmount),
126
126
  bir: {
127
127
  vatSales: vat > 0 ? vatNet + Math.abs(discounted) : 0,
128
128
  vatExemptSales: vat > 0 ? 0 : vatNet + Math.abs(discounted),
@@ -133,7 +133,7 @@ function calculateTotals(input) {
133
133
  discount: discounted,
134
134
  serviceCharge,
135
135
  togoCharge,
136
- amountPayable: totalAmount
136
+ amountPayable: format2(totalAmount)
137
137
  }
138
138
  };
139
139
  }
package/dist/index.js CHANGED
@@ -51,7 +51,7 @@ function calculateTotals(input) {
51
51
  let vat = format2(vatNet * 0.12);
52
52
  const isSpecial = discountRate > 0;
53
53
  const isAddVat = isAddVatAfterDiscount(input.discountType);
54
- const discounted = format2(discountRate / 100 * -vatNet);
54
+ const discounted = format2(discountRate * -vatNet);
55
55
  if (isSpecial) {
56
56
  vatNet = format2(vatNet + discounted);
57
57
  if (!isAddVat) {
@@ -90,7 +90,7 @@ function calculateTotals(input) {
90
90
  vat,
91
91
  serviceCharge,
92
92
  togoCharge,
93
- totalAmount,
93
+ totalAmount: format2(totalAmount),
94
94
  bir: {
95
95
  vatSales: vat > 0 ? vatNet + Math.abs(discounted) : 0,
96
96
  vatExemptSales: vat > 0 ? 0 : vatNet + Math.abs(discounted),
@@ -101,7 +101,7 @@ function calculateTotals(input) {
101
101
  discount: discounted,
102
102
  serviceCharge,
103
103
  togoCharge,
104
- amountPayable: totalAmount
104
+ amountPayable: format2(totalAmount)
105
105
  }
106
106
  };
107
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrwise/pos-calculations",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "Shared POS calculations for QR Wise POS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",