@silexpert/core 1.1.311 → 1.1.312

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 (81) hide show
  1. package/dist/cjs/types/Enum/BalanceSheet.d.ts +21 -0
  2. package/dist/cjs/types/Enum/BalanceSheet.d.ts.map +1 -1
  3. package/dist/cjs/types/Enum/BalanceSheet.js +27 -1
  4. package/dist/cjs/types/Enum/BalanceSheet.js.map +1 -1
  5. package/dist/cjs/types/Enum/Contract.d.ts +2 -1
  6. package/dist/cjs/types/Enum/Contract.d.ts.map +1 -1
  7. package/dist/cjs/types/Enum/Contract.js +2 -0
  8. package/dist/cjs/types/Enum/Contract.js.map +1 -1
  9. package/dist/cjs/types/Enum/MailAuto.d.ts +3 -1
  10. package/dist/cjs/types/Enum/MailAuto.d.ts.map +1 -1
  11. package/dist/cjs/types/Enum/MailAuto.js +2 -0
  12. package/dist/cjs/types/Enum/MailAuto.js.map +1 -1
  13. package/dist/cjs/types/Enum/PriceGridClementine.js +1 -1
  14. package/dist/cjs/types/Enum/PriceGridClementine.js.map +1 -1
  15. package/dist/cjs/types/Enum/Supervision.d.ts +0 -2
  16. package/dist/cjs/types/Enum/Supervision.d.ts.map +1 -1
  17. package/dist/cjs/types/Enum/Supervision.js +12 -12
  18. package/dist/cjs/types/Enum/Supervision.js.map +1 -1
  19. package/dist/cjs/types/Interface/api/payment/Util.d.ts +1 -0
  20. package/dist/cjs/types/Interface/api/payment/Util.d.ts.map +1 -1
  21. package/dist/cjs/types/Interface/api/payment/Util.js.map +1 -1
  22. package/dist/cjs/types/Interface/api/supervision/Query.d.ts +4 -2
  23. package/dist/cjs/types/Interface/api/supervision/Query.d.ts.map +1 -1
  24. package/dist/cjs/types/Interface/api/supervision/Query.js +20 -8
  25. package/dist/cjs/types/Interface/api/supervision/Query.js.map +1 -1
  26. package/dist/cjs/types/Interface/models/ISocialDetail.d.ts +1 -0
  27. package/dist/cjs/types/Interface/models/ISocialDetail.d.ts.map +1 -1
  28. package/dist/cjs/types/Interface/models/ISocialDetail.js.map +1 -1
  29. package/dist/cjs/utils/payment.d.ts.map +1 -1
  30. package/dist/cjs/utils/payment.js +34 -15
  31. package/dist/cjs/utils/payment.js.map +1 -1
  32. package/dist/cjs/utils/prestation.d.ts +8 -1
  33. package/dist/cjs/utils/prestation.d.ts.map +1 -1
  34. package/dist/cjs/utils/prestation.js +35 -8
  35. package/dist/cjs/utils/prestation.js.map +1 -1
  36. package/dist/mjs/types/Enum/BalanceSheet.d.ts +21 -0
  37. package/dist/mjs/types/Enum/BalanceSheet.d.ts.map +1 -1
  38. package/dist/mjs/types/Enum/BalanceSheet.js +26 -0
  39. package/dist/mjs/types/Enum/BalanceSheet.js.map +1 -1
  40. package/dist/mjs/types/Enum/Contract.d.ts +2 -1
  41. package/dist/mjs/types/Enum/Contract.d.ts.map +1 -1
  42. package/dist/mjs/types/Enum/Contract.js +2 -0
  43. package/dist/mjs/types/Enum/Contract.js.map +1 -1
  44. package/dist/mjs/types/Enum/MailAuto.d.ts +3 -1
  45. package/dist/mjs/types/Enum/MailAuto.d.ts.map +1 -1
  46. package/dist/mjs/types/Enum/MailAuto.js +2 -0
  47. package/dist/mjs/types/Enum/MailAuto.js.map +1 -1
  48. package/dist/mjs/types/Enum/PriceGridClementine.js +1 -1
  49. package/dist/mjs/types/Enum/PriceGridClementine.js.map +1 -1
  50. package/dist/mjs/types/Enum/Supervision.d.ts +0 -2
  51. package/dist/mjs/types/Enum/Supervision.d.ts.map +1 -1
  52. package/dist/mjs/types/Enum/Supervision.js +12 -12
  53. package/dist/mjs/types/Enum/Supervision.js.map +1 -1
  54. package/dist/mjs/types/Interface/api/payment/Util.d.ts +1 -0
  55. package/dist/mjs/types/Interface/api/payment/Util.d.ts.map +1 -1
  56. package/dist/mjs/types/Interface/api/payment/Util.js.map +1 -1
  57. package/dist/mjs/types/Interface/api/supervision/Query.d.ts +4 -2
  58. package/dist/mjs/types/Interface/api/supervision/Query.d.ts.map +1 -1
  59. package/dist/mjs/types/Interface/api/supervision/Query.js +24 -10
  60. package/dist/mjs/types/Interface/api/supervision/Query.js.map +1 -1
  61. package/dist/mjs/types/Interface/models/ISocialDetail.d.ts +1 -0
  62. package/dist/mjs/types/Interface/models/ISocialDetail.d.ts.map +1 -1
  63. package/dist/mjs/types/Interface/models/ISocialDetail.js.map +1 -1
  64. package/dist/mjs/utils/payment.d.ts.map +1 -1
  65. package/dist/mjs/utils/payment.js +35 -17
  66. package/dist/mjs/utils/payment.js.map +1 -1
  67. package/dist/mjs/utils/prestation.d.ts +8 -1
  68. package/dist/mjs/utils/prestation.d.ts.map +1 -1
  69. package/dist/mjs/utils/prestation.js +34 -8
  70. package/dist/mjs/utils/prestation.js.map +1 -1
  71. package/package.json +1 -1
  72. package/ts/types/Enum/BalanceSheet.ts +28 -1
  73. package/ts/types/Enum/Contract.ts +2 -0
  74. package/ts/types/Enum/MailAuto.ts +2 -0
  75. package/ts/types/Enum/PriceGridClementine.ts +1 -1
  76. package/ts/types/Enum/Supervision.ts +4 -4
  77. package/ts/types/Interface/api/payment/Util.ts +1 -0
  78. package/ts/types/Interface/api/supervision/Query.ts +17 -7
  79. package/ts/types/Interface/models/ISocialDetail.ts +1 -0
  80. package/ts/utils/payment.ts +34 -17
  81. package/ts/utils/prestation.ts +43 -15
