shareneus 1.7.313 → 1.7.314
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.
|
@@ -53,14 +53,14 @@ const math_operations_1 = require("../shared/math-operations");
|
|
|
53
53
|
* SubTotal = sum of line values before line/document discounts and before tax.
|
|
54
54
|
*/
|
|
55
55
|
function CalculateGrossAmt(input) {
|
|
56
|
-
var _a, _b, _c;
|
|
56
|
+
var _a, _b, _c, _d;
|
|
57
57
|
const line = input;
|
|
58
58
|
if (line.UnAmt != null || line.Amt != null) {
|
|
59
59
|
return (0, util_1.GetNumber)((_a = line.UnAmt) !== null && _a !== void 0 ? _a : line.Amt);
|
|
60
60
|
}
|
|
61
|
-
const unitPrice = (_c = (_b = line.UnitPrice) !== null && _b !== void 0 ? _b : line.UnPr) !== null && _c !== void 0 ? _c : line.Pr;
|
|
61
|
+
const unitPrice = (_d = (_c = (_b = line.UnitPrice) !== null && _b !== void 0 ? _b : line.UnPr) !== null && _c !== void 0 ? _c : line.Pr) !== null && _d !== void 0 ? _d : line.UnCo;
|
|
62
62
|
if (unitPrice != null) {
|
|
63
|
-
const qty = input.Qty == null ? 1 : (0, util_1.GetNumber)(input.Qty);
|
|
63
|
+
const qty = (input.Qty == null || input.Qty == 0) ? 1 : (0, util_1.GetNumber)(input.Qty);
|
|
64
64
|
return (0, math_operations_1.Multiply)(qty, (0, util_1.GetNumber)(unitPrice));
|
|
65
65
|
}
|
|
66
66
|
return 0;
|
package/package.json
CHANGED
|
@@ -61,6 +61,7 @@ export function CalculateGrossAmt(input: ILineAmountFields): number {
|
|
|
61
61
|
Amt?: number;
|
|
62
62
|
UnPr?: number;
|
|
63
63
|
Pr?: number;
|
|
64
|
+
UnCo?: number;
|
|
64
65
|
UnitPrice?: number;
|
|
65
66
|
};
|
|
66
67
|
|
|
@@ -68,9 +69,9 @@ export function CalculateGrossAmt(input: ILineAmountFields): number {
|
|
|
68
69
|
return GetNumber(line.UnAmt ?? line.Amt);
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
const unitPrice = line.UnitPrice ?? line.UnPr ?? line.Pr;
|
|
72
|
+
const unitPrice = line.UnitPrice ?? line.UnPr ?? line.Pr ?? line.UnCo;
|
|
72
73
|
if (unitPrice != null) {
|
|
73
|
-
const qty = input.Qty == null ? 1 : GetNumber(input.Qty);
|
|
74
|
+
const qty = (input.Qty == null || input.Qty == 0) ? 1 : GetNumber(input.Qty);
|
|
74
75
|
return Multiply(qty, GetNumber(unitPrice));
|
|
75
76
|
}
|
|
76
77
|
|