asv-hlps-market 1.0.6 → 1.0.9
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/bills/bill.d.ts +19 -0
- package/lib/cjs/bills/bill.js +79 -0
- package/lib/cjs/bills/models/Bill.d.ts +21 -0
- package/lib/cjs/buys/models/Buy.d.ts +3 -2
- package/lib/cjs/buys/models/BuyProduct.d.ts +3 -0
- package/lib/cjs/index.d.ts +12 -2
- package/lib/cjs/index.js +14 -2
- package/lib/cjs/markets/index.d.ts +1 -0
- package/lib/cjs/{shops → markets}/index.js +1 -1
- package/lib/cjs/{models → markets/models}/Market.d.ts +2 -1
- package/lib/{esm → cjs/markets}/models/UMarket.d.ts +2 -2
- package/lib/cjs/models/Gender.d.ts +6 -0
- package/lib/cjs/models/Gender.js +2 -0
- package/lib/cjs/models/Sale.d.ts +34 -0
- package/lib/cjs/models/Sale.js +2 -0
- package/lib/cjs/models/SaleProduct.d.ts +18 -0
- package/lib/cjs/models/SaleProduct.js +6 -0
- package/lib/cjs/models/Ste.d.ts +8 -0
- package/lib/cjs/models/Ste.js +2 -0
- package/lib/cjs/models/SteGrp.d.ts +7 -0
- package/lib/cjs/models/SteGrp.js +2 -0
- package/lib/cjs/models/Titr.d.ts +5 -0
- package/lib/cjs/models/Titr.js +2 -0
- package/lib/cjs/models/User.d.ts +38 -0
- package/lib/cjs/models/User.js +2 -0
- package/lib/cjs/models/UserGrp.d.ts +4 -0
- package/lib/cjs/models/UserGrp.js +2 -0
- package/lib/cjs/models/UserRole.d.ts +5 -0
- package/lib/cjs/models/UserRole.js +2 -0
- package/lib/cjs/models/shared/NaAc.d.ts +6 -0
- package/lib/cjs/models/shared/NaAc.js +2 -0
- package/lib/cjs/models/shared/NaCoAc.d.ts +4 -0
- package/lib/cjs/models/shared/NaCoAc.js +2 -0
- package/lib/cjs/models/shared/NaCoShortAc.d.ts +4 -0
- package/lib/cjs/models/shared/NaCoShortAc.js +2 -0
- package/lib/cjs/pdfs/invoices/amountInvoice.d.ts +66 -0
- package/lib/cjs/pdfs/invoices/amountInvoice.js +144 -0
- package/lib/cjs/pdfs/invoices/infoInvoice.d.ts +32 -0
- package/lib/cjs/pdfs/invoices/infoInvoice.js +80 -0
- package/lib/cjs/pdfs/tools/tools.d.ts +34 -0
- package/lib/cjs/pdfs/tools/tools.js +53 -0
- package/lib/cjs/products/hlpProduct.d.ts +1 -2
- package/lib/cjs/products/hlpProduct.js +7 -16
- package/lib/cjs/products/interfaces/Product.d.ts +53 -0
- package/lib/cjs/products/interfaces/Product.js +2 -0
- package/lib/cjs/products/interfaces/ProductCat.d.ts +6 -0
- package/lib/cjs/products/interfaces/ProductCat.js +2 -0
- package/lib/cjs/products/interfaces/ProductStore.d.ts +24 -0
- package/lib/cjs/products/interfaces/ProductStore.js +2 -0
- package/lib/cjs/products/models/Product.d.ts +5 -5
- package/lib/cjs/products/product.d.ts +3 -0
- package/lib/cjs/products/product.js +22 -0
- package/lib/cjs/sales/models/SaleItems.d.ts +2 -2
- package/lib/cjs/sales/models/SalePayment.d.ts +2 -1
- package/lib/cjs/sales/sale.d.ts +18 -0
- package/lib/cjs/sales/sale.js +129 -0
- package/lib/cjs/shared/CartItem.js +0 -1
- package/lib/cjs/shopping/models/CartItem.d.ts +6 -0
- package/lib/cjs/shopping/models/CartItem.js +2 -0
- package/lib/cjs/shopping/models/index.d.ts +1 -0
- package/lib/cjs/shopping/models/index.js +17 -0
- package/lib/cjs/shops/models/CartItem.d.ts +6 -0
- package/lib/cjs/shops/models/CartItem.js +2 -0
- package/lib/cjs/shops/models/Shop.d.ts +1 -1
- package/lib/cjs/shops/models/index.d.ts +1 -0
- package/lib/cjs/shops/models/index.js +17 -0
- package/lib/cjs/users/index.d.ts +1 -0
- package/lib/cjs/users/index.js +17 -0
- package/lib/cjs/users/models/User.d.ts +1 -1
- package/lib/cjs/users/models/index.d.ts +1 -0
- package/lib/cjs/users/models/index.js +17 -0
- package/lib/esm/bills/bill.d.ts +19 -0
- package/lib/esm/bills/bill.js +58 -0
- package/lib/esm/bills/models/Bill.d.ts +21 -0
- package/lib/esm/buys/models/Buy.d.ts +3 -2
- package/lib/esm/buys/models/BuyProduct.d.ts +3 -0
- package/lib/esm/index.d.ts +12 -2
- package/lib/esm/index.js +14 -2
- package/lib/esm/markets/index.d.ts +1 -0
- package/lib/esm/markets/index.js +1 -0
- package/lib/esm/{models → markets/models}/Market.d.ts +2 -1
- package/lib/{cjs → esm/markets}/models/UMarket.d.ts +2 -2
- package/lib/esm/models/Gender.d.ts +6 -0
- package/lib/esm/models/Gender.js +1 -0
- package/lib/esm/models/Sale.d.ts +34 -0
- package/lib/esm/models/Sale.js +1 -0
- package/lib/esm/models/SaleProduct.d.ts +18 -0
- package/lib/esm/models/SaleProduct.js +2 -0
- package/lib/esm/models/Ste.d.ts +8 -0
- package/lib/esm/models/Ste.js +1 -0
- package/lib/esm/models/SteGrp.d.ts +7 -0
- package/lib/esm/models/SteGrp.js +1 -0
- package/lib/esm/models/Titr.d.ts +5 -0
- package/lib/esm/models/Titr.js +1 -0
- package/lib/esm/models/User.d.ts +38 -0
- package/lib/esm/models/User.js +1 -0
- package/lib/esm/models/UserGrp.d.ts +4 -0
- package/lib/esm/models/UserGrp.js +1 -0
- package/lib/esm/models/UserRole.d.ts +5 -0
- package/lib/esm/models/UserRole.js +1 -0
- package/lib/esm/models/shared/NaAc.d.ts +6 -0
- package/lib/esm/models/shared/NaAc.js +1 -0
- package/lib/esm/models/shared/NaCoAc.d.ts +4 -0
- package/lib/esm/models/shared/NaCoAc.js +1 -0
- package/lib/esm/models/shared/NaCoShortAc.d.ts +4 -0
- package/lib/esm/models/shared/NaCoShortAc.js +1 -0
- package/lib/esm/pdfs/invoices/amountInvoice.d.ts +66 -0
- package/lib/esm/pdfs/invoices/amountInvoice.js +137 -0
- package/lib/esm/pdfs/invoices/infoInvoice.d.ts +26 -0
- package/lib/esm/pdfs/invoices/infoInvoice.js +75 -0
- package/lib/esm/pdfs/tools/tools.d.ts +34 -0
- package/lib/esm/pdfs/tools/tools.js +47 -0
- package/lib/esm/products/hlpProduct.d.ts +1 -2
- package/lib/esm/products/hlpProduct.js +7 -16
- package/lib/esm/products/interfaces/Product.d.ts +53 -0
- package/lib/esm/products/interfaces/Product.js +1 -0
- package/lib/esm/products/interfaces/ProductCat.d.ts +6 -0
- package/lib/esm/products/interfaces/ProductCat.js +1 -0
- package/lib/esm/products/interfaces/ProductStore.d.ts +24 -0
- package/lib/esm/products/interfaces/ProductStore.js +1 -0
- package/lib/esm/products/models/Product.d.ts +5 -5
- package/lib/esm/products/product.d.ts +3 -0
- package/lib/esm/products/product.js +17 -0
- package/lib/esm/sales/models/SaleItems.d.ts +2 -2
- package/lib/esm/sales/models/SalePayment.d.ts +2 -1
- package/lib/esm/sales/sale.d.ts +18 -0
- package/lib/esm/sales/sale.js +109 -0
- package/lib/esm/shared/CartItem.js +0 -1
- package/lib/esm/shopping/models/CartItem.d.ts +6 -0
- package/lib/esm/shopping/models/CartItem.js +1 -0
- package/lib/esm/shopping/models/index.d.ts +1 -0
- package/lib/esm/shopping/models/index.js +1 -0
- package/lib/esm/shops/models/CartItem.d.ts +6 -0
- package/lib/esm/shops/models/CartItem.js +1 -0
- package/lib/esm/shops/models/Shop.d.ts +1 -1
- package/lib/esm/shops/models/index.d.ts +1 -0
- package/lib/esm/shops/models/index.js +1 -0
- package/lib/esm/users/index.d.ts +1 -0
- package/lib/esm/users/index.js +1 -0
- package/lib/esm/users/models/User.d.ts +1 -1
- package/lib/esm/users/models/index.d.ts +1 -0
- package/lib/esm/users/models/index.js +1 -0
- package/package.json +4 -4
- package/lib/cjs/pos/CartProduct.d.ts +0 -6
- package/lib/cjs/pos/hlpShop.d.ts +0 -37
- package/lib/cjs/pos/hlpShop.js +0 -216
- package/lib/cjs/pos/index.d.ts +0 -1
- package/lib/cjs/pos/index.js +0 -8
- package/lib/cjs/shops/index.d.ts +0 -1
- package/lib/esm/pos/CartProduct.d.ts +0 -6
- package/lib/esm/pos/hlpShop.d.ts +0 -37
- package/lib/esm/pos/hlpShop.js +0 -210
- package/lib/esm/pos/index.d.ts +0 -1
- package/lib/esm/pos/index.js +0 -1
- package/lib/esm/shops/index.d.ts +0 -1
- package/lib/esm/shops/index.js +0 -1
- /package/lib/cjs/{models/Market.js → bills/models/Bill.js} +0 -0
- /package/lib/cjs/{models/UMarket.js → markets/models/Market.js} +0 -0
- /package/lib/cjs/{pos/CartProduct.js → markets/models/UMarket.js} +0 -0
- /package/lib/cjs/{models → markets/models}/index.d.ts +0 -0
- /package/lib/cjs/{models → markets/models}/index.js +0 -0
- /package/lib/esm/{models/Market.js → bills/models/Bill.js} +0 -0
- /package/lib/esm/{models/UMarket.js → markets/models/Market.js} +0 -0
- /package/lib/esm/{pos/CartProduct.js → markets/models/UMarket.js} +0 -0
- /package/lib/esm/{models → markets/models}/index.d.ts +0 -0
- /package/lib/esm/{models → markets/models}/index.js +0 -0
@@ -0,0 +1,32 @@
|
|
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: string;
|
11
|
+
style: string;
|
12
|
+
} | {
|
13
|
+
text: number;
|
14
|
+
style: string;
|
15
|
+
})[][];
|
16
|
+
};
|
17
|
+
};
|
18
|
+
export declare const infoBill: (tob: Bill) => {
|
19
|
+
width: string;
|
20
|
+
table: {
|
21
|
+
headerRows: number;
|
22
|
+
widths: (string | number)[];
|
23
|
+
heights: number[];
|
24
|
+
body: ({
|
25
|
+
text: string;
|
26
|
+
style: string;
|
27
|
+
} | {
|
28
|
+
text: number;
|
29
|
+
style: string;
|
30
|
+
})[][];
|
31
|
+
};
|
32
|
+
};
|
@@ -0,0 +1,80 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.infoBill = exports.infoSale = void 0;
|
4
|
+
const asv_hlps_1 = require("asv-hlps");
|
5
|
+
const bill_1 = require("../../bills/bill");
|
6
|
+
const sale_1 = require("../../sales/sale");
|
7
|
+
const infoSale = (tob) => {
|
8
|
+
const totalQtity = (0, sale_1.getTotalQtityOnSale)(tob);
|
9
|
+
const nbProducts = (0, sale_1.getNbProductsOnSale)(tob);
|
10
|
+
const nbColis = tob.nbPackages;
|
11
|
+
const nbFreeze = tob.nbFreeze;
|
12
|
+
// const oWidth = [ '*', '*', 75, 75, 75, 75];
|
13
|
+
const tabTop = {
|
14
|
+
width: '50%',
|
15
|
+
table: {
|
16
|
+
headerRows: 1,
|
17
|
+
widths: ['*', '*', 75, 75, 75, 75],
|
18
|
+
heights: [6],
|
19
|
+
body: [
|
20
|
+
[
|
21
|
+
{ text: 'FACTURE N°', style: 'headerText' },
|
22
|
+
{ text: 'DATE', style: 'headerText' },
|
23
|
+
{ text: 'NBRE DE PDTS', style: 'headerText' },
|
24
|
+
{ text: 'QUANTITE TOTALE', style: 'headerText' },
|
25
|
+
{ text: 'NBRE COLIS', style: 'headerText' },
|
26
|
+
{ text: 'NBRE FROID', style: 'headerText' }
|
27
|
+
],
|
28
|
+
[
|
29
|
+
{ text: tob.ref, style: 'rowText' },
|
30
|
+
// { text: moment(tob.createdAt ).format('DD/MM/YYYY'), style: 'rowText'},
|
31
|
+
{ text: (0, asv_hlps_1.convertEnDateToFr)(tob.createdAt, '/'), style: 'rowText' },
|
32
|
+
{ text: nbProducts, style: 'rowText' },
|
33
|
+
{ text: totalQtity, style: 'rowText' },
|
34
|
+
{ text: nbColis, style: 'rowText' },
|
35
|
+
{ text: nbFreeze, style: 'rowText' },
|
36
|
+
]
|
37
|
+
]
|
38
|
+
}
|
39
|
+
};
|
40
|
+
return tabTop;
|
41
|
+
};
|
42
|
+
exports.infoSale = infoSale;
|
43
|
+
const infoBill = (tob) => {
|
44
|
+
const totalQtity = (0, bill_1.getTotalQtityOnBill)(tob.sales);
|
45
|
+
const nbProducts = (0, bill_1.getNbProductsOnBill)(tob.sales);
|
46
|
+
const nbColis = (0, bill_1.getNbPackagesOnBill)(tob.sales);
|
47
|
+
const nbFreeze = (0, bill_1.getNbFreezeOnBill)(tob.sales);
|
48
|
+
const oWidth = ['*', '*', 75, 75, 75, 75];
|
49
|
+
const tabTop = {
|
50
|
+
width: '50%',
|
51
|
+
table: {
|
52
|
+
headerRows: 1,
|
53
|
+
// widths: [ 125, 125, 125, '*' ],
|
54
|
+
widths: oWidth,
|
55
|
+
heights: [6],
|
56
|
+
// widths: [ '16%', '16%', '16%', '16%' ],
|
57
|
+
body: [
|
58
|
+
[
|
59
|
+
{ text: 'FACTURE N°', style: 'headerText' },
|
60
|
+
{ text: 'DATE', style: 'headerText' },
|
61
|
+
{ text: 'NBRE DE PDTS', style: 'headerText' },
|
62
|
+
{ text: 'QUANTITE TOTALE', style: 'headerText' },
|
63
|
+
{ text: 'NBRE COLIS', style: 'headerText' },
|
64
|
+
{ text: 'NBRE FROID', style: 'headerText' }
|
65
|
+
],
|
66
|
+
[
|
67
|
+
{ text: tob.ref, style: 'rowText' },
|
68
|
+
// { text: moment(tob.createdAt ).format('DD/MM/YYYY'), style: 'rowText'},
|
69
|
+
{ text: (0, asv_hlps_1.convertEnDateToFr)(tob.createdAt, '/'), style: 'rowText' },
|
70
|
+
{ text: nbProducts, style: 'rowText' },
|
71
|
+
{ text: totalQtity, style: 'rowText' },
|
72
|
+
{ text: nbColis, style: 'rowText' },
|
73
|
+
{ text: nbFreeze, style: 'rowText' },
|
74
|
+
]
|
75
|
+
]
|
76
|
+
}
|
77
|
+
};
|
78
|
+
return tabTop;
|
79
|
+
};
|
80
|
+
exports.infoBill = infoBill;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { User } from 'asv-hlps-models';
|
2
|
+
export declare const displayPdfDate: (label: string, fromDate: string, toDate: string) => string;
|
3
|
+
export declare const displayTitle: (title: string) => {
|
4
|
+
width: string;
|
5
|
+
alignment: string;
|
6
|
+
text: string;
|
7
|
+
bold: boolean;
|
8
|
+
margin: number[];
|
9
|
+
fontSize: number;
|
10
|
+
};
|
11
|
+
export declare const displayClient: (user: User) => {
|
12
|
+
absolutePosition: {
|
13
|
+
x: number;
|
14
|
+
y: number;
|
15
|
+
};
|
16
|
+
text: ({
|
17
|
+
text: string;
|
18
|
+
fontSize: number;
|
19
|
+
bold?: undefined;
|
20
|
+
} | {
|
21
|
+
text: string;
|
22
|
+
bold: boolean;
|
23
|
+
fontSize: number;
|
24
|
+
} | {
|
25
|
+
text: string;
|
26
|
+
fontSize?: undefined;
|
27
|
+
bold?: undefined;
|
28
|
+
})[];
|
29
|
+
color: string;
|
30
|
+
width: string;
|
31
|
+
fontSize: number;
|
32
|
+
bold: boolean;
|
33
|
+
alignment: string;
|
34
|
+
};
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.displayClient = exports.displayTitle = exports.displayPdfDate = void 0;
|
4
|
+
const asv_hlps_1 = require("asv-hlps");
|
5
|
+
const displayPdfDate = (label, fromDate, toDate) => {
|
6
|
+
fromDate = (!fromDate) ? (0, asv_hlps_1.formatDateYmdHypen)(new Date()) : fromDate;
|
7
|
+
toDate = (!toDate) ? fromDate : toDate;
|
8
|
+
return label + ' du ' + (0, asv_hlps_1.convertEnDateToFr)(fromDate) + ' au ' + (0, asv_hlps_1.convertEnDateToFr)(toDate);
|
9
|
+
};
|
10
|
+
exports.displayPdfDate = displayPdfDate;
|
11
|
+
const displayTitle = (title) => {
|
12
|
+
return {
|
13
|
+
width: '100%',
|
14
|
+
alignment: 'center',
|
15
|
+
text: title,
|
16
|
+
bold: true,
|
17
|
+
margin: [0, 10, 0, 10],
|
18
|
+
fontSize: 15,
|
19
|
+
};
|
20
|
+
};
|
21
|
+
exports.displayTitle = displayTitle;
|
22
|
+
const displayClient = (user) => {
|
23
|
+
// const clientSte = user.ste ? HlpUser.getSteShortname(user.ste) : '';
|
24
|
+
const clientSte = user.ste ? (0, asv_hlps_1.getSteShortname)(user.ste, ['pharmacie', 'clinique', 'hopital']) : '';
|
25
|
+
/* const clientLastname = (user.lastname) ? user.lastname : '';
|
26
|
+
const clientFirstname = (user.firstname) ? user.firstname : '';
|
27
|
+
const clientGender = (user.gender) ? user.gender.abr : ''; */
|
28
|
+
const clientName = user.ste ? clientSte : user.fullname;
|
29
|
+
const cp = user.cp ? user.cp : '';
|
30
|
+
const city = user.city ? user.city : '';
|
31
|
+
const nif = user.ste.nif ? user.ste.nif : '';
|
32
|
+
const address = user.address ? user.address : '';
|
33
|
+
const client = {
|
34
|
+
absolutePosition: { x: 310, y: 30 },
|
35
|
+
text: [
|
36
|
+
{ text: 'CLIENT: ', fontSize: 8 },
|
37
|
+
{ text: user.username + '\n', bold: true, fontSize: 10 },
|
38
|
+
{ text: clientName + '\n' },
|
39
|
+
{ text: address + ' ' },
|
40
|
+
{ text: cp + '\n' },
|
41
|
+
{ text: city + '\n' },
|
42
|
+
// {text: nif + '\n'}
|
43
|
+
],
|
44
|
+
color: '#000',
|
45
|
+
width: 'auto',
|
46
|
+
fontSize: 12,
|
47
|
+
bold: true,
|
48
|
+
alignment: 'left',
|
49
|
+
// margin: [100, 0, 0, 0],
|
50
|
+
};
|
51
|
+
return client;
|
52
|
+
};
|
53
|
+
exports.displayClient = displayClient;
|
@@ -1,13 +1,12 @@
|
|
1
1
|
import Product from "./models/Product";
|
2
2
|
import ProductStock from "./models/ProductStock";
|
3
3
|
declare class HlpProduct {
|
4
|
+
stock: (product: Product, param: "salable" | "packs" | "units") => number;
|
4
5
|
qtityInAllDepots(stock: ProductStock, prms?: {
|
5
6
|
exceptDepots?: string[];
|
6
7
|
main?: "master" | "slave";
|
7
8
|
}): number;
|
8
9
|
getStockSalable(product: Product): number;
|
9
|
-
stock: (product: Product, param: "salable" | "packs" | "units") => number;
|
10
|
-
extraFiilters: (row: Product) => string;
|
11
10
|
}
|
12
11
|
declare const _default: HlpProduct;
|
13
12
|
export default _default;
|
@@ -17,31 +17,22 @@ class HlpProduct {
|
|
17
17
|
return salable;
|
18
18
|
}
|
19
19
|
};
|
20
|
-
this.extraFiilters = (row) => row.designation; /* +
|
21
|
-
row.codeCompta +
|
22
|
-
(row.tva > 0 ? "@tva" : "") +
|
23
|
-
(row.isAvailable ? "@dispo" : "") +
|
24
|
-
(!row.isAvailable ? "@indispo" : "") +
|
25
|
-
(row.isActive ? "@actif" : "") +
|
26
|
-
(!row.isActive ? "@inactif" : "") +
|
27
|
-
(row.isPrivate ? "@private" : "") +
|
28
|
-
(!row.isPrivate ? "@noprivate" : ""); */
|
29
20
|
}
|
30
21
|
qtityInAllDepots(stock, prms) {
|
31
22
|
const ins = stock.sumIns - stock.sumOuts;
|
32
23
|
return ins <= 0 ? 0 : ins;
|
33
24
|
}
|
34
25
|
getStockSalable(product) {
|
35
|
-
const stockAllSalable =
|
26
|
+
const stockAllSalable = this.qtityInAllDepots(product.stock);
|
36
27
|
const stockProduct = Math.trunc(stockAllSalable / product.qtityUnit);
|
37
28
|
/* let stockSalable: number = 0;
|
38
29
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
30
|
+
if (stockAllSalable <= stockStore) {
|
31
|
+
stockSalable = stockAllSalable;
|
32
|
+
}
|
33
|
+
if (stockAllSalable > stockStore) {
|
34
|
+
stockSalable = stockStore;
|
35
|
+
} */
|
45
36
|
// return stockSalable || 0;
|
46
37
|
return stockProduct || 0;
|
47
38
|
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { ProductCat } from "./ProductCat";
|
2
|
+
import { ProductStore } from "./ProductStore";
|
3
|
+
export interface Product {
|
4
|
+
id: number;
|
5
|
+
ref?: string;
|
6
|
+
designation?: string;
|
7
|
+
unitPrice?: number;
|
8
|
+
salePrice?: number;
|
9
|
+
pght?: number;
|
10
|
+
pghtPrice?: number;
|
11
|
+
codeHs?: string;
|
12
|
+
codeCip?: string;
|
13
|
+
codeCip7?: string;
|
14
|
+
codeEan?: string;
|
15
|
+
condeInam?: string;
|
16
|
+
codeCompta?: number;
|
17
|
+
codeAmm?: string;
|
18
|
+
codeAmmStart?: Date | string;
|
19
|
+
codeAmmEnd?: Date | string;
|
20
|
+
pvdPrice?: number;
|
21
|
+
fees?: number;
|
22
|
+
profit?: number;
|
23
|
+
profitPhcie?: number;
|
24
|
+
publicPrice?: number;
|
25
|
+
qtityLimit?: number;
|
26
|
+
stockLimit?: number;
|
27
|
+
stockMax?: number;
|
28
|
+
stockReap?: number;
|
29
|
+
stock?: number;
|
30
|
+
stockReserved?: number;
|
31
|
+
stockSalable?: number;
|
32
|
+
qtityPerPackaging?: number;
|
33
|
+
qtityPerBox?: number;
|
34
|
+
promo?: number;
|
35
|
+
isInOrder?: boolean;
|
36
|
+
coef?: number;
|
37
|
+
promoPerQtity?: number;
|
38
|
+
promoEndAt?: Date;
|
39
|
+
image?: string;
|
40
|
+
description?: string;
|
41
|
+
isActive?: boolean;
|
42
|
+
tva?: number;
|
43
|
+
discountRate?: number;
|
44
|
+
createdAt?: Date;
|
45
|
+
updatedAt?: Date;
|
46
|
+
hasPromo?: boolean;
|
47
|
+
inEqeer?: boolean;
|
48
|
+
qtityWarning?: boolean;
|
49
|
+
isPublished?: boolean;
|
50
|
+
isAvailable?: boolean;
|
51
|
+
cat?: ProductCat;
|
52
|
+
stores?: ProductStore[];
|
53
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
export interface ProductStore {
|
2
|
+
id?: number;
|
3
|
+
name?: string;
|
4
|
+
qtityLimit?: number;
|
5
|
+
stockLimit?: number;
|
6
|
+
stockMax?: number;
|
7
|
+
stock?: number;
|
8
|
+
stockReap?: number;
|
9
|
+
stockReserved?: number;
|
10
|
+
stockSalable?: number;
|
11
|
+
fees?: number;
|
12
|
+
pght?: number;
|
13
|
+
pvdPrice?: number;
|
14
|
+
pghtPrice?: number;
|
15
|
+
costPrice?: number;
|
16
|
+
salePrice?: number;
|
17
|
+
profitPhcie?: number;
|
18
|
+
publicPrice?: number;
|
19
|
+
isActive?: boolean;
|
20
|
+
isAvailable?: boolean;
|
21
|
+
isPublished?: boolean;
|
22
|
+
hasPromo?: boolean;
|
23
|
+
discountRate?: number;
|
24
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import Market from "../../markets/models/Market";
|
2
2
|
import { Shop } from "../../shops/models/Shop";
|
3
3
|
import ProductCat from "./ProductCat";
|
4
4
|
import ProductImage from "./ProductImage";
|
@@ -9,6 +9,7 @@ interface Stock {
|
|
9
9
|
qtityPerPackaging: number;
|
10
10
|
}
|
11
11
|
export default interface Product {
|
12
|
+
id: number;
|
12
13
|
capacity: string;
|
13
14
|
cat: ProductCat;
|
14
15
|
createdAt: Date;
|
@@ -17,7 +18,6 @@ export default interface Product {
|
|
17
18
|
disabled?: boolean;
|
18
19
|
iconName: string;
|
19
20
|
iconPack: string;
|
20
|
-
id: number;
|
21
21
|
images: ProductImage[];
|
22
22
|
ins: ProductIn[];
|
23
23
|
isActive: boolean;
|
@@ -27,14 +27,14 @@ export default interface Product {
|
|
27
27
|
price: number;
|
28
28
|
publicPrice: number;
|
29
29
|
qtityLimit: number;
|
30
|
-
qtityUnit: number;
|
31
|
-
stock: Stock;
|
32
30
|
qtityPerBox: number;
|
33
31
|
qtityPerPackaging: number;
|
32
|
+
qtityUnit: number;
|
34
33
|
ref: string;
|
35
34
|
salePrice: number;
|
36
35
|
shop: Shop;
|
37
|
-
updatedAt: Date;
|
38
36
|
specialPrice?: number;
|
37
|
+
stock: Stock;
|
38
|
+
updatedAt: Date;
|
39
39
|
}
|
40
40
|
export {};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.productCatCode = exports.unitPriceByClientCat = void 0;
|
4
|
+
const asv_hlps_1 = require("asv-hlps");
|
5
|
+
const unitPriceByClientCat = (product, client, speUnitPrice = 0, addDiscount = false) => {
|
6
|
+
if (speUnitPrice > 0) {
|
7
|
+
return speUnitPrice;
|
8
|
+
}
|
9
|
+
// const store = await getCustomRepository(ProductStoreRepository).getOneStoreByParams({storeName: 'cpa', productId: product.id})
|
10
|
+
if (product.stores[0].discountRate && addDiscount) {
|
11
|
+
return Math.ceil(product.stores[0].salePrice) - Math.ceil((0, asv_hlps_1.calculPercent)(product.stores[0].salePrice, product.stores[0].discountRate));
|
12
|
+
}
|
13
|
+
const clientCoef = (!client) ? 1 : (0, asv_hlps_1.userCoef)(client);
|
14
|
+
return ((0, exports.productCatCode)(product, ['spe', 'para'])) ?
|
15
|
+
Math.ceil(product.stores[0].salePrice) :
|
16
|
+
Math.ceil(product.stores[0].salePrice * clientCoef);
|
17
|
+
};
|
18
|
+
exports.unitPriceByClientCat = unitPriceByClientCat;
|
19
|
+
const productCatCode = (product, catCodes) => {
|
20
|
+
return catCodes.includes(product.cat.code && product.cat.code.toLowerCase());
|
21
|
+
};
|
22
|
+
exports.productCatCode = productCatCode;
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import
|
1
|
+
import CartItem from "../../shopping/models/CartItem";
|
2
2
|
import Sale from "./Sale";
|
3
3
|
export default interface SaleItems {
|
4
4
|
sale?: Sale;
|
5
|
-
items?:
|
5
|
+
items?: CartItem[];
|
6
6
|
clientId?: number;
|
7
7
|
fromMobile?: boolean;
|
8
8
|
isWaiting?: boolean;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { Bank, BankAccount
|
1
|
+
import { Bank, BankAccount } from "asv-hlps/lib/cjs/cashs";
|
2
|
+
import PaymentMode from "asv-hlps/lib/cjs/cashs/models/PaymentMode";
|
2
3
|
import User from "../../users/models/User";
|
3
4
|
import Sale from "./Sale";
|
4
5
|
export default interface SalePayment {
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { Sale } from "asv-hlps-models";
|
2
|
+
export declare const getNbProductsOnSale: (sale: Sale) => number;
|
3
|
+
export declare const getTotalTvaOnSale: (sale: Sale, dlvr?: boolean) => number;
|
4
|
+
export declare const getSubTotalAmountOnSale: (sale: Sale, dlvr?: boolean) => number;
|
5
|
+
export declare const getSubTotalAmountBackOnSale: (sale: Sale) => number;
|
6
|
+
export declare const getTotalAmountWithoutTvaOnSale: (sale: Sale, dlvr?: boolean) => number;
|
7
|
+
export declare const getTotalAmountWithoutTvaBackOnSale: (sale: Sale) => number;
|
8
|
+
export declare const getTotalTvaOnSaleOnSale: (sale: Sale, dlvr?: boolean) => number;
|
9
|
+
export declare const getTotalTvaBackOnSale: (sale: Sale) => number;
|
10
|
+
export declare const getTotalAmountOnSale: (sale: Sale, dlvr?: boolean) => number;
|
11
|
+
export declare const getTotalAmountBackOnSale: (sale: Sale) => number;
|
12
|
+
export declare const getTotalAmountAllIncludedOnSale: (sale: Sale, dlvr?: boolean) => number;
|
13
|
+
export declare const getTotalShippingOnSale: (sale: Sale) => number;
|
14
|
+
export declare const getTotalAmountDiscountOnSale: (sale: Sale, dlvr?: boolean) => number;
|
15
|
+
export declare const getTotalQtityOnSale: (sale: Sale, dlvr?: boolean) => number;
|
16
|
+
export declare const getTotalQtityFreeOnSale: (sale: Sale) => number;
|
17
|
+
export declare const getTotalQtityOdrOrDlvrOnSale: (sale: Sale, dlvr?: boolean) => number;
|
18
|
+
export declare const tabLabel: (sale: Sale) => any[];
|
@@ -0,0 +1,129 @@
|
|
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;
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./CartItem";
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./CartItem"), exports);
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./Shop";
|