@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
@@ -279,6 +279,7 @@ export const allPrestations2025WithCGV = [
279
279
  PrestationType.ATTESTATION_1,
280
280
  PrestationType.ATTESTATION_NON_REMUNERATION_RECURRENTE,
281
281
  PrestationType.FORFAIT_EXPRESS,
282
+ PrestationType.BILAN_PREVISIONNEL,
282
283
  ];
283
284
 
284
285
  export const ClementineSubscriptionAccountancyExpertPrestations: PrestationType[] = [
@@ -616,7 +617,7 @@ export const PrestationDetail: PrestationDetailEnum = {
616
617
  isComplementary: false,
617
618
  signaturePosition: '400,54,569,90',
618
619
  signaturePage: 6,
619
- point: 100,
620
+ point: 150,
620
621
  },
621
622
  JURIDIQUE: {
622
623
  id: 16,
@@ -3792,7 +3793,7 @@ export const PrestationDetail: PrestationDetailEnum = {
3792
3793
  isComplementary: false,
3793
3794
  signaturePosition: '400,54,569,90',
3794
3795
  signaturePage: 7,
3795
- point: 200,
3796
+ point: 150,
3796
3797
  },
3797
3798
  //Software
3798
3799
  STEERING: {
@@ -3812,7 +3813,7 @@ export const PrestationDetail: PrestationDetailEnum = {
3812
3813
  isComplementary: false,
3813
3814
  signaturePosition: '400,54,569,90',
3814
3815
  signaturePage: 7,
3815
- point: 200,
3816
+ point: 150,
3816
3817
  },
3817
3818
  //Software
3818
3819
  VAT: {
@@ -3832,7 +3833,7 @@ export const PrestationDetail: PrestationDetailEnum = {
3832
3833
  isComplementary: false,
3833
3834
  signaturePosition: '400,54,569,90',
3834
3835
  signaturePage: 7,
3835
- point: 200,
3836
+ point: 150,
3836
3837
  },
3837
3838
  //Software
3838
3839
  BALANCESHEET: {
@@ -3852,7 +3853,7 @@ export const PrestationDetail: PrestationDetailEnum = {
3852
3853
  isComplementary: false,
3853
3854
  signaturePosition: '400,54,569,90',
3854
3855
  signaturePage: 7,
3855
- point: 200,
3856
+ point: 150,
3856
3857
  },
3857
3858
  EXPERTISE: {
3858
3859
  id: PrestationType.EXPERTISE,
@@ -3871,7 +3872,7 @@ export const PrestationDetail: PrestationDetailEnum = {
3871
3872
  isComplementary: false,
3872
3873
  signaturePosition: '400,54,569,90',
3873
3874
  signaturePage: 7, //???
3874
- point: 200,
3875
+ point: 150,
3875
3876
  listPcaTypes: [PcaType.ACCOUNTING],
3876
3877
  },
3877
3878
  SUPPORT: {
@@ -3891,7 +3892,7 @@ export const PrestationDetail: PrestationDetailEnum = {
3891
3892
  isComplementary: false,
3892
3893
  signaturePosition: '400,54,569,90',
3893
3894
  signaturePage: 7, //???
3894
- point: 200,
3895
+ point: 400,
3895
3896
  listPcaTypes: [PcaType.ACCOUNTING, PcaType.LEGAL],
3896
3897
  },
3897
3898
  PREMIUM: {
@@ -3911,7 +3912,7 @@ export const PrestationDetail: PrestationDetailEnum = {
3911
3912
  isComplementary: false,
3912
3913
  signaturePosition: '400,54,569,90',
3913
3914
  signaturePage: 7, //???
3914
- point: 400,
3915
+ point: 600,
3915
3916
  listPcaTypes: [PcaType.ACCOUNTING, PcaType.LEGAL],
3916
3917
  },
3917
3918
  CUSTOM_MADE: {
@@ -3931,7 +3932,7 @@ export const PrestationDetail: PrestationDetailEnum = {
3931
3932
  isComplementary: false,
3932
3933
  signaturePosition: '400,54,569,90',
3933
3934
  signaturePage: 7, //???
3934
- point: 400,
3935
+ point: 600,
3935
3936
  listPcaTypes: [PcaType.ACCOUNTING, PcaType.LEGAL],
3936
3937
  },
3937
3938
  EI: {
@@ -3951,7 +3952,7 @@ export const PrestationDetail: PrestationDetailEnum = {
3951
3952
  isComplementary: false,
3952
3953
  signaturePosition: '400,54,569,90',
3953
3954
  signaturePage: 7, //???
3954
- point: 200, //???
3955
+ point: 150, //???
3955
3956
  listPcaTypes: [PcaType.ACCOUNTING],
3956
3957
  },
3957
3958
  MICRO: {
@@ -3971,7 +3972,7 @@ export const PrestationDetail: PrestationDetailEnum = {
3971
3972
  isComplementary: false,
3972
3973
  signaturePosition: '400,54,569,90',
3973
3974
  signaturePage: 7, //???
3974
- point: 200, //???
3975
+ point: 150, //???
3975
3976
  },
3976
3977
  GESTION_IMMO: {
3977
3978
  id: PrestationType.GESTION_IMMO,
@@ -3990,7 +3991,7 @@ export const PrestationDetail: PrestationDetailEnum = {
3990
3991
  isComplementary: false,
3991
3992
  signaturePosition: '400,54,569,90',
3992
3993
  signaturePage: 7, //???
3993
- point: 200, //???
3994
+ point: 150, //???
3994
3995
  listPcaTypes: [PcaType.ACCOUNTING],
3995
3996
  },
3996
3997
  TERMINATION_FEES: {
@@ -1,12 +1,27 @@
1
- import { IsInt, IsOptional, IsString } from 'class-validator';
2
- import { ApiPropertyOptional } from '../../../../utils';
1
+ import { IsBoolean, IsInt, IsOptional, IsString } from 'class-validator';
2
+ import { ApiPropertyOptional } from '@nestjs/swagger';
3
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform.js';
4
+ import { ToNumber } from '../../../../utils/transforms/number.transform.js';
5
+ import { OptionalQueryPaginate } from '../BasePaginate.js';
3
6
 
4
- export class QueryGetStats {
7
+ export class QueryGetStats extends OptionalQueryPaginate {
5
8
  @ApiPropertyOptional()
6
9
  @IsOptional()
7
10
  @IsString()
8
11
  search?: string;
9
12
 
13
+ @ApiPropertyOptional()
14
+ @IsOptional()
15
+ @IsBoolean()
16
+ @ToBoolean()
17
+ isInCA?: boolean;
18
+
19
+ @ApiPropertyOptional()
20
+ @IsOptional()
21
+ @IsInt()
22
+ @ToNumber()
23
+ isAdditionalSales?: number;
24
+
10
25
  @ApiPropertyOptional()
11
26
  @IsOptional()
12
27
  @IsInt()
@@ -37,8 +52,23 @@ export class QueryGetStats {
37
52
  @IsInt({ each: true })
38
53
  idPrestationList?: number[];
39
54
 
55
+ @ApiPropertyOptional()
56
+ @IsOptional()
57
+ @IsInt({ each: true })
58
+ idOfferList?: number[];
59
+
60
+ @ApiPropertyOptional()
61
+ @IsOptional()
62
+ @IsInt({ each: true })
63
+ idState?: number[];
64
+
40
65
  @ApiPropertyOptional()
41
66
  @IsOptional()
42
67
  @IsInt({ each: true })
43
68
  idConstitutionState?: number[];
69
+
70
+ @ApiPropertyOptional()
71
+ @IsOptional()
72
+ @IsInt()
73
+ idTypeBrand?: number;
44
74
  }
@@ -1,23 +1,21 @@
1
- import { IExercice, IPrestation, IPrestationList } from '../types';
2
- import { Vat } from '../types/Enum/Vat';
3
- import { ReasonTerminationType } from '../types/Enum/ReasonTerminationType';
4
- import { getTaxesIncludedAmount } from './vat/utils';
5
- import { intersection } from './noLodash';
1
+ import { IExercice, IPrestation, IPrestationList } from '../types/index.js';
2
+ import { Vat } from '../types/Enum/Vat.js';
3
+ import { ReasonTerminationType } from '../types/Enum/ReasonTerminationType.js';
4
+ import { intersection } from './noLodash.js';
6
5
  import {
7
6
  ClementineSubscriptionAccountancySoftwarePrestations,
8
7
  PrestationDetail,
9
8
  PrestationType,
10
- } from '../types/Enum/PrestationType';
11
- import { LegalFormTypeEnum } from '../types/Enum/LegalForm';
12
- import { PrestationOptionType, PrestationOption } from '../types/Enum/PrestationOption';
13
- import { PriceGridClementine } from '../types/Enum/PriceGridClementine';
14
- import { PriceGridPourcentage } from '../types/Enum/PriceGridPourcentage';
15
- import { PriceGridLegalstart } from '../types/Enum/PriceGridLegalstart';
16
- import { PriceGridStatutsExpress } from '../types/Enum/PriceGridStatutsExpress';
17
- import { ClosingType } from '../types/Enum/ClosingType';
18
- import { getBrandNameByNodeEnv } from './brands';
19
- import * as dayjs from 'dayjs';
20
- import { exerciceNumber } from './exercice';
9
+ } from '../types/Enum/PrestationType.js';
10
+ import { PrestationOptionType, PrestationOption } from '../types/Enum/PrestationOption.js';
11
+ import { PriceGridClementine } from '../types/Enum/PriceGridClementine.js';
12
+ import { PriceGridPourcentage } from '../types/Enum/PriceGridPourcentage.js';
13
+ import { PriceGridLegalstart } from '../types/Enum/PriceGridLegalstart.js';
14
+ import { PriceGridStatutsExpress } from '../types/Enum/PriceGridStatutsExpress.js';
15
+ import { ClosingType } from '../types/Enum/ClosingType.js';
16
+ import { getBrandNameByNodeEnv } from './brands.js';
17
+ import dayjs from 'dayjs';
18
+ import { exerciceNumber } from './exercice.js';
21
19
 
22
20
  type priceGridBrand = {
23
21
  idTypeBrand: number;
@@ -154,10 +152,45 @@ const isConsultingHour = (idPrestationList: number[]): boolean =>
154
152
  !!intersection(idPrestationList, [PrestationType.CONSULTING_HOUR]).length;
155
153
 
156
154
  const isSoftwarePrestation = (idPrestationList: number[]): boolean =>
157
- !!intersection(idPrestationList, [PrestationType.STEERING, PrestationType.VAT, PrestationType.BALANCESHEET])
158
- .length; /* &&
155
+ !!intersection(idPrestationList, [
156
+ PrestationType.STEERING,
157
+ PrestationType.VAT,
158
+ PrestationType.BALANCESHEET,
159
+ PrestationType.BILLING,
160
+ ]).length; /* &&
159
161
  idPrestationList.length === 1 */ // Commenté car si un client résilie un software pour un utre software, condition non prise en charge
160
162
 
163
+ /**
164
+ * Retourne la première prestation comptable non catalogue trouvée dans une liste.
165
+ *
166
+ * @param prestationsList Liste de prestations de référence.
167
+ * @returns La prestation comptable non catalogue, ou undefined si aucune n'est trouvée.
168
+ */
169
+ const getComptableNotCatalogPrestation = (
170
+ prestationsList: Array<Partial<IPrestationList>>,
171
+ ): Partial<IPrestationList> | undefined =>
172
+ prestationsList.find((prestation) => !!prestation.isComptable && !prestation.isCatalog);
173
+
174
+ /**
175
+ * Retourne true si une prestation comptable (isPlannable & isComptable & !isCatalog) est trouvée dans la liste.
176
+ *
177
+ * @param prestationsList Liste de prestations de référence.
178
+ * @returns true si une prestation comptable est trouvée, sinon false.
179
+ */
180
+ const hasAccountingPrestation = (prestationsList: Array<Partial<IPrestationList>>): boolean =>
181
+ !!prestationsList.find((prestation) => !!prestation.isPlannable && !!prestation.isComptable && !prestation.isCatalog);
182
+
183
+ /**
184
+ * Retourne la première prestation comptable (isPlannable & isComptable & !isCatalog) trouvée dans la liste.
185
+ *
186
+ * @param prestationsList Liste de prestations de référence.
187
+ * @returns La prestation comptable, ou undefined si aucune n'est trouvée.
188
+ */
189
+ const getAccountingPrestation = (
190
+ prestationsList: Array<Partial<IPrestationList>>,
191
+ ): Partial<IPrestationList> | undefined =>
192
+ prestationsList.find((prestation) => !!prestation.isPlannable && !!prestation.isComptable && !prestation.isCatalog);
193
+
161
194
  const calculateScoringOfPrestation = (
162
195
  idPrestationType: PrestationType,
163
196
  prestations: IPrestation[],
@@ -196,7 +229,9 @@ const calculateScoringOfPrestation = (
196
229
  p.isComptable &&
197
230
  !p.isCatalog &&
198
231
  p.id &&
199
- ![PrestationType.BALANCESHEET, PrestationType.VAT, PrestationType.STEERING].includes(p.id),
232
+ ![PrestationType.BALANCESHEET, PrestationType.VAT, PrestationType.STEERING, PrestationType.BILLING].includes(
233
+ p.id,
234
+ ),
200
235
  );
201
236
  const prestationHalfPriceIds = prestationHalfPriceList.map((t) => t.id);
202
237
 
@@ -227,9 +262,8 @@ const calculateScoringOfPrestation = (
227
262
  const prestationsExistIds = prestationsSignedPaid.map((prestation) => prestation.idPrestationList);
228
263
  const prestationHalfPriceAlreadyDoneIds = prestationsExistIds.filter((id) => prestationHalfPriceIds.includes(id));
229
264
 
230
- // 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
231
- if (prestationHalfPriceAlreadyDoneIds.length && prestationHalfPriceIds.includes(idPrestationType))
232
- return Math.floor(numberPoint * 0.3);
265
+ // 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)
266
+ if (prestationHalfPriceAlreadyDoneIds.length && prestationHalfPriceIds.includes(idPrestationType)) return 250;
233
267
 
234
268
  return numberPoint;
235
269
  };
@@ -427,24 +461,6 @@ const calculatePrestationPriceWithPrestationList = (prestationList: IPrestationL
427
461
  return totalPrestation;
428
462
  };
429
463
 
430
- /**
431
- * From idLegalForm, get application fees amount (without taxes included if no idVat passed, or with taxes included calculated by given idVat)
432
- * @param idLegalForm
433
- * @param idVat
434
- * @returns amount of application fees, without taxes included
435
- * @deprecated Application fees are not charged anymore
436
- */
437
- const getApplicationFeesAmount = (idLegalForm: number, idVat?: number) => {
438
- let applicationFeesAmount = 50;
439
- if (idLegalForm === LegalFormTypeEnum.SCI) applicationFeesAmount = 150;
440
-
441
- //Sans tva, on envoie le montant HT
442
- if (!idVat) return applicationFeesAmount;
443
-
444
- //Avec tva, on envoie le montant TTC
445
- return getTaxesIncludedAmount(applicationFeesAmount, idVat);
446
- };
447
-
448
464
  const calculatePrestationPrice = (
449
465
  idPrestationList: number,
450
466
  prestationList: IPrestationList,
@@ -461,7 +477,6 @@ const calculatePrestationPrice = (
461
477
  totalPercentage: number /* total pourcentage offer (%) */,
462
478
  totalAmount: number /* total montant offer (€) */,
463
479
  totalMonth: number /* total mois offer (mois) */,
464
- isWithApplicationFees: boolean /* frais de dossier */,
465
480
  idTaxSystem: number,
466
481
  idLegalForm: number,
467
482
  isYearly: boolean = false /* prestation annuel ou mensuel */,
@@ -552,11 +567,10 @@ const calculatePrestationPrice = (
552
567
  } else {
553
568
  totalPrestation = calculatePrestationPriceWithPrestationList(prestationList);
554
569
  if ([PrestationType.CREATION_SOCIETE].includes(idPrestationList) && !isSubPrestation) {
555
- if ([LegalFormTypeEnum.EI, LegalFormTypeEnum.LMNP, LegalFormTypeEnum.AUTO_ENTREPRENEUR].includes(idLegalForm)) {
556
- totalPrestation += 100;
557
- } else {
558
- totalPrestation += 300;
559
- }
570
+ // totalPrestation += 50;
571
+ // La création est offerte désormais
572
+ // inutile d'ajouter les frais de greffe et d'annonce légale,
573
+ // car ne compte pas dans le calcul pour les sales
560
574
  }
561
575
  }
562
576
  /* Gestion des offres */
@@ -578,13 +592,8 @@ const calculatePrestationPrice = (
578
592
  });
579
593
  }
580
594
  totalPrestation += OptionTotalPrice ? OptionTotalPrice : 0;
581
- /* Gestion des frais de dossier */
582
- // if (isWithApplicationFees) {
583
- // const applicationFeesAmount = getApplicationFeesAmount(idLegalForm);
584
- // totalPrestation += applicationFeesAmount;
585
- // }
586
595
 
587
- 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€' : ''}`;
596
+ const calculDetail = `${monthNbr > 0 ? monthNbr + ' mois x ' + Math.round(price * 100) / 100 + '€' : Math.round(price * 100) / 100 + '€'} ${totalAmount > 0 ? '- ' + totalAmount + '€' : ''} ${totalPercentage > 0 ? '- ' + totalPercentage + '%' : ''}`;
588
597
 
589
598
  return {
590
599
  totalPrestation,
@@ -665,11 +674,13 @@ export {
665
674
  isExpress,
666
675
  isConsultingHour,
667
676
  isSoftwarePrestation,
677
+ getComptableNotCatalogPrestation,
678
+ hasAccountingPrestation,
679
+ getAccountingPrestation,
668
680
  calculateScoringOfPrestation,
669
681
  calculatePrestationPrice,
670
682
  getPrestationOptions,
671
683
  isAbleToUpdatePrice,
672
684
  calculatePrestationPriceWithPriceGrid,
673
- getApplicationFeesAmount,
674
685
  idPrestationListToOfferType,
675
686
  };