@@ -1,4 +1,5 @@
1
1
  import { IExercice, IPrestation, IPrestationList } from '../types';
2
+ import { getTaxesIncludedAmount } from './vat/utils';
2
3
  import { intersection } from './noLodash';
3
4
  import { PrestationDetail, PrestationType } from '../types/Enum/PrestationType';
4
5
  import { LegalFormTypeEnum } from '../types/Enum/LegalForm';
@@ -156,7 +157,7 @@ export const getPriceGrid = (idTypeBrand: number, idPrestationList: number): pri
156
157
  const calculatePrestationPriceWithPriceGrid = (
157
158
  idPrestationList: number,
158
159
  endDate: string,
159
- NbrMonth: number,
160
+ NbrMonth: number, /* Nbr de mois dans l'exercice */
160
161
  turnover: number,
161
162
  rentsNumber: number,
162
163
  employeesNumber: number,
@@ -164,12 +165,12 @@ const calculatePrestationPriceWithPriceGrid = (
164
165
  idTypeBrand: number,
165
166
  idVatRegime: number,
166
167
  pastBalanceSheet: boolean,
167
- isYearly: boolean,
168
- totalMonth: number,
168
+ isYearly: boolean, /* Prestation annuel ou mensuel */
169
+ totalMonth: number, /* Nbr de moiis offer */
169
170
  idTaxSystem: number,
170
171
  idLegalForm: number,
171
172
  exerciceNbr: number,
172
- balanceSheetOffered: number = 0,
173
+ balanceSheetOffered: number = 0, /* montant du bilan offer */
173
174
  ): {
174
175
  totalPrestation: number,
175
176
  reduceMonth: number,
@@ -201,6 +202,7 @@ const calculatePrestationPriceWithPriceGrid = (
201
202
  if (currentPriceGrid.taxSystem && idTaxSystem) taxSystemPrice = currentPriceGrid.taxSystem?.find(tax => tax.id === idTaxSystem)?.price;
202
203
 
203
204
  /* Gestion des montants */
205
+ /* Récupératioin des prix mensuels */
204
206
  if (currentPriceGrid.turnoverMonthly && !isYearly) monthlyPrice = currentPriceGrid.turnoverMonthly?.find(turn => turnover < turn.turnoverValue)?.price;
205
207
  else if (currentPriceGrid.properties) monthlyPrice = currentPriceGrid.properties?.find(property => property.amount === rentsNumber)?.price;
206
208
  else if (currentPriceGrid.employee) {
@@ -209,12 +211,14 @@ const calculatePrestationPriceWithPriceGrid = (
209
211
  } else if (currentPriceGrid.employeeByLegalForm) {
210
212
  monthlyPrice = currentPriceGrid.employeeByLegalForm?.find(emp => emp.idLegalForm === idLegalForm)?.price;
211
213
  monthlyPrice = monthlyPrice ? monthlyPrice * employeesNumber : 0;
214
+ /* Récupération des prix annuels */
212
215
  } else if (currentPriceGrid.turnoverYearly && isYearly) yearlyPrice = currentPriceGrid.turnoverYearly?.find(turn => turnover < turn.turnoverValue)?.price;
213
216
  else if (!pastBalanceSheet && currentPriceGrid.turnoverCreatedYear) yearlyPrice = currentPriceGrid.turnoverCreatedYear?.find(turn => turnover < turn.turnoverValue)?.price;
214
217
  else if (pastBalanceSheet && currentPriceGrid.turnoverPastYear) yearlyPrice = currentPriceGrid.turnoverPastYear?.find(turn => turnover < turn.turnoverValue)?.price;
215
218
  else if (currentPriceGrid.partner) yearlyPrice = currentPriceGrid.partner?.find(part => part.amountMinimum <= associatesNumber && part.amountMaximum >= associatesNumber)?.price;
216
219
  else if (currentPriceGrid.legalForm) yearlyPrice = currentPriceGrid.legalForm?.find(form => form.idLegalForm === idLegalForm)?.price;
217
220
  else if (currentPriceGrid.exerciceNbr) yearlyPrice = currentPriceGrid.exerciceNbr?.find(el => el.minimum <= exerciceNbr && exerciceNbr <= el.maximum )?.price;
221
+ /* Calcul du prix mensuel final */
218
222
  finalMonthlyPrice = (monthlyPrice ? monthlyPrice : 0) + (vatRegimePrice ? vatRegimePrice : 0) + (taxSystemPrice ? taxSystemPrice : 0);
219
223
 
220
224
  /* Gestion des mois */
@@ -231,14 +235,17 @@ const calculatePrestationPriceWithPriceGrid = (
231
235
  }
232
236
  }
233
237
  }
238
+ /* Gestion des offres, mois offer */
234
239
  if (totalMonth > 0) {
235
240
  if (monthlyNbr && ((monthNbr - totalMonth) < monthlyNbr?.minimum)) canBeCreated = false;
236
241
  monthNbr = monthNbr - totalMonth;
237
242
  recalculateMonthly = true;
238
243
  }
239
244
 
245
+ /* Calcul du nombre de mois soustraient */
240
246
  reduceMonth = (monthNbr === NbrMonth - totalMonth ? totalMonth : 0);
241
247
 
248
+ /* Gestion des offres, bilan offer */
242
249
  if (balanceSheetOffered > 0) {
243
250
  yearlyPrice = undefined;
244
251
  recalculateMonthly = false;
@@ -248,7 +255,7 @@ const calculatePrestationPriceWithPriceGrid = (
248
255
  /* Prix Final */
249
256
  totalPrestation = (yearlyPrice ? yearlyPrice : finalMonthlyPrice * monthNbr);
250
257
  }
251
- return { totalPrestation, reduceMonth, canBeCreated, monthNbr: yearlyPrice ? 0 : recalculateMonthly ? NbrMonth : monthNbr, price: yearlyPrice ? yearlyPrice : recalculateMonthly ? (totalPrestation / NbrMonth) : (finalMonthlyPrice ? finalMonthlyPrice : 0) };
258
+ return { totalPrestation, reduceMonth, canBeCreated, monthNbr: yearlyPrice ? 0 : recalculateMonthly ? NbrMonth : monthNbr, price: yearlyPrice ? yearlyPrice : recalculateMonthly ? (totalPrestation / monthNbr) : (finalMonthlyPrice ? finalMonthlyPrice : 0) };
252
259
  };
253
260
 
254
261
  const calculatePrestationPriceWithPrestationList = (prestationList: IPrestationList): number => {
@@ -259,11 +266,28 @@ const calculatePrestationPriceWithPrestationList = (prestationList: IPrestationL
259
266
  return totalPrestation;
260
267
  };
261
268
 
269
+ /**
270
+ * From idLegalForm, get application fees amount (without taxes included if no idVat passed, or with taxes included calculated by given idVat)
271
+ * @param idLegalForm
272
+ * @param idVat
273
+ * @returns amount of application fees, without taxes included
274
+ */
275
+ const getApplicationFeesAmount = (idLegalForm: number, idVat?: number) =>{
276
+ let applicationFeesAmount = 50;
277
+ if (idLegalForm === LegalFormTypeEnum.SCI) applicationFeesAmount = 150;
278
+
279
+ //Sans tva, on envoie le montant HT
280
+ if (!idVat) return applicationFeesAmount;
281
+
282
+ //Avec tva, on envoie le montant TTC
283
+ return getTaxesIncludedAmount(applicationFeesAmount, idVat);
284
+ };
285
+
262
286
  const calculatePrestationPrice = (
263
287
  idPrestationList: number,
264
288
  prestationList: IPrestationList,
265
289
  endDate: string,
266
- NbrMonth: number,
290
+ NbrMonth: number, /* Nbr de mois dans l'exercice */
267
291
  turnover: number,
268
292
  rentsNumber: number,
269
293
  employeesNumber: number,
@@ -272,13 +296,13 @@ const calculatePrestationPrice = (
272
296
  idVatRegime: number,
273
297
  pastBalanceSheet: boolean,
274
298
  optionsList: number[],
275
- totalPercentage: number,
276
- totalAmount: number,
277
- totalMonth: number,
278
- isWithApplicationFees: boolean,
299
+ totalPercentage: number, /* total pourcentage offer (%) */
300
+ totalAmount: number, /* total montant offer (€) */
301
+ totalMonth: number, /* total mois offer (mois) */
302
+ isWithApplicationFees: boolean, /* frais de dossier */
279
303
  idTaxSystem: number,
280
304
  idLegalForm: number,
281
- isYearly: boolean = false,
305
+ isYearly: boolean = false, /* prestation annuel ou mensuel */
282
306
  isSubPrestation: boolean = false,
283
307
  balanceSheetOffered: number = 0,
284
308
  exerciceList: IExercice[] = [],
@@ -354,8 +378,12 @@ const calculatePrestationPrice = (
354
378
  totalPrestation = calculatePrestationPriceWithPrestationList(prestationList);
355
379
  if ([PrestationType.CREATION_SOCIETE].includes(idPrestationList) && !isSubPrestation) totalPrestation += 50;
356
380
  }
381
+ /* Gestion des offres */
382
+ /* Offre montant offer */
357
383
  if (totalAmount > 0) totalPrestation = totalPrestation - totalAmount;
384
+ /* Offre pourcentage offer */
358
385
  if (totalPercentage > 0) totalPrestation = totalPrestation - (totalPrestation * (totalPercentage / 100));
386
+ /* Gesstioin du prix minimum acceptable pour la prestation */
359
387
  if (prestationList.minimumPrice && totalPrestation < prestationList.minimumPrice) totalPrestation = prestationList.minimumPrice;
360
388
  /* Gestion des options */
361
389
  let OptionTotalPrice: number = 0;
@@ -366,10 +394,10 @@ const calculatePrestationPrice = (
366
394
  });
367
395
  }
368
396
  totalPrestation += (OptionTotalPrice ? OptionTotalPrice : 0);
369
-
397
+ /* Gestion des frais de dossier */
370
398
  if (isWithApplicationFees) {
371
- if (idLegalForm === LegalFormTypeEnum.SCI) totalPrestation += 150;
372
- else totalPrestation += 50;
399
+ const applicationFeesAmount = getApplicationFeesAmount(idLegalForm);
400
+ totalPrestation += applicationFeesAmount;
373
401
  }
374
402
 
375
403
  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€' : ''}`;
@@ -401,5 +429,5 @@ const isAbleToUpdatePrice = (idTypeBrand: number, idPrestationList: number, turn
401
429
  };
402
430
 
403
431
  export {
404
- isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isFromStatutsExpress, isExpress, calculateScoringOfPrestation, calculatePrestationPrice, getPrestationOptions, isAbleToUpdatePrice, calculatePrestationPriceWithPriceGrid,
432
+ isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isFromStatutsExpress, isExpress, calculateScoringOfPrestation, calculatePrestationPrice, getPrestationOptions, isAbleToUpdatePrice, calculatePrestationPriceWithPriceGrid, getApplicationFeesAmount,
405
433
  };