@silexpert/core 1.0.153 → 1.0.155

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 (78) hide show
  1. package/es/api/resources/Rule.d.ts +4 -2
  2. package/es/api/resources/Rule.d.ts.map +1 -1
  3. package/es/api/resources/Rule.js +6 -0
  4. package/es/api/resources/Rule.js.map +1 -1
  5. package/es/api/resources/Shine.js +4 -4
  6. package/es/api/resources/Shine.js.map +1 -1
  7. package/es/types/Enum/PrestationType.d.ts +5 -2626
  8. package/es/types/Enum/PrestationType.d.ts.map +1 -1
  9. package/es/types/Enum/PrestationType.js +1674 -1511
  10. package/es/types/Enum/PrestationType.js.map +1 -1
  11. package/es/types/Interface/api/rule/Create.d.ts +10 -0
  12. package/es/types/Interface/api/rule/Create.d.ts.map +1 -0
  13. package/es/types/Interface/api/rule/Create.js +46 -0
  14. package/es/types/Interface/api/rule/Create.js.map +1 -0
  15. package/es/types/Interface/api/rule/Update.d.ts +4 -0
  16. package/es/types/Interface/api/rule/Update.d.ts.map +1 -0
  17. package/es/types/Interface/api/rule/Update.js +21 -0
  18. package/es/types/Interface/api/rule/Update.js.map +1 -0
  19. package/es/types/Interface/models/IAccountingTransaction.d.ts +1 -0
  20. package/es/types/Interface/models/IAccountingTransaction.d.ts.map +1 -1
  21. package/es/types/Interface/models/IAccountingTransaction.js.map +1 -1
  22. package/es/types/Interface/models/IExercicePrestation.d.ts +2 -1
  23. package/es/types/Interface/models/IExercicePrestation.d.ts.map +1 -1
  24. package/es/types/Interface/models/IExercicePrestation.js.map +1 -1
  25. package/es/types/Interface/models/IPrestation.d.ts +13 -10
  26. package/es/types/Interface/models/IPrestation.d.ts.map +1 -1
  27. package/es/types/Interface/models/IPrestation.js.map +1 -1
  28. package/es/types/Interface/models/IPrestationList.d.ts +3 -2
  29. package/es/types/Interface/models/IPrestationList.d.ts.map +1 -1
  30. package/es/types/Interface/models/IPrestationList.js.map +1 -1
  31. package/es/types/Interface/models/IRule.d.ts +2 -0
  32. package/es/types/Interface/models/IRule.d.ts.map +1 -1
  33. package/es/types/Interface/models/IRule.js.map +1 -1
  34. package/es/types/Interface/models/ITerminationList.d.ts +7 -4
  35. package/es/types/Interface/models/ITerminationList.d.ts.map +1 -1
  36. package/es/types/Interface/models/ITerminationList.js.map +1 -1
  37. package/es/types/index.d.ts +3 -0
  38. package/es/types/index.d.ts.map +1 -1
  39. package/es/types/index.js +3 -0
  40. package/es/types/index.js.map +1 -1
  41. package/es/utils/prestation.d.ts +4 -1
  42. package/es/utils/prestation.d.ts.map +1 -1
  43. package/es/utils/prestation.js +18 -1
  44. package/es/utils/prestation.js.map +1 -1
  45. package/js/api/resources/Rule.js +6 -0
  46. package/js/api/resources/Rule.js.map +1 -1
  47. package/js/api/resources/Shine.js +4 -4
  48. package/js/api/resources/Shine.js.map +1 -1
  49. package/js/types/Enum/PrestationType.js +1837 -1674
  50. package/js/types/Enum/PrestationType.js.map +1 -1
  51. package/js/types/Interface/api/rule/Create.js +29 -0
  52. package/js/types/Interface/api/rule/Create.js.map +1 -0
  53. package/js/types/Interface/api/rule/Update.js +23 -0
  54. package/js/types/Interface/api/rule/Update.js.map +1 -0
  55. package/js/types/Interface/models/IAccountingTransaction.js.map +1 -1
  56. package/js/types/Interface/models/IExercicePrestation.js.map +1 -1
  57. package/js/types/Interface/models/IPrestation.js.map +1 -1
  58. package/js/types/Interface/models/IPrestationList.js.map +1 -1
  59. package/js/types/Interface/models/IRule.js.map +1 -1
  60. package/js/types/Interface/models/ITerminationList.js.map +1 -1
  61. package/js/types/index.js +30 -0
  62. package/js/types/index.js.map +1 -1
  63. package/js/utils/prestation.js +17 -1
  64. package/js/utils/prestation.js.map +1 -1
  65. package/package.json +1 -1
  66. package/ts/api/resources/Rule.ts +12 -2
  67. package/ts/api/resources/Shine.ts +4 -4
  68. package/ts/types/Enum/PrestationType.ts +1681 -1512
  69. package/ts/types/Interface/api/rule/Create.ts +29 -0
  70. package/ts/types/Interface/api/rule/Update.ts +10 -0
  71. package/ts/types/Interface/models/IAccountingTransaction.ts +1 -0
  72. package/ts/types/Interface/models/IExercicePrestation.ts +2 -1
  73. package/ts/types/Interface/models/IPrestation.ts +13 -10
  74. package/ts/types/Interface/models/IPrestationList.ts +3 -2
  75. package/ts/types/Interface/models/IRule.ts +2 -0
  76. package/ts/types/Interface/models/ITerminationList.ts +7 -4
  77. package/ts/types/index.ts +3 -0
  78. package/ts/utils/prestation.ts +23 -1
