asv-hlps 1.0.35 → 1.0.38
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/index.d.ts +12 -3
- package/lib/cjs/index.js +12 -3
- 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 +54 -0
- package/lib/cjs/products/product.d.ts +3 -0
- package/lib/cjs/products/product.js +23 -0
- package/lib/cjs/sales/sale.d.ts +18 -0
- package/lib/cjs/sales/sale.js +124 -1
- package/lib/esm/bills/bill.d.ts +19 -0
- package/lib/esm/bills/bill.js +58 -0
- package/lib/esm/index.d.ts +12 -3
- package/lib/esm/index.js +12 -3
- 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 +32 -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 +48 -0
- package/lib/esm/products/product.d.ts +3 -0
- package/lib/esm/products/product.js +18 -0
- package/lib/esm/sales/sale.d.ts +18 -0
- package/lib/esm/sales/sale.js +107 -1
- 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;
|
|
@@ -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("../sales/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,7 +1,16 @@
|
|
|
1
|
-
import './
|
|
2
|
-
import './
|
|
3
|
-
import './
|
|
1
|
+
import './bills/bill';
|
|
2
|
+
import './pdfs/invoices/amountInvoice';
|
|
3
|
+
import './pdfs/invoices/infoInvoice';
|
|
4
|
+
import './pdfs/tools/tools';
|
|
5
|
+
import './products/product';
|
|
4
6
|
import './sales/sale';
|
|
7
|
+
import './users/user';
|
|
8
|
+
import './utils/shared';
|
|
9
|
+
export * from './bills/bill';
|
|
10
|
+
export * from './pdfs/invoices/amountInvoice';
|
|
11
|
+
export * from './pdfs/invoices/infoInvoice';
|
|
12
|
+
export * from './pdfs/tools/tools';
|
|
13
|
+
export * from './products/product';
|
|
5
14
|
export * from './users/user';
|
|
6
15
|
export * from './utils/shared';
|
|
7
16
|
export * from './sales/sale';
|
package/lib/cjs/index.js
CHANGED
|
@@ -14,10 +14,19 @@ 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("./
|
|
18
|
-
require("./
|
|
19
|
-
require("./
|
|
17
|
+
require("./bills/bill");
|
|
18
|
+
require("./pdfs/invoices/amountInvoice");
|
|
19
|
+
require("./pdfs/invoices/infoInvoice");
|
|
20
|
+
require("./pdfs/tools/tools");
|
|
21
|
+
require("./products/product");
|
|
20
22
|
require("./sales/sale");
|
|
23
|
+
require("./users/user");
|
|
24
|
+
require("./utils/shared");
|
|
25
|
+
__exportStar(require("./bills/bill"), exports);
|
|
26
|
+
__exportStar(require("./pdfs/invoices/amountInvoice"), exports);
|
|
27
|
+
__exportStar(require("./pdfs/invoices/infoInvoice"), exports);
|
|
28
|
+
__exportStar(require("./pdfs/tools/tools"), exports);
|
|
29
|
+
__exportStar(require("./products/product"), exports);
|
|
21
30
|
__exportStar(require("./users/user"), exports);
|
|
22
31
|
__exportStar(require("./utils/shared"), exports);
|
|
23
32
|
__exportStar(require("./sales/sale"), exports);
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.infoAmountOnBill = exports.infoAmounOntSale = exports.infoAmountOnProforma = exports.infoAmountOnBl = void 0;
|
|
4
|
+
const bill_1 = require("../../bills/bill");
|
|
5
|
+
const sale_1 = require("../../sales/sale");
|
|
6
|
+
const shared_1 = require("../../utils/shared");
|
|
7
|
+
const infoAmountOnBl = (tob) => {
|
|
8
|
+
const totalAmountWithoutTva = (tob.isBack && (tob.backChoice.toLowerCase() === 'autre' || tob.rejectedReason)) ? 0 : (0, shared_1.formatToStringCfa)((0, sale_1.getTotalAmountWithoutTvaOnSale)(tob, true));
|
|
9
|
+
// const totalPort = formatToStringCfa(HlpSale.getTotalShipping(tob));
|
|
10
|
+
const totalTva = (0, shared_1.formatToStringCfa)((0, sale_1.getTotalTvaOnSale)(tob, true));
|
|
11
|
+
const totalAmountAllIncluded = (tob.isBack && (tob.backChoice.toLowerCase() === 'autre' || tob.rejectedReason)) ? 0 : (0, shared_1.formatToStringCfa)((0, sale_1.getTotalAmountAllIncludedOnSale)(tob, true));
|
|
12
|
+
const tabFooter = {
|
|
13
|
+
width: '50%',
|
|
14
|
+
table: {
|
|
15
|
+
headerRows: 1,
|
|
16
|
+
// widths: [ 100, 100, 100, 100 ],
|
|
17
|
+
widths: ['*', '*', '*', '*'],
|
|
18
|
+
heights: [6],
|
|
19
|
+
body: [
|
|
20
|
+
[
|
|
21
|
+
{ text: 'TOTAL HT', style: 'headerText' },
|
|
22
|
+
// {text: 'PORT HT', style: 'headerText'},
|
|
23
|
+
{ text: 'TOTAL TVA', style: 'headerText' },
|
|
24
|
+
{ text: 'TOTAL TTC', style: 'headerText' },
|
|
25
|
+
{ text: 'NET A PAYER', style: 'headerText' }
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
{ text: totalAmountWithoutTva, style: 'rowText', alignment: 'center' },
|
|
29
|
+
// { text: totalPort, style: 'rowText', alignment: 'center' },
|
|
30
|
+
{ text: totalTva, style: 'rowText', alignment: 'center' },
|
|
31
|
+
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
|
32
|
+
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
|
33
|
+
]
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return tabFooter;
|
|
38
|
+
};
|
|
39
|
+
exports.infoAmountOnBl = infoAmountOnBl;
|
|
40
|
+
const infoAmountOnProforma = (tob) => {
|
|
41
|
+
const totalAmountWithoutTva = (tob.isBack && tob.backChoice.toLowerCase() === 'autre') ? 0 : (0, shared_1.formatToStringCfa)((0, sale_1.getTotalAmountWithoutTvaOnSale)(tob));
|
|
42
|
+
// const totalPort = formatToStringCfa(HlpSale.getTotalShipping(tob));
|
|
43
|
+
const totalTva = (0, shared_1.formatToStringCfa)((0, sale_1.getTotalTvaOnSale)(tob));
|
|
44
|
+
const totalAmountAllIncluded = (tob.isBack && tob.backChoice.toLowerCase() === 'autre') ? 0 : (0, shared_1.formatToStringCfa)((0, sale_1.getTotalAmountAllIncludedOnSale)(tob));
|
|
45
|
+
const tabFooter = {
|
|
46
|
+
width: '50%',
|
|
47
|
+
table: {
|
|
48
|
+
headerRows: 1,
|
|
49
|
+
// widths: [ 100, 100, 100, 100 ],
|
|
50
|
+
widths: ['*', '*', '*', '*'],
|
|
51
|
+
heights: [6],
|
|
52
|
+
body: [
|
|
53
|
+
[
|
|
54
|
+
{ text: 'TOTAL HT', style: 'headerText' },
|
|
55
|
+
// {text: 'PORT HT', style: 'headerText'},
|
|
56
|
+
{ text: 'TOTAL TVA', style: 'headerText' },
|
|
57
|
+
{ text: 'TOTAL TTC', style: 'headerText' },
|
|
58
|
+
{ text: 'NET A PAYER', style: 'headerText' }
|
|
59
|
+
],
|
|
60
|
+
[
|
|
61
|
+
{ text: totalAmountWithoutTva, style: 'rowText', alignment: 'center' },
|
|
62
|
+
// { text: totalPort, style: 'rowText', alignment: 'center' },
|
|
63
|
+
{ text: totalTva, style: 'rowText', alignment: 'center' },
|
|
64
|
+
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
|
65
|
+
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
|
66
|
+
]
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
return tabFooter;
|
|
71
|
+
};
|
|
72
|
+
exports.infoAmountOnProforma = infoAmountOnProforma;
|
|
73
|
+
const infoAmounOntSale = (tob) => {
|
|
74
|
+
const totalAmountWithoutTva = (tob.isBack && (tob.backChoice.toLowerCase() === 'autre' || tob.rejectedReason)) ? 0 : (0, shared_1.formatToStringCfa)((0, sale_1.getTotalAmountWithoutTvaOnSale)(tob, true));
|
|
75
|
+
const totalPort = (0, shared_1.formatToStringCfa)((0, sale_1.getTotalShippingOnSale)(tob));
|
|
76
|
+
const totalTva = (0, shared_1.formatToStringCfa)((0, sale_1.getTotalTvaOnSale)(tob, true));
|
|
77
|
+
const totalAmountAllIncluded = (tob.isBack && (tob.backChoice.toLowerCase() === 'autre' || tob.rejectedReason)) ? 0 : (0, shared_1.formatToStringCfa)((0, sale_1.getTotalAmountAllIncludedOnSale)(tob, true));
|
|
78
|
+
const tabFooter = {
|
|
79
|
+
width: '50%',
|
|
80
|
+
table: {
|
|
81
|
+
headerRows: 1,
|
|
82
|
+
// widths: [ 100, 100, 100, 100 ],
|
|
83
|
+
widths: ['*', '*', '*', '*', '*'],
|
|
84
|
+
heights: [6],
|
|
85
|
+
body: [
|
|
86
|
+
[
|
|
87
|
+
{ text: 'TOTAL HT', style: 'headerText' },
|
|
88
|
+
{ text: 'PORT HT', style: 'headerText' },
|
|
89
|
+
{ text: 'TOTAL TVA', style: 'headerText' },
|
|
90
|
+
{ text: 'TOTAL TTC', style: 'headerText' },
|
|
91
|
+
{ text: 'NET A PAYER', style: 'headerText' }
|
|
92
|
+
],
|
|
93
|
+
[
|
|
94
|
+
{ text: totalAmountWithoutTva, style: 'rowText', alignment: 'center' },
|
|
95
|
+
{ text: totalPort, style: 'rowText', alignment: 'center' },
|
|
96
|
+
{ text: totalTva, style: 'rowText', alignment: 'center' },
|
|
97
|
+
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
|
98
|
+
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
|
99
|
+
]
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
return tabFooter;
|
|
104
|
+
};
|
|
105
|
+
exports.infoAmounOntSale = infoAmounOntSale;
|
|
106
|
+
const infoAmountOnBill = (tob) => {
|
|
107
|
+
const totalAmountAllAndBackInclused = (0, bill_1.getTotalAmountAllIncludedOnBill)(tob.sales);
|
|
108
|
+
const totalAmountWithoutTvaAllAndBack = (0, bill_1.getTotalAmountWithoutTvaOnBill)(tob.sales);
|
|
109
|
+
const totalAmountTvaAllAndBack = (0, bill_1.getTotalAmountTvaOnBill)(tob.sales);
|
|
110
|
+
// const totalAmountWithoutTva = formatToStringCfa(HlpSale.getTotalAmountWithoutTvaOnBill(tob.sales));
|
|
111
|
+
const totalAmountWithoutTva = (0, shared_1.formatToStringCfa)(totalAmountWithoutTvaAllAndBack);
|
|
112
|
+
// const totalPort = formatToStringCfa(HlpSale.getTotalShipping(tob));
|
|
113
|
+
const totalTva = (0, shared_1.formatToStringCfa)(totalAmountTvaAllAndBack);
|
|
114
|
+
// const totalTva = formatToStringCfa(HlpSale.getTotalAmountTvaOnBill(tob.sales));
|
|
115
|
+
// const totalAmountAllIncluded = formatToStringCfa(HlpSale.getTotalAmountOnBill(tob.sales));
|
|
116
|
+
const totalAmountAllIncluded = (0, shared_1.formatToStringCfa)(totalAmountAllAndBackInclused);
|
|
117
|
+
const tabFooter = {
|
|
118
|
+
width: '50%',
|
|
119
|
+
table: {
|
|
120
|
+
headerRows: 1,
|
|
121
|
+
// widths: [ 100, 100, 100, 100 ],
|
|
122
|
+
widths: ['*', '*', '*', '*'],
|
|
123
|
+
heights: [6],
|
|
124
|
+
body: [
|
|
125
|
+
[
|
|
126
|
+
{ text: 'TOTAL HT', style: 'headerText' },
|
|
127
|
+
// {text: 'PORT HT', style: 'headerText'},
|
|
128
|
+
{ text: 'TOTAL TVA', style: 'headerText' },
|
|
129
|
+
{ text: 'TOTAL TTC', style: 'headerText' },
|
|
130
|
+
{ text: 'NET A PAYER', style: 'headerText' }
|
|
131
|
+
],
|
|
132
|
+
[
|
|
133
|
+
{ text: totalAmountWithoutTva, style: 'rowText', alignment: 'center' },
|
|
134
|
+
// { text: totalPort, style: 'rowText', alignment: 'center' },
|
|
135
|
+
{ text: totalTva, style: 'rowText', alignment: 'center' },
|
|
136
|
+
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
|
137
|
+
{ text: totalAmountAllIncluded, style: 'rowText', alignment: 'center' },
|
|
138
|
+
]
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
return tabFooter;
|
|
143
|
+
};
|
|
144
|
+
exports.infoAmountOnBill = infoAmountOnBill;
|
|
@@ -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 bill_1 = require("../../bills/bill");
|
|
5
|
+
const sale_1 = require("../../sales/sale");
|
|
6
|
+
const shared_1 = require("../../utils/shared");
|
|
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, shared_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, shared_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,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.displayClient = exports.displayTitle = exports.displayPdfDate = void 0;
|
|
4
|
+
const user_1 = require("../../users/user");
|
|
5
|
+
const shared_1 = require("../../utils/shared");
|
|
6
|
+
const displayPdfDate = (label, fromDate, toDate) => {
|
|
7
|
+
fromDate = (!fromDate) ? (0, shared_1.formatDateYmdHypen)(new Date()) : fromDate;
|
|
8
|
+
toDate = (!toDate) ? fromDate : toDate;
|
|
9
|
+
return label + ' du ' + (0, shared_1.convertEnDateToFr)(fromDate) + ' au ' + (0, shared_1.convertEnDateToFr)(toDate);
|
|
10
|
+
};
|
|
11
|
+
exports.displayPdfDate = displayPdfDate;
|
|
12
|
+
const displayTitle = (title) => {
|
|
13
|
+
return {
|
|
14
|
+
width: '100%',
|
|
15
|
+
alignment: 'center',
|
|
16
|
+
text: title,
|
|
17
|
+
bold: true,
|
|
18
|
+
margin: [0, 10, 0, 10],
|
|
19
|
+
fontSize: 15,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
exports.displayTitle = displayTitle;
|
|
23
|
+
const displayClient = (user) => {
|
|
24
|
+
// const clientSte = user.ste ? HlpUser.getSteShortname(user.ste) : '';
|
|
25
|
+
const clientSte = user.ste ? (0, user_1.getSteShortname)(user.ste, ['pharmacie', 'clinique', 'hopital']) : '';
|
|
26
|
+
/* const clientLastname = (user.lastname) ? user.lastname : '';
|
|
27
|
+
const clientFirstname = (user.firstname) ? user.firstname : '';
|
|
28
|
+
const clientGender = (user.gender) ? user.gender.abr : ''; */
|
|
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 : '';
|
|
34
|
+
const client = {
|
|
35
|
+
absolutePosition: { x: 310, y: 30 },
|
|
36
|
+
text: [
|
|
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
|
+
// {text: nif + '\n'}
|
|
44
|
+
],
|
|
45
|
+
color: '#000',
|
|
46
|
+
width: 'auto',
|
|
47
|
+
fontSize: 12,
|
|
48
|
+
bold: true,
|
|
49
|
+
alignment: 'left',
|
|
50
|
+
// margin: [100, 0, 0, 0],
|
|
51
|
+
};
|
|
52
|
+
return client;
|
|
53
|
+
};
|
|
54
|
+
exports.displayClient = displayClient;
|
|
@@ -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("../users/user");
|
|
5
|
+
const shared_1 = require("../utils/shared");
|
|
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, shared_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;
|
package/lib/cjs/sales/sale.d.ts
CHANGED
|
@@ -1 +1,19 @@
|
|
|
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[];
|
|
1
19
|
export declare const refSaleGenerator: () => string;
|