@silexpert/core 1.0.163 → 1.0.167

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 (135) hide show
  1. package/es/api/resources/Prestations.d.ts +24 -0
  2. package/es/api/resources/Prestations.d.ts.map +1 -0
  3. package/es/api/resources/Prestations.js +29 -0
  4. package/es/api/resources/Prestations.js.map +1 -0
  5. package/es/api/resources/Quotation.d.ts +17 -0
  6. package/es/api/resources/Quotation.d.ts.map +1 -0
  7. package/es/api/resources/Quotation.js +20 -0
  8. package/es/api/resources/Quotation.js.map +1 -0
  9. package/es/api/resources/Rating.d.ts +18 -0
  10. package/es/api/resources/Rating.d.ts.map +1 -0
  11. package/es/api/resources/Rating.js +20 -0
  12. package/es/api/resources/Rating.js.map +1 -0
  13. package/es/api/resources.d.ts +6 -0
  14. package/es/api/resources.d.ts.map +1 -1
  15. package/es/api/resources.js +6 -0
  16. package/es/api/resources.js.map +1 -1
  17. package/es/types/Enum/AbsenceType.d.ts +4 -3
  18. package/es/types/Enum/AbsenceType.d.ts.map +1 -1
  19. package/es/types/Enum/AbsenceType.js +5 -0
  20. package/es/types/Enum/AbsenceType.js.map +1 -1
  21. package/es/types/Enum/AdminAcceptance.d.ts +11 -0
  22. package/es/types/Enum/AdminAcceptance.d.ts.map +1 -0
  23. package/es/types/Enum/AdminAcceptance.js +26 -0
  24. package/es/types/Enum/AdminAcceptance.js.map +1 -0
  25. package/es/types/Enum/BalanceSheet.d.ts.map +1 -1
  26. package/es/types/Enum/BalanceSheet.js +1 -0
  27. package/es/types/Enum/BalanceSheet.js.map +1 -1
  28. package/es/types/Enum/Channel.d.ts +3 -1
  29. package/es/types/Enum/Channel.d.ts.map +1 -1
  30. package/es/types/Enum/Channel.js +2 -0
  31. package/es/types/Enum/Channel.js.map +1 -1
  32. package/es/types/Enum/ConstitutionState.d.ts.map +1 -1
  33. package/es/types/Enum/ConstitutionState.js +8 -2
  34. package/es/types/Enum/ConstitutionState.js.map +1 -1
  35. package/es/types/Enum/PrestationListType.d.ts +11 -0
  36. package/es/types/Enum/PrestationListType.d.ts.map +1 -0
  37. package/es/types/Enum/PrestationListType.js +26 -0
  38. package/es/types/Enum/PrestationListType.js.map +1 -0
  39. package/es/types/Interface/api/prestations/QueryCreate.d.ts +20 -0
  40. package/es/types/Interface/api/prestations/QueryCreate.d.ts.map +1 -0
  41. package/es/types/Interface/api/prestations/QueryCreate.js +116 -0
  42. package/es/types/Interface/api/prestations/QueryCreate.js.map +1 -0
  43. package/es/types/Interface/api/prestations/QueryGetAllPrestations.d.ts +6 -0
  44. package/es/types/Interface/api/prestations/QueryGetAllPrestations.d.ts.map +1 -0
  45. package/es/types/Interface/api/prestations/QueryGetAllPrestations.js +36 -0
  46. package/es/types/Interface/api/prestations/QueryGetAllPrestations.js.map +1 -0
  47. package/es/types/Interface/api/prestations/QueryUpdate.d.ts +22 -0
  48. package/es/types/Interface/api/prestations/QueryUpdate.d.ts.map +1 -0
  49. package/es/types/Interface/api/prestations/QueryUpdate.js +131 -0
  50. package/es/types/Interface/api/prestations/QueryUpdate.js.map +1 -0
  51. package/es/types/Interface/api/quotation/ReadClientQuotation.d.ts +20 -0
  52. package/es/types/Interface/api/quotation/ReadClientQuotation.d.ts.map +1 -0
  53. package/es/types/Interface/api/quotation/ReadClientQuotation.js +2 -0
  54. package/es/types/Interface/api/quotation/ReadClientQuotation.js.map +1 -0
  55. package/es/types/Interface/api/rating/QueryRatingPaginated.d.ts +6 -0
  56. package/es/types/Interface/api/rating/QueryRatingPaginated.d.ts.map +1 -0
  57. package/es/types/Interface/api/rating/QueryRatingPaginated.js +42 -0
  58. package/es/types/Interface/api/rating/QueryRatingPaginated.js.map +1 -0
  59. package/es/types/Interface/api/task/QueryPaginatedTask.d.ts +1 -1
  60. package/es/types/Interface/api/task/QueryPaginatedTask.d.ts.map +1 -1
  61. package/es/types/Interface/api/task/QueryPaginatedTask.js +3 -3
  62. package/es/types/Interface/api/task/QueryPaginatedTask.js.map +1 -1
  63. package/es/types/Interface/models/IPrestationList.d.ts +3 -0
  64. package/es/types/Interface/models/IPrestationList.d.ts.map +1 -1
  65. package/es/types/Interface/models/IPrestationList.js.map +1 -1
  66. package/es/types/Interface/models/IRating.d.ts +9 -5
  67. package/es/types/Interface/models/IRating.d.ts.map +1 -1
  68. package/es/types/Interface/models/IRating.js.map +1 -1
  69. package/es/types/index.d.ts +7 -0
  70. package/es/types/index.d.ts.map +1 -1
  71. package/es/types/index.js +7 -0
  72. package/es/types/index.js.map +1 -1
  73. package/es/utils/quotation.d.ts +5 -0
  74. package/es/utils/quotation.d.ts.map +1 -1
  75. package/es/utils/quotation.js +160 -0
  76. package/es/utils/quotation.js.map +1 -1
  77. package/js/api/resources/Prestations.js +38 -0
  78. package/js/api/resources/Prestations.js.map +1 -0
  79. package/js/api/resources/Quotation.js +27 -0
  80. package/js/api/resources/Quotation.js.map +1 -0
  81. package/js/api/resources/Rating.js +29 -0
  82. package/js/api/resources/Rating.js.map +1 -0
  83. package/js/api/resources.js +7 -1
  84. package/js/api/resources.js.map +1 -1
  85. package/js/types/Enum/AbsenceType.js +4 -0
  86. package/js/types/Enum/AbsenceType.js.map +1 -1
  87. package/js/types/Enum/AdminAcceptance.js +26 -0
  88. package/js/types/Enum/AdminAcceptance.js.map +1 -0
  89. package/js/types/Enum/BalanceSheet.js +1 -0
  90. package/js/types/Enum/BalanceSheet.js.map +1 -1
  91. package/js/types/Enum/Channel.js +2 -0
  92. package/js/types/Enum/Channel.js.map +1 -1
  93. package/js/types/Enum/ConstitutionState.js +8 -2
  94. package/js/types/Enum/ConstitutionState.js.map +1 -1
  95. package/js/types/Enum/PrestationListType.js +26 -0
  96. package/js/types/Enum/PrestationListType.js.map +1 -0
  97. package/js/types/Interface/api/prestations/QueryCreate.js +39 -0
  98. package/js/types/Interface/api/prestations/QueryCreate.js.map +1 -0
  99. package/js/types/Interface/api/prestations/QueryGetAllPrestations.js +26 -0
  100. package/js/types/Interface/api/prestations/QueryGetAllPrestations.js.map +1 -0
  101. package/js/types/Interface/api/prestations/QueryUpdate.js +40 -0
  102. package/js/types/Interface/api/prestations/QueryUpdate.js.map +1 -0
  103. package/js/types/Interface/api/quotation/ReadClientQuotation.js +6 -0
  104. package/js/types/Interface/api/quotation/ReadClientQuotation.js.map +1 -0
  105. package/js/types/Interface/api/rating/QueryRatingPaginated.js +40 -0
  106. package/js/types/Interface/api/rating/QueryRatingPaginated.js.map +1 -0
  107. package/js/types/Interface/api/task/QueryPaginatedTask.js +1 -1
  108. package/js/types/Interface/api/task/QueryPaginatedTask.js.map +1 -1
  109. package/js/types/Interface/models/IPrestationList.js.map +1 -1
  110. package/js/types/Interface/models/IRating.js.map +1 -1
  111. package/js/types/index.js +70 -0
  112. package/js/types/index.js.map +1 -1
  113. package/js/utils/quotation.js +157 -0
  114. package/js/utils/quotation.js.map +1 -1
  115. package/package.json +1 -1
  116. package/ts/api/resources/Prestations.ts +34 -0
  117. package/ts/api/resources/Quotation.ts +22 -0
  118. package/ts/api/resources/Rating.ts +23 -0
  119. package/ts/api/resources.ts +6 -0
  120. package/ts/types/Enum/AbsenceType.ts +6 -1
  121. package/ts/types/Enum/AdminAcceptance.ts +26 -0
  122. package/ts/types/Enum/BalanceSheet.ts +1 -0
  123. package/ts/types/Enum/Channel.ts +2 -0
  124. package/ts/types/Enum/ConstitutionState.ts +8 -2
  125. package/ts/types/Enum/PrestationListType.ts +25 -0
  126. package/ts/types/Interface/api/prestations/QueryCreate.ts +91 -0
  127. package/ts/types/Interface/api/prestations/QueryGetAllPrestations.ts +25 -0
  128. package/ts/types/Interface/api/prestations/QueryUpdate.ts +106 -0
  129. package/ts/types/Interface/api/quotation/ReadClientQuotation.ts +19 -0
  130. package/ts/types/Interface/api/rating/QueryRatingPaginated.ts +29 -0
  131. package/ts/types/Interface/api/task/QueryPaginatedTask.ts +3 -3
  132. package/ts/types/Interface/models/IPrestationList.ts +5 -0
  133. package/ts/types/Interface/models/IRating.ts +9 -5
  134. package/ts/types/index.ts +7 -1
  135. package/ts/utils/quotation.ts +178 -0
