@silexpert/core 1.0.154 → 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.
- package/es/types/Enum/PrestationType.d.ts +5 -2626
- package/es/types/Enum/PrestationType.d.ts.map +1 -1
- package/es/types/Enum/PrestationType.js +1674 -1511
- package/es/types/Enum/PrestationType.js.map +1 -1
- package/es/types/Interface/models/IExercicePrestation.d.ts +2 -1
- package/es/types/Interface/models/IExercicePrestation.d.ts.map +1 -1
- package/es/types/Interface/models/IExercicePrestation.js.map +1 -1
- package/es/types/Interface/models/IPrestation.d.ts +13 -10
- package/es/types/Interface/models/IPrestation.d.ts.map +1 -1
- package/es/types/Interface/models/IPrestation.js.map +1 -1
- package/es/types/Interface/models/IPrestationList.d.ts +3 -2
- package/es/types/Interface/models/IPrestationList.d.ts.map +1 -1
- package/es/types/Interface/models/IPrestationList.js.map +1 -1
- package/es/types/Interface/models/ITerminationList.d.ts +7 -4
- package/es/types/Interface/models/ITerminationList.d.ts.map +1 -1
- package/es/types/Interface/models/ITerminationList.js.map +1 -1
- package/es/utils/prestation.d.ts +4 -1
- package/es/utils/prestation.d.ts.map +1 -1
- package/es/utils/prestation.js +18 -1
- package/es/utils/prestation.js.map +1 -1
- package/js/types/Enum/PrestationType.js +1837 -1674
- package/js/types/Enum/PrestationType.js.map +1 -1
- package/js/types/Interface/models/IExercicePrestation.js.map +1 -1
- package/js/types/Interface/models/IPrestation.js.map +1 -1
- package/js/types/Interface/models/IPrestationList.js.map +1 -1
- package/js/types/Interface/models/ITerminationList.js.map +1 -1
- package/js/utils/prestation.js +17 -1
- package/js/utils/prestation.js.map +1 -1
- package/package.json +1 -1
- package/ts/types/Enum/PrestationType.ts +1681 -1512
- package/ts/types/Interface/models/IExercicePrestation.ts +2 -1
- package/ts/types/Interface/models/IPrestation.ts +13 -10
- package/ts/types/Interface/models/IPrestationList.ts +3 -2
- package/ts/types/Interface/models/ITerminationList.ts +7 -4
- 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
|
|
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
|
|
50
|
-
prestationsPayments
|
|
51
|
-
prestationsList
|
|
52
|
-
prestationsComplementary
|
|
53
|
-
prestationJuridique
|
|
54
|
-
prestationSocial
|
|
55
|
-
prestationCreation
|
|
56
|
-
societiesPrestations
|
|
57
|
-
prestationsDetailsBeforeExercice
|
|
58
|
-
customersSignatures
|
|
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
|
|
18
|
-
color
|
|
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
|
|
24
|
-
societiesTerminations
|
|
25
|
-
exercice
|
|
26
|
-
user
|
|
25
|
+
reasonTermination?: IReasonTermination;
|
|
26
|
+
societiesTerminations?: ISociety;
|
|
27
|
+
exercice?: IExercice;
|
|
28
|
+
user?: IUser;
|
|
29
|
+
prestation?: IPrestation;
|
|
27
30
|
}
|
package/ts/utils/prestation.ts
CHANGED
|
@@ -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
|
};
|