@silexpert/core 1.3.271 → 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.
Files changed (26) hide show
  1. package/dist/cjs/types/Enum/PrestationType.d.ts.map +1 -1
  2. package/dist/cjs/types/Enum/PrestationType.js +13 -12
  3. package/dist/cjs/types/Enum/PrestationType.js.map +1 -1
  4. package/dist/cjs/types/Interface/api/commercial/QueryGetStats.d.ts +7 -1
  5. package/dist/cjs/types/Interface/api/commercial/QueryGetStats.d.ts.map +1 -1
  6. package/dist/cjs/types/Interface/api/commercial/QueryGetStats.js +45 -10
  7. package/dist/cjs/types/Interface/api/commercial/QueryGetStats.js.map +1 -1
  8. package/dist/cjs/utils/prestation.d.ts +26 -13
  9. package/dist/cjs/utils/prestation.d.ts.map +1 -1
  10. package/dist/cjs/utils/prestation.js +136 -135
  11. package/dist/cjs/utils/prestation.js.map +1 -1
  12. package/dist/mjs/types/Enum/PrestationType.d.ts.map +1 -1
  13. package/dist/mjs/types/Enum/PrestationType.js +13 -12
  14. package/dist/mjs/types/Enum/PrestationType.js.map +1 -1
  15. package/dist/mjs/types/Interface/api/commercial/QueryGetStats.d.ts +7 -1
  16. package/dist/mjs/types/Interface/api/commercial/QueryGetStats.d.ts.map +1 -1
  17. package/dist/mjs/types/Interface/api/commercial/QueryGetStats.js +43 -3
  18. package/dist/mjs/types/Interface/api/commercial/QueryGetStats.js.map +1 -1
  19. package/dist/mjs/utils/prestation.d.ts +26 -13
  20. package/dist/mjs/utils/prestation.d.ts.map +1 -1
  21. package/dist/mjs/utils/prestation.js +50 -51
  22. package/dist/mjs/utils/prestation.js.map +1 -1
  23. package/package.json +1 -1
  24. package/ts/types/Enum/PrestationType.ts +13 -12
  25. package/ts/types/Interface/api/commercial/QueryGetStats.ts +33 -3
  26. 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.getApplicationFeesAmount = exports.calculatePrestationPriceWithPriceGrid = exports.isAbleToUpdatePrice = exports.getPrestationOptions = exports.calculatePrestationPrice = exports.calculateScoringOfPrestation = 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_1 = require("../types/Enum/Vat");
