asv-hlps 1.4.19 → 1.4.21
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/pdfs/amountInvoice.js +19 -19
- package/lib/cjs/sales/sale.js +1 -1
- package/lib/cjs/utils.d.ts +2 -2
- package/lib/cjs/utils.js +19 -16
- package/lib/esm/pdfs/amountInvoice.js +20 -20
- package/lib/esm/sales/sale.js +2 -2
- package/lib/esm/utils.d.ts +2 -2
- package/lib/esm/utils.js +15 -12
- package/package.json +1 -1
|
@@ -7,12 +7,12 @@ const utils_1 = require("../utils");
|
|
|
7
7
|
const infoAmountOnBl = (tob) => {
|
|
8
8
|
const totalAmountWithoutTva = tob.isBack && (tob.backChoice.toLowerCase() === "autre" || tob.rejectedReason)
|
|
9
9
|
? 0
|
|
10
|
-
: (0, utils_1.
|
|
11
|
-
// const totalPort =
|
|
12
|
-
const totalTva = (0, utils_1.
|
|
10
|
+
: (0, utils_1.currencyFormatterCfa)((0, sale_1.getTotalAmountWithoutTvaOnSale)(tob, true));
|
|
11
|
+
// const totalPort = currencyFormatterCfa(HlpSale.getTotalShipping(tob));
|
|
12
|
+
const totalTva = (0, utils_1.currencyFormatterCfa)((0, sale_1.getTotalTvaOnSale)(tob, true));
|
|
13
13
|
const totalAmountAllIncluded = tob.isBack && (tob.backChoice.toLowerCase() === "autre" || tob.rejectedReason)
|
|
14
14
|
? 0
|
|
15
|
-
: (0, utils_1.
|
|
15
|
+
: (0, utils_1.currencyFormatterCfa)((0, sale_1.getTotalAmountAllIncludedOnSale)(tob, true));
|
|
16
16
|
const tabFooter = {
|
|
17
17
|
width: "50%",
|
|
18
18
|
table: {
|
|
@@ -42,10 +42,10 @@ const infoAmountOnBl = (tob) => {
|
|
|
42
42
|
};
|
|
43
43
|
exports.infoAmountOnBl = infoAmountOnBl;
|
|
44
44
|
const infoAmountOnProforma = (tob) => {
|
|
45
|
-
const totalAmountWithoutTva = tob.isBack && tob.backChoice.toLowerCase() === "autre" ? 0 : (0, utils_1.
|
|
46
|
-
// const totalPort =
|
|
47
|
-
const totalTva = (0, utils_1.
|
|
48
|
-
const totalAmountAllIncluded = tob.isBack && tob.backChoice.toLowerCase() === "autre" ? 0 : (0, utils_1.
|
|
45
|
+
const totalAmountWithoutTva = tob.isBack && tob.backChoice.toLowerCase() === "autre" ? 0 : (0, utils_1.currencyFormatterCfa)((0, sale_1.getTotalAmountWithoutTvaOnSale)(tob));
|
|
46
|
+
// const totalPort = currencyFormatterCfa(HlpSale.getTotalShipping(tob));
|
|
47
|
+
const totalTva = (0, utils_1.currencyFormatterCfa)((0, sale_1.getTotalTvaOnSale)(tob));
|
|
48
|
+
const totalAmountAllIncluded = tob.isBack && tob.backChoice.toLowerCase() === "autre" ? 0 : (0, utils_1.currencyFormatterCfa)((0, sale_1.getTotalAmountAllIncludedOnSale)(tob));
|
|
49
49
|
const tabFooter = {
|
|
50
50
|
width: "50%",
|
|
51
51
|
table: {
|
|
@@ -77,12 +77,12 @@ exports.infoAmountOnProforma = infoAmountOnProforma;
|
|
|
77
77
|
const infoAmounOntSale = (tob) => {
|
|
78
78
|
const totalAmountWithoutTva = tob.isBack && (tob.backChoice.toLowerCase() === "autre" || tob.rejectedReason)
|
|
79
79
|
? 0
|
|
80
|
-
: (0, utils_1.
|
|
81
|
-
const totalPort = (0, utils_1.
|
|
82
|
-
const totalTva = (0, utils_1.
|
|
80
|
+
: (0, utils_1.currencyFormatterCfa)((0, sale_1.getTotalAmountWithoutTvaOnSale)(tob, true));
|
|
81
|
+
const totalPort = (0, utils_1.currencyFormatterCfa)((0, sale_1.getTotalShippingOnSale)(tob));
|
|
82
|
+
const totalTva = (0, utils_1.currencyFormatterCfa)((0, sale_1.getTotalTvaOnSale)(tob, true));
|
|
83
83
|
const totalAmountAllIncluded = tob.isBack && (tob.backChoice.toLowerCase() === "autre" || tob.rejectedReason)
|
|
84
84
|
? 0
|
|
85
|
-
: (0, utils_1.
|
|
85
|
+
: (0, utils_1.currencyFormatterCfa)((0, sale_1.getTotalAmountAllIncludedOnSale)(tob, true));
|
|
86
86
|
const tabFooter = {
|
|
87
87
|
width: "50%",
|
|
88
88
|
table: {
|
|
@@ -115,13 +115,13 @@ const infoAmountOnBill = (tob) => {
|
|
|
115
115
|
const totalAmountAllAndBackInclused = (0, bill_1.getTotalAmountAllIncludedOnBill)(tob.sales);
|
|
116
116
|
const totalAmountWithoutTvaAllAndBack = (0, bill_1.getTotalAmountWithoutTvaOnBill)(tob.sales);
|
|
117
117
|
const totalAmountTvaAllAndBack = (0, bill_1.getTotalAmountTvaOnBill)(tob.sales);
|
|
118
|
-
// const totalAmountWithoutTva =
|
|
119
|
-
const totalAmountWithoutTva = (0, utils_1.
|
|
120
|
-
// const totalPort =
|
|
121
|
-
const totalTva = (0, utils_1.
|
|
122
|
-
// const totalTva =
|
|
123
|
-
// const totalAmountAllIncluded =
|
|
124
|
-
const totalAmountAllIncluded = (0, utils_1.
|
|
118
|
+
// const totalAmountWithoutTva = currencyFormatterCfa(HlpSale.getTotalAmountWithoutTvaOnBill(tob.sales));
|
|
119
|
+
const totalAmountWithoutTva = (0, utils_1.currencyFormatterCfa)(totalAmountWithoutTvaAllAndBack);
|
|
120
|
+
// const totalPort = currencyFormatterCfa(HlpSale.getTotalShipping(tob));
|
|
121
|
+
const totalTva = (0, utils_1.currencyFormatterCfa)(totalAmountTvaAllAndBack);
|
|
122
|
+
// const totalTva = currencyFormatterCfa(HlpSale.getTotalAmountTvaOnBill(tob.sales));
|
|
123
|
+
// const totalAmountAllIncluded = currencyFormatterCfa(HlpSale.getTotalAmountOnBill(tob.sales));
|
|
124
|
+
const totalAmountAllIncluded = (0, utils_1.currencyFormatterCfa)(totalAmountAllAndBackInclused);
|
|
125
125
|
const tabFooter = {
|
|
126
126
|
width: "50%",
|
|
127
127
|
table: {
|
package/lib/cjs/sales/sale.js
CHANGED
|
@@ -110,7 +110,7 @@ const tabLabel = (sale) => {
|
|
|
110
110
|
for (let j = 0; j < +sp.qtityDlvr + +sp.qtityFree; j++) {
|
|
111
111
|
const name = (0, user_1.labelSteName)(sale.client.ste);
|
|
112
112
|
const product = sp.product.designation;
|
|
113
|
-
const pp = (0, utils_1.
|
|
113
|
+
const pp = (0, utils_1.currencyFormatterCfa)(Math.ceil(sp.publicPrice));
|
|
114
114
|
const saleDate = (0, utils_1.dateFormatter)(sale.saleDate, "dmy", "/");
|
|
115
115
|
// const saleDate = formatDateYmd(sale.saleDate, '/');
|
|
116
116
|
// const saleDate = moment(sale.saleDate ).format('DD/MM/YYYY');
|
package/lib/cjs/utils.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const getRandomColor: (brightness: number) => string;
|
|
|
13
13
|
* @returns
|
|
14
14
|
*/
|
|
15
15
|
export declare const removeDuplicateObjects: (array: any[], property?: string) => any[];
|
|
16
|
+
export declare const removeDuplicateValues: (array: any[]) => any[];
|
|
16
17
|
export declare const duplicateObjects: (array: any[], property: string) => any[];
|
|
17
18
|
export declare const toObjectDate: (fromDate: any, toDate: string) => {
|
|
18
19
|
fromDate: any;
|
|
@@ -23,9 +24,7 @@ export declare const limitTo: (value: string, limit?: number, trail?: string) =>
|
|
|
23
24
|
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
24
25
|
export declare const wakeUp: (sleep: any) => void;
|
|
25
26
|
export declare const checkAuth: (auth?: boolean) => boolean;
|
|
26
|
-
export declare const formatToString: (val: number, separator?: string, currency?: string) => string;
|
|
27
27
|
export declare const currencyFormatter: (val: number, separator?: string, currency?: string) => string;
|
|
28
|
-
export declare const formatToStringCfa: (val: number) => string;
|
|
29
28
|
export declare const currencyFormatterCfa: (val: number) => string;
|
|
30
29
|
export declare const notInSequence: (arr: number[]) => number[];
|
|
31
30
|
export declare const sequencesToNumbers: (arr: any[]) => number[];
|
|
@@ -81,6 +80,7 @@ export declare const isBirthday: (birthDayDate: any) => boolean;
|
|
|
81
80
|
export declare const insertAtInArray: (array: any[], index: number, ...elements: any) => void;
|
|
82
81
|
export declare const randomInteger: (max: number) => number;
|
|
83
82
|
export declare const randomRgbColor: () => number[];
|
|
83
|
+
export declare const genRandomNumberArray: (nbSize: number) => number[];
|
|
84
84
|
export declare const randomHexColor: () => string;
|
|
85
85
|
export declare const randomHslColor: () => number[];
|
|
86
86
|
export declare const getArrayOfRandomColor: (length: number, type?: "hex" | "rgb" | "hsl") => string[];
|
package/lib/cjs/utils.js
CHANGED
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = exports.formatNgbDate = exports.getNbOfDaysBetweenTwoDates = exports.displayDateRangeFr = exports.reformatDates = exports.firstDayOfDate = exports.dateToString = exports.dateDiff = exports.dateNthWeek = exports.getNthWeek = exports.dateFormatter = exports.replaceSpacesWith = exports.replaceAllIn = exports.toPlural = exports.sesStorageGet = exports.sesStorageSet = exports.genSequenceRef = exports.refGenerator = exports.removeBackSlashOccurences = exports.stringifyFormatter = exports.removeString = exports.diffArraysByProp = exports.diffArraysByFunc = exports.deepClone = exports.findFirstSequenceMissing = exports.fillNumWithZero = exports.findSequencesMissing = exports.sequencesToNumbers = exports.notInSequence = exports.currencyFormatterCfa = exports.
|
|
7
|
-
exports.checkObjInArray = exports.arraySome = exports.winMaxHeight = exports.toggleProp = exports.roundLastNDigits = exports.removeParamKeyName = exports.countryIsoToFlag = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceTimes = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = exports.unCheckedAll =
|
|
6
|
+
exports.inputChecked = exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = exports.formatNgbDate = exports.getNbOfDaysBetweenTwoDates = exports.displayDateRangeFr = exports.reformatDates = exports.firstDayOfDate = exports.dateToString = exports.dateDiff = exports.dateNthWeek = exports.getNthWeek = exports.dateFormatter = exports.replaceSpacesWith = exports.replaceAllIn = exports.toPlural = exports.sesStorageGet = exports.sesStorageSet = exports.genSequenceRef = exports.refGenerator = exports.removeBackSlashOccurences = exports.stringifyFormatter = exports.removeString = exports.diffArraysByProp = exports.diffArraysByFunc = exports.deepClone = exports.findFirstSequenceMissing = exports.fillNumWithZero = exports.findSequencesMissing = exports.sequencesToNumbers = exports.notInSequence = exports.currencyFormatterCfa = exports.currencyFormatter = exports.checkAuth = exports.wakeUp = exports.sleep = exports.limitTo = exports.titleCase = exports.toObjectDate = exports.duplicateObjects = exports.removeDuplicateValues = exports.removeDuplicateObjects = exports.getRandomColor = exports.calPercent = exports.percentOf = exports.genDateMinutesStep = exports.formatDateFirstDayFr = exports.isEmpty = void 0;
|
|
7
|
+
exports.checkObjInArray = exports.arraySome = exports.winMaxHeight = exports.toggleProp = exports.roundLastNDigits = exports.removeParamKeyName = exports.countryIsoToFlag = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceTimes = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.genRandomNumberArray = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = exports.unCheckedAll = void 0;
|
|
8
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
9
|
const isSameOrBefore_1 = __importDefault(require("dayjs/plugin/isSameOrBefore"));
|
|
10
10
|
const relativeTime_1 = __importDefault(require("dayjs/plugin/relativeTime"));
|
|
@@ -135,6 +135,10 @@ const removeDuplicateObjects = (array, property = "id") => {
|
|
|
135
135
|
return unique; */
|
|
136
136
|
};
|
|
137
137
|
exports.removeDuplicateObjects = removeDuplicateObjects;
|
|
138
|
+
const removeDuplicateValues = (array) => {
|
|
139
|
+
return [...new Set(array)];
|
|
140
|
+
};
|
|
141
|
+
exports.removeDuplicateValues = removeDuplicateValues;
|
|
138
142
|
const duplicateObjects = (array, property) => {
|
|
139
143
|
return array.filter((obj, index) => array.findIndex((item) => lodash_1.default.get(item, property) === lodash_1.default.get(obj, property)) !== index);
|
|
140
144
|
};
|
|
@@ -174,23 +178,11 @@ const checkAuth = (auth = true) => {
|
|
|
174
178
|
return auth;
|
|
175
179
|
};
|
|
176
180
|
exports.checkAuth = checkAuth;
|
|
177
|
-
// -- to remove later
|
|
178
|
-
const formatToString = (val, separator = " ", currency = "") => {
|
|
179
|
-
// return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1,');
|
|
180
|
-
return String(val).replace(/(.)(?=(\d{3})+$)/g, "$1" + separator + "") + currency;
|
|
181
|
-
};
|
|
182
|
-
exports.formatToString = formatToString;
|
|
183
181
|
const currencyFormatter = (val, separator = " ", currency = "") => {
|
|
184
182
|
// return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1,');
|
|
185
183
|
return String(val).replace(/(.)(?=(\d{3})+$)/g, "$1" + separator + "") + currency;
|
|
186
184
|
};
|
|
187
185
|
exports.currencyFormatter = currencyFormatter;
|
|
188
|
-
// -- to remove later
|
|
189
|
-
const formatToStringCfa = (val) => {
|
|
190
|
-
// return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1 ') + ' CFA';
|
|
191
|
-
return (0, exports.formatToString)(val, " ", " FCFA");
|
|
192
|
-
};
|
|
193
|
-
exports.formatToStringCfa = formatToStringCfa;
|
|
194
186
|
const currencyFormatterCfa = (val) => {
|
|
195
187
|
// return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1 ') + ' CFA';
|
|
196
188
|
return (0, exports.currencyFormatter)(val, " ", " FCFA");
|
|
@@ -617,6 +609,17 @@ const randomRgbColor = () => {
|
|
|
617
609
|
return [r, g, b];
|
|
618
610
|
};
|
|
619
611
|
exports.randomRgbColor = randomRgbColor;
|
|
612
|
+
const genRandomNumberArray = (nbSize) => {
|
|
613
|
+
const numbers = [];
|
|
614
|
+
while (numbers.length < nbSize) {
|
|
615
|
+
const random = Math.floor(Math.random() * nbSize) + 1;
|
|
616
|
+
if (numbers.indexOf(random) === -1) {
|
|
617
|
+
numbers.push(random);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
return numbers;
|
|
621
|
+
};
|
|
622
|
+
exports.genRandomNumberArray = genRandomNumberArray;
|
|
620
623
|
const randomHexColor = () => {
|
|
621
624
|
let [r, g, b] = (0, exports.randomRgbColor)();
|
|
622
625
|
let hr = r.toString(16).padStart(2, "0");
|
|
@@ -725,9 +728,9 @@ const formatAmountToString = (amount, opt) => {
|
|
|
725
728
|
}
|
|
726
729
|
switch (opt === null || opt === void 0 ? void 0 : opt.currency) {
|
|
727
730
|
case "cfa":
|
|
728
|
-
return (0, exports.
|
|
731
|
+
return (0, exports.currencyFormatterCfa)(getAmount);
|
|
729
732
|
default:
|
|
730
|
-
return (0, exports.
|
|
733
|
+
return (0, exports.currencyFormatter)(getAmount);
|
|
731
734
|
}
|
|
732
735
|
};
|
|
733
736
|
exports.formatAmountToString = formatAmountToString;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { getTotalAmountAllIncludedOnBill, getTotalAmountTvaOnBill, getTotalAmountWithoutTvaOnBill } from "../bills/bill";
|
|
2
2
|
import { getTotalAmountAllIncludedOnSale, getTotalAmountWithoutTvaOnSale, getTotalShippingOnSale, getTotalTvaOnSale } from "../sales/sale";
|
|
3
|
-
import {
|
|
3
|
+
import { currencyFormatterCfa } from "../utils";
|
|
4
4
|
export const infoAmountOnBl = (tob) => {
|
|
5
5
|
const totalAmountWithoutTva = tob.isBack && (tob.backChoice.toLowerCase() === "autre" || tob.rejectedReason)
|
|
6
6
|
? 0
|
|
7
|
-
:
|
|
8
|
-
// const totalPort =
|
|
9
|
-
const totalTva =
|
|
7
|
+
: currencyFormatterCfa(getTotalAmountWithoutTvaOnSale(tob, true));
|
|
8
|
+
// const totalPort = currencyFormatterCfa(HlpSale.getTotalShipping(tob));
|
|
9
|
+
const totalTva = currencyFormatterCfa(getTotalTvaOnSale(tob, true));
|
|
10
10
|
const totalAmountAllIncluded = tob.isBack && (tob.backChoice.toLowerCase() === "autre" || tob.rejectedReason)
|
|
11
11
|
? 0
|
|
12
|
-
:
|
|
12
|
+
: currencyFormatterCfa(getTotalAmountAllIncludedOnSale(tob, true));
|
|
13
13
|
const tabFooter = {
|
|
14
14
|
width: "50%",
|
|
15
15
|
table: {
|
|
@@ -38,10 +38,10 @@ export const infoAmountOnBl = (tob) => {
|
|
|
38
38
|
return tabFooter;
|
|
39
39
|
};
|
|
40
40
|
export const infoAmountOnProforma = (tob) => {
|
|
41
|
-
const totalAmountWithoutTva = tob.isBack && tob.backChoice.toLowerCase() === "autre" ? 0 :
|
|
42
|
-
// const totalPort =
|
|
43
|
-
const totalTva =
|
|
44
|
-
const totalAmountAllIncluded = tob.isBack && tob.backChoice.toLowerCase() === "autre" ? 0 :
|
|
41
|
+
const totalAmountWithoutTva = tob.isBack && tob.backChoice.toLowerCase() === "autre" ? 0 : currencyFormatterCfa(getTotalAmountWithoutTvaOnSale(tob));
|
|
42
|
+
// const totalPort = currencyFormatterCfa(HlpSale.getTotalShipping(tob));
|
|
43
|
+
const totalTva = currencyFormatterCfa(getTotalTvaOnSale(tob));
|
|
44
|
+
const totalAmountAllIncluded = tob.isBack && tob.backChoice.toLowerCase() === "autre" ? 0 : currencyFormatterCfa(getTotalAmountAllIncludedOnSale(tob));
|
|
45
45
|
const tabFooter = {
|
|
46
46
|
width: "50%",
|
|
47
47
|
table: {
|
|
@@ -72,12 +72,12 @@ export const infoAmountOnProforma = (tob) => {
|
|
|
72
72
|
export const infoAmounOntSale = (tob) => {
|
|
73
73
|
const totalAmountWithoutTva = tob.isBack && (tob.backChoice.toLowerCase() === "autre" || tob.rejectedReason)
|
|
74
74
|
? 0
|
|
75
|
-
:
|
|
76
|
-
const totalPort =
|
|
77
|
-
const totalTva =
|
|
75
|
+
: currencyFormatterCfa(getTotalAmountWithoutTvaOnSale(tob, true));
|
|
76
|
+
const totalPort = currencyFormatterCfa(getTotalShippingOnSale(tob));
|
|
77
|
+
const totalTva = currencyFormatterCfa(getTotalTvaOnSale(tob, true));
|
|
78
78
|
const totalAmountAllIncluded = tob.isBack && (tob.backChoice.toLowerCase() === "autre" || tob.rejectedReason)
|
|
79
79
|
? 0
|
|
80
|
-
:
|
|
80
|
+
: currencyFormatterCfa(getTotalAmountAllIncludedOnSale(tob, true));
|
|
81
81
|
const tabFooter = {
|
|
82
82
|
width: "50%",
|
|
83
83
|
table: {
|
|
@@ -109,13 +109,13 @@ export const infoAmountOnBill = (tob) => {
|
|
|
109
109
|
const totalAmountAllAndBackInclused = getTotalAmountAllIncludedOnBill(tob.sales);
|
|
110
110
|
const totalAmountWithoutTvaAllAndBack = getTotalAmountWithoutTvaOnBill(tob.sales);
|
|
111
111
|
const totalAmountTvaAllAndBack = getTotalAmountTvaOnBill(tob.sales);
|
|
112
|
-
// const totalAmountWithoutTva =
|
|
113
|
-
const totalAmountWithoutTva =
|
|
114
|
-
// const totalPort =
|
|
115
|
-
const totalTva =
|
|
116
|
-
// const totalTva =
|
|
117
|
-
// const totalAmountAllIncluded =
|
|
118
|
-
const totalAmountAllIncluded =
|
|
112
|
+
// const totalAmountWithoutTva = currencyFormatterCfa(HlpSale.getTotalAmountWithoutTvaOnBill(tob.sales));
|
|
113
|
+
const totalAmountWithoutTva = currencyFormatterCfa(totalAmountWithoutTvaAllAndBack);
|
|
114
|
+
// const totalPort = currencyFormatterCfa(HlpSale.getTotalShipping(tob));
|
|
115
|
+
const totalTva = currencyFormatterCfa(totalAmountTvaAllAndBack);
|
|
116
|
+
// const totalTva = currencyFormatterCfa(HlpSale.getTotalAmountTvaOnBill(tob.sales));
|
|
117
|
+
// const totalAmountAllIncluded = currencyFormatterCfa(HlpSale.getTotalAmountOnBill(tob.sales));
|
|
118
|
+
const totalAmountAllIncluded = currencyFormatterCfa(totalAmountAllAndBackInclused);
|
|
119
119
|
const tabFooter = {
|
|
120
120
|
width: "50%",
|
|
121
121
|
table: {
|
package/lib/esm/sales/sale.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { unitPriceByClientCat } from "../products/product";
|
|
2
2
|
import { labelSteName } from "../users/user";
|
|
3
|
-
import {
|
|
3
|
+
import { currencyFormatterCfa, dateFormatter, removeBackSlashOccurences } from "../utils";
|
|
4
4
|
export const getNbProductsOnSale = (sale) => {
|
|
5
5
|
return sale.saleProducts.length || 0;
|
|
6
6
|
};
|
|
@@ -91,7 +91,7 @@ export const tabLabel = (sale) => {
|
|
|
91
91
|
for (let j = 0; j < +sp.qtityDlvr + +sp.qtityFree; j++) {
|
|
92
92
|
const name = labelSteName(sale.client.ste);
|
|
93
93
|
const product = sp.product.designation;
|
|
94
|
-
const pp =
|
|
94
|
+
const pp = currencyFormatterCfa(Math.ceil(sp.publicPrice));
|
|
95
95
|
const saleDate = dateFormatter(sale.saleDate, "dmy", "/");
|
|
96
96
|
// const saleDate = formatDateYmd(sale.saleDate, '/');
|
|
97
97
|
// const saleDate = moment(sale.saleDate ).format('DD/MM/YYYY');
|
package/lib/esm/utils.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const getRandomColor: (brightness: number) => string;
|
|
|
13
13
|
* @returns
|
|
14
14
|
*/
|
|
15
15
|
export declare const removeDuplicateObjects: (array: any[], property?: string) => any[];
|
|
16
|
+
export declare const removeDuplicateValues: (array: any[]) => any[];
|
|
16
17
|
export declare const duplicateObjects: (array: any[], property: string) => any[];
|
|
17
18
|
export declare const toObjectDate: (fromDate: any, toDate: string) => {
|
|
18
19
|
fromDate: any;
|
|
@@ -23,9 +24,7 @@ export declare const limitTo: (value: string, limit?: number, trail?: string) =>
|
|
|
23
24
|
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
24
25
|
export declare const wakeUp: (sleep: any) => void;
|
|
25
26
|
export declare const checkAuth: (auth?: boolean) => boolean;
|
|
26
|
-
export declare const formatToString: (val: number, separator?: string, currency?: string) => string;
|
|
27
27
|
export declare const currencyFormatter: (val: number, separator?: string, currency?: string) => string;
|
|
28
|
-
export declare const formatToStringCfa: (val: number) => string;
|
|
29
28
|
export declare const currencyFormatterCfa: (val: number) => string;
|
|
30
29
|
export declare const notInSequence: (arr: number[]) => number[];
|
|
31
30
|
export declare const sequencesToNumbers: (arr: any[]) => number[];
|
|
@@ -81,6 +80,7 @@ export declare const isBirthday: (birthDayDate: any) => boolean;
|
|
|
81
80
|
export declare const insertAtInArray: (array: any[], index: number, ...elements: any) => void;
|
|
82
81
|
export declare const randomInteger: (max: number) => number;
|
|
83
82
|
export declare const randomRgbColor: () => number[];
|
|
83
|
+
export declare const genRandomNumberArray: (nbSize: number) => number[];
|
|
84
84
|
export declare const randomHexColor: () => string;
|
|
85
85
|
export declare const randomHslColor: () => number[];
|
|
86
86
|
export declare const getArrayOfRandomColor: (length: number, type?: "hex" | "rgb" | "hsl") => string[];
|
package/lib/esm/utils.js
CHANGED
|
@@ -121,6 +121,9 @@ export const removeDuplicateObjects = (array, property = "id") => {
|
|
|
121
121
|
|
|
122
122
|
return unique; */
|
|
123
123
|
};
|
|
124
|
+
export const removeDuplicateValues = (array) => {
|
|
125
|
+
return [...new Set(array)];
|
|
126
|
+
};
|
|
124
127
|
export const duplicateObjects = (array, property) => {
|
|
125
128
|
return array.filter((obj, index) => array.findIndex((item) => lodash.get(item, property) === lodash.get(obj, property)) !== index);
|
|
126
129
|
};
|
|
@@ -153,20 +156,10 @@ export const wakeUp = (sleep) => {
|
|
|
153
156
|
export const checkAuth = (auth = true) => {
|
|
154
157
|
return auth;
|
|
155
158
|
};
|
|
156
|
-
// -- to remove later
|
|
157
|
-
export const formatToString = (val, separator = " ", currency = "") => {
|
|
158
|
-
// return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1,');
|
|
159
|
-
return String(val).replace(/(.)(?=(\d{3})+$)/g, "$1" + separator + "") + currency;
|
|
160
|
-
};
|
|
161
159
|
export const currencyFormatter = (val, separator = " ", currency = "") => {
|
|
162
160
|
// return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1,');
|
|
163
161
|
return String(val).replace(/(.)(?=(\d{3})+$)/g, "$1" + separator + "") + currency;
|
|
164
162
|
};
|
|
165
|
-
// -- to remove later
|
|
166
|
-
export const formatToStringCfa = (val) => {
|
|
167
|
-
// return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1 ') + ' CFA';
|
|
168
|
-
return formatToString(val, " ", " FCFA");
|
|
169
|
-
};
|
|
170
163
|
export const currencyFormatterCfa = (val) => {
|
|
171
164
|
// return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1 ') + ' CFA';
|
|
172
165
|
return currencyFormatter(val, " ", " FCFA");
|
|
@@ -547,6 +540,16 @@ export const randomRgbColor = () => {
|
|
|
547
540
|
let b = randomInteger(255);
|
|
548
541
|
return [r, g, b];
|
|
549
542
|
};
|
|
543
|
+
export const genRandomNumberArray = (nbSize) => {
|
|
544
|
+
const numbers = [];
|
|
545
|
+
while (numbers.length < nbSize) {
|
|
546
|
+
const random = Math.floor(Math.random() * nbSize) + 1;
|
|
547
|
+
if (numbers.indexOf(random) === -1) {
|
|
548
|
+
numbers.push(random);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return numbers;
|
|
552
|
+
};
|
|
550
553
|
export const randomHexColor = () => {
|
|
551
554
|
let [r, g, b] = randomRgbColor();
|
|
552
555
|
let hr = r.toString(16).padStart(2, "0");
|
|
@@ -644,9 +647,9 @@ export const formatAmountToString = (amount, opt) => {
|
|
|
644
647
|
}
|
|
645
648
|
switch (opt === null || opt === void 0 ? void 0 : opt.currency) {
|
|
646
649
|
case "cfa":
|
|
647
|
-
return
|
|
650
|
+
return currencyFormatterCfa(getAmount);
|
|
648
651
|
default:
|
|
649
|
-
return
|
|
652
|
+
return currencyFormatter(getAmount);
|
|
650
653
|
}
|
|
651
654
|
};
|
|
652
655
|
export const returnBool = (tob = true) => {
|