shareneus 1.6.21 → 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.
- package/dist/tax/tax-calculator.js +14 -11
- package/package.json +1 -1
|
@@ -63,15 +63,22 @@ const math_operations_1 = require("../shared/math-operations");
|
|
|
63
63
|
* // Returns: 3000
|
|
64
64
|
*/
|
|
65
65
|
function CalculateNetAmt(input) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (
|
|
69
|
-
|
|
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
|
-
|
|
72
|
-
|
|
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
|
|
81
|
+
return 0;
|
|
75
82
|
}
|
|
76
83
|
// ============================================================
|
|
77
84
|
// Core Tax Calculation
|
|
@@ -369,9 +376,7 @@ function SumTaxComponents(taxes) {
|
|
|
369
376
|
* // }
|
|
370
377
|
*/
|
|
371
378
|
function ComputeTaxSummary(input) {
|
|
372
|
-
console.log("ComputeTaxSummary input:", input);
|
|
373
379
|
const { Lines, RegimeCode, Rounding } = input;
|
|
374
|
-
console.log(Lines, RegimeCode, Rounding);
|
|
375
380
|
// Group by Code+Rate (more granular than Code-only for rate-wise reporting)
|
|
376
381
|
const groupMap = new Map();
|
|
377
382
|
let totalTaxable = 0;
|
|
@@ -476,9 +481,7 @@ function ComputeTaxSummary(input) {
|
|
|
476
481
|
* // }
|
|
477
482
|
*/
|
|
478
483
|
function ComputeDocumentTotals(input) {
|
|
479
|
-
console.log("ComputeDocumentTotals input:", input);
|
|
480
484
|
const { Lines, Rounding, RegimeCode } = input;
|
|
481
|
-
console.log(Lines, Rounding, RegimeCode);
|
|
482
485
|
// 1. SubTotal = sum of line NetAmts (computed from Qty × UnitPrice - Disc - RecDisc)
|
|
483
486
|
let subTotal = 0;
|
|
484
487
|
for (const line of Lines) {
|