5
- const ReasonTerminationType_1 = require("../types/Enum/ReasonTerminationType");
6
- const utils_1 = require("./vat/utils");
7
- const noLodash_1 = require("./noLodash");
8
- const PrestationType_1 = require("../types/Enum/PrestationType");
9
- const LegalForm_1 = require("../types/Enum/LegalForm");
10
- const PrestationOption_1 = require("../types/Enum/PrestationOption");
11
- const PriceGridClementine_1 = require("../types/Enum/PriceGridClementine");
12
- const PriceGridPourcentage_1 = require("../types/Enum/PriceGridPourcentage");
13
- const PriceGridLegalstart_1 = require("../types/Enum/PriceGridLegalstart");
14
- const PriceGridStatutsExpress_1 = require("../types/Enum/PriceGridStatutsExpress");
15
- const ClosingType_1 = require("../types/Enum/ClosingType");
16
- const brands_1 = require("./brands");
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
- PrestationType_1.PrestationType.PREVISIONNEL,
21
- PrestationType_1.PrestationType.BILAN_INTERMEDIAIRE,
22
- PrestationType_1.PrestationType.AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE,
23
- PrestationType_1.PrestationType.AUTRE_MISSION_COMPTABLE,
24
- PrestationType_1.PrestationType.TVS,
25
- PrestationType_1.PrestationType.ETUDE_FISCALE,
26
- PrestationType_1.PrestationType.BILAN_PREVISIONNEL,
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 !== PrestationType_1.PrestationType.GESTION_JURIDIQUE && isCatalog && isJuridique;
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 === PrestationType_1.PrestationType.AUTRE_MISSION_SOCIALE_HORS_PAIE;
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) => ![PrestationType_1.PrestationType.PREVISIONNEL, PrestationType_1.PrestationType.BILAN_PREVISIONNEL, PrestationType_1.PrestationType.PV_AG].includes(idPL)).length;
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) => ![PrestationType_1.PrestationType.FRUCTUPAIE, PrestationType_1.PrestationType.SOCIAL].includes(idPL)).length;
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) => ![PrestationType_1.PrestationType.GESTION_JURIDIQUE].includes(idPL)).length;
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, noLodash_1.intersection)(idPrestationList, [
42
- PrestationType_1.PrestationType.CREATION_SOCIETE,
43
- PrestationType_1.PrestationType.STATUTS_FREE,
44
- PrestationType_1.PrestationType.STATUTS_OPTION_1,
45
- PrestationType_1.PrestationType.STATUTS_OPTION_2,
46
- PrestationType_1.PrestationType.STATUTS_OPTION_AE,
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
- PrestationType_1.PrestationType.STATUTS_FREE,
51
- PrestationType_1.PrestationType.STATUTS_OPTION_1,
52
- PrestationType_1.PrestationType.STATUTS_OPTION_2,
53
- PrestationType_1.PrestationType.STATUTS_OPTION_AE,
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(PrestationType_1.PrestationDetail);
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, noLodash_1.intersection)(idPrestationList, [PrestationType_1.PrestationType.CONSULTING_HOUR]).length;
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, noLodash_1.intersection)(idPrestationList, [PrestationType_1.PrestationType.STEERING, PrestationType_1.PrestationType.VAT, PrestationType_1.PrestationType.BALANCESHEET])
65
- .length; /* &&
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(ReasonTerminationType_1.ReasonTerminationType.CHANGES_NEW_OFFERS))) &&
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(PrestationType_1.PrestationDetail).filter((p) => p.isComptable &&
117
+ const prestationHalfPriceList = Object.values(PrestationType_js_1.PrestationDetail).filter((p) => p.isComptable &&
92
118
  !p.isCatalog &&
93
119
  p.id &&
94
- ![PrestationType_1.PrestationType.BALANCESHEET, PrestationType_1.PrestationType.VAT, PrestationType_1.PrestationType.STEERING].includes(p.id));
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(PrestationType_1.PrestationDetail).find((prestaDetail) => prestaDetail.id === idPrestationType);
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
- PrestationType_1.PrestationType.EXPERTISE,
103
- PrestationType_1.PrestationType.SUPPORT,
104
- PrestationType_1.PrestationType.PREMIUM,
105
- PrestationType_1.PrestationType.CUSTOM_MADE,
106
- PrestationType_1.PrestationType.GESTION_IMMO,
107
- PrestationType_1.PrestationType.EI,
108
- PrestationType_1.PrestationType.MICRO,
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 50% of points
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 Math.floor(numberPoint * 0.3);
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(Vat_1.Vat).find((el) => el.id === idVatForInternalInvoicing).value / 100));
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, brands_1.getBrandNameByNodeEnv)(process.env.NODE_ENV);
164
+ const currentEnvName = (0, brands_js_1.getBrandNameByNodeEnv)(process.env.NODE_ENV);
139
165
  const listEnvEnum = {
140
- PriceGridClementine: PriceGridClementine_1.PriceGridClementine,
141
- PriceGridPourcentage: PriceGridPourcentage_1.PriceGridPourcentage,
142
- PriceGridLegalstart: PriceGridLegalstart_1.PriceGridLegalstart,
143
- PriceGridStatutsExpress: PriceGridStatutsExpress_1.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 (dayjs(endDate, 'YYYY-MM-DD').subtract(15, 'day').isBefore(dayjs()))
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 ? ClosingType_1.ClosingType.OUTDATED : ClosingType_1.ClosingType.IN_PROGRESS));
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
- PrestationType_1.PrestationType.COMPTA_PRO,
291
- PrestationType_1.PrestationType.COMPTA_PRO_EXPRESS,
292
- PrestationType_1.PrestationType.COMPTA_ENTREPRISE,
293
- PrestationType_1.PrestationType.COMPTA_ENTREPRISE_EXPRESS,
294
- PrestationType_1.PrestationType.COMPTA_SCI,
295
- PrestationType_1.PrestationType.COMPTA_SCI_EXPRESS,
296
- PrestationType_1.PrestationType.BILAN_PREVISIONNEL,
297
- PrestationType_1.PrestationType.COMPTA_PREMIUM,
298
- PrestationType_1.PrestationType.COMPTA_POURCENTAGE_PREMIUM,
299
- PrestationType_1.PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS,
300
- PrestationType_1.PrestationType.COMPTA_POURCENTAGE,
301
- PrestationType_1.PrestationType.COMPTA_POURCENTAGE_EXPRESS,
302
- PrestationType_1.PrestationType.SOCIAL,
303
- PrestationType_1.PrestationType.GESTION_JURIDIQUE,
304
- PrestationType_1.PrestationType.COMPTA_PRO_COMPTASTART,
305
- PrestationType_1.PrestationType.COMPTA_PRO_COMPTASTART_EXPRESS,
306
- PrestationType_1.PrestationType.COMPTA_EI_KLEMS,
307
- PrestationType_1.PrestationType.COMPTA_EI_KLEMS_EXPRESS,
308
- PrestationType_1.PrestationType.COMPTA_MICRO_KLEMS,
309
- PrestationType_1.PrestationType.COMPTA_MICRO_KLEMS_EXPRESS,
310
- PrestationType_1.PrestationType.COMPTA_LOUEUR_MEUBLE_NON_PRO_KLEMS,
311
- PrestationType_1.PrestationType.COMPTA_LOUEUR_MEUBLE_NON_PRO_KLEMS_EXPRESS,
312
- PrestationType_1.PrestationType.STATUTS_OPTION_2,
313
- PrestationType_1.PrestationType.EXPERTISE,
314
- PrestationType_1.PrestationType.SUPPORT,
315
- PrestationType_1.PrestationType.PREMIUM,
316
- PrestationType_1.PrestationType.CUSTOM_MADE,
317
- PrestationType_1.PrestationType.EI,
318
- PrestationType_1.PrestationType.MICRO,
319
- PrestationType_1.PrestationType.GESTION_IMMO,
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, exercice_1.exerciceNumber)(dayjs(endDate, 'YYYY-MM-DD').toDate(), exerciceList);
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 ([PrestationType_1.PrestationType.CREATION_SOCIETE].includes(idPrestationList) && !isSubPrestation) {
334
- if ([LegalForm_1.LegalFormTypeEnum.EI, LegalForm_1.LegalFormTypeEnum.LMNP, LegalForm_1.LegalFormTypeEnum.AUTO_ENTREPRENEUR].includes(idLegalForm)) {
335
- totalPrestation += 100;
336
- }
337
- else {
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(PrestationOption_1.PrestationOption).find((option) => option.id === optionId)) === null || _a === void 0 ? void 0 : _a.price;
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
- /* Gestion des frais de dossier */
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(PrestationOption_1.PrestationOption).filter((option) => option.brand.includes((0, brands_1.getBrandNameByNodeEnv)(process.env.NODE_ENV)));
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
- PrestationType_1.PrestationType.COMPTA_PREMIUM,
390
- PrestationType_1.PrestationType.COMPTA_POURCENTAGE_PREMIUM,
391
- PrestationType_1.PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS,
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 ([PrestationType_1.PrestationType.COMPTA_POURCENTAGE, PrestationType_1.PrestationType.COMPTA_POURCENTAGE_EXPRESS].includes(idPrestationList) &&
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 ([PrestationType_1.PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) &&
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 ([PrestationType_1.PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) &&
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 (PrestationType_1.ClementineSubscriptionAccountancySoftwarePrestations.includes(idPrestationList))
418
+ if (PrestationType_js_1.ClementineSubscriptionAccountancySoftwarePrestations.includes(idPrestationList))
418
419
  return 'software';
419
420
  return 'expertise';
420
421
  };