@silexpert/core 1.0.161 → 1.0.164
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/api/resources/Qonto.d.ts +2 -2
- package/es/api/resources/Qonto.d.ts.map +1 -1
- package/es/api/resources/Qonto.js.map +1 -1
- package/es/api/resources/Quotation.d.ts +17 -0
- package/es/api/resources/Quotation.d.ts.map +1 -0
- package/es/api/resources/Quotation.js +20 -0
- package/es/api/resources/Quotation.js.map +1 -0
- package/es/api/resources/Rating.d.ts +18 -0
- package/es/api/resources/Rating.d.ts.map +1 -0
- package/es/api/resources/Rating.js +20 -0
- package/es/api/resources/Rating.js.map +1 -0
- package/es/api/resources.d.ts +4 -0
- package/es/api/resources.d.ts.map +1 -1
- package/es/api/resources.js +4 -0
- package/es/api/resources.js.map +1 -1
- package/es/types/Enum/AbsenceType.d.ts +4 -3
- package/es/types/Enum/AbsenceType.d.ts.map +1 -1
- package/es/types/Enum/AbsenceType.js +5 -0
- package/es/types/Enum/AbsenceType.js.map +1 -1
- package/es/types/Enum/Channel.d.ts +3 -1
- package/es/types/Enum/Channel.d.ts.map +1 -1
- package/es/types/Enum/Channel.js +2 -0
- package/es/types/Enum/Channel.js.map +1 -1
- package/es/types/Enum/LegalForm.d.ts +2 -1
- package/es/types/Enum/LegalForm.d.ts.map +1 -1
- package/es/types/Enum/LegalForm.js +10 -0
- package/es/types/Enum/LegalForm.js.map +1 -1
- package/es/types/Interface/api/qonto/{ReadCreateConnection.d.ts → Read.d.ts} +5 -1
- package/es/types/Interface/api/qonto/Read.d.ts.map +1 -0
- package/es/types/Interface/api/qonto/Read.js +2 -0
- package/es/types/Interface/api/qonto/Read.js.map +1 -0
- package/es/types/Interface/api/quotation/ReadClientQuotation.d.ts +20 -0
- package/es/types/Interface/api/quotation/ReadClientQuotation.d.ts.map +1 -0
- package/es/types/Interface/api/quotation/ReadClientQuotation.js +2 -0
- package/es/types/Interface/api/quotation/ReadClientQuotation.js.map +1 -0
- package/es/types/Interface/api/rating/QueryRatingPaginated.d.ts +6 -0
- package/es/types/Interface/api/rating/QueryRatingPaginated.d.ts.map +1 -0
- package/es/types/Interface/api/rating/QueryRatingPaginated.js +42 -0
- package/es/types/Interface/api/rating/QueryRatingPaginated.js.map +1 -0
- package/es/types/Interface/api/task/QueryPaginatedTask.d.ts +1 -1
- package/es/types/Interface/api/task/QueryPaginatedTask.d.ts.map +1 -1
- package/es/types/Interface/api/task/QueryPaginatedTask.js +3 -3
- package/es/types/Interface/api/task/QueryPaginatedTask.js.map +1 -1
- package/es/types/Interface/models/IRating.d.ts +9 -5
- package/es/types/Interface/models/IRating.d.ts.map +1 -1
- package/es/types/Interface/models/IRating.js.map +1 -1
- package/es/types/index.d.ts +3 -1
- package/es/types/index.d.ts.map +1 -1
- package/es/types/index.js +3 -1
- package/es/types/index.js.map +1 -1
- package/es/utils/documents.js +1 -1
- package/es/utils/documents.js.map +1 -1
- package/es/utils/quotation.d.ts +5 -0
- package/es/utils/quotation.d.ts.map +1 -1
- package/es/utils/quotation.js +160 -0
- package/es/utils/quotation.js.map +1 -1
- package/js/api/resources/Qonto.js.map +1 -1
- package/js/api/resources/Quotation.js +27 -0
- package/js/api/resources/Quotation.js.map +1 -0
- package/js/api/resources/Rating.js +29 -0
- package/js/api/resources/Rating.js.map +1 -0
- package/js/api/resources.js +5 -1
- package/js/api/resources.js.map +1 -1
- package/js/types/Enum/AbsenceType.js +4 -0
- package/js/types/Enum/AbsenceType.js.map +1 -1
- package/js/types/Enum/Channel.js +2 -0
- package/js/types/Enum/Channel.js.map +1 -1
- package/js/types/Enum/LegalForm.js +10 -0
- package/js/types/Enum/LegalForm.js.map +1 -1
- package/js/types/Interface/api/qonto/{ReadCreateConnection.js → Read.js} +1 -1
- package/js/types/Interface/api/qonto/Read.js.map +1 -0
- package/js/types/Interface/api/quotation/ReadClientQuotation.js +6 -0
- package/js/types/Interface/api/quotation/ReadClientQuotation.js.map +1 -0
- package/js/types/Interface/api/rating/QueryRatingPaginated.js +40 -0
- package/js/types/Interface/api/rating/QueryRatingPaginated.js.map +1 -0
- package/js/types/Interface/api/task/QueryPaginatedTask.js +1 -1
- package/js/types/Interface/api/task/QueryPaginatedTask.js.map +1 -1
- package/js/types/Interface/models/IRating.js.map +1 -1
- package/js/types/index.js +29 -9
- package/js/types/index.js.map +1 -1
- package/js/utils/documents.js +1 -1
- package/js/utils/documents.js.map +1 -1
- package/js/utils/quotation.js +158 -0
- package/js/utils/quotation.js.map +1 -1
- package/package.json +1 -1
- package/ts/api/resources/Qonto.ts +2 -2
- package/ts/api/resources/Quotation.ts +22 -0
- package/ts/api/resources/Rating.ts +23 -0
- package/ts/api/resources.ts +4 -0
- package/ts/types/Enum/AbsenceType.ts +6 -1
- package/ts/types/Enum/Channel.ts +2 -0
- package/ts/types/Enum/LegalForm.ts +10 -0
- package/ts/types/Interface/api/qonto/{ReadCreateConnection.ts → Read.ts} +6 -1
- package/ts/types/Interface/api/quotation/ReadClientQuotation.ts +19 -0
- package/ts/types/Interface/api/rating/QueryRatingPaginated.ts +29 -0
- package/ts/types/Interface/api/task/QueryPaginatedTask.ts +3 -3
- package/ts/types/Interface/models/IRating.ts +9 -5
- package/ts/types/index.ts +3 -1
- package/ts/utils/documents.ts +1 -1
- package/ts/utils/quotation.ts +178 -0
- package/es/types/Interface/api/qonto/ReadCreateConnection.d.ts.map +0 -1
- package/es/types/Interface/api/qonto/ReadCreateConnection.js +0 -2
- package/es/types/Interface/api/qonto/ReadCreateConnection.js.map +0 -1
- package/js/types/Interface/api/qonto/ReadCreateConnection.js.map +0 -1
package/ts/utils/quotation.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
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
|
+
IRating, IReport, ISocietyProceding, ReadClientQuotation,
|
|
10
|
+
} from '../types';
|
|
3
11
|
|
|
4
12
|
type getLeadQuotationParams = {
|
|
5
13
|
firstname: string,
|
|
@@ -122,4 +130,174 @@ export function getLeadQuotation(params: getLeadQuotationParams):number {
|
|
|
122
130
|
}
|
|
123
131
|
|
|
124
132
|
return quotation;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* 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) */
|
|
136
|
+
export function getClientQuotation(society: ISociety, otherSocieties: ISociety[], lastNotice: BasePaginate<IRating>, unpaidDetails: [], reports: IReport[], societyProcedings: ISocietyProceding[], tabBankAccount: any): ReadClientQuotation {
|
|
137
|
+
let quotationPositive = 0;
|
|
138
|
+
let quotationNegative = 0;
|
|
139
|
+
let quotation = 0;
|
|
140
|
+
const detailQuotation = {
|
|
141
|
+
signature: 0,
|
|
142
|
+
seniority: 0,
|
|
143
|
+
additionalBenefits: 0,
|
|
144
|
+
additionalCompanies: 0,
|
|
145
|
+
unpayed: 0,
|
|
146
|
+
updatedAnnotations: 0,
|
|
147
|
+
bankSynchronization: 0,
|
|
148
|
+
rating: 0,
|
|
149
|
+
labRefused: 0,
|
|
150
|
+
ongoingProceedings: 0,
|
|
151
|
+
report: 0,
|
|
152
|
+
termination: 0,
|
|
153
|
+
created: 0,
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// calcul de l'ancienneté de la société
|
|
157
|
+
const anciennete = dayjs().diff(dayjs(society.dateIsClient, 'YYYY-MM-DD'), 'years');
|
|
158
|
+
const ponderation = (anciennete * 0.1) + 1;
|
|
159
|
+
|
|
160
|
+
/* Type de comptabilité du client (Tresorerie (+10) / Engagement (+15)) */
|
|
161
|
+
if (society.idComptaType) {
|
|
162
|
+
if ([ComptaType.CASH_BASED, ComptaType.CASH_BASED_ASSISTANCE, ComptaType.CASH_BASED_SEIZURE].includes(society.idComptaType)) {
|
|
163
|
+
quotationPositive += 10;
|
|
164
|
+
detailQuotation.signature += 10;
|
|
165
|
+
} else if ([ComptaType.ACCRUALS, ComptaType.ACCRUALS_ASSISTANCE, ComptaType.ACCRUALS_SEIZURE].includes(society.idComptaType)) {
|
|
166
|
+
quotationPositive += 15;
|
|
167
|
+
detailQuotation.signature += 15;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* Ancienneté (1 ans < dateIsClient < 2 ans (+10) / 2 ans < dateIsClient (+15 / année)) */
|
|
172
|
+
if (society.dateIsClient) {
|
|
173
|
+
const yearAsClient = Number(new Date().getFullYear()) - Number(new Date(society.dateIsClient).getFullYear());
|
|
174
|
+
if (yearAsClient > 0) {
|
|
175
|
+
quotationPositive += 10;
|
|
176
|
+
detailQuotation.seniority += 10;
|
|
177
|
+
if (yearAsClient > 1) {
|
|
178
|
+
quotationPositive += 15 * (yearAsClient - 1);
|
|
179
|
+
detailQuotation.seniority += 15 * (yearAsClient - 1);
|
|
180
|
+
}
|
|
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
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReadCreateConnection.d.ts","sourceRoot":"","sources":["../../../../../ts/types/Interface/api/qonto/ReadCreateConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,oBAAoB,CAAC;CACvC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReadCreateConnection.js","sourceRoot":"","sources":["../../../../../ts/types/Interface/api/qonto/ReadCreateConnection.ts"],"names":[],"mappings":"","sourcesContent":["import { GetQontoOrganization } from './Query';\n\nexport interface ReadCreateConnection {\n idBankConnection: number;\n qontoConnection: GetQontoOrganization;\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReadCreateConnection.js","names":[],"sources":["../../../../../ts/types/Interface/api/qonto/ReadCreateConnection.ts"],"sourcesContent":["import { GetQontoOrganization } from './Query';\n\nexport interface ReadCreateConnection {\n idBankConnection: number;\n qontoConnection: GetQontoOrganization;\n}"],"mappings":""}
|