@silexpert/core 1.0.154 → 1.0.158

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 (35) hide show
  1. package/es/types/Enum/PrestationType.d.ts +5 -2626
  2. package/es/types/Enum/PrestationType.d.ts.map +1 -1
  3. package/es/types/Enum/PrestationType.js +1674 -1511
  4. package/es/types/Enum/PrestationType.js.map +1 -1
  5. package/es/types/Interface/models/IExercicePrestation.d.ts +2 -1
  6. package/es/types/Interface/models/IExercicePrestation.d.ts.map +1 -1
  7. package/es/types/Interface/models/IExercicePrestation.js.map +1 -1
  8. package/es/types/Interface/models/IPrestation.d.ts +13 -10
  9. package/es/types/Interface/models/IPrestation.d.ts.map +1 -1
  10. package/es/types/Interface/models/IPrestation.js.map +1 -1
  11. package/es/types/Interface/models/IPrestationList.d.ts +3 -2
  12. package/es/types/Interface/models/IPrestationList.d.ts.map +1 -1
  13. package/es/types/Interface/models/IPrestationList.js.map +1 -1
  14. package/es/types/Interface/models/ITerminationList.d.ts +7 -4
  15. package/es/types/Interface/models/ITerminationList.d.ts.map +1 -1
  16. package/es/types/Interface/models/ITerminationList.js.map +1 -1
  17. package/es/utils/prestation.d.ts +4 -1
  18. package/es/utils/prestation.d.ts.map +1 -1
  19. package/es/utils/prestation.js +18 -1
  20. package/es/utils/prestation.js.map +1 -1
  21. package/js/types/Enum/PrestationType.js +1837 -1674
  22. package/js/types/Enum/PrestationType.js.map +1 -1
  23. package/js/types/Interface/models/IExercicePrestation.js.map +1 -1
  24. package/js/types/Interface/models/IPrestation.js.map +1 -1
  25. package/js/types/Interface/models/IPrestationList.js.map +1 -1
  26. package/js/types/Interface/models/ITerminationList.js.map +1 -1
  27. package/js/utils/prestation.js +17 -1
  28. package/js/utils/prestation.js.map +1 -1
  29. package/package.json +1 -1
  30. package/ts/types/Enum/PrestationType.ts +1681 -1512
  31. package/ts/types/Interface/models/IExercicePrestation.ts +2 -1
  32. package/ts/types/Interface/models/IPrestation.ts +13 -10
  33. package/ts/types/Interface/models/IPrestationList.ts +3 -2
  34. package/ts/types/Interface/models/ITerminationList.ts +7 -4
  35. package/ts/utils/prestation.ts +23 -1
@@ -6,6 +6,7 @@ import { IExercice } from '../..';
6
6
  export interface IExercicePrestation {
7
7
  id?: number;
8
8
  priceHt: number | null;
9
+ customerPriceHt: number | null;
9
10
  totalPrestation: number | null;
10
11
  monthNumber: number | null;
11
12
  amountSocial: number | null;
@@ -18,7 +19,7 @@ export interface IExercicePrestation {
18
19
  idPrestation: number | null;
19
20
 
20
21
  // Associations
21
- prestation: IPrestation;
22
+ prestation?: IPrestation;
22
23
  balanceSheet?: IBalanceSheet;
23
24
  exercice?: IExercice;
24
25
  }
@@ -5,6 +5,7 @@ import { IPrestationComplementary } from './IPrestationComplementary';
5
5
  import { ISociety } from './ISociety';
6
6
  import { IExercicePrestation } from './IExercicePrestation';
7
7
  import { ICustomerSignature } from './ICustomerSignature';
8
+ import { ITerminationList } from './ITerminationList';
8
9
 
9
10
  // prestations
10
11
  export interface IPrestation {
@@ -26,6 +27,7 @@ export interface IPrestation {
26
27
  dateValidPrestation: Date | null;
27
28
  goToOnboarding: Date | null;
28
29
  goToClient: Date | null;
30
+ scoring: number | null;
29
31
  state: boolean;
30
32
  commentPdf: string | null;
31
33
  token: string | null;
@@ -46,14 +48,15 @@ export interface IPrestation {
46
48
  deletedAt?: Date | null;
47
49
 
48
50
  // Associations
49
- exercices: IExercice[];
50
- prestationsPayments: IPayment[];
51
- prestationsList: IPrestationList;
52
- prestationsComplementary: IPrestationComplementary;
53
- prestationJuridique: IPrestation;
54
- prestationSocial: IPrestation;
55
- prestationCreation: IPrestation;
56
- societiesPrestations: ISociety;
57
- prestationsDetailsBeforeExercice: IExercicePrestation[];
58
- customersSignatures: ICustomerSignature[];
51
+ exercices?: IExercice[];
52
+ prestationsPayments?: IPayment[];
53
+ prestationsList?: IPrestationList;
54
+ prestationsComplementary?: IPrestationComplementary;
55
+ prestationJuridique?: IPrestation;
56
+ prestationSocial?: IPrestation;
57
+ prestationCreation?: IPrestation;
58
+ societiesPrestations?: ISociety;
59
+ prestationsDetailsBeforeExercice?: IExercicePrestation[];
60
+ customersSignatures?: ICustomerSignature[];
61
+ terminationsList?: ITerminationList;
59
62
  }
@@ -14,8 +14,9 @@ export interface IPrestationList {
14
14
  isComplementary: boolean;
15
15
  signaturePosition: string | null;
16
16
  signaturePage: number | null;
17
- textDefault: string | null;
18
- color: string | null;
17
+ textDefault?: string;
18
+ color?: string;
19
+ point?: number;
19
20
  createdAt?: Date | null;
20
21
  updatedAt?: Date | null;
21
22
  }
@@ -2,6 +2,7 @@ import { IReasonTermination } from './IReasonTermination';
2
2
  import { ISociety } from './ISociety';
3
3
  import { IExercice } from './IExercice';
4
4
  import { IUser } from './IUser';
5
+ import { IPrestation } from './IPrestation';
5
6
 
6
7
  // terminitionsList
7
8
  export interface ITerminationList {
@@ -15,13 +16,15 @@ export interface ITerminationList {
15
16
  refund: boolean;
16
17
  idReasonTermination: number | null;
17
18
  idSociety: number | null;
19
+ idPrestation: number | null;
18
20
  idCollaborateur: number | null;
19
21
  createdAt?: Date | null;
20
22
  updatedAt?: Date | null;
21
23
 
22
24
  // Associations
23
- reasonTermination: IReasonTermination;
24
- societiesTerminations: ISociety;
25
- exercice: IExercice;
26
- user: IUser;
25
+ reasonTermination?: IReasonTermination;
26
+ societiesTerminations?: ISociety;
27
+ exercice?: IExercice;
28
+ user?: IUser;
29
+ prestation?: IPrestation;
27
30
  }
@@ -1,3 +1,4 @@
1
+ import { IPrestation } from '../types';
1
2
  import { PrestationDetail, PrestationType } from '../types/Enum/PrestationType';
2
3
 
3
4
  const isOtherAccountingMissions = (idPrestationList: number): boolean => [
@@ -29,6 +30,27 @@ const isExpress = (idPrestationList: number):boolean => {
29
30
  return !!prestaList.isBack;
30
31
  };
31
32
 
33
+ const calculateScoringOfPrestation = (idPrestationType: PrestationType, prestations: IPrestation[]): number => {
34
+ // Get the list of prestations that are half price
35
+ const prestationHalfPriceList = Object.values(PrestationDetail).filter((p) => p.isComptable && !p.isCatalog);
36
+ const prestationHalfPriceIds = prestationHalfPriceList.map((t) => t.id);
37
+
38
+ // Get the number of points for the prestation
39
+ const prestaDetails = Object.values(PrestationDetail).find((prestaDetail) => prestaDetail.id === idPrestationType);
40
+ const numberPoint = prestaDetails?.point || 0;
41
+
42
+ // Find the prestation with the same idPrestationList and they need to be paid and signed
43
+ const samePrestation = prestations.filter((prestation) => (prestation.idPrestationList === idPrestationType) && (prestation.paid === true && prestation.signed === true && prestation.terminationsList === null));
44
+
45
+ // If there is no prestation with the same idPrestationList, return 100% of points
46
+ if (samePrestation.length === 0) return numberPoint;
47
+
48
+ // If the prestation is in the list of half price prestation, return 50% of points
49
+ if (prestationHalfPriceIds.includes(idPrestationType)) return numberPoint * 0.5;
50
+
51
+ return 0;
52
+ };
53
+
32
54
  export {
33
- isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isExpress,
55
+ isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isExpress, calculateScoringOfPrestation,
34
56
  };