@@ -0,0 +1,106 @@
1
+ import {
2
+ IsOptional, IsNumber, IsString, IsBoolean,
3
+ } from 'class-validator';
4
+ import { ApiPropertyOptional } from '../../../../utils';
5
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
6
+ import { TFile } from '../file/TFile';
7
+
8
+ export class QueryUpdatePrestations {
9
+ @ApiPropertyOptional()
10
+ @IsString()
11
+ @IsOptional()
12
+ name?: string;
13
+
14
+ @ApiPropertyOptional()
15
+ @IsNumber()
16
+ @IsOptional()
17
+ idFile?: number;
18
+
19
+ @ApiPropertyOptional()
20
+ @IsBoolean()
21
+ @ToBoolean()
22
+ @IsOptional()
23
+ isComptable?: boolean;
24
+
25
+ @ApiPropertyOptional()
26
+ @IsBoolean()
27
+ @ToBoolean()
28
+ @IsOptional()
29
+ isJuridique?: boolean;
30
+
31
+ @ApiPropertyOptional()
32
+ @IsBoolean()
33
+ @ToBoolean()
34
+ @IsOptional()
35
+ isSocial?: boolean;
36
+
37
+ @ApiPropertyOptional()
38
+ @IsBoolean()
39
+ @ToBoolean()
40
+ @IsOptional()
41
+ isAttestation?: boolean;
42
+
43
+ @ApiPropertyOptional()
44
+ @IsBoolean()
45
+ @ToBoolean()
46
+ @IsOptional()
47
+ inAverageCart?: boolean;
48
+
49
+ @ApiPropertyOptional()
50
+ @IsBoolean()
51
+ @ToBoolean()
52
+ @IsOptional()
53
+ isBack?: boolean;
54
+
55
+ @ApiPropertyOptional()
56
+ @IsNumber()
57
+ @IsOptional()
58
+ price?: number;
59
+
60
+ @ApiPropertyOptional()
61
+ @IsBoolean()
62
+ @ToBoolean()
63
+ @IsOptional()
64
+ isCatalog?: boolean;
65
+
66
+ @ApiPropertyOptional()
67
+ @IsBoolean()
68
+ @ToBoolean()
69
+ @IsOptional()
70
+ hidden?: boolean;
71
+
72
+ @ApiPropertyOptional()
73
+ @IsBoolean()
74
+ @ToBoolean()
75
+ @IsOptional()
76
+ isComplementary?: boolean;
77
+
78
+ @ApiPropertyOptional()
79
+ @IsString()
80
+ @IsOptional()
81
+ signaturePosition?: string;
82
+
83
+ @ApiPropertyOptional()
84
+ @IsNumber()
85
+ @IsOptional()
86
+ signaturePage?: number;
87
+
88
+ @ApiPropertyOptional()
89
+ @IsString()
90
+ @IsOptional()
91
+ textDefault?: string;
92
+
93
+ @ApiPropertyOptional()
94
+ @IsString()
95
+ @IsOptional()
96
+ color?: string;
97
+
98
+ @ApiPropertyOptional()
99
+ @IsNumber()
100
+ @IsOptional()
101
+ point?: number;
102
+
103
+ @ApiPropertyOptional()
104
+ @IsOptional()
105
+ files?: TFile[];
106
+ }
@@ -0,0 +1,19 @@
1
+ export type ReadClientQuotation = {
2
+ cotation: number,
3
+ data: {
4
+ signature: number,
5
+ seniority: number,
6
+ additionalBenefits: number,
7
+ additionalCompanies: number,
8
+ unpayed: number,
9
+ updatedAnnotations: number,
10
+ bankSynchronization: number,
11
+ rating: number,
12
+ labRefused: number,
13
+ ongoingProceedings: number,
14
+ report: number,
15
+ termination: number,
16
+ created: number,
17
+ },
18
+ idSociety: number
19
+ };
@@ -0,0 +1,29 @@
1
+ import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
2
+
3
+ export class QueryRatingPaginated {
4
+ @ApiProperty({
5
+ description: 'limit of element',
6
+ required: true,
7
+ type: Number,
8
+ default: 50,
9
+ example: 50,
10
+ })
11
+ limit: number;
12
+
13
+ @ApiProperty({
14
+ description: 'limit of element',
15
+ required: true,
16
+ type: Number,
17
+ default: 1,
18
+ example: 5,
19
+ })
20
+ page: number;
21
+
22
+ @ApiPropertyOptional({
23
+ description: 'idSociety',
24
+ required: false,
25
+ type: Number,
26
+ example: 1,
27
+ })
28
+ idSociety: number;
29
+ }
@@ -1,5 +1,5 @@
1
1
  import {
2
- IsBoolean, IsNumber, IsOptional, IsString, IsInt, IsDate, IsIn,
2
+ IsBoolean, IsNumber, IsOptional, IsString, IsInt, IsDate, IsIn, IsArray,
3
3
  } from 'class-validator';
