kcommons 5.22.7 → 5.23.0
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/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/utils/taxes.util.d.ts +2 -0
- package/build/utils/taxes.util.js +19 -0
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export * from "./constants/socket.constants";
|
|
|
45
45
|
export * from "./constants/csvUpload.constants";
|
|
46
46
|
export * from "./classes/asnWrapper.class";
|
|
47
47
|
export * from "./utils/permission.utils";
|
|
48
|
+
export * from "./utils/taxes.util";
|
|
48
49
|
export * from "./templates/notifications/rfq.notifications";
|
|
49
50
|
export * from "./templates/notifications/po.notifications";
|
|
50
51
|
export * from "./templates/notifications/quote.notifications";
|
package/build/index.js
CHANGED
|
@@ -65,6 +65,7 @@ __exportStar(require("./constants/csvUpload.constants"), exports);
|
|
|
65
65
|
__exportStar(require("./classes/asnWrapper.class"), exports);
|
|
66
66
|
// Utils
|
|
67
67
|
__exportStar(require("./utils/permission.utils"), exports);
|
|
68
|
+
__exportStar(require("./utils/taxes.util"), exports);
|
|
68
69
|
// Templates
|
|
69
70
|
__exportStar(require("./templates/notifications/rfq.notifications"), exports);
|
|
70
71
|
__exportStar(require("./templates/notifications/po.notifications"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDiscountedPerUnitRate = getDiscountedPerUnitRate;
|
|
4
|
+
const documentTaxes_typings_1 = require("../typings/documentTaxes.typings");
|
|
5
|
+
function getDiscountedPerUnitRate(item) {
|
|
6
|
+
if (!item.per_unit_rate)
|
|
7
|
+
return item.per_unit_rate;
|
|
8
|
+
if (item.discount_value && item.discount_type) {
|
|
9
|
+
if (item.discount_type === documentTaxes_typings_1.TAX_TYPE.FIXED) {
|
|
10
|
+
return item.per_unit_rate - item.discount_value;
|
|
11
|
+
}
|
|
12
|
+
else if (item.discount_type === documentTaxes_typings_1.TAX_TYPE.PERCENTAGE) {
|
|
13
|
+
return item.per_unit_rate * (1 - item.discount_value / 100);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return item.per_unit_rate;
|
|
18
|
+
}
|
|
19
|
+
}
|