asv-hlps-market 1.0.0 → 1.0.2
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/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +17 -0
- package/lib/cjs/models/Market.d.ts +8 -0
- package/lib/cjs/models/UMarket.d.ts +11 -0
- package/lib/cjs/models/index.d.ts +2 -0
- package/lib/cjs/models/index.js +18 -0
- package/lib/cjs/products/hlpProduct.d.ts +13 -0
- package/lib/cjs/products/hlpProduct.js +49 -0
- package/lib/cjs/products/index.d.ts +2 -0
- package/lib/cjs/products/index.js +23 -0
- package/lib/cjs/products/models/Product.d.ts +39 -0
- package/lib/cjs/products/models/ProductAsset.d.ts +8 -0
- package/lib/cjs/products/models/ProductCat.d.ts +3 -0
- package/lib/cjs/products/models/ProductCollection.d.ts +3 -0
- package/lib/cjs/products/models/ProductDepot.d.ts +11 -0
- package/lib/cjs/products/models/ProductElt.d.ts +3 -0
- package/lib/cjs/products/models/ProductGrp.d.ts +3 -0
- package/lib/cjs/products/models/ProductImage.d.ts +5 -0
- package/lib/cjs/products/models/ProductIn.d.ts +42 -0
- package/lib/cjs/products/models/ProductState.d.ts +3 -0
- package/lib/cjs/products/models/ProductStock.d.ts +6 -0
- package/lib/cjs/products/models/ProductTag.d.ts +3 -0
- package/lib/cjs/products/models/ProductVariant.d.ts +6 -0
- package/lib/cjs/products/models/index.d.ts +13 -0
- package/lib/cjs/products/models/index.js +29 -0
- package/lib/cjs/sales/index.d.ts +1 -0
- package/lib/cjs/sales/index.js +17 -0
- package/lib/cjs/sales/models/Sale.d.ts +8 -0
- package/lib/cjs/sales/models/Sale.js +2 -0
- package/lib/cjs/sales/models/SalePayment.d.ts +21 -0
- package/lib/cjs/sales/models/SalePayment.js +2 -0
- package/lib/cjs/sales/models/SaleProduct.d.ts +8 -0
- package/lib/cjs/sales/models/SaleProduct.js +2 -0
- package/lib/cjs/sales/models/index.d.ts +3 -0
- package/lib/cjs/sales/models/index.js +19 -0
- package/lib/cjs/shops/index.d.ts +1 -0
- package/lib/cjs/shops/index.js +17 -0
- package/lib/cjs/shops/models/Shop.d.ts +13 -0
- package/lib/cjs/shops/models/Shop.js +2 -0
- package/lib/cjs/users/models/User.d.ts +7 -0
- package/lib/cjs/users/models/User.js +2 -0
- package/lib/esm/index.d.ts +2 -0
- package/lib/esm/index.js +2 -1
- package/lib/esm/models/Market.d.ts +8 -0
- package/lib/esm/models/UMarket.d.ts +11 -0
- package/lib/esm/models/index.d.ts +2 -0
- package/lib/esm/models/index.js +2 -0
- package/lib/esm/products/hlpProduct.d.ts +13 -0
- package/lib/esm/products/hlpProduct.js +47 -0
- package/lib/esm/products/index.d.ts +2 -0
- package/lib/esm/products/index.js +2 -0
- package/lib/esm/products/models/Product.d.ts +39 -0
- package/lib/esm/products/models/ProductAsset.d.ts +8 -0
- package/lib/esm/products/models/ProductCat.d.ts +3 -0
- package/lib/esm/products/models/ProductCollection.d.ts +3 -0
- package/lib/esm/products/models/ProductDepot.d.ts +11 -0
- package/lib/esm/products/models/ProductElt.d.ts +3 -0
- package/lib/esm/products/models/ProductGrp.d.ts +3 -0
- package/lib/esm/products/models/ProductImage.d.ts +5 -0
- package/lib/esm/products/models/ProductIn.d.ts +42 -0
- package/lib/esm/products/models/ProductState.d.ts +3 -0
- package/lib/esm/products/models/ProductStock.d.ts +6 -0
- package/lib/esm/products/models/ProductTag.d.ts +3 -0
- package/lib/esm/products/models/ProductVariant.d.ts +6 -0
- package/lib/esm/products/models/index.d.ts +13 -0
- package/lib/esm/products/models/index.js +13 -0
- package/lib/esm/sales/index.d.ts +1 -0
- package/lib/esm/sales/index.js +1 -0
- package/lib/esm/sales/models/Sale.d.ts +8 -0
- package/lib/esm/sales/models/Sale.js +1 -0
- package/lib/esm/sales/models/SalePayment.d.ts +21 -0
- package/lib/esm/sales/models/SalePayment.js +1 -0
- package/lib/esm/sales/models/SaleProduct.d.ts +8 -0
- package/lib/esm/sales/models/SaleProduct.js +1 -0
- package/lib/esm/sales/models/index.d.ts +3 -0
- package/lib/esm/sales/models/index.js +3 -0
- package/lib/esm/shops/index.d.ts +1 -0
- package/lib/esm/shops/index.js +1 -0
- package/lib/esm/shops/models/Shop.d.ts +13 -0
- package/lib/esm/shops/models/Shop.js +1 -0
- package/lib/esm/users/models/User.d.ts +7 -0
- package/lib/esm/users/models/User.js +1 -0
- package/package.json +2 -2
- package/lib/cjs/bills/bill.d.ts +0 -19
- package/lib/cjs/bills/bill.js +0 -79
- package/lib/cjs/bills/models/Bill.d.ts +0 -21
- package/lib/cjs/models/Gender.d.ts +0 -6
- package/lib/cjs/models/Sale.d.ts +0 -34
- package/lib/cjs/models/SaleProduct.d.ts +0 -18
- package/lib/cjs/models/SaleProduct.js +0 -6
- package/lib/cjs/models/Ste.d.ts +0 -8
- package/lib/cjs/models/SteGrp.d.ts +0 -7
- package/lib/cjs/models/Titr.d.ts +0 -5
- package/lib/cjs/models/User.d.ts +0 -38
- package/lib/cjs/models/UserGrp.d.ts +0 -4
- package/lib/cjs/models/UserRole.d.ts +0 -5
- package/lib/cjs/models/shared/NaAc.d.ts +0 -6
- package/lib/cjs/models/shared/NaCoAc.d.ts +0 -4
- package/lib/cjs/models/shared/NaCoShortAc.d.ts +0 -4
- package/lib/cjs/pdfs/invoices/amountInvoice.d.ts +0 -66
- package/lib/cjs/pdfs/invoices/amountInvoice.js +0 -144
- package/lib/cjs/pdfs/invoices/infoInvoice.d.ts +0 -32
- package/lib/cjs/pdfs/invoices/infoInvoice.js +0 -80
- package/lib/cjs/pdfs/tools/tools.d.ts +0 -34
- package/lib/cjs/pdfs/tools/tools.js +0 -53
- package/lib/cjs/products/interfaces/Product.d.ts +0 -53
- package/lib/cjs/products/interfaces/ProductCat.d.ts +0 -6
- package/lib/cjs/products/interfaces/ProductStore.d.ts +0 -24
- package/lib/cjs/products/product.d.ts +0 -3
- package/lib/cjs/products/product.js +0 -22
- package/lib/cjs/sales/sale.d.ts +0 -18
- package/lib/cjs/sales/sale.js +0 -129
- package/lib/esm/bills/bill.d.ts +0 -19
- package/lib/esm/bills/bill.js +0 -58
- package/lib/esm/bills/models/Bill.d.ts +0 -21
- package/lib/esm/models/Gender.d.ts +0 -6
- package/lib/esm/models/Sale.d.ts +0 -34
- package/lib/esm/models/SaleProduct.d.ts +0 -18
- package/lib/esm/models/SaleProduct.js +0 -2
- package/lib/esm/models/Ste.d.ts +0 -8
- package/lib/esm/models/SteGrp.d.ts +0 -7
- package/lib/esm/models/Titr.d.ts +0 -5
- package/lib/esm/models/User.d.ts +0 -38
- package/lib/esm/models/UserGrp.d.ts +0 -4
- package/lib/esm/models/UserRole.d.ts +0 -5
- package/lib/esm/models/shared/NaAc.d.ts +0 -6
- package/lib/esm/models/shared/NaCoAc.d.ts +0 -4
- package/lib/esm/models/shared/NaCoShortAc.d.ts +0 -4
- package/lib/esm/pdfs/invoices/amountInvoice.d.ts +0 -66
- package/lib/esm/pdfs/invoices/amountInvoice.js +0 -137
- package/lib/esm/pdfs/invoices/infoInvoice.d.ts +0 -26
- package/lib/esm/pdfs/invoices/infoInvoice.js +0 -75
- package/lib/esm/pdfs/tools/tools.d.ts +0 -34
- package/lib/esm/pdfs/tools/tools.js +0 -47
- package/lib/esm/products/interfaces/Product.d.ts +0 -53
- package/lib/esm/products/interfaces/ProductCat.d.ts +0 -6
- package/lib/esm/products/interfaces/ProductStore.d.ts +0 -24
- package/lib/esm/products/product.d.ts +0 -3
- package/lib/esm/products/product.js +0 -17
- package/lib/esm/sales/sale.d.ts +0 -19
- package/lib/esm/sales/sale.js +0 -112
- /package/lib/cjs/{bills/models/Bill.js → models/Market.js} +0 -0
- /package/lib/cjs/models/{Gender.js → UMarket.js} +0 -0
- /package/lib/cjs/products/{interfaces → models}/Product.js +0 -0
- /package/lib/cjs/{models/Sale.js → products/models/ProductAsset.js} +0 -0
- /package/lib/cjs/products/{interfaces → models}/ProductCat.js +0 -0
- /package/lib/cjs/{models/Ste.js → products/models/ProductCollection.js} +0 -0
- /package/lib/cjs/{models/SteGrp.js → products/models/ProductDepot.js} +0 -0
- /package/lib/cjs/{models/Titr.js → products/models/ProductElt.js} +0 -0
- /package/lib/cjs/{models/User.js → products/models/ProductGrp.js} +0 -0
- /package/lib/cjs/{models/UserGrp.js → products/models/ProductImage.js} +0 -0
- /package/lib/cjs/{models/UserRole.js → products/models/ProductIn.js} +0 -0
- /package/lib/cjs/{models/shared/NaAc.js → products/models/ProductState.js} +0 -0
- /package/lib/cjs/{models/shared/NaCoAc.js → products/models/ProductStock.js} +0 -0
- /package/lib/cjs/{models/shared/NaCoShortAc.js → products/models/ProductTag.js} +0 -0
- /package/lib/cjs/products/{interfaces/ProductStore.js → models/ProductVariant.js} +0 -0
- /package/lib/esm/{bills/models/Bill.js → models/Market.js} +0 -0
- /package/lib/esm/models/{Gender.js → UMarket.js} +0 -0
- /package/lib/esm/products/{interfaces → models}/Product.js +0 -0
- /package/lib/esm/{models/Sale.js → products/models/ProductAsset.js} +0 -0
- /package/lib/esm/products/{interfaces → models}/ProductCat.js +0 -0
- /package/lib/esm/{models/Ste.js → products/models/ProductCollection.js} +0 -0
- /package/lib/esm/{models/SteGrp.js → products/models/ProductDepot.js} +0 -0
- /package/lib/esm/{models/Titr.js → products/models/ProductElt.js} +0 -0
- /package/lib/esm/{models/User.js → products/models/ProductGrp.js} +0 -0
- /package/lib/esm/{models/UserGrp.js → products/models/ProductImage.js} +0 -0
- /package/lib/esm/{models/UserRole.js → products/models/ProductIn.js} +0 -0
- /package/lib/esm/{models/shared/NaAc.js → products/models/ProductState.js} +0 -0
- /package/lib/esm/{models/shared/NaCoAc.js → products/models/ProductStock.js} +0 -0
- /package/lib/esm/{models/shared/NaCoShortAc.js → products/models/ProductTag.js} +0 -0
- /package/lib/esm/products/{interfaces/ProductStore.js → models/ProductVariant.js} +0 -0
package/lib/cjs/sales/sale.js
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.tabLabel = exports.getTotalQtityOdrOrDlvrOnSale = exports.getTotalQtityFreeOnSale = exports.getTotalQtityOnSale = exports.getTotalAmountDiscountOnSale = exports.getTotalShippingOnSale = exports.getTotalAmountAllIncludedOnSale = exports.getTotalAmountBackOnSale = exports.getTotalAmountOnSale = exports.getTotalTvaBackOnSale = exports.getTotalTvaOnSaleOnSale = exports.getTotalAmountWithoutTvaBackOnSale = exports.getTotalAmountWithoutTvaOnSale = exports.getSubTotalAmountBackOnSale = exports.getSubTotalAmountOnSale = exports.getTotalTvaOnSale = exports.getNbProductsOnSale = void 0;
|
4
|
-
const asv_hlps_1 = require("asv-hlps");
|
5
|
-
const product_1 = require("../products/product");
|
6
|
-
const getNbProductsOnSale = (sale) => {
|
7
|
-
return sale.saleProducts.length || 0;
|
8
|
-
};
|
9
|
-
exports.getNbProductsOnSale = getNbProductsOnSale;
|
10
|
-
const getTotalTvaOnSale = (sale, dlvr = false) => {
|
11
|
-
return sale.saleProducts.reduce((prev, curr) => {
|
12
|
-
console.log('------ cuurr ------');
|
13
|
-
console.log(curr);
|
14
|
-
console.log('------ cuurr ------');
|
15
|
-
const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : (0, product_1.unitPriceByClientCat)(curr.product, sale.client, curr.speUnitPrice);
|
16
|
-
return !dlvr
|
17
|
-
? Math.ceil(prev + unitPrice * (+curr.product.tva / 100) * +curr.qtityOdr)
|
18
|
-
: Math.ceil(prev + unitPrice * (+curr.product.tva / 100) * +curr.qtityDlvr);
|
19
|
-
}, 0);
|
20
|
-
};
|
21
|
-
exports.getTotalTvaOnSale = getTotalTvaOnSale;
|
22
|
-
const getSubTotalAmountOnSale = (sale, dlvr = false) => {
|
23
|
-
return sale.saleProducts.reduce((prev, curr) => {
|
24
|
-
const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : (0, product_1.unitPriceByClientCat)(curr.product, sale.client, curr.speUnitPrice);
|
25
|
-
return !dlvr ? Math.ceil(prev + unitPrice * +curr.qtityOdr) : Math.ceil(prev + unitPrice * +curr.qtityDlvr);
|
26
|
-
}, 0);
|
27
|
-
};
|
28
|
-
exports.getSubTotalAmountOnSale = getSubTotalAmountOnSale;
|
29
|
-
const getSubTotalAmountBackOnSale = (sale) => {
|
30
|
-
return sale.saleProducts.reduce((prev, curr) => {
|
31
|
-
const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : (0, product_1.unitPriceByClientCat)(curr.product, sale.client, curr.speUnitPrice);
|
32
|
-
return Math.ceil(prev + unitPrice * +curr.qtityBack);
|
33
|
-
}, 0);
|
34
|
-
};
|
35
|
-
exports.getSubTotalAmountBackOnSale = getSubTotalAmountBackOnSale;
|
36
|
-
const getTotalAmountWithoutTvaOnSale = (sale, dlvr = false) => {
|
37
|
-
return sale.saleProducts.reduce((prev, curr) => {
|
38
|
-
const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : (0, product_1.unitPriceByClientCat)(curr.product, sale.client, curr.speUnitPrice);
|
39
|
-
return !dlvr ? Math.ceil(prev + unitPrice * +curr.qtityOdr) : Math.ceil(prev + unitPrice * +curr.qtityDlvr);
|
40
|
-
}, 0);
|
41
|
-
};
|
42
|
-
exports.getTotalAmountWithoutTvaOnSale = getTotalAmountWithoutTvaOnSale;
|
43
|
-
const getTotalAmountWithoutTvaBackOnSale = (sale) => {
|
44
|
-
return sale.saleProducts.reduce((prev, curr) => {
|
45
|
-
const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : (0, product_1.unitPriceByClientCat)(curr.product, sale.client, curr.speUnitPrice);
|
46
|
-
return Math.ceil(prev + unitPrice * +curr.qtityBack);
|
47
|
-
}, 0);
|
48
|
-
};
|
49
|
-
exports.getTotalAmountWithoutTvaBackOnSale = getTotalAmountWithoutTvaBackOnSale;
|
50
|
-
const getTotalTvaOnSaleOnSale = (sale, dlvr = false) => {
|
51
|
-
return sale.saleProducts.reduce((prev, curr) => {
|
52
|
-
const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : (0, product_1.unitPriceByClientCat)(curr.product, sale.client, curr.speUnitPrice);
|
53
|
-
return !dlvr
|
54
|
-
? Math.ceil(prev + unitPrice * (+curr.product.tva / 100) * +curr.qtityOdr)
|
55
|
-
: Math.ceil(prev + unitPrice * (+curr.product.tva / 100) * +curr.qtityDlvr);
|
56
|
-
}, 0);
|
57
|
-
};
|
58
|
-
exports.getTotalTvaOnSaleOnSale = getTotalTvaOnSaleOnSale;
|
59
|
-
const getTotalTvaBackOnSale = (sale) => {
|
60
|
-
return sale.saleProducts.reduce((prev, curr) => {
|
61
|
-
const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : (0, product_1.unitPriceByClientCat)(curr.product, sale.client, curr.speUnitPrice);
|
62
|
-
return Math.ceil(prev + unitPrice * (+curr.product.tva / 100) * +curr.qtityBack);
|
63
|
-
}, 0);
|
64
|
-
};
|
65
|
-
exports.getTotalTvaBackOnSale = getTotalTvaBackOnSale;
|
66
|
-
const getTotalAmountOnSale = (sale, dlvr = false) => {
|
67
|
-
return (0, exports.getTotalAmountWithoutTvaOnSale)(sale, dlvr) + (0, exports.getTotalTvaOnSale)(sale, dlvr);
|
68
|
-
};
|
69
|
-
exports.getTotalAmountOnSale = getTotalAmountOnSale;
|
70
|
-
const getTotalAmountBackOnSale = (sale) => {
|
71
|
-
return (0, exports.getTotalAmountWithoutTvaBackOnSale)(sale) + (0, exports.getTotalTvaBackOnSale)(sale);
|
72
|
-
};
|
73
|
-
exports.getTotalAmountBackOnSale = getTotalAmountBackOnSale;
|
74
|
-
const getTotalAmountAllIncludedOnSale = (sale, dlvr = false) => {
|
75
|
-
return (0, exports.getTotalAmountOnSale)(sale, dlvr) + (0, exports.getTotalShippingOnSale)(sale) - (0, exports.getTotalAmountDiscountOnSale)(sale, dlvr) || 0;
|
76
|
-
};
|
77
|
-
exports.getTotalAmountAllIncludedOnSale = getTotalAmountAllIncludedOnSale;
|
78
|
-
// export const getTotalShippingOnSale = (shippingFee: number , otherFee: number = 0) => {
|
79
|
-
const getTotalShippingOnSale = (sale) => {
|
80
|
-
return (+sale.shippingFee || 0) + (+sale.otherFee || 0);
|
81
|
-
};
|
82
|
-
exports.getTotalShippingOnSale = getTotalShippingOnSale;
|
83
|
-
const getTotalAmountDiscountOnSale = (sale, dlvr = false) => {
|
84
|
-
return (0, exports.getTotalAmountOnSale)(sale, dlvr) * (+sale.discountRate / 100 || 0);
|
85
|
-
};
|
86
|
-
exports.getTotalAmountDiscountOnSale = getTotalAmountDiscountOnSale;
|
87
|
-
const getTotalQtityOnSale = (sale, dlvr = false) => {
|
88
|
-
return sale.saleProducts.reduce((prev, curr) => {
|
89
|
-
return !dlvr
|
90
|
-
? Math.ceil(prev + (+curr.qtityOdr + (+curr.qtityFree || 0)))
|
91
|
-
: Math.ceil(prev + (+curr.qtityDlvr + (+curr.qtityFree || 0)));
|
92
|
-
}, 0);
|
93
|
-
};
|
94
|
-
exports.getTotalQtityOnSale = getTotalQtityOnSale;
|
95
|
-
const getTotalQtityFreeOnSale = (sale) => {
|
96
|
-
return sale.saleProducts.reduce((prev, curr) => {
|
97
|
-
return Math.ceil(prev + (+curr.qtityFree || 0));
|
98
|
-
}, 0);
|
99
|
-
};
|
100
|
-
exports.getTotalQtityFreeOnSale = getTotalQtityFreeOnSale;
|
101
|
-
const getTotalQtityOdrOrDlvrOnSale = (sale, dlvr = false) => {
|
102
|
-
return sale.saleProducts.reduce((prev, curr) => {
|
103
|
-
return !dlvr ? Math.ceil(prev + (+curr.qtityOdr || 0)) : Math.ceil(prev + (+curr.qtityDlvr || 0));
|
104
|
-
}, 0);
|
105
|
-
};
|
106
|
-
exports.getTotalQtityOdrOrDlvrOnSale = getTotalQtityOdrOrDlvrOnSale;
|
107
|
-
const tabLabel = (sale) => {
|
108
|
-
const labels = [];
|
109
|
-
for (const sp of sale.saleProducts) {
|
110
|
-
for (let j = 0; j < (+sp.qtityDlvr + +sp.qtityFree); j++) {
|
111
|
-
const name = (0, asv_hlps_1.labelSteName)(sale.client.ste);
|
112
|
-
const product = sp.product.designation;
|
113
|
-
const pp = (0, asv_hlps_1.formatToStringCfa)(Math.ceil(sp.publicPrice));
|
114
|
-
const saleDate = (0, asv_hlps_1.convertEnDateToFr)(sale.saleDate, '/');
|
115
|
-
// const saleDate = formatDateYmd(sale.saleDate, '/');
|
116
|
-
// const saleDate = moment(sale.saleDate ).format('DD/MM/YYYY');
|
117
|
-
labels.push({ name, product, pp, saleDate });
|
118
|
-
}
|
119
|
-
}
|
120
|
-
const tabLen = labels.length;
|
121
|
-
const modulo = tabLen % 5;
|
122
|
-
if (modulo !== 0) {
|
123
|
-
for (let i = 0; i < (5 - +modulo); i++) {
|
124
|
-
labels.push({ name: 'L\' OEIL DE DIEU', product: 'est votre meilleur ami', pp: ' ', saleDate: ' ' });
|
125
|
-
}
|
126
|
-
}
|
127
|
-
return labels;
|
128
|
-
};
|
129
|
-
exports.tabLabel = tabLabel;
|
package/lib/esm/bills/bill.d.ts
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
import { Bill, Sale } from "asv-hlps-models";
|
2
|
-
export declare const getNbProductsOnBill: (sales: Sale[]) => Sale;
|
3
|
-
export declare const getNbPackagesOnBill: (sales: Sale[]) => Sale;
|
4
|
-
export declare const getNbFreezeOnBill: (sales: Sale[]) => Sale;
|
5
|
-
export declare const getTotalTvaOnBill: (sales: Sale[]) => any;
|
6
|
-
export declare const getTotalAmountOnBill: (sales: Sale[]) => Sale;
|
7
|
-
export declare const getTotalAmountBackOnBill: (sales: Sale[]) => Sale;
|
8
|
-
export declare const getTotalTvaBackOnBill: (sales: Sale[]) => Sale;
|
9
|
-
export declare const getTotalQtityOnBill: (sales: Sale[]) => Sale;
|
10
|
-
export declare const getTotalQtityFreeOnBill: (sales: Sale[]) => Sale;
|
11
|
-
export declare const getTotalAmountWithoutTvaOnBill: (sales: Sale[]) => Sale;
|
12
|
-
export declare const getTotalAmountWithoutTvaBackOnBill: (sales: Sale[]) => Sale;
|
13
|
-
export declare const getTotalAmountAllIncludedOnBill: (sales: Sale[]) => Sale;
|
14
|
-
export declare const getTotalAmountTvaOnBill: (sales: Sale[]) => Sale;
|
15
|
-
export declare const getTotalAmountTvaBackOnBill: (sales: Sale[]) => Sale;
|
16
|
-
export declare const getTotalAmountOnListBill: (bills: Bill[]) => Bill;
|
17
|
-
export declare const getTotalAmountTvaOnListBill: (bills: Bill[]) => Bill;
|
18
|
-
export declare const getTotalAmountWithoutTvaOnListBill: (bills: Bill[]) => Bill;
|
19
|
-
export declare const getTotalDueAmountOnListBill: (bills: Bill[]) => Bill;
|
package/lib/esm/bills/bill.js
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
import { getNbProductsOnSale, getTotalAmountAllIncludedOnSale, getTotalAmountBackOnSale, getTotalAmountOnSale, getTotalAmountWithoutTvaBackOnSale, getTotalAmountWithoutTvaOnSale, getTotalQtityFreeOnSale, getTotalQtityOnSale, getTotalTvaBackOnSale, getTotalTvaOnSale } from "../sales/sale";
|
2
|
-
export const getNbProductsOnBill = (sales) => {
|
3
|
-
return sales.reduce((prev, sale) => prev + (+getNbProductsOnSale(sale)), 0);
|
4
|
-
};
|
5
|
-
export const getNbPackagesOnBill = (sales) => {
|
6
|
-
return sales.reduce((prev, sale) => prev + (+sale.nbPackages), 0);
|
7
|
-
};
|
8
|
-
export const getNbFreezeOnBill = (sales) => {
|
9
|
-
return sales.reduce((prev, sale) => prev + (+sale.nbFreeze), 0);
|
10
|
-
};
|
11
|
-
export const getTotalTvaOnBill = (sales) => {
|
12
|
-
if (!sales.length) {
|
13
|
-
return 0;
|
14
|
-
}
|
15
|
-
return sales.reduce((prev, sale) => prev + (getTotalTvaOnSale(sale, true)), 0);
|
16
|
-
};
|
17
|
-
export const getTotalAmountOnBill = (sales) => {
|
18
|
-
return sales.reduce((prev, sale) => prev + (getTotalAmountOnSale(sale, true)), 0);
|
19
|
-
};
|
20
|
-
export const getTotalAmountBackOnBill = (sales) => {
|
21
|
-
return sales.reduce((prev, sale) => prev + (getTotalAmountBackOnSale(sale)), 0);
|
22
|
-
};
|
23
|
-
export const getTotalTvaBackOnBill = (sales) => {
|
24
|
-
return sales.reduce((prev, sale) => prev + (getTotalTvaBackOnSale(sale)), 0);
|
25
|
-
};
|
26
|
-
export const getTotalQtityOnBill = (sales) => {
|
27
|
-
return sales.reduce((prev, sale) => prev + (getTotalQtityOnSale(sale, true)), 0);
|
28
|
-
};
|
29
|
-
export const getTotalQtityFreeOnBill = (sales) => {
|
30
|
-
return sales.reduce((prev, sale) => prev + (getTotalQtityFreeOnSale(sale)), 0);
|
31
|
-
};
|
32
|
-
export const getTotalAmountWithoutTvaOnBill = (sales) => {
|
33
|
-
return sales.reduce((prev, sale) => prev + (+getTotalAmountWithoutTvaOnSale(sale, true)), 0);
|
34
|
-
};
|
35
|
-
export const getTotalAmountWithoutTvaBackOnBill = (sales) => {
|
36
|
-
return sales.reduce((prev, sale) => prev + (+getTotalAmountWithoutTvaBackOnSale(sale)), 0);
|
37
|
-
};
|
38
|
-
export const getTotalAmountAllIncludedOnBill = (sales) => {
|
39
|
-
return sales.reduce((prev, sale) => prev + (+getTotalAmountAllIncludedOnSale(sale, true)), 0);
|
40
|
-
};
|
41
|
-
export const getTotalAmountTvaOnBill = (sales) => {
|
42
|
-
return sales.reduce((prev, sale) => prev + (+getTotalTvaOnSale(sale, true)), 0);
|
43
|
-
};
|
44
|
-
export const getTotalAmountTvaBackOnBill = (sales) => {
|
45
|
-
return sales.reduce((prev, sale) => prev + (+getTotalTvaBackOnSale(sale)), 0);
|
46
|
-
};
|
47
|
-
export const getTotalAmountOnListBill = (bills) => {
|
48
|
-
return bills.reduce((prev, curr) => prev + (+curr.totalAmount), 0);
|
49
|
-
};
|
50
|
-
export const getTotalAmountTvaOnListBill = (bills) => {
|
51
|
-
return bills.reduce((prev, curr) => prev + (+getTotalAmountTvaOnBill(curr.sales)), 0);
|
52
|
-
};
|
53
|
-
export const getTotalAmountWithoutTvaOnListBill = (bills) => {
|
54
|
-
return bills.reduce((prev, curr) => prev + (+getTotalAmountWithoutTvaOnBill(curr.sales)), 0);
|
55
|
-
};
|
56
|
-
export const getTotalDueAmountOnListBill = (bills) => {
|
57
|
-
return bills.reduce((prev, curr) => prev + (+curr.dueAmount), 0);
|
58
|
-
};
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { Sale } from "../../models/Sale";
|
2
|
-
export interface Bill {
|
3
|
-
id?: number;
|
4
|
-
createdAt?: Date;
|
5
|
-
ref?: string;
|
6
|
-
totalAmount?: number;
|
7
|
-
isPaid?: boolean;
|
8
|
-
isPartialPaid?: boolean;
|
9
|
-
paidDate?: Date;
|
10
|
-
dueAmount?: number;
|
11
|
-
escompteAmount?: number;
|
12
|
-
totalAmountAllIncluded?: number;
|
13
|
-
hasTva?: boolean;
|
14
|
-
isBack?: boolean;
|
15
|
-
fromCron?: boolean;
|
16
|
-
nbPrint?: number;
|
17
|
-
type?: 'sale' | 'avoir';
|
18
|
-
store?: string;
|
19
|
-
sales?: Sale[];
|
20
|
-
nbrePayment?: number;
|
21
|
-
}
|
package/lib/esm/models/Sale.d.ts
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
import { SaleProduct } from "./SaleProduct";
|
2
|
-
import { User } from "./User";
|
3
|
-
export interface Sale {
|
4
|
-
id: number;
|
5
|
-
ref?: string;
|
6
|
-
createdAt?: any;
|
7
|
-
saleDate?: any;
|
8
|
-
deliveryDate?: Date;
|
9
|
-
shippingDate?: Date;
|
10
|
-
shippingFee?: number;
|
11
|
-
otherFee?: number;
|
12
|
-
nbPrint?: number;
|
13
|
-
discountRate?: number;
|
14
|
-
status?: number;
|
15
|
-
isValided?: boolean;
|
16
|
-
isProforma?: boolean;
|
17
|
-
proformaToSale?: boolean;
|
18
|
-
hasBack?: boolean;
|
19
|
-
isBack?: boolean;
|
20
|
-
isWaiting?: boolean;
|
21
|
-
waitingToSale?: boolean;
|
22
|
-
backChoice?: string;
|
23
|
-
nbPackages?: number;
|
24
|
-
nbFreeze?: number;
|
25
|
-
isProcessing?: boolean;
|
26
|
-
isProcessed?: boolean;
|
27
|
-
isOnProcessed?: boolean;
|
28
|
-
isDelivering?: boolean;
|
29
|
-
isPicking?: boolean;
|
30
|
-
isDelivered?: boolean;
|
31
|
-
rejectedReason?: string;
|
32
|
-
saleProducts?: SaleProduct[];
|
33
|
-
client?: User;
|
34
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { Product } from '../products/interfaces/Product';
|
2
|
-
export declare class SaleProduct {
|
3
|
-
id: number;
|
4
|
-
qtityFund?: number;
|
5
|
-
qtityOdr?: number;
|
6
|
-
qtityDlvr?: number;
|
7
|
-
qtityFree?: number;
|
8
|
-
qtityBack?: number;
|
9
|
-
publicPrice?: number;
|
10
|
-
unitPrice?: number;
|
11
|
-
speUnitPrice?: number;
|
12
|
-
pghtPrice?: number;
|
13
|
-
promo?: number;
|
14
|
-
tva?: number;
|
15
|
-
isBack?: boolean;
|
16
|
-
hasBack?: boolean;
|
17
|
-
product?: Product;
|
18
|
-
}
|
package/lib/esm/models/Ste.d.ts
DELETED
package/lib/esm/models/Titr.d.ts
DELETED
package/lib/esm/models/User.d.ts
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
import { Gender } from "./Gender";
|
2
|
-
import { Ste } from "./Ste";
|
3
|
-
import { Titr } from "./Titr";
|
4
|
-
import { UserGrp } from "./UserGrp";
|
5
|
-
import { UserRole } from "./UserRole";
|
6
|
-
export interface User {
|
7
|
-
id: number;
|
8
|
-
codeCompta?: string | number;
|
9
|
-
firstname?: string;
|
10
|
-
lastname?: string;
|
11
|
-
username?: string;
|
12
|
-
birthday?: Date | string;
|
13
|
-
password?: string;
|
14
|
-
approval?: string;
|
15
|
-
approvalExpDate?: Date;
|
16
|
-
ip?: string;
|
17
|
-
isActive?: boolean;
|
18
|
-
isSpecial?: boolean;
|
19
|
-
hasBillCredit?: boolean;
|
20
|
-
isValided?: boolean;
|
21
|
-
disabled?: boolean;
|
22
|
-
isBadPayer?: boolean;
|
23
|
-
isEqeerUser?: boolean;
|
24
|
-
ifDarkMode?: boolean;
|
25
|
-
foto?: string;
|
26
|
-
clp?: string;
|
27
|
-
periodBill?: string;
|
28
|
-
limitAmountSaleByMonth?: number;
|
29
|
-
hasLimitSaleSafe?: boolean;
|
30
|
-
hasBillSafe?: boolean;
|
31
|
-
gender?: Gender;
|
32
|
-
titr?: Titr;
|
33
|
-
clientId?: number;
|
34
|
-
grp?: UserGrp;
|
35
|
-
role?: UserRole;
|
36
|
-
ste?: Ste;
|
37
|
-
fullname: string;
|
38
|
-
}
|
@@ -1,66 +0,0 @@
|
|
1
|
-
import { Bill } from "asv-hlps-models";
|
2
|
-
import { Sale } from "asv-hlps-models";
|
3
|
-
export declare const infoAmountOnBl: (tob: Sale) => {
|
4
|
-
width: string;
|
5
|
-
table: {
|
6
|
-
headerRows: number;
|
7
|
-
widths: string[];
|
8
|
-
heights: number[];
|
9
|
-
body: ({
|
10
|
-
text: string;
|
11
|
-
style: string;
|
12
|
-
}[] | {
|
13
|
-
text: string | number;
|
14
|
-
style: string;
|
15
|
-
alignment: string;
|
16
|
-
}[])[];
|
17
|
-
};
|
18
|
-
};
|
19
|
-
export declare const infoAmountOnProforma: (tob: Sale) => {
|
20
|
-
width: string;
|
21
|
-
table: {
|
22
|
-
headerRows: number;
|
23
|
-
widths: string[];
|
24
|
-
heights: number[];
|
25
|
-
body: ({
|
26
|
-
text: string;
|
27
|
-
style: string;
|
28
|
-
}[] | {
|
29
|
-
text: string | number;
|
30
|
-
style: string;
|
31
|
-
alignment: string;
|
32
|
-
}[])[];
|
33
|
-
};
|
34
|
-
};
|
35
|
-
export declare const infoAmounOntSale: (tob: Sale) => {
|
36
|
-
width: string;
|
37
|
-
table: {
|
38
|
-
headerRows: number;
|
39
|
-
widths: string[];
|
40
|
-
heights: number[];
|
41
|
-
body: ({
|
42
|
-
text: string;
|
43
|
-
style: string;
|
44
|
-
}[] | {
|
45
|
-
text: string | number;
|
46
|
-
style: string;
|
47
|
-
alignment: string;
|
48
|
-
}[])[];
|
49
|
-
};
|
50
|
-
};
|
51
|
-
export declare const infoAmountOnBill: (tob: Bill) => {
|
52
|
-
width: string;
|
53
|
-
table: {
|
54
|
-
headerRows: number;
|
55
|
-
widths: string[];
|
56
|
-
heights: number[];
|
57
|
-
body: ({
|
58
|
-
text: string;
|
59
|
-
style: string;
|
60
|
-
}[] | {
|
61
|
-
text: string;
|
62
|
-
style: string;
|
63
|
-
alignment: string;
|
64
|
-
}[])[];
|
65
|
-
};
|
66
|
-
};
|
@@ -1,137 +0,0 @@
|
|
1
|
-
import { formatToStringCfa } from "asv-hlps";
|
2
|
-
import { getTotalAmountAllIncludedOnBill, getTotalAmountTvaOnBill, getTotalAmountWithoutTvaOnBill } from "../../bills/bill";
|
3
|
-
import { getTotalAmountAllIncludedOnSale, getTotalAmountWithoutTvaOnSale, getTotalShippingOnSale, getTotalTvaOnSale } from '../../sales/sale';
|
4
|
-
export const infoAmountOnBl = (tob) => {
|
5
|
-
const totalAmountWithoutTva = (tob.isBack && (tob.backChoice.toLowerCase() === 'autre' || tob.rejectedReason)) ? 0 : formatToStringCfa(getTotalAmountWithoutTvaOnSale(tob, true));
|
6
|
-
// const totalPort = formatToStringCfa(HlpSale.getTotalShipping(tob));
|
7
|
-
const totalTva = formatToStringCfa(getTotalTvaOnSale(tob, true));
|
8
|
-
const totalAmountAllIncluded = (tob.isBack && (tob.backChoice.toLowerCase() === 'autre' || tob.rejectedReason)) ? 0 : formatToStringCfa(getTotalAmountAllIncludedOnSale(tob, true));
|
9
|
-
const tabFooter = {
|
10
|
-
width: '50%',
|
11
|
-
table: {
|
12
|
-
headerRows: 1,
|
13
|
-
// widths: [ 100, 100, 100, 100 ],
|
14
|
-
widths: ['*', '*', '*', '*'],
|
15
|
-
heights: [6],
|
16
|
-
body: [
|
17
|
-
[
|
18
|
-
{ text: 'TOTAL HT', style: 'headerText' },
|
19
|
-
// {text: 'PORT HT', style: 'headerText'},
|
20
|
-
{ text: 'TOTAL TVA', style: 'headerText' },
|
21
|
-
{ text: 'TOTAL TTC', style: 'headerText' },
|
22
|
-
{ text: 'NET A PAYER', style: 'headerText' }
|
23
|
-
],
|
24
|
-
[
|
25
|
-
{ text: totalAmountWithoutTva, style: 'rowText', alignment: 'center' },
|
26
|
-
// { text: totalPort, style: 'rowText', alignment: 'center' },
|
27
|
-
{ text: totalTva, style: 'rowText', alignment: 'center' },
|
28
|
-
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
29
|
-
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
30
|
-
]
|
31
|
-
]
|
32
|
-
}
|
33
|
-
};
|
34
|
-
return tabFooter;
|
35
|
-
};
|
36
|
-
export const infoAmountOnProforma = (tob) => {
|
37
|
-
const totalAmountWithoutTva = (tob.isBack && tob.backChoice.toLowerCase() === 'autre') ? 0 : formatToStringCfa(getTotalAmountWithoutTvaOnSale(tob));
|
38
|
-
// const totalPort = formatToStringCfa(HlpSale.getTotalShipping(tob));
|
39
|
-
const totalTva = formatToStringCfa(getTotalTvaOnSale(tob));
|
40
|
-
const totalAmountAllIncluded = (tob.isBack && tob.backChoice.toLowerCase() === 'autre') ? 0 : formatToStringCfa(getTotalAmountAllIncludedOnSale(tob));
|
41
|
-
const tabFooter = {
|
42
|
-
width: '50%',
|
43
|
-
table: {
|
44
|
-
headerRows: 1,
|
45
|
-
// widths: [ 100, 100, 100, 100 ],
|
46
|
-
widths: ['*', '*', '*', '*'],
|
47
|
-
heights: [6],
|
48
|
-
body: [
|
49
|
-
[
|
50
|
-
{ text: 'TOTAL HT', style: 'headerText' },
|
51
|
-
// {text: 'PORT HT', style: 'headerText'},
|
52
|
-
{ text: 'TOTAL TVA', style: 'headerText' },
|
53
|
-
{ text: 'TOTAL TTC', style: 'headerText' },
|
54
|
-
{ text: 'NET A PAYER', style: 'headerText' }
|
55
|
-
],
|
56
|
-
[
|
57
|
-
{ text: totalAmountWithoutTva, style: 'rowText', alignment: 'center' },
|
58
|
-
// { text: totalPort, style: 'rowText', alignment: 'center' },
|
59
|
-
{ text: totalTva, style: 'rowText', alignment: 'center' },
|
60
|
-
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
61
|
-
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
62
|
-
]
|
63
|
-
]
|
64
|
-
}
|
65
|
-
};
|
66
|
-
return tabFooter;
|
67
|
-
};
|
68
|
-
export const infoAmounOntSale = (tob) => {
|
69
|
-
const totalAmountWithoutTva = (tob.isBack && (tob.backChoice.toLowerCase() === 'autre' || tob.rejectedReason)) ? 0 : formatToStringCfa(getTotalAmountWithoutTvaOnSale(tob, true));
|
70
|
-
const totalPort = formatToStringCfa(getTotalShippingOnSale(tob));
|
71
|
-
const totalTva = formatToStringCfa(getTotalTvaOnSale(tob, true));
|
72
|
-
const totalAmountAllIncluded = (tob.isBack && (tob.backChoice.toLowerCase() === 'autre' || tob.rejectedReason)) ? 0 : formatToStringCfa(getTotalAmountAllIncludedOnSale(tob, true));
|
73
|
-
const tabFooter = {
|
74
|
-
width: '50%',
|
75
|
-
table: {
|
76
|
-
headerRows: 1,
|
77
|
-
// widths: [ 100, 100, 100, 100 ],
|
78
|
-
widths: ['*', '*', '*', '*', '*'],
|
79
|
-
heights: [6],
|
80
|
-
body: [
|
81
|
-
[
|
82
|
-
{ text: 'TOTAL HT', style: 'headerText' },
|
83
|
-
{ text: 'PORT HT', style: 'headerText' },
|
84
|
-
{ text: 'TOTAL TVA', style: 'headerText' },
|
85
|
-
{ text: 'TOTAL TTC', style: 'headerText' },
|
86
|
-
{ text: 'NET A PAYER', style: 'headerText' }
|
87
|
-
],
|
88
|
-
[
|
89
|
-
{ text: totalAmountWithoutTva, style: 'rowText', alignment: 'center' },
|
90
|
-
{ text: totalPort, style: 'rowText', alignment: 'center' },
|
91
|
-
{ text: totalTva, style: 'rowText', alignment: 'center' },
|
92
|
-
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
93
|
-
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
94
|
-
]
|
95
|
-
]
|
96
|
-
}
|
97
|
-
};
|
98
|
-
return tabFooter;
|
99
|
-
};
|
100
|
-
export const infoAmountOnBill = (tob) => {
|
101
|
-
const totalAmountAllAndBackInclused = getTotalAmountAllIncludedOnBill(tob.sales);
|
102
|
-
const totalAmountWithoutTvaAllAndBack = getTotalAmountWithoutTvaOnBill(tob.sales);
|
103
|
-
const totalAmountTvaAllAndBack = getTotalAmountTvaOnBill(tob.sales);
|
104
|
-
// const totalAmountWithoutTva = formatToStringCfa(HlpSale.getTotalAmountWithoutTvaOnBill(tob.sales));
|
105
|
-
const totalAmountWithoutTva = formatToStringCfa(totalAmountWithoutTvaAllAndBack);
|
106
|
-
// const totalPort = formatToStringCfa(HlpSale.getTotalShipping(tob));
|
107
|
-
const totalTva = formatToStringCfa(totalAmountTvaAllAndBack);
|
108
|
-
// const totalTva = formatToStringCfa(HlpSale.getTotalAmountTvaOnBill(tob.sales));
|
109
|
-
// const totalAmountAllIncluded = formatToStringCfa(HlpSale.getTotalAmountOnBill(tob.sales));
|
110
|
-
const totalAmountAllIncluded = formatToStringCfa(totalAmountAllAndBackInclused);
|
111
|
-
const tabFooter = {
|
112
|
-
width: '50%',
|
113
|
-
table: {
|
114
|
-
headerRows: 1,
|
115
|
-
// widths: [ 100, 100, 100, 100 ],
|
116
|
-
widths: ['*', '*', '*', '*'],
|
117
|
-
heights: [6],
|
118
|
-
body: [
|
119
|
-
[
|
120
|
-
{ text: 'TOTAL HT', style: 'headerText' },
|
121
|
-
// {text: 'PORT HT', style: 'headerText'},
|
122
|
-
{ text: 'TOTAL TVA', style: 'headerText' },
|
123
|
-
{ text: 'TOTAL TTC', style: 'headerText' },
|
124
|
-
{ text: 'NET A PAYER', style: 'headerText' }
|
125
|
-
],
|
126
|
-
[
|
127
|
-
{ text: totalAmountWithoutTva, style: 'rowText', alignment: 'center' },
|
128
|
-
// { text: totalPort, style: 'rowText', alignment: 'center' },
|
129
|
-
{ text: totalTva, style: 'rowText', alignment: 'center' },
|
130
|
-
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
131
|
-
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
132
|
-
]
|
133
|
-
]
|
134
|
-
}
|
135
|
-
};
|
136
|
-
return tabFooter;
|
137
|
-
};
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import { Bill } from 'asv-hlps-models';
|
2
|
-
import { Sale } from "asv-hlps-models";
|
3
|
-
export declare const infoSale: (tob: Sale) => {
|
4
|
-
width: string;
|
5
|
-
table: {
|
6
|
-
headerRows: number;
|
7
|
-
widths: (string | number)[];
|
8
|
-
heights: number[];
|
9
|
-
body: {
|
10
|
-
text: any;
|
11
|
-
style: string;
|
12
|
-
}[][];
|
13
|
-
};
|
14
|
-
};
|
15
|
-
export declare const infoBill: (tob: Bill) => {
|
16
|
-
width: string;
|
17
|
-
table: {
|
18
|
-
headerRows: number;
|
19
|
-
widths: (string | number)[];
|
20
|
-
heights: number[];
|
21
|
-
body: {
|
22
|
-
text: any;
|
23
|
-
style: string;
|
24
|
-
}[][];
|
25
|
-
};
|
26
|
-
};
|