4
4
  import { ApiPropertyOptional } from '../../../../utils';
5
5
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
@@ -52,8 +52,8 @@ export class QueryPaginatedTask {
52
52
 
53
53
  @ApiPropertyOptional({ description: 'user who create the task' })
54
54
  @IsOptional()
55
- @IsInt()
56
- idUserWhoCreated?: number;
55
+ @IsArray()
56
+ idUserWhoCreated?: number[];
57
57
 
58
58
  @ApiPropertyOptional()
59
59
  @IsOptional()
@@ -1,7 +1,10 @@
1
+ import { IFile } from './IFile';
2
+
1
3
  // prestationsList
2
4
  export interface IPrestationList {
3
5
  id?: number;
4
6
  name: string;
7
+ idFile?: number;
5
8
  isComptable: boolean;
6
9
  isJuridique: boolean;
7
10
  isSocial: boolean;
@@ -19,4 +22,6 @@ export interface IPrestationList {
19
22
  point?: number;
20
23
  createdAt?: Date | null;
21
24
  updatedAt?: Date | null;
25
+
26
+ file?: IFile;
22
27
  }
@@ -3,14 +3,18 @@ import { ISociety } from './ISociety';
3
3
  // ratings
4
4
  export interface IRating {
5
5
  id?: number;
6
- notes: string;
7
- comment: string;
8
- average: number;
9
- dateNotShowPopUp: Date | null;
6
+ notes?: string;
7
+ comment?: string;
8
+ average?: number;
9
+ dateNotShowPopUp?: Date | null;
10
+ link?: string | null;
11
+ idUserWhoInsert: number | null;
12
+ noticeDate?: Date | null;
13
+ isMugSent?: boolean | null;
10
14
  idSociety: number;
11
15
  createdAt?: Date | null;
12
16
  updatedAt?: Date | null;
13
17
 
14
18
  // Associations
15
- society: ISociety;
19
+ society?: ISociety;
16
20
  }
package/ts/types/index.ts CHANGED
@@ -477,7 +477,8 @@ export * from './Enum/MailDomainType';
477
477
  export * from './Enum/TextMessageType';
478
478
  export * from './Enum/JobTitle';
479
479
  export * from './Enum/Holidays';
480
-
480
+ export * from './Enum/AdminAcceptance';
481
+ export * from './Enum/PrestationListType';
481
482
  // Interfaces API
482
483
  export * from './Interface/api/partnerTransactionType/ReadPartnerTransactionType';
483
484
  export * from './Interface/api/jeDeclare/ReadJeDeclare';
@@ -638,6 +639,7 @@ export * from './Interface/api/timeRecorder/ReadUsersNotConnected';
638
639
  export * from './Interface/api/timeRecorder/UpdateRecorder';
639
640
  export * from './Interface/api/inpiBalance/QueryInpiBalanceStatistic';
640
641
  export * from './Interface/api/inpiBalance/QueryInpiBalancePaginated';
642
+ export * from './Interface/api/rating/QueryRatingPaginated';
641
643
  export * from './Interface/api/inpiBalance/inpiBalanceStatistic';
642
644
  export * from './Interface/api/inpiPayment/QueryInpiPaymentStatistic';
643
645
  export * from './Interface/api/inpiPayment/QueryInpiPaymentPaginated';
@@ -882,6 +884,10 @@ export * from './Interface/api/rule/Update';
882
884
  export * from './Interface/api/rule/Read';
883
885
  export * from './Interface/api/revive/PostRevive';
884
886
  export * from './Interface/api/acceptance/CreateAcceptance';
887
+ export * from './Interface/api/quotation/ReadClientQuotation';
888
+ export * from './Interface/api/prestations/QueryCreate';
889
+ export * from './Interface/api/prestations/QueryUpdate';
890
+ export * from './Interface/api/prestations/QueryGetAllPrestations';
885
891
 
886
892
  // Enums types
887
893
  export * from './Interface/enum/Util';
@@ -1,5 +1,14 @@
1
+ import * as dayjs from 'dayjs';
1
2
  import { ForbidenDomain, BasicDomain } from '../types/Enum/MailDomainType';
2
3
  import { Activity } from '../types/Enum/Activity';
4
+ import { ComptaType } from '../types/Enum/ComptaType';
5
+ import { ISociety } from '../types/Interface/models/ISociety';
6
+ import { ICotation } from '../types/Interface/models/ICotation';
7
+ import {
8
+ BasePaginate,
9
+ IPayment,
10
+ IRating, IReport, ISocietyProceding, ReadClientQuotation,
11
+ } from '../types';
3
12
 
4
13
  type getLeadQuotationParams = {
5
14
  firstname: string,
@@ -122,4 +131,173 @@ export function getLeadQuotation(params: getLeadQuotationParams):number {
122
131
  }
123
132
 
124
133
  return quotation;
134
+ }
135
+
136
+ /* besoin en entré de la société concerné avec les différents imports (society), ainsi que la liste des autres sociétés ou l'owner est owner (otherSocieties) */
137
+ export function getClientQuotation(society: ISociety, otherSocieties: ISociety[], lastNotice: BasePaginate<IRating>, unpaidDetails: [], reports: IReport[], societyProcedings: ISocietyProceding[], tabBankAccount: any, firstPaiement: IPayment[]): ReadClientQuotation {
138
+ let quotationPositive = 0;
139
+ let quotationNegative = 0;
140
+ let quotation = 0;
141
+ const detailQuotation = {
142
+ signature: 0,
143
+ seniority: 0,
144
+ additionalBenefits: 0,
145
+ additionalCompanies: 0,
146
+ unpayed: 0,
147
+ updatedAnnotations: 0,
148
+ bankSynchronization: 0,
149
+ rating: 0,
150
+ labRefused: 0,
151
+ ongoingProceedings: 0,
152
+ report: 0,
153
+ termination: 0,
154
+ created: 0,
155
+ };
156
+
157
+ // calcul de l'ancienneté de la société
158
+ const anciennete = firstPaiement?.length > 0 ? dayjs().diff(dayjs(firstPaiement[0].datePayment, 'YYYY-MM-DD'), 'years') : 0;
159
+ const ponderation = (anciennete * 0.1) + 1;
160
+
161
+ /* Type de comptabilité du client (Tresorerie (+10) / Engagement (+15)) */
162
+ if (society.idComptaType) {
163
+ if ([ComptaType.CASH_BASED, ComptaType.CASH_BASED_ASSISTANCE, ComptaType.CASH_BASED_SEIZURE].includes(society.idComptaType)) {
164
+ quotationPositive += 10;
165
+ detailQuotation.signature += 10;
166
+ } else if ([ComptaType.ACCRUALS, ComptaType.ACCRUALS_ASSISTANCE, ComptaType.ACCRUALS_SEIZURE].includes(society.idComptaType)) {
167
+ quotationPositive += 15;
168
+ detailQuotation.signature += 15;
169
+ }
170
+ }
171
+
172
+ /* Ancienneté (1 ans < firstPaiement < 2 ans (+10) / 2 ans < firstPaiement (+20 / année)) */
173
+ if (firstPaiement?.length > 0) {
174
+ const yearAsClient = Number(new Date().getFullYear()) - Number(new Date(firstPaiement[0].datePayment).getFullYear());
175
+ if (yearAsClient === 1) {
176
+ quotationPositive += 10;
177
+ detailQuotation.seniority += 10;
178
+ } else if (yearAsClient > 1) {
179
+ quotationPositive += (20 * (yearAsClient - 1) + 10);
180
+ detailQuotation.seniority += (20 * (yearAsClient - 1) + 10);
181
+ }
182
+ }
183
+
184
+ /* Prestations Complémentaires (+5 / prestation) */
185
+ if (society.prestationsSocieties?.length) {
186
+ const prestationsCompl = society.prestationsSocieties.filter((prestation) => prestation.idPrestationComplementary);
187
+ prestationsCompl.forEach(() => {
188
+ quotationPositive += Math.ceil(5 * ponderation);
189
+ detailQuotation.additionalBenefits += Math.ceil(5 * ponderation);
190
+ });
191
+ }
192
+
193
+ /* Sociétés supplémentaires (+8 / société) */
194
+ if (otherSocieties.length) {
195
+ quotationPositive += Math.ceil(8 * otherSocieties.length * ponderation);
196
+ detailQuotation.additionalCompanies += Math.ceil(8 * otherSocieties.length * ponderation);
197
+ }
198
+
199
+ /* Impayés (-15 / mois) */
200
+ if (unpaidDetails.length) {
201
+ quotationNegative -= Math.ceil(15 * unpaidDetails.length * ponderation);
202
+ detailQuotation.unpayed -= Math.ceil(15 * unpaidDetails.length * ponderation);
203
+ }
204
+
205
+ /* annotations à jour */
206
+ if (tabBankAccount.societyAccountingTransactions?.length) {
207
+ // on check s'il y a 80% des lignes annotées (dateLocked)
208
+ let countNotAnnoted = 0;
209
+ let percentageAnnotations = 100;
210
+ tabBankAccount.societyAccountingTransactions.map((na:any) => {
211
+ if (na.dateLocked === null) {
212
+ countNotAnnoted += 1;
213
+ }
214
+ return countNotAnnoted;
215
+ });
216
+ if (countNotAnnoted !== 0) percentageAnnotations = (countNotAnnoted / tabBankAccount.societyAccountingTransactions?.length) * 100;
217
+ if (percentageAnnotations >= 80) {
218
+ quotationPositive += Math.ceil(12 * ponderation);
219
+ detailQuotation.updatedAnnotations += Math.ceil(12 * ponderation);
220
+ } else {
221
+ quotationNegative -= Math.ceil(12 * ponderation);
222
+ detailQuotation.updatedAnnotations -= Math.ceil(12 * ponderation);
223
+ }
224
+ }
225
+
226
+ /* synchronisation bancaire */
227
+ if (tabBankAccount.societyActivatedBankAccounts?.length) {
228
+ // comptes synchro
229
+ const synchro = tabBankAccount.societyActivatedBankAccounts.length - tabBankAccount.desactivatedBankAccount.length;
230
+ quotationPositive += Math.ceil(12 * synchro * ponderation);
231
+ detailQuotation.bankSynchronization += Math.ceil(12 * synchro * ponderation);
232
+
233
+ // comptes desynchro
234
+ quotationNegative -= Math.ceil(12 * tabBankAccount.desactivatedBankAccount.length * ponderation);
235
+ detailQuotation.bankSynchronization -= Math.ceil(12 * tabBankAccount.desactivatedBankAccount.length * ponderation);
236
+ }
237
+
238
+ /* avis */
239
+ if (lastNotice && lastNotice.data.length === 1) {
240
+ if (lastNotice.data[0].average === 5) {
241
+ quotationPositive += Math.ceil(10 * ponderation);
242
+ detailQuotation.rating += Math.ceil(10 * ponderation);
243
+ } else {
244
+ quotationNegative -= 10;
245
+ detailQuotation.rating -= 10;
246
+ }
247
+ }
248
+
249
+ /* LAB refusée */
250
+ if (!society.societyDetail?.acceptation) {
251
+ quotationNegative -= 10;
252
+ detailQuotation.labRefused -= 10;
253
+ }
254
+
255
+ /* Cessation de paiement - redressement judiciaire - procédure en cours / signalements / résiliation */
256
+ if (societyProcedings?.length) {
257
+ quotationNegative -= 5 * societyProcedings.length;
258
+ detailQuotation.ongoingProceedings -= 5 * societyProcedings.length;
259
+ }
260
+
261
+ if (reports?.length) {
262
+ quotationNegative -= 10;
263
+ detailQuotation.report -= 10;
264
+ }
265
+
266
+ if (society.isWaitingEnd) {
267
+ quotationNegative -= 50;
268
+ detailQuotation.termination -= 50;
269
+ }
270
+
271
+ /* Création chez nous */
272
+ if (society.prestationsSocieties?.length) {
273
+ const prestationsCreation = society.prestationsSocieties.filter((prestation) => prestation.idPrestationList === 15); // creation pas d'enum
274
+ prestationsCreation.forEach(() => {
275
+ quotationPositive += 10;
276
+ detailQuotation.created += 10;
277
+ });
278
+ }
279
+
280
+ if (quotationPositive > 100) quotationPositive = 100;
281
+ if (quotationNegative > 100) quotationNegative = 100;
282
+
283
+ quotation = quotationPositive + quotationNegative;
284
+
285
+ if (quotation < 0) quotation = 0;
286
+
287
+ return {
288
+ cotation: quotation,
289
+ data: detailQuotation,
290
+ idSociety: society.id as number,
291
+ };
292
+ }
293
+
294
+ export function compareTwoCotation(cotations: ICotation[]):boolean | null {
295
+ // on recupere les 2 dernieres cotations de la societe
296
+ const higher = false;
297
+ if (cotations[0].cotation === cotations[1].cotation) {
298
+ return null;
299
+ } if (cotations[0].cotation > cotations[1].cotation) {
300
+ return true;
301
+ }
302
+ return higher;
125
303
  }