@win2win/shared 1.0.285 → 1.0.286
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.
|
@@ -3,6 +3,7 @@ interface PartialPedidoProducto {
|
|
|
3
3
|
DESCUENTO: number;
|
|
4
4
|
RECARGO_EQUIVALENCIA: number;
|
|
5
5
|
IVA: number;
|
|
6
|
+
CANTIDAD: number;
|
|
6
7
|
}
|
|
7
8
|
export declare class OrderPrice {
|
|
8
9
|
private products;
|
|
@@ -13,6 +14,14 @@ export declare class OrderPrice {
|
|
|
13
14
|
getIVAPrice(): number;
|
|
14
15
|
getREPrice(): number;
|
|
15
16
|
getTotalPrice(): number;
|
|
17
|
+
getTotalAmounts(): {
|
|
18
|
+
IMP_BRUTO_PED: number;
|
|
19
|
+
IMP_DESC_PED: number;
|
|
20
|
+
IMP_NETO_PED: number;
|
|
21
|
+
IMP_IVA_PED: number;
|
|
22
|
+
IMP_RE_PED: number;
|
|
23
|
+
IMP_TOTAL_PED: number;
|
|
24
|
+
};
|
|
16
25
|
getDiscountPercent(): number;
|
|
17
26
|
getIVAPercent(): number;
|
|
18
27
|
getREPercent(): number;
|
|
@@ -7,23 +7,33 @@ class OrderPrice {
|
|
|
7
7
|
}
|
|
8
8
|
// ==== PRICES AMOUNTS ====
|
|
9
9
|
getPrice() {
|
|
10
|
-
return this.roundToDecimals(this.products.reduce((acc, product) => acc + product.PRECIO, 0));
|
|
10
|
+
return this.roundToDecimals(this.products.reduce((acc, product) => acc + product.PRECIO * product.CANTIDAD, 0));
|
|
11
11
|
}
|
|
12
12
|
getDiscountPrice() {
|
|
13
|
-
return this.roundToDecimals(this.products.reduce((acc, product) => acc + product.DESCUENTO, 0));
|
|
13
|
+
return this.roundToDecimals(this.products.reduce((acc, product) => acc + product.DESCUENTO * product.CANTIDAD, 0));
|
|
14
14
|
}
|
|
15
15
|
getNetPrice() {
|
|
16
16
|
return this.roundToDecimals(this.getPrice() - this.getDiscountPrice());
|
|
17
17
|
}
|
|
18
18
|
getIVAPrice() {
|
|
19
|
-
return this.roundToDecimals(this.products.reduce((acc, product) => acc + product.IVA, 0));
|
|
19
|
+
return this.roundToDecimals(this.products.reduce((acc, product) => acc + product.IVA * product.CANTIDAD, 0));
|
|
20
20
|
}
|
|
21
21
|
getREPrice() {
|
|
22
|
-
return this.roundToDecimals(this.products.reduce((acc, product) => acc + product.RECARGO_EQUIVALENCIA, 0));
|
|
22
|
+
return this.roundToDecimals(this.products.reduce((acc, product) => acc + product.RECARGO_EQUIVALENCIA * product.CANTIDAD, 0));
|
|
23
23
|
}
|
|
24
24
|
getTotalPrice() {
|
|
25
25
|
return this.roundToDecimals(this.getNetPrice() + this.getIVAPrice() + this.getREPrice());
|
|
26
26
|
}
|
|
27
|
+
getTotalAmounts() {
|
|
28
|
+
return {
|
|
29
|
+
IMP_BRUTO_PED: this.getPrice(),
|
|
30
|
+
IMP_DESC_PED: this.getDiscountPrice(),
|
|
31
|
+
IMP_NETO_PED: this.getNetPrice(),
|
|
32
|
+
IMP_IVA_PED: this.getIVAPrice(),
|
|
33
|
+
IMP_RE_PED: this.getREPrice(),
|
|
34
|
+
IMP_TOTAL_PED: this.getTotalPrice(),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
27
37
|
// ==== PERCENTAGES ====
|
|
28
38
|
getDiscountPercent() {
|
|
29
39
|
const price = this.getPrice();
|
package/dist/helpers/index.d.ts
CHANGED
package/dist/helpers/index.js
CHANGED
package/package.json
CHANGED