@@ -0,0 +1,29 @@
1
+ import { IsBoolean, IsOptional } from 'class-validator';
2
+ import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
3
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
4
+
5
+ export class CreateRule {
6
+ @ApiProperty()
7
+ designation: string;
8
+
9
+ @ApiProperty()
10
+ basicDesignation: string;
11
+
12
+ @ApiPropertyOptional()
13
+ idTva?: number;
14
+
15
+ @ApiPropertyOptional()
16
+ idAccount?: number;
17
+
18
+ @ApiPropertyOptional()
19
+ idNature?: number;
20
+
21
+ @ApiPropertyOptional()
22
+ idThirdParty?: number;
23
+
24
+ @ApiPropertyOptional()
25
+ @IsOptional()
26
+ @IsBoolean()
27
+ @ToBoolean()
28
+ autolock?: boolean;
29
+ }
@@ -0,0 +1,10 @@
1
+ import { IsBoolean } from 'class-validator';
2
+ import { ApiProperty } from '../../../../utils';
3
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
4
+
5
+ export class UpdateRule {
6
+ @ApiProperty()
7
+ @IsBoolean()
8
+ @ToBoolean()
9
+ autolock: boolean;
10
+ }
@@ -16,6 +16,7 @@ import { IMachineLearningResult } from './IMachineLearningResult';
16
16
  export interface IAccountingTransaction {
17
17
  id?: number;
18
18
  label: string | null;
19
+ budgeaTransactionId?: string | null;
19
20
  originalLabel?: string | null;
20
21
  invoiceNumber: string | null;
21
22
  reference: string | null;
@@ -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
  }
@@ -1,6 +1,7 @@
1
1
  import { IVat } from './IVat';
2
2
  import { IAccount } from './IAccount';
3
3
  import { IThirdParty } from './IThirdParty';
4
+ import { INature } from './INature';
4
5
 
5
6
  // rules
6
7
  export interface IRule {
@@ -23,4 +24,5 @@ export interface IRule {
23
24
  tva: IVat;
24
25
  account: IAccount;
25
26
  thirdParty: IThirdParty;
27
+ nature: INature;
26
28
  }
@@ -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
  }
package/ts/types/index.ts CHANGED
@@ -876,6 +876,9 @@ export * from './Interface/api/iDocus/CreateExport';
876
876
  export * from './Interface/api/pdf/ReadPdftkizer';
877
877
  export * from './Interface/api/signFile/CreateFileToSign';
878
878
  export * from './Interface/api/rule/Query';
879
+ export * from './Interface/api/rule/Create';
880
+ export * from './Interface/api/rule/Update';
881
+ export * from './Interface/api/rule/Read';
879
882
  export * from './Interface/api/revive/PostRevive';
880
883
  export * from './Interface/api/acceptance/CreateAcceptance';
881
884
 
@@ -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
  };