@silexpert/core 1.3.273 → 1.3.274
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/dist/cjs/types/Enum/PrestationType.js +3 -3
- package/dist/cjs/types/Enum/PrestationType.js.map +1 -1
- package/dist/cjs/types/Interface/api/commercial/QueryGetStats.d.ts +7 -1
- package/dist/cjs/types/Interface/api/commercial/QueryGetStats.d.ts.map +1 -1
- package/dist/cjs/types/Interface/api/commercial/QueryGetStats.js +45 -10
- package/dist/cjs/types/Interface/api/commercial/QueryGetStats.js.map +1 -1
- package/dist/cjs/utils/prestation.d.ts +26 -13
- package/dist/cjs/utils/prestation.d.ts.map +1 -1
- package/dist/cjs/utils/prestation.js +136 -135
- package/dist/cjs/utils/prestation.js.map +1 -1
- package/dist/mjs/types/Enum/PrestationType.js +3 -3
- package/dist/mjs/types/Enum/PrestationType.js.map +1 -1
- package/dist/mjs/types/Interface/api/commercial/QueryGetStats.d.ts +7 -1
- package/dist/mjs/types/Interface/api/commercial/QueryGetStats.d.ts.map +1 -1
- package/dist/mjs/types/Interface/api/commercial/QueryGetStats.js +43 -3
- package/dist/mjs/types/Interface/api/commercial/QueryGetStats.js.map +1 -1
- package/dist/mjs/utils/prestation.d.ts +26 -13
- package/dist/mjs/utils/prestation.d.ts.map +1 -1
- package/dist/mjs/utils/prestation.js +50 -51
- package/dist/mjs/utils/prestation.js.map +1 -1
- package/package.json +1 -1
- package/ts/types/Enum/PrestationType.ts +3 -3
- package/ts/types/Interface/api/commercial/QueryGetStats.ts +33 -3
- package/ts/utils/prestation.ts +64 -53
|
@@ -1,70 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.idPrestationListToOfferType = exports.
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const dayjs = require("dayjs");
|
|
18
|
-
const exercice_1 = require("./exercice");
|
|
3
|
+
exports.idPrestationListToOfferType = exports.calculatePrestationPriceWithPriceGrid = exports.isAbleToUpdatePrice = exports.getPrestationOptions = exports.calculatePrestationPrice = exports.calculateScoringOfPrestation = exports.getAccountingPrestation = exports.hasAccountingPrestation = exports.getComptableNotCatalogPrestation = exports.isSoftwarePrestation = exports.isConsultingHour = exports.isExpress = exports.isFromStatutsExpress = exports.isCreation = exports.isOnlyJuridic = exports.isOnlySocial = exports.isOnlyPrevi = exports.isOtherSocialMission = exports.isAdditionalPresta = exports.isOtherJuridicalMissions = exports.isOtherAccountingMissions = exports.getPriceGrid = exports.calculateMonthlyAmount = void 0;
|
|
4
|
+
const Vat_js_1 = require("../types/Enum/Vat.js");
|
|
5
|
+
const ReasonTerminationType_js_1 = require("../types/Enum/ReasonTerminationType.js");
|
|
6
|
+
const noLodash_js_1 = require("./noLodash.js");
|
|
7
|
+
const PrestationType_js_1 = require("../types/Enum/PrestationType.js");
|
|
8
|
+
const PrestationOption_js_1 = require("../types/Enum/PrestationOption.js");
|
|
9
|
+
const PriceGridClementine_js_1 = require("../types/Enum/PriceGridClementine.js");
|
|
10
|
+
const PriceGridPourcentage_js_1 = require("../types/Enum/PriceGridPourcentage.js");
|
|
11
|
+
const PriceGridLegalstart_js_1 = require("../types/Enum/PriceGridLegalstart.js");
|
|
12
|
+
const PriceGridStatutsExpress_js_1 = require("../types/Enum/PriceGridStatutsExpress.js");
|
|
13
|
+
const ClosingType_js_1 = require("../types/Enum/ClosingType.js");
|
|
14
|
+
const brands_js_1 = require("./brands.js");
|
|
15
|
+
const dayjs_1 = require("dayjs");
|
|
16
|
+
const exercice_js_1 = require("./exercice.js");
|
|
19
17
|
const isOtherAccountingMissions = (idPrestationList) => [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
PrestationType_js_1.PrestationType.PREVISIONNEL,
|
|
19
|
+
PrestationType_js_1.PrestationType.BILAN_INTERMEDIAIRE,
|
|
20
|
+
PrestationType_js_1.PrestationType.AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE,
|
|
21
|
+
PrestationType_js_1.PrestationType.AUTRE_MISSION_COMPTABLE,
|
|
22
|
+
PrestationType_js_1.PrestationType.TVS,
|
|
23
|
+
PrestationType_js_1.PrestationType.ETUDE_FISCALE,
|
|
24
|
+
PrestationType_js_1.PrestationType.BILAN_PREVISIONNEL,
|
|
27
25
|
].includes(idPrestationList);
|
|
28
26
|
exports.isOtherAccountingMissions = isOtherAccountingMissions;
|
|
29
|
-
const isOtherJuridicalMissions = (isJuridique, isCatalog, idPrestationList) => idPrestationList !==
|
|
27
|
+
const isOtherJuridicalMissions = (isJuridique, isCatalog, idPrestationList) => idPrestationList !== PrestationType_js_1.PrestationType.GESTION_JURIDIQUE && isCatalog && isJuridique;
|
|
30
28
|
exports.isOtherJuridicalMissions = isOtherJuridicalMissions;
|
|
31
|
-
const isOtherSocialMission = (idPrestationList) => idPrestationList ===
|
|
29
|
+
const isOtherSocialMission = (idPrestationList) => idPrestationList === PrestationType_js_1.PrestationType.AUTRE_MISSION_SOCIALE_HORS_PAIE;
|
|
32
30
|
exports.isOtherSocialMission = isOtherSocialMission;
|
|
33
31
|
const isAdditionalPresta = (hidden, isCatalog) => !hidden && isCatalog;
|
|
34
32
|
exports.isAdditionalPresta = isAdditionalPresta;
|
|
35
|
-
const isOnlyPrevi = (idPrestationList) => !idPrestationList.filter((idPL) => ![
|
|
33
|
+
const isOnlyPrevi = (idPrestationList) => !idPrestationList.filter((idPL) => ![PrestationType_js_1.PrestationType.PREVISIONNEL, PrestationType_js_1.PrestationType.BILAN_PREVISIONNEL, PrestationType_js_1.PrestationType.PV_AG].includes(idPL)).length;
|
|
36
34
|
exports.isOnlyPrevi = isOnlyPrevi;
|
|
37
|
-
const isOnlySocial = (idPrestationList) => !idPrestationList.filter((idPL) => ![
|
|
35
|
+
const isOnlySocial = (idPrestationList) => !idPrestationList.filter((idPL) => ![PrestationType_js_1.PrestationType.FRUCTUPAIE, PrestationType_js_1.PrestationType.SOCIAL].includes(idPL)).length;
|
|
38
36
|
exports.isOnlySocial = isOnlySocial;
|
|
39
|
-
const isOnlyJuridic = (idPrestationList) => !idPrestationList.filter((idPL) => ![
|
|
37
|
+
const isOnlyJuridic = (idPrestationList) => !idPrestationList.filter((idPL) => ![PrestationType_js_1.PrestationType.GESTION_JURIDIQUE].includes(idPL)).length;
|
|
40
38
|
exports.isOnlyJuridic = isOnlyJuridic;
|
|
41
|
-
const isCreation = (idPrestationList) => !!(0,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
const isCreation = (idPrestationList) => !!(0, noLodash_js_1.intersection)(idPrestationList, [
|
|
40
|
+
PrestationType_js_1.PrestationType.CREATION_SOCIETE,
|
|
41
|
+
PrestationType_js_1.PrestationType.STATUTS_FREE,
|
|
42
|
+
PrestationType_js_1.PrestationType.STATUTS_OPTION_1,
|
|
43
|
+
PrestationType_js_1.PrestationType.STATUTS_OPTION_2,
|
|
44
|
+
PrestationType_js_1.PrestationType.STATUTS_OPTION_AE,
|
|
47
45
|
]).length;
|
|
48
46
|
exports.isCreation = isCreation;
|
|
49
47
|
const isFromStatutsExpress = (idPrestationList) => !idPrestationList.filter((idPL) => ![
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
PrestationType_js_1.PrestationType.STATUTS_FREE,
|
|
49
|
+
PrestationType_js_1.PrestationType.STATUTS_OPTION_1,
|
|
50
|
+
PrestationType_js_1.PrestationType.STATUTS_OPTION_2,
|
|
51
|
+
PrestationType_js_1.PrestationType.STATUTS_OPTION_AE,
|
|
54
52
|
].includes(idPL)).length;
|
|
55
53
|
exports.isFromStatutsExpress = isFromStatutsExpress;
|
|
56
54
|
const isExpress = (idPrestationList) => {
|
|
57
|
-
const prestationDetailValues = Object.values(
|
|
55
|
+
const prestationDetailValues = Object.values(PrestationType_js_1.PrestationDetail);
|
|
58
56
|
const prestaList = prestationDetailValues.find((pr) => pr.id === idPrestationList);
|
|
59
57
|
return !!prestaList.isBack;
|
|
60
58
|
};
|
|
61
59
|
exports.isExpress = isExpress;
|
|
62
|
-
const isConsultingHour = (idPrestationList) => !!(0,
|
|
60
|
+
const isConsultingHour = (idPrestationList) => !!(0, noLodash_js_1.intersection)(idPrestationList, [PrestationType_js_1.PrestationType.CONSULTING_HOUR]).length;
|
|
63
61
|
exports.isConsultingHour = isConsultingHour;
|
|
64
|
-
const isSoftwarePrestation = (idPrestationList) => !!(0,
|
|
65
|
-
.
|
|
62
|
+
const isSoftwarePrestation = (idPrestationList) => !!(0, noLodash_js_1.intersection)(idPrestationList, [
|
|
63
|
+
PrestationType_js_1.PrestationType.STEERING,
|
|
64
|
+
PrestationType_js_1.PrestationType.VAT,
|
|
65
|
+
PrestationType_js_1.PrestationType.BALANCESHEET,
|
|
66
|
+
PrestationType_js_1.PrestationType.BILLING,
|
|
67
|
+
]).length; /* &&
|
|
66
68
|
idPrestationList.length === 1 */ // Commenté car si un client résilie un software pour un utre software, condition non prise en charge
|
|
67
69
|
exports.isSoftwarePrestation = isSoftwarePrestation;
|
|
70
|
+
/**
|
|
71
|
+
* Retourne la première prestation comptable non catalogue trouvée dans une liste.
|
|
72
|
+
*
|
|
73
|
+
* @param prestationsList Liste de prestations de référence.
|
|
74
|
+
* @returns La prestation comptable non catalogue, ou undefined si aucune n'est trouvée.
|
|
75
|
+
*/
|
|
76
|
+
const getComptableNotCatalogPrestation = (prestationsList) => prestationsList.find((prestation) => !!prestation.isComptable && !prestation.isCatalog);
|
|
77
|
+
exports.getComptableNotCatalogPrestation = getComptableNotCatalogPrestation;
|
|
78
|
+
/**
|
|
79
|
+
* Retourne true si une prestation comptable (isPlannable & isComptable & !isCatalog) est trouvée dans la liste.
|
|
80
|
+
*
|
|
81
|
+
* @param prestationsList Liste de prestations de référence.
|
|
82
|
+
* @returns true si une prestation comptable est trouvée, sinon false.
|
|
83
|
+
*/
|
|
84
|
+
const hasAccountingPrestation = (prestationsList) => !!prestationsList.find((prestation) => !!prestation.isPlannable && !!prestation.isComptable && !prestation.isCatalog);
|
|
85
|
+
exports.hasAccountingPrestation = hasAccountingPrestation;
|
|
86
|
+
/**
|
|
87
|
+
* Retourne la première prestation comptable (isPlannable & isComptable & !isCatalog) trouvée dans la liste.
|
|
88
|
+
*
|
|
89
|
+
* @param prestationsList Liste de prestations de référence.
|
|
90
|
+
* @returns La prestation comptable, ou undefined si aucune n'est trouvée.
|
|
91
|
+
*/
|
|
92
|
+
const getAccountingPrestation = (prestationsList) => prestationsList.find((prestation) => !!prestation.isPlannable && !!prestation.isComptable && !prestation.isCatalog);
|
|
93
|
+
exports.getAccountingPrestation = getAccountingPrestation;
|
|
68
94
|
const calculateScoringOfPrestation = (idPrestationType, prestations, currentIdPrestation) => {
|
|
69
95
|
var _a, _b, _c, _d, _e;
|
|
70
96
|
const prestationsSignedPaid = prestations.filter((prestation) => {
|
|
@@ -72,7 +98,7 @@ const calculateScoringOfPrestation = (idPrestationType, prestations, currentIdPr
|
|
|
72
98
|
return prestation.paid &&
|
|
73
99
|
prestation.signed &&
|
|
74
100
|
(prestation.terminationList === null ||
|
|
75
|
-
((_b = (_a = prestation.terminationList) === null || _a === void 0 ? void 0 : _a.idReasonTermination) === null || _b === void 0 ? void 0 : _b.includes(
|
|
101
|
+
((_b = (_a = prestation.terminationList) === null || _a === void 0 ? void 0 : _a.idReasonTermination) === null || _b === void 0 ? void 0 : _b.includes(ReasonTerminationType_js_1.ReasonTerminationType.CHANGES_NEW_OFFERS))) &&
|
|
76
102
|
prestation.id !== currentIdPrestation;
|
|
77
103
|
});
|
|
78
104
|
const currentPrestation = prestations.find((el) => el.idPrestationList === idPrestationType && el.terminationList === null);
|
|
@@ -88,24 +114,24 @@ const calculateScoringOfPrestation = (idPrestationType, prestations, currentIdPr
|
|
|
88
114
|
return 0;
|
|
89
115
|
}
|
|
90
116
|
// Get the list of prestations that are half price
|
|
91
|
-
const prestationHalfPriceList = Object.values(
|
|
117
|
+
const prestationHalfPriceList = Object.values(PrestationType_js_1.PrestationDetail).filter((p) => p.isComptable &&
|
|
92
118
|
!p.isCatalog &&
|
|
93
119
|
p.id &&
|
|
94
|
-
![
|
|
120
|
+
![PrestationType_js_1.PrestationType.BALANCESHEET, PrestationType_js_1.PrestationType.VAT, PrestationType_js_1.PrestationType.STEERING, PrestationType_js_1.PrestationType.BILLING].includes(p.id));
|
|
95
121
|
const prestationHalfPriceIds = prestationHalfPriceList.map((t) => t.id);
|
|
96
122
|
// Get the number of points for the new prestation
|
|
97
|
-
const prestaDetails = Object.values(
|
|
123
|
+
const prestaDetails = Object.values(PrestationType_js_1.PrestationDetail).find((prestaDetail) => prestaDetail.id === idPrestationType);
|
|
98
124
|
let numberPoint = (prestaDetails === null || prestaDetails === void 0 ? void 0 : prestaDetails.point) || 0;
|
|
99
125
|
// For each back exercices, add 100 points
|
|
100
126
|
// -> for new prestations only
|
|
101
127
|
if ([
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
128
|
+
PrestationType_js_1.PrestationType.EXPERTISE,
|
|
129
|
+
PrestationType_js_1.PrestationType.SUPPORT,
|
|
130
|
+
PrestationType_js_1.PrestationType.PREMIUM,
|
|
131
|
+
PrestationType_js_1.PrestationType.CUSTOM_MADE,
|
|
132
|
+
PrestationType_js_1.PrestationType.GESTION_IMMO,
|
|
133
|
+
PrestationType_js_1.PrestationType.EI,
|
|
134
|
+
PrestationType_js_1.PrestationType.MICRO,
|
|
109
135
|
].includes(idPrestationType) &&
|
|
110
136
|
((_d = currentPrestation === null || currentPrestation === void 0 ? void 0 : currentPrestation.exercices) === null || _d === void 0 ? void 0 : _d.length) &&
|
|
111
137
|
(currentPrestation === null || currentPrestation === void 0 ? void 0 : currentPrestation.exercices.find((el) => el.isBack))) {
|
|
@@ -115,9 +141,9 @@ const calculateScoringOfPrestation = (idPrestationType, prestations, currentIdPr
|
|
|
115
141
|
// and check if one of them is in the list of prestations that are half price
|
|
116
142
|
const prestationsExistIds = prestationsSignedPaid.map((prestation) => prestation.idPrestationList);
|
|
117
143
|
const prestationHalfPriceAlreadyDoneIds = prestationsExistIds.filter((id) => prestationHalfPriceIds.includes(id));
|
|
118
|
-
// If one of the prestations already done is in the list of prestations that are half price and if the idPrestationType is in prestationHalfPriceIds, return
|
|
144
|
+
// If one of the prestations already done is in the list of prestations that are half price and if the idPrestationType is in prestationHalfPriceIds, return upsell points (250)
|
|
119
145
|
if (prestationHalfPriceAlreadyDoneIds.length && prestationHalfPriceIds.includes(idPrestationType))
|
|
120
|
-
return
|
|
146
|
+
return 250;
|
|
121
147
|
return numberPoint;
|
|
122
148
|
};
|
|
123
149
|
exports.calculateScoringOfPrestation = calculateScoringOfPrestation;
|
|
@@ -129,18 +155,18 @@ const calculateMonthlyAmount = (params) => {
|
|
|
129
155
|
return monthlyPrice * (monthNumber - monthOffer);
|
|
130
156
|
return (monthlyPrice *
|
|
131
157
|
(monthNumber - monthOffer) *
|
|
132
|
-
(1 + Object.values(
|
|
158
|
+
(1 + Object.values(Vat_js_1.Vat).find((el) => el.id === idVatForInternalInvoicing).value / 100));
|
|
133
159
|
};
|
|
134
160
|
exports.calculateMonthlyAmount = calculateMonthlyAmount;
|
|
135
161
|
const getPriceGrid = (idTypeBrand, idPrestationList) => {
|
|
136
162
|
let currentBrandPriceGrid;
|
|
137
163
|
let currentPriceGrid;
|
|
138
|
-
const currentEnvName = (0,
|
|
164
|
+
const currentEnvName = (0, brands_js_1.getBrandNameByNodeEnv)(process.env.NODE_ENV);
|
|
139
165
|
const listEnvEnum = {
|
|
140
|
-
PriceGridClementine:
|
|
141
|
-
PriceGridPourcentage:
|
|
142
|
-
PriceGridLegalstart:
|
|
143
|
-
PriceGridStatutsExpress:
|
|
166
|
+
PriceGridClementine: PriceGridClementine_js_1.PriceGridClementine,
|
|
167
|
+
PriceGridPourcentage: PriceGridPourcentage_js_1.PriceGridPourcentage,
|
|
168
|
+
PriceGridLegalstart: PriceGridLegalstart_js_1.PriceGridLegalstart,
|
|
169
|
+
PriceGridStatutsExpress: PriceGridStatutsExpress_js_1.PriceGridStatutsExpress,
|
|
144
170
|
};
|
|
145
171
|
// @ts-ignore
|
|
146
172
|
const currentPriceGridFile = listEnvEnum[`PriceGrid${currentEnvName}`];
|
|
@@ -206,12 +232,12 @@ const calculatePrestationPriceWithPriceGrid = (idPrestationList, endDate, NbrMon
|
|
|
206
232
|
(monthlyPrice ? monthlyPrice : 0) + (vatRegimePrice ? vatRegimePrice : 0) + (taxSystemPrice ? taxSystemPrice : 0);
|
|
207
233
|
/* Gestion des mois */
|
|
208
234
|
let cloturedPast = false;
|
|
209
|
-
if (
|
|
235
|
+
if ((0, dayjs_1.default)(endDate, 'YYYY-MM-DD').subtract(15, 'day').isBefore((0, dayjs_1.default)()))
|
|
210
236
|
cloturedPast = true;
|
|
211
237
|
let monthlyNbrList;
|
|
212
238
|
let monthlyNbr;
|
|
213
239
|
if (currentPriceGrid.monthlyNbr) {
|
|
214
|
-
monthlyNbrList = (_2 = currentPriceGrid.monthlyNbr) === null || _2 === void 0 ? void 0 : _2.filter((el) => el.closingType.includes(cloturedPast ?
|
|
240
|
+
monthlyNbrList = (_2 = currentPriceGrid.monthlyNbr) === null || _2 === void 0 ? void 0 : _2.filter((el) => el.closingType.includes(cloturedPast ? ClosingType_js_1.ClosingType.OUTDATED : ClosingType_js_1.ClosingType.IN_PROGRESS));
|
|
215
241
|
if (monthlyNbrList) {
|
|
216
242
|
monthlyNbr = monthlyNbrList.find((el) => el.minimum <= monthNbr && monthNbr <= el.maximum);
|
|
217
243
|
if (monthlyNbr) {
|
|
@@ -260,25 +286,7 @@ const calculatePrestationPriceWithPrestationList = (prestationList) => {
|
|
|
260
286
|
totalPrestation = (prestationList === null || prestationList === void 0 ? void 0 : prestationList.price) || 0;
|
|
261
287
|
return totalPrestation;
|
|
262
288
|
};
|
|
263
|
-
|
|
264
|
-
* From idLegalForm, get application fees amount (without taxes included if no idVat passed, or with taxes included calculated by given idVat)
|
|
265
|
-
* @param idLegalForm
|
|
266
|
-
* @param idVat
|
|
267
|
-
* @returns amount of application fees, without taxes included
|
|
268
|
-
* @deprecated Application fees are not charged anymore
|
|
269
|
-
*/
|
|
270
|
-
const getApplicationFeesAmount = (idLegalForm, idVat) => {
|
|
271
|
-
let applicationFeesAmount = 50;
|
|
272
|
-
if (idLegalForm === LegalForm_1.LegalFormTypeEnum.SCI)
|
|
273
|
-
applicationFeesAmount = 150;
|
|
274
|
-
//Sans tva, on envoie le montant HT
|
|
275
|
-
if (!idVat)
|
|
276
|
-
return applicationFeesAmount;
|
|
277
|
-
//Avec tva, on envoie le montant TTC
|
|
278
|
-
return (0, utils_1.getTaxesIncludedAmount)(applicationFeesAmount, idVat);
|
|
279
|
-
};
|
|
280
|
-
exports.getApplicationFeesAmount = getApplicationFeesAmount;
|
|
281
|
-
const calculatePrestationPrice = (idPrestationList, prestationList, endDate, NbrMonth /* Nbr de mois dans l'exercice */, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, optionsList, totalPercentage /* total pourcentage offer (%) */, totalAmount /* total montant offer (€) */, totalMonth /* total mois offer (mois) */, isWithApplicationFees /* frais de dossier */, idTaxSystem, idLegalForm, isYearly = false /* prestation annuel ou mensuel */, isSubPrestation = false, balanceSheetOffered = 0, exerciceList = []) => {
|
|
289
|
+
const calculatePrestationPrice = (idPrestationList, prestationList, endDate, NbrMonth /* Nbr de mois dans l'exercice */, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, optionsList, totalPercentage /* total pourcentage offer (%) */, totalAmount /* total montant offer (€) */, totalMonth /* total mois offer (mois) */, idTaxSystem, idLegalForm, isYearly = false /* prestation annuel ou mensuel */, isSubPrestation = false, balanceSheetOffered = 0, exerciceList = []) => {
|
|
282
290
|
let totalPrestation = 0;
|
|
283
291
|
let reduceMonth = 0;
|
|
284
292
|
let canBeCreated = true;
|
|
@@ -287,40 +295,40 @@ const calculatePrestationPrice = (idPrestationList, prestationList, endDate, Nbr
|
|
|
287
295
|
let totalWithReduce = { totalPrestation: 0, reduceMonth: 0, canBeCreated: true, monthNbr: 0, price: 0 };
|
|
288
296
|
/* Gestion du prix en fonction de la prestation */
|
|
289
297
|
if ([
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
298
|
+
PrestationType_js_1.PrestationType.COMPTA_PRO,
|
|
299
|
+
PrestationType_js_1.PrestationType.COMPTA_PRO_EXPRESS,
|
|
300
|
+
PrestationType_js_1.PrestationType.COMPTA_ENTREPRISE,
|
|
301
|
+
PrestationType_js_1.PrestationType.COMPTA_ENTREPRISE_EXPRESS,
|
|
302
|
+
PrestationType_js_1.PrestationType.COMPTA_SCI,
|
|
303
|
+
PrestationType_js_1.PrestationType.COMPTA_SCI_EXPRESS,
|
|
304
|
+
PrestationType_js_1.PrestationType.BILAN_PREVISIONNEL,
|
|
305
|
+
PrestationType_js_1.PrestationType.COMPTA_PREMIUM,
|
|
306
|
+
PrestationType_js_1.PrestationType.COMPTA_POURCENTAGE_PREMIUM,
|
|
307
|
+
PrestationType_js_1.PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS,
|
|
308
|
+
PrestationType_js_1.PrestationType.COMPTA_POURCENTAGE,
|
|
309
|
+
PrestationType_js_1.PrestationType.COMPTA_POURCENTAGE_EXPRESS,
|
|
310
|
+
PrestationType_js_1.PrestationType.SOCIAL,
|
|
311
|
+
PrestationType_js_1.PrestationType.GESTION_JURIDIQUE,
|
|
312
|
+
PrestationType_js_1.PrestationType.COMPTA_PRO_COMPTASTART,
|
|
313
|
+
PrestationType_js_1.PrestationType.COMPTA_PRO_COMPTASTART_EXPRESS,
|
|
314
|
+
PrestationType_js_1.PrestationType.COMPTA_EI_KLEMS,
|
|
315
|
+
PrestationType_js_1.PrestationType.COMPTA_EI_KLEMS_EXPRESS,
|
|
316
|
+
PrestationType_js_1.PrestationType.COMPTA_MICRO_KLEMS,
|
|
317
|
+
PrestationType_js_1.PrestationType.COMPTA_MICRO_KLEMS_EXPRESS,
|
|
318
|
+
PrestationType_js_1.PrestationType.COMPTA_LOUEUR_MEUBLE_NON_PRO_KLEMS,
|
|
319
|
+
PrestationType_js_1.PrestationType.COMPTA_LOUEUR_MEUBLE_NON_PRO_KLEMS_EXPRESS,
|
|
320
|
+
PrestationType_js_1.PrestationType.STATUTS_OPTION_2,
|
|
321
|
+
PrestationType_js_1.PrestationType.EXPERTISE,
|
|
322
|
+
PrestationType_js_1.PrestationType.SUPPORT,
|
|
323
|
+
PrestationType_js_1.PrestationType.PREMIUM,
|
|
324
|
+
PrestationType_js_1.PrestationType.CUSTOM_MADE,
|
|
325
|
+
PrestationType_js_1.PrestationType.EI,
|
|
326
|
+
PrestationType_js_1.PrestationType.MICRO,
|
|
327
|
+
PrestationType_js_1.PrestationType.GESTION_IMMO,
|
|
320
328
|
].includes(idPrestationList)) {
|
|
321
329
|
let exerciceNbr = 0;
|
|
322
330
|
if (exerciceList.length)
|
|
323
|
-
exerciceNbr = (0,
|
|
331
|
+
exerciceNbr = (0, exercice_js_1.exerciceNumber)((0, dayjs_1.default)(endDate, 'YYYY-MM-DD').toDate(), exerciceList);
|
|
324
332
|
totalWithReduce = calculatePrestationPriceWithPriceGrid(idPrestationList, endDate, NbrMonth, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, isYearly, totalMonth, idTaxSystem, idLegalForm, exerciceNbr, balanceSheetOffered);
|
|
325
333
|
totalPrestation = totalWithReduce.totalPrestation;
|
|
326
334
|
reduceMonth = totalWithReduce.reduceMonth;
|
|
@@ -330,13 +338,11 @@ const calculatePrestationPrice = (idPrestationList, prestationList, endDate, Nbr
|
|
|
330
338
|
}
|
|
331
339
|
else {
|
|
332
340
|
totalPrestation = calculatePrestationPriceWithPrestationList(prestationList);
|
|
333
|
-
if ([
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
totalPrestation += 300;
|
|
339
|
-
}
|
|
341
|
+
if ([PrestationType_js_1.PrestationType.CREATION_SOCIETE].includes(idPrestationList) && !isSubPrestation) {
|
|
342
|
+
// totalPrestation += 50;
|
|
343
|
+
// La création est offerte désormais
|
|
344
|
+
// inutile d'ajouter les frais de greffe et d'annonce légale,
|
|
345
|
+
// car ne compte pas dans le calcul pour les sales
|
|
340
346
|
}
|
|
341
347
|
}
|
|
342
348
|
/* Gestion des offres */
|
|
@@ -354,18 +360,13 @@ const calculatePrestationPrice = (idPrestationList, prestationList, endDate, Nbr
|
|
|
354
360
|
if (optionsList.length) {
|
|
355
361
|
optionsList.forEach((optionId) => {
|
|
356
362
|
var _a;
|
|
357
|
-
const optionPrice = (_a = Object.values(
|
|
363
|
+
const optionPrice = (_a = Object.values(PrestationOption_js_1.PrestationOption).find((option) => option.id === optionId)) === null || _a === void 0 ? void 0 : _a.price;
|
|
358
364
|
if (optionPrice)
|
|
359
365
|
OptionTotalPrice += optionPrice;
|
|
360
366
|
});
|
|
361
367
|
}
|
|
362
368
|
totalPrestation += OptionTotalPrice ? OptionTotalPrice : 0;
|
|
363
|
-
|
|
364
|
-
// if (isWithApplicationFees) {
|
|
365
|
-
// const applicationFeesAmount = getApplicationFeesAmount(idLegalForm);
|
|
366
|
-
// totalPrestation += applicationFeesAmount;
|
|
367
|
-
// }
|
|
368
|
-
const calculDetail = `${monthNbr > 0 ? monthNbr + ' mois x ' + Math.round(price * 100) / 100 + '€' : Math.round(price * 100) / 100 + '€'} ${totalAmount > 0 ? '- ' + totalAmount + '€' : ''} ${totalPercentage > 0 ? '- ' + totalPercentage + '%' : ''} ${isWithApplicationFees ? '+ 50€' : ''}`;
|
|
369
|
+
const calculDetail = `${monthNbr > 0 ? monthNbr + ' mois x ' + Math.round(price * 100) / 100 + '€' : Math.round(price * 100) / 100 + '€'} ${totalAmount > 0 ? '- ' + totalAmount + '€' : ''} ${totalPercentage > 0 ? '- ' + totalPercentage + '%' : ''}`;
|
|
369
370
|
return {
|
|
370
371
|
totalPrestation,
|
|
371
372
|
reduceMonth,
|
|
@@ -377,7 +378,7 @@ const calculatePrestationPrice = (idPrestationList, prestationList, endDate, Nbr
|
|
|
377
378
|
};
|
|
378
379
|
exports.calculatePrestationPrice = calculatePrestationPrice;
|
|
379
380
|
const getPrestationOptions = (idPrestationList) => {
|
|
380
|
-
const PrestationOptionList = Object.values(
|
|
381
|
+
const PrestationOptionList = Object.values(PrestationOption_js_1.PrestationOption).filter((option) => option.brand.includes((0, brands_js_1.getBrandNameByNodeEnv)(process.env.NODE_ENV)));
|
|
381
382
|
return PrestationOptionList.filter((option) => option.prestationList.includes(idPrestationList));
|
|
382
383
|
};
|
|
383
384
|
exports.getPrestationOptions = getPrestationOptions;
|
|
@@ -386,23 +387,23 @@ const isAbleToUpdatePrice = (idTypeBrand, idPrestationList, turnover, pastBalanc
|
|
|
386
387
|
const currentPriceGrid = (0, exports.getPriceGrid)(idTypeBrand, idPrestationList);
|
|
387
388
|
if (currentPriceGrid) {
|
|
388
389
|
if ([
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
390
|
+
PrestationType_js_1.PrestationType.COMPTA_PREMIUM,
|
|
391
|
+
PrestationType_js_1.PrestationType.COMPTA_POURCENTAGE_PREMIUM,
|
|
392
|
+
PrestationType_js_1.PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS,
|
|
392
393
|
].includes(idPrestationList) &&
|
|
393
394
|
// @ts-ignore: error after prettier formatting
|
|
394
395
|
currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 2].turnoverValue < turnover)
|
|
395
396
|
return true;
|
|
396
|
-
else if ([
|
|
397
|
+
else if ([PrestationType_js_1.PrestationType.COMPTA_POURCENTAGE, PrestationType_js_1.PrestationType.COMPTA_POURCENTAGE_EXPRESS].includes(idPrestationList) &&
|
|
397
398
|
// @ts-ignore: error after prettier formatting
|
|
398
399
|
currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 1].turnoverValue < turnover)
|
|
399
400
|
return true;
|
|
400
|
-
else if ([
|
|
401
|
+
else if ([PrestationType_js_1.PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) &&
|
|
401
402
|
!pastBalanceSheet &&
|
|
402
403
|
// @ts-ignore: error after prettier formatting
|
|
403
404
|
currentPriceGrid.turnoverCreatedYear[currentPriceGrid.turnoverCreatedYear.length - 1].turnoverValue < turnover)
|
|
404
405
|
return true;
|
|
405
|
-
else if ([
|
|
406
|
+
else if ([PrestationType_js_1.PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) &&
|
|
406
407
|
pastBalanceSheet &&
|
|
407
408
|
// @ts-ignore: error after prettier formatting
|
|
408
409
|
currentPriceGrid.turnoverPastYear[currentPriceGrid.turnoverPastYear.length - 1].turnoverValue < turnover)
|
|
@@ -414,7 +415,7 @@ const isAbleToUpdatePrice = (idTypeBrand, idPrestationList, turnover, pastBalanc
|
|
|
414
415
|
};
|
|
415
416
|
exports.isAbleToUpdatePrice = isAbleToUpdatePrice;
|
|
416
417
|
const idPrestationListToOfferType = (idPrestationList) => {
|
|
417
|
-
if (
|
|
418
|
+
if (PrestationType_js_1.ClementineSubscriptionAccountancySoftwarePrestations.includes(idPrestationList))
|
|
418
419
|
return 'software';
|
|
419
420
|
return 'expertise';
|
|
420
421
|
};
|