shareneus 1.6.20 → 1.6.22

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.
@@ -63,15 +63,22 @@ const math_operations_1 = require("../shared/math-operations");
63
63
  * // Returns: 3000
64
64
  */
65
65
  function CalculateNetAmt(input) {
66
- const grossAmt = (0, math_operations_1.Multiply)((0, util_1.GetNumber)(input.Qty), (0, util_1.GetNumber)(input.UnitPrice));
67
- let netAmt = grossAmt;
68
- if (input.Disc) {
69
- netAmt = (0, math_operations_1.Subtract)(netAmt, (0, util_1.GetNumber)(input.Disc));
66
+ var _a, _b, _c;
67
+ const line = input;
68
+ if (line.NetAmt != null) {
69
+ return (0, util_1.GetNumber)(line.NetAmt);
70
+ }
71
+ const disc = (0, util_1.GetNumber)(input.Disc);
72
+ const recDisc = (0, util_1.GetNumber)(input.RecDisc);
73
+ if (line.UnAmt != null || line.Amt != null) {
74
+ return (0, math_operations_1.Subtract)((0, util_1.GetNumber)((_a = line.UnAmt) !== null && _a !== void 0 ? _a : line.Amt), disc, recDisc);
70
75
  }
71
- if (input.RecDisc) {
72
- netAmt = (0, math_operations_1.Subtract)(netAmt, (0, util_1.GetNumber)(input.RecDisc));
76
+ const unitPrice = (_c = (_b = line.UnitPrice) !== null && _b !== void 0 ? _b : line.UnPr) !== null && _c !== void 0 ? _c : line.Pr;
77
+ if (unitPrice != null) {
78
+ const qty = input.Qty == null ? 1 : (0, util_1.GetNumber)(input.Qty);
79
+ return (0, math_operations_1.Subtract)((0, math_operations_1.Multiply)(qty, (0, util_1.GetNumber)(unitPrice)), disc, recDisc);
73
80
  }
74
- return netAmt;
81
+ return 0;
75
82
  }
76
83
  // ============================================================
77
84
  // Core Tax Calculation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.20",
3
+ "version": "1.6.22",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",