asv-hlps 1.0.42 → 1.0.45
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/bill.d.ts +19 -0
- package/lib/cjs/bill.js +79 -0
- package/lib/cjs/index.d.ts +12 -12
- package/lib/cjs/index.js +12 -12
- package/lib/cjs/pdfs/invoices/amountInvoice.js +78 -70
- package/lib/cjs/pdfs/invoices/infoInvoice.d.ts +1 -1
- package/lib/cjs/pdfs/invoices/infoInvoice.js +37 -37
- package/lib/cjs/pdfs/tools/tools.d.ts +1 -1
- package/lib/cjs/pdfs/tools/tools.js +21 -21
- package/lib/cjs/product.d.ts +3 -0
- package/lib/cjs/product.js +23 -0
- package/lib/cjs/sale.d.ts +19 -0
- package/lib/cjs/sale.js +136 -0
- package/lib/cjs/typeorm.d.ts +10 -0
- package/lib/cjs/typeorm.js +39 -0
- package/lib/cjs/user.d.ts +14 -0
- package/lib/cjs/user.js +132 -0
- package/lib/cjs/utils.d.ts +62 -0
- package/lib/cjs/utils.js +388 -0
- package/lib/esm/bill.d.ts +19 -0
- package/lib/esm/bill.js +58 -0
- package/lib/esm/index.d.ts +12 -12
- package/lib/esm/index.js +12 -12
- package/lib/esm/pdfs/invoices/amountInvoice.js +71 -63
- package/lib/esm/pdfs/invoices/infoInvoice.d.ts +1 -1
- package/lib/esm/pdfs/invoices/infoInvoice.js +37 -37
- package/lib/esm/pdfs/tools/tools.d.ts +1 -1
- package/lib/esm/pdfs/tools/tools.js +21 -21
- package/lib/esm/product.d.ts +3 -0
- package/lib/esm/product.js +18 -0
- package/lib/esm/sale.d.ts +19 -0
- package/lib/esm/sale.js +115 -0
- package/lib/esm/typeorm.d.ts +10 -0
- package/lib/esm/typeorm.js +35 -0
- package/lib/esm/user.d.ts +14 -0
- package/lib/esm/user.js +90 -0
- package/lib/esm/utils.d.ts +62 -0
- package/lib/esm/utils.js +331 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Bill, Sale } from "asv-hlps-models";
|
|
2
|
+
export declare const getNbProductsOnBill: (sales: Sale[]) => number;
|
|
3
|
+
export declare const getNbPackagesOnBill: (sales: Sale[]) => number;
|
|
4
|
+
export declare const getNbFreezeOnBill: (sales: Sale[]) => number;
|
|
5
|
+
export declare const getTotalTvaOnBill: (sales: Sale[]) => number;
|
|
6
|
+
export declare const getTotalAmountOnBill: (sales: Sale[]) => number;
|
|
7
|
+
export declare const getTotalAmountBackOnBill: (sales: Sale[]) => number;
|
|
8
|
+
export declare const getTotalTvaBackOnBill: (sales: Sale[]) => number;
|
|
9
|
+
export declare const getTotalQtityOnBill: (sales: Sale[]) => number;
|
|
10
|
+
export declare const getTotalQtityFreeOnBill: (sales: Sale[]) => number;
|
|
11
|
+
export declare const getTotalAmountWithoutTvaOnBill: (sales: Sale[]) => number;
|
|
12
|
+
export declare const getTotalAmountWithoutTvaBackOnBill: (sales: Sale[]) => number;
|
|
13
|
+
export declare const getTotalAmountAllIncludedOnBill: (sales: Sale[]) => number;
|
|
14
|
+
export declare const getTotalAmountTvaOnBill: (sales: Sale[]) => number;
|
|
15
|
+
export declare const getTotalAmountTvaBackOnBill: (sales: Sale[]) => number;
|
|
16
|
+
export declare const getTotalAmountOnListBill: (bills: Bill[]) => number;
|
|
17
|
+
export declare const getTotalAmountTvaOnListBill: (bills: Bill[]) => number;
|
|
18
|
+
export declare const getTotalAmountWithoutTvaOnListBill: (bills: Bill[]) => number;
|
|
19
|
+
export declare const getTotalDueAmountOnListBill: (bills: Bill[]) => number;
|
package/lib/cjs/bill.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTotalDueAmountOnListBill = exports.getTotalAmountWithoutTvaOnListBill = exports.getTotalAmountTvaOnListBill = exports.getTotalAmountOnListBill = exports.getTotalAmountTvaBackOnBill = exports.getTotalAmountTvaOnBill = exports.getTotalAmountAllIncludedOnBill = exports.getTotalAmountWithoutTvaBackOnBill = exports.getTotalAmountWithoutTvaOnBill = exports.getTotalQtityFreeOnBill = exports.getTotalQtityOnBill = exports.getTotalTvaBackOnBill = exports.getTotalAmountBackOnBill = exports.getTotalAmountOnBill = exports.getTotalTvaOnBill = exports.getNbFreezeOnBill = exports.getNbPackagesOnBill = exports.getNbProductsOnBill = void 0;
|
|
4
|
+
const sale_1 = require("./sale");
|
|
5
|
+
const getNbProductsOnBill = (sales) => {
|
|
6
|
+
return sales.reduce((prev, sale) => prev + +(0, sale_1.getNbProductsOnSale)(sale), 0);
|
|
7
|
+
};
|
|
8
|
+
exports.getNbProductsOnBill = getNbProductsOnBill;
|
|
9
|
+
const getNbPackagesOnBill = (sales) => {
|
|
10
|
+
return sales.reduce((prev, sale) => prev + +sale.nbPackages, 0);
|
|
11
|
+
};
|
|
12
|
+
exports.getNbPackagesOnBill = getNbPackagesOnBill;
|
|
13
|
+
const getNbFreezeOnBill = (sales) => {
|
|
14
|
+
return sales.reduce((prev, sale) => prev + +sale.nbFreeze, 0);
|
|
15
|
+
};
|
|
16
|
+
exports.getNbFreezeOnBill = getNbFreezeOnBill;
|
|
17
|
+
const getTotalTvaOnBill = (sales) => {
|
|
18
|
+
if (!sales.length) {
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
return sales.reduce((prev, sale) => prev + (0, sale_1.getTotalTvaOnSale)(sale, true), 0);
|
|
22
|
+
};
|
|
23
|
+
exports.getTotalTvaOnBill = getTotalTvaOnBill;
|
|
24
|
+
const getTotalAmountOnBill = (sales) => {
|
|
25
|
+
return sales.reduce((prev, sale) => prev + (0, sale_1.getTotalAmountOnSale)(sale, true), 0);
|
|
26
|
+
};
|
|
27
|
+
exports.getTotalAmountOnBill = getTotalAmountOnBill;
|
|
28
|
+
const getTotalAmountBackOnBill = (sales) => {
|
|
29
|
+
return sales.reduce((prev, sale) => prev + (0, sale_1.getTotalAmountBackOnSale)(sale), 0);
|
|
30
|
+
};
|
|
31
|
+
exports.getTotalAmountBackOnBill = getTotalAmountBackOnBill;
|
|
32
|
+
const getTotalTvaBackOnBill = (sales) => {
|
|
33
|
+
return sales.reduce((prev, sale) => prev + (0, sale_1.getTotalTvaBackOnSale)(sale), 0);
|
|
34
|
+
};
|
|
35
|
+
exports.getTotalTvaBackOnBill = getTotalTvaBackOnBill;
|
|
36
|
+
const getTotalQtityOnBill = (sales) => {
|
|
37
|
+
return sales.reduce((prev, sale) => prev + (0, sale_1.getTotalQtityOnSale)(sale, true), 0);
|
|
38
|
+
};
|
|
39
|
+
exports.getTotalQtityOnBill = getTotalQtityOnBill;
|
|
40
|
+
const getTotalQtityFreeOnBill = (sales) => {
|
|
41
|
+
return sales.reduce((prev, sale) => prev + (0, sale_1.getTotalQtityFreeOnSale)(sale), 0);
|
|
42
|
+
};
|
|
43
|
+
exports.getTotalQtityFreeOnBill = getTotalQtityFreeOnBill;
|
|
44
|
+
const getTotalAmountWithoutTvaOnBill = (sales) => {
|
|
45
|
+
return sales.reduce((prev, sale) => prev + +(0, sale_1.getTotalAmountWithoutTvaOnSale)(sale, true), 0);
|
|
46
|
+
};
|
|
47
|
+
exports.getTotalAmountWithoutTvaOnBill = getTotalAmountWithoutTvaOnBill;
|
|
48
|
+
const getTotalAmountWithoutTvaBackOnBill = (sales) => {
|
|
49
|
+
return sales.reduce((prev, sale) => prev + +(0, sale_1.getTotalAmountWithoutTvaBackOnSale)(sale), 0);
|
|
50
|
+
};
|
|
51
|
+
exports.getTotalAmountWithoutTvaBackOnBill = getTotalAmountWithoutTvaBackOnBill;
|
|
52
|
+
const getTotalAmountAllIncludedOnBill = (sales) => {
|
|
53
|
+
return sales.reduce((prev, sale) => prev + +(0, sale_1.getTotalAmountAllIncludedOnSale)(sale, true), 0);
|
|
54
|
+
};
|
|
55
|
+
exports.getTotalAmountAllIncludedOnBill = getTotalAmountAllIncludedOnBill;
|
|
56
|
+
const getTotalAmountTvaOnBill = (sales) => {
|
|
57
|
+
return sales.reduce((prev, sale) => prev + +(0, sale_1.getTotalTvaOnSale)(sale, true), 0);
|
|
58
|
+
};
|
|
59
|
+
exports.getTotalAmountTvaOnBill = getTotalAmountTvaOnBill;
|
|
60
|
+
const getTotalAmountTvaBackOnBill = (sales) => {
|
|
61
|
+
return sales.reduce((prev, sale) => prev + +(0, sale_1.getTotalTvaBackOnSale)(sale), 0);
|
|
62
|
+
};
|
|
63
|
+
exports.getTotalAmountTvaBackOnBill = getTotalAmountTvaBackOnBill;
|
|
64
|
+
const getTotalAmountOnListBill = (bills) => {
|
|
65
|
+
return bills.reduce((prev, curr) => prev + +curr.totalAmount, 0);
|
|
66
|
+
};
|
|
67
|
+
exports.getTotalAmountOnListBill = getTotalAmountOnListBill;
|
|
68
|
+
const getTotalAmountTvaOnListBill = (bills) => {
|
|
69
|
+
return bills.reduce((prev, curr) => prev + +(0, exports.getTotalAmountTvaOnBill)(curr.sales), 0);
|
|
70
|
+
};
|
|
71
|
+
exports.getTotalAmountTvaOnListBill = getTotalAmountTvaOnListBill;
|
|
72
|
+
const getTotalAmountWithoutTvaOnListBill = (bills) => {
|
|
73
|
+
return bills.reduce((prev, curr) => prev + +(0, exports.getTotalAmountWithoutTvaOnBill)(curr.sales), 0);
|
|
74
|
+
};
|
|
75
|
+
exports.getTotalAmountWithoutTvaOnListBill = getTotalAmountWithoutTvaOnListBill;
|
|
76
|
+
const getTotalDueAmountOnListBill = (bills) => {
|
|
77
|
+
return bills.reduce((prev, curr) => prev + +curr.dueAmount, 0);
|
|
78
|
+
};
|
|
79
|
+
exports.getTotalDueAmountOnListBill = getTotalDueAmountOnListBill;
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import "./
|
|
1
|
+
import "./bill";
|
|
2
2
|
import "./pdfs/invoices/amountInvoice";
|
|
3
3
|
import "./pdfs/invoices/infoInvoice";
|
|
4
4
|
import "./pdfs/tools/tools";
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
import "./
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
export * from "./
|
|
5
|
+
import "./product";
|
|
6
|
+
import "./sale";
|
|
7
|
+
import "./typeorm";
|
|
8
|
+
import "./user";
|
|
9
|
+
import "./utils";
|
|
10
|
+
export * from "./bill";
|
|
11
11
|
export * from "./pdfs/invoices/amountInvoice";
|
|
12
12
|
export * from "./pdfs/invoices/infoInvoice";
|
|
13
13
|
export * from "./pdfs/tools/tools";
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
18
|
-
export * from "./
|
|
14
|
+
export * from "./product";
|
|
15
|
+
export * from "./sale";
|
|
16
|
+
export * from "./typeorm";
|
|
17
|
+
export * from "./user";
|
|
18
|
+
export * from "./utils";
|
package/lib/cjs/index.js
CHANGED
|
@@ -14,21 +14,21 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
require("./
|
|
17
|
+
require("./bill");
|
|
18
18
|
require("./pdfs/invoices/amountInvoice");
|
|
19
19
|
require("./pdfs/invoices/infoInvoice");
|
|
20
20
|
require("./pdfs/tools/tools");
|
|
21
|
-
require("./
|
|
22
|
-
require("./
|
|
23
|
-
require("./
|
|
24
|
-
require("./
|
|
25
|
-
require("./
|
|
26
|
-
__exportStar(require("./
|
|
21
|
+
require("./product");
|
|
22
|
+
require("./sale");
|
|
23
|
+
require("./typeorm");
|
|
24
|
+
require("./user");
|
|
25
|
+
require("./utils");
|
|
26
|
+
__exportStar(require("./bill"), exports);
|
|
27
27
|
__exportStar(require("./pdfs/invoices/amountInvoice"), exports);
|
|
28
28
|
__exportStar(require("./pdfs/invoices/infoInvoice"), exports);
|
|
29
29
|
__exportStar(require("./pdfs/tools/tools"), exports);
|
|
30
|
-
__exportStar(require("./
|
|
31
|
-
__exportStar(require("./
|
|
32
|
-
__exportStar(require("./
|
|
33
|
-
__exportStar(require("./
|
|
34
|
-
__exportStar(require("./
|
|
30
|
+
__exportStar(require("./product"), exports);
|
|
31
|
+
__exportStar(require("./sale"), exports);
|
|
32
|
+
__exportStar(require("./typeorm"), exports);
|
|
33
|
+
__exportStar(require("./user"), exports);
|
|
34
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -1,104 +1,112 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.infoAmountOnBill = exports.infoAmounOntSale = exports.infoAmountOnProforma = exports.infoAmountOnBl = void 0;
|
|
4
|
-
const bill_1 = require("../../
|
|
5
|
-
const sale_1 = require("../../
|
|
6
|
-
const
|
|
4
|
+
const bill_1 = require("../../bill");
|
|
5
|
+
const sale_1 = require("../../sale");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
7
|
const infoAmountOnBl = (tob) => {
|
|
8
|
-
const totalAmountWithoutTva =
|
|
8
|
+
const totalAmountWithoutTva = tob.isBack && (tob.backChoice.toLowerCase() === "autre" || tob.rejectedReason)
|
|
9
|
+
? 0
|
|
10
|
+
: (0, utils_1.formatToStringCfa)((0, sale_1.getTotalAmountWithoutTvaOnSale)(tob, true));
|
|
9
11
|
// const totalPort = formatToStringCfa(HlpSale.getTotalShipping(tob));
|
|
10
|
-
const totalTva = (0,
|
|
11
|
-
const totalAmountAllIncluded =
|
|
12
|
+
const totalTva = (0, utils_1.formatToStringCfa)((0, sale_1.getTotalTvaOnSale)(tob, true));
|
|
13
|
+
const totalAmountAllIncluded = tob.isBack && (tob.backChoice.toLowerCase() === "autre" || tob.rejectedReason)
|
|
14
|
+
? 0
|
|
15
|
+
: (0, utils_1.formatToStringCfa)((0, sale_1.getTotalAmountAllIncludedOnSale)(tob, true));
|
|
12
16
|
const tabFooter = {
|
|
13
|
-
width:
|
|
17
|
+
width: "50%",
|
|
14
18
|
table: {
|
|
15
19
|
headerRows: 1,
|
|
16
20
|
// widths: [ 100, 100, 100, 100 ],
|
|
17
|
-
widths: [
|
|
21
|
+
widths: ["*", "*", "*", "*"],
|
|
18
22
|
heights: [6],
|
|
19
23
|
body: [
|
|
20
24
|
[
|
|
21
|
-
{ text:
|
|
25
|
+
{ text: "TOTAL HT", style: "headerText" },
|
|
22
26
|
// {text: 'PORT HT', style: 'headerText'},
|
|
23
|
-
{ text:
|
|
24
|
-
{ text:
|
|
25
|
-
{ text:
|
|
27
|
+
{ text: "TOTAL TVA", style: "headerText" },
|
|
28
|
+
{ text: "TOTAL TTC", style: "headerText" },
|
|
29
|
+
{ text: "NET A PAYER", style: "headerText" },
|
|
26
30
|
],
|
|
27
31
|
[
|
|
28
|
-
{ text: totalAmountWithoutTva, style:
|
|
32
|
+
{ text: totalAmountWithoutTva, style: "rowText", alignment: "center" },
|
|
29
33
|
// { text: totalPort, style: 'rowText', alignment: 'center' },
|
|
30
|
-
{ text: totalTva, style:
|
|
31
|
-
{ text: totalAmountAllIncluded, style:
|
|
32
|
-
{ text: totalAmountAllIncluded, style:
|
|
33
|
-
]
|
|
34
|
-
]
|
|
35
|
-
}
|
|
34
|
+
{ text: totalTva, style: "rowText", alignment: "center" },
|
|
35
|
+
{ text: totalAmountAllIncluded, style: "rowText", alignment: "center" },
|
|
36
|
+
{ text: totalAmountAllIncluded, style: "rowText", alignment: "center" },
|
|
37
|
+
],
|
|
38
|
+
],
|
|
39
|
+
},
|
|
36
40
|
};
|
|
37
41
|
return tabFooter;
|
|
38
42
|
};
|
|
39
43
|
exports.infoAmountOnBl = infoAmountOnBl;
|
|
40
44
|
const infoAmountOnProforma = (tob) => {
|
|
41
|
-
const totalAmountWithoutTva =
|
|
45
|
+
const totalAmountWithoutTva = tob.isBack && tob.backChoice.toLowerCase() === "autre" ? 0 : (0, utils_1.formatToStringCfa)((0, sale_1.getTotalAmountWithoutTvaOnSale)(tob));
|
|
42
46
|
// const totalPort = formatToStringCfa(HlpSale.getTotalShipping(tob));
|
|
43
|
-
const totalTva = (0,
|
|
44
|
-
const totalAmountAllIncluded =
|
|
47
|
+
const totalTva = (0, utils_1.formatToStringCfa)((0, sale_1.getTotalTvaOnSale)(tob));
|
|
48
|
+
const totalAmountAllIncluded = tob.isBack && tob.backChoice.toLowerCase() === "autre" ? 0 : (0, utils_1.formatToStringCfa)((0, sale_1.getTotalAmountAllIncludedOnSale)(tob));
|
|
45
49
|
const tabFooter = {
|
|
46
|
-
width:
|
|
50
|
+
width: "50%",
|
|
47
51
|
table: {
|
|
48
52
|
headerRows: 1,
|
|
49
53
|
// widths: [ 100, 100, 100, 100 ],
|
|
50
|
-
widths: [
|
|
54
|
+
widths: ["*", "*", "*", "*"],
|
|
51
55
|
heights: [6],
|
|
52
56
|
body: [
|
|
53
57
|
[
|
|
54
|
-
{ text:
|
|
58
|
+
{ text: "TOTAL HT", style: "headerText" },
|
|
55
59
|
// {text: 'PORT HT', style: 'headerText'},
|
|
56
|
-
{ text:
|
|
57
|
-
{ text:
|
|
58
|
-
{ text:
|
|
60
|
+
{ text: "TOTAL TVA", style: "headerText" },
|
|
61
|
+
{ text: "TOTAL TTC", style: "headerText" },
|
|
62
|
+
{ text: "NET A PAYER", style: "headerText" },
|
|
59
63
|
],
|
|
60
64
|
[
|
|
61
|
-
{ text: totalAmountWithoutTva, style:
|
|
65
|
+
{ text: totalAmountWithoutTva, style: "rowText", alignment: "center" },
|
|
62
66
|
// { text: totalPort, style: 'rowText', alignment: 'center' },
|
|
63
|
-
{ text: totalTva, style:
|
|
64
|
-
{ text: totalAmountAllIncluded, style:
|
|
65
|
-
{ text: totalAmountAllIncluded, style:
|
|
66
|
-
]
|
|
67
|
-
]
|
|
68
|
-
}
|
|
67
|
+
{ text: totalTva, style: "rowText", alignment: "center" },
|
|
68
|
+
{ text: totalAmountAllIncluded, style: "rowText", alignment: "center" },
|
|
69
|
+
{ text: totalAmountAllIncluded, style: "rowText", alignment: "center" },
|
|
70
|
+
],
|
|
71
|
+
],
|
|
72
|
+
},
|
|
69
73
|
};
|
|
70
74
|
return tabFooter;
|
|
71
75
|
};
|
|
72
76
|
exports.infoAmountOnProforma = infoAmountOnProforma;
|
|
73
77
|
const infoAmounOntSale = (tob) => {
|
|
74
|
-
const totalAmountWithoutTva =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
+
const totalAmountWithoutTva = tob.isBack && (tob.backChoice.toLowerCase() === "autre" || tob.rejectedReason)
|
|
79
|
+
? 0
|
|
80
|
+
: (0, utils_1.formatToStringCfa)((0, sale_1.getTotalAmountWithoutTvaOnSale)(tob, true));
|
|
81
|
+
const totalPort = (0, utils_1.formatToStringCfa)((0, sale_1.getTotalShippingOnSale)(tob));
|
|
82
|
+
const totalTva = (0, utils_1.formatToStringCfa)((0, sale_1.getTotalTvaOnSale)(tob, true));
|
|
83
|
+
const totalAmountAllIncluded = tob.isBack && (tob.backChoice.toLowerCase() === "autre" || tob.rejectedReason)
|
|
84
|
+
? 0
|
|
85
|
+
: (0, utils_1.formatToStringCfa)((0, sale_1.getTotalAmountAllIncludedOnSale)(tob, true));
|
|
78
86
|
const tabFooter = {
|
|
79
|
-
width:
|
|
87
|
+
width: "50%",
|
|
80
88
|
table: {
|
|
81
89
|
headerRows: 1,
|
|
82
90
|
// widths: [ 100, 100, 100, 100 ],
|
|
83
|
-
widths: [
|
|
91
|
+
widths: ["*", "*", "*", "*", "*"],
|
|
84
92
|
heights: [6],
|
|
85
93
|
body: [
|
|
86
94
|
[
|
|
87
|
-
{ text:
|
|
88
|
-
{ text:
|
|
89
|
-
{ text:
|
|
90
|
-
{ text:
|
|
91
|
-
{ text:
|
|
95
|
+
{ text: "TOTAL HT", style: "headerText" },
|
|
96
|
+
{ text: "PORT HT", style: "headerText" },
|
|
97
|
+
{ text: "TOTAL TVA", style: "headerText" },
|
|
98
|
+
{ text: "TOTAL TTC", style: "headerText" },
|
|
99
|
+
{ text: "NET A PAYER", style: "headerText" },
|
|
92
100
|
],
|
|
93
101
|
[
|
|
94
|
-
{ text: totalAmountWithoutTva, style:
|
|
95
|
-
{ text: totalPort, style:
|
|
96
|
-
{ text: totalTva, style:
|
|
97
|
-
{ text: totalAmountAllIncluded, style:
|
|
98
|
-
{ text: totalAmountAllIncluded, style:
|
|
99
|
-
]
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
+
{ text: totalAmountWithoutTva, style: "rowText", alignment: "center" },
|
|
103
|
+
{ text: totalPort, style: "rowText", alignment: "center" },
|
|
104
|
+
{ text: totalTva, style: "rowText", alignment: "center" },
|
|
105
|
+
{ text: totalAmountAllIncluded, style: "rowText", alignment: "center" },
|
|
106
|
+
{ text: totalAmountAllIncluded, style: "rowText", alignment: "center" },
|
|
107
|
+
],
|
|
108
|
+
],
|
|
109
|
+
},
|
|
102
110
|
};
|
|
103
111
|
return tabFooter;
|
|
104
112
|
};
|
|
@@ -108,36 +116,36 @@ const infoAmountOnBill = (tob) => {
|
|
|
108
116
|
const totalAmountWithoutTvaAllAndBack = (0, bill_1.getTotalAmountWithoutTvaOnBill)(tob.sales);
|
|
109
117
|
const totalAmountTvaAllAndBack = (0, bill_1.getTotalAmountTvaOnBill)(tob.sales);
|
|
110
118
|
// const totalAmountWithoutTva = formatToStringCfa(HlpSale.getTotalAmountWithoutTvaOnBill(tob.sales));
|
|
111
|
-
const totalAmountWithoutTva = (0,
|
|
119
|
+
const totalAmountWithoutTva = (0, utils_1.formatToStringCfa)(totalAmountWithoutTvaAllAndBack);
|
|
112
120
|
// const totalPort = formatToStringCfa(HlpSale.getTotalShipping(tob));
|
|
113
|
-
const totalTva = (0,
|
|
121
|
+
const totalTva = (0, utils_1.formatToStringCfa)(totalAmountTvaAllAndBack);
|
|
114
122
|
// const totalTva = formatToStringCfa(HlpSale.getTotalAmountTvaOnBill(tob.sales));
|
|
115
123
|
// const totalAmountAllIncluded = formatToStringCfa(HlpSale.getTotalAmountOnBill(tob.sales));
|
|
116
|
-
const totalAmountAllIncluded = (0,
|
|
124
|
+
const totalAmountAllIncluded = (0, utils_1.formatToStringCfa)(totalAmountAllAndBackInclused);
|
|
117
125
|
const tabFooter = {
|
|
118
|
-
width:
|
|
126
|
+
width: "50%",
|
|
119
127
|
table: {
|
|
120
128
|
headerRows: 1,
|
|
121
129
|
// widths: [ 100, 100, 100, 100 ],
|
|
122
|
-
widths: [
|
|
130
|
+
widths: ["*", "*", "*", "*"],
|
|
123
131
|
heights: [6],
|
|
124
132
|
body: [
|
|
125
133
|
[
|
|
126
|
-
{ text:
|
|
134
|
+
{ text: "TOTAL HT", style: "headerText" },
|
|
127
135
|
// {text: 'PORT HT', style: 'headerText'},
|
|
128
|
-
{ text:
|
|
129
|
-
{ text:
|
|
130
|
-
{ text:
|
|
136
|
+
{ text: "TOTAL TVA", style: "headerText" },
|
|
137
|
+
{ text: "TOTAL TTC", style: "headerText" },
|
|
138
|
+
{ text: "NET A PAYER", style: "headerText" },
|
|
131
139
|
],
|
|
132
140
|
[
|
|
133
|
-
{ text: totalAmountWithoutTva, style:
|
|
141
|
+
{ text: totalAmountWithoutTva, style: "rowText", alignment: "center" },
|
|
134
142
|
// { text: totalPort, style: 'rowText', alignment: 'center' },
|
|
135
|
-
{ text: totalTva, style:
|
|
136
|
-
{ text: totalAmountAllIncluded, style:
|
|
137
|
-
{ text: totalAmountAllIncluded, style:
|
|
138
|
-
]
|
|
139
|
-
]
|
|
140
|
-
}
|
|
143
|
+
{ text: totalTva, style: "rowText", alignment: "center" },
|
|
144
|
+
{ text: totalAmountAllIncluded, style: "rowText", alignment: "center" },
|
|
145
|
+
{ text: totalAmountAllIncluded, style: "rowText", alignment: "center" },
|
|
146
|
+
],
|
|
147
|
+
],
|
|
148
|
+
},
|
|
141
149
|
};
|
|
142
150
|
return tabFooter;
|
|
143
151
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.infoBill = exports.infoSale = void 0;
|
|
4
|
-
const bill_1 = require("../../
|
|
5
|
-
const sale_1 = require("../../
|
|
6
|
-
const
|
|
4
|
+
const bill_1 = require("../../bill");
|
|
5
|
+
const sale_1 = require("../../sale");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
7
|
const infoSale = (tob) => {
|
|
8
8
|
const totalQtity = (0, sale_1.getTotalQtityOnSale)(tob);
|
|
9
9
|
const nbProducts = (0, sale_1.getNbProductsOnSale)(tob);
|
|
@@ -11,31 +11,31 @@ const infoSale = (tob) => {
|
|
|
11
11
|
const nbFreeze = tob.nbFreeze;
|
|
12
12
|
// const oWidth = [ '*', '*', 75, 75, 75, 75];
|
|
13
13
|
const tabTop = {
|
|
14
|
-
width:
|
|
14
|
+
width: "50%",
|
|
15
15
|
table: {
|
|
16
16
|
headerRows: 1,
|
|
17
|
-
widths: [
|
|
17
|
+
widths: ["*", "*", 75, 75, 75, 75],
|
|
18
18
|
heights: [6],
|
|
19
19
|
body: [
|
|
20
20
|
[
|
|
21
|
-
{ text:
|
|
22
|
-
{ text:
|
|
23
|
-
{ text:
|
|
24
|
-
{ text:
|
|
25
|
-
{ text:
|
|
26
|
-
{ text:
|
|
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
27
|
],
|
|
28
28
|
[
|
|
29
|
-
{ text: tob.ref, style:
|
|
29
|
+
{ text: tob.ref, style: "rowText" },
|
|
30
30
|
// { text: moment(tob.createdAt ).format('DD/MM/YYYY'), style: 'rowText'},
|
|
31
|
-
{ text: (0,
|
|
32
|
-
{ text: nbProducts, style:
|
|
33
|
-
{ text: totalQtity, style:
|
|
34
|
-
{ text: nbColis, style:
|
|
35
|
-
{ text: nbFreeze, style:
|
|
36
|
-
]
|
|
37
|
-
]
|
|
38
|
-
}
|
|
31
|
+
{ text: (0, utils_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
39
|
};
|
|
40
40
|
return tabTop;
|
|
41
41
|
};
|
|
@@ -45,9 +45,9 @@ const infoBill = (tob) => {
|
|
|
45
45
|
const nbProducts = (0, bill_1.getNbProductsOnBill)(tob.sales);
|
|
46
46
|
const nbColis = (0, bill_1.getNbPackagesOnBill)(tob.sales);
|
|
47
47
|
const nbFreeze = (0, bill_1.getNbFreezeOnBill)(tob.sales);
|
|
48
|
-
const oWidth = [
|
|
48
|
+
const oWidth = ["*", "*", 75, 75, 75, 75];
|
|
49
49
|
const tabTop = {
|
|
50
|
-
width:
|
|
50
|
+
width: "50%",
|
|
51
51
|
table: {
|
|
52
52
|
headerRows: 1,
|
|
53
53
|
// widths: [ 125, 125, 125, '*' ],
|
|
@@ -56,24 +56,24 @@ const infoBill = (tob) => {
|
|
|
56
56
|
// widths: [ '16%', '16%', '16%', '16%' ],
|
|
57
57
|
body: [
|
|
58
58
|
[
|
|
59
|
-
{ text:
|
|
60
|
-
{ text:
|
|
61
|
-
{ text:
|
|
62
|
-
{ text:
|
|
63
|
-
{ text:
|
|
64
|
-
{ text:
|
|
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
65
|
],
|
|
66
66
|
[
|
|
67
|
-
{ text: tob.ref, style:
|
|
67
|
+
{ text: tob.ref, style: "rowText" },
|
|
68
68
|
// { text: moment(tob.createdAt ).format('DD/MM/YYYY'), style: 'rowText'},
|
|
69
|
-
{ text: (0,
|
|
70
|
-
{ text: nbProducts, style:
|
|
71
|
-
{ text: totalQtity, style:
|
|
72
|
-
{ text: nbColis, style:
|
|
73
|
-
{ text: nbFreeze, style:
|
|
74
|
-
]
|
|
75
|
-
]
|
|
76
|
-
}
|
|
69
|
+
{ text: (0, utils_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
77
|
};
|
|
78
78
|
return tabTop;
|
|
79
79
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.displayClient = exports.displayTitle = exports.displayPdfDate = void 0;
|
|
4
|
-
const user_1 = require("../../
|
|
5
|
-
const
|
|
4
|
+
const user_1 = require("../../user");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
6
|
const displayPdfDate = (label, fromDate, toDate) => {
|
|
7
|
-
fromDate =
|
|
8
|
-
toDate =
|
|
9
|
-
return label +
|
|
7
|
+
fromDate = !fromDate ? (0, utils_1.formatDateYmdHypen)(new Date()) : fromDate;
|
|
8
|
+
toDate = !toDate ? fromDate : toDate;
|
|
9
|
+
return label + " du " + (0, utils_1.convertEnDateToFr)(fromDate) + " au " + (0, utils_1.convertEnDateToFr)(toDate);
|
|
10
10
|
};
|
|
11
11
|
exports.displayPdfDate = displayPdfDate;
|
|
12
12
|
const displayTitle = (title) => {
|
|
13
13
|
return {
|
|
14
|
-
width:
|
|
15
|
-
alignment:
|
|
14
|
+
width: "100%",
|
|
15
|
+
alignment: "center",
|
|
16
16
|
text: title,
|
|
17
17
|
bold: true,
|
|
18
18
|
margin: [0, 10, 0, 10],
|
|
@@ -22,31 +22,31 @@ const displayTitle = (title) => {
|
|
|
22
22
|
exports.displayTitle = displayTitle;
|
|
23
23
|
const displayClient = (user) => {
|
|
24
24
|
// const clientSte = user.ste ? HlpUser.getSteShortname(user.ste) : '';
|
|
25
|
-
const clientSte = user.ste ? (0, user_1.getSteShortname)(user.ste, [
|
|
25
|
+
const clientSte = user.ste ? (0, user_1.getSteShortname)(user.ste, ["pharmacie", "clinique", "hopital"]) : "";
|
|
26
26
|
/* const clientLastname = (user.lastname) ? user.lastname : '';
|
|
27
27
|
const clientFirstname = (user.firstname) ? user.firstname : '';
|
|
28
28
|
const clientGender = (user.gender) ? user.gender.abr : ''; */
|
|
29
29
|
const clientName = user.ste ? clientSte : user.fullname;
|
|
30
|
-
const cp = user.cp ? user.cp :
|
|
31
|
-
const city = user.city ? user.city :
|
|
32
|
-
const nif = user.ste.nif ? user.ste.nif :
|
|
33
|
-
const address = user.address ? user.address :
|
|
30
|
+
const cp = user.cp ? user.cp : "";
|
|
31
|
+
const city = user.city ? user.city : "";
|
|
32
|
+
const nif = user.ste.nif ? user.ste.nif : "";
|
|
33
|
+
const address = user.address ? user.address : "";
|
|
34
34
|
const client = {
|
|
35
35
|
absolutePosition: { x: 310, y: 30 },
|
|
36
36
|
text: [
|
|
37
|
-
{ text:
|
|
38
|
-
{ text: user.username +
|
|
39
|
-
{ text: clientName +
|
|
40
|
-
{ text: address +
|
|
41
|
-
{ text: cp +
|
|
42
|
-
{ text: city +
|
|
37
|
+
{ text: "CLIENT: ", fontSize: 8 },
|
|
38
|
+
{ text: user.username + "\n", bold: true, fontSize: 10 },
|
|
39
|
+
{ text: clientName + "\n" },
|
|
40
|
+
{ text: address + " " },
|
|
41
|
+
{ text: cp + "\n" },
|
|
42
|
+
{ text: city + "\n" },
|
|
43
43
|
// {text: nif + '\n'}
|
|
44
44
|
],
|
|
45
|
-
color:
|
|
46
|
-
width:
|
|
45
|
+
color: "#000",
|
|
46
|
+
width: "auto",
|
|
47
47
|
fontSize: 12,
|
|
48
48
|
bold: true,
|
|
49
|
-
alignment:
|
|
49
|
+
alignment: "left",
|
|
50
50
|
// margin: [100, 0, 0, 0],
|
|
51
51
|
};
|
|
52
52
|
return client;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.productCatCode = exports.unitPriceByClientCat = void 0;
|
|
4
|
+
const user_1 = require("./user");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
const unitPriceByClientCat = (product, client, speUnitPrice = 0, addDiscount = false) => {
|
|
7
|
+
if (speUnitPrice > 0) {
|
|
8
|
+
return speUnitPrice;
|
|
9
|
+
}
|
|
10
|
+
// const store = await getCustomRepository(ProductStoreRepository).getOneStoreByParams({storeName: 'cpa', productId: product.id})
|
|
11
|
+
if (product.stores[0].discountRate && addDiscount) {
|
|
12
|
+
return Math.ceil(product.stores[0].salePrice) - Math.ceil((0, utils_1.calculPercent)(product.stores[0].salePrice, product.stores[0].discountRate));
|
|
13
|
+
}
|
|
14
|
+
const clientCoef = !client ? 1 : (0, user_1.userCoef)(client);
|
|
15
|
+
return (0, exports.productCatCode)(product, ["spe", "para"])
|
|
16
|
+
? Math.ceil(product.stores[0].salePrice)
|
|
17
|
+
: Math.ceil(product.stores[0].salePrice * clientCoef);
|
|
18
|
+
};
|
|
19
|
+
exports.unitPriceByClientCat = unitPriceByClientCat;
|
|
20
|
+
const productCatCode = (product, catCodes) => {
|
|
21
|
+
return catCodes.includes(product.cat.code && product.cat.code.toLowerCase());
|
|
22
|
+
};
|
|
23
|
+
exports.productCatCode = productCatCode;
|