@silexpert/core 1.1.344 → 1.1.346

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.
@@ -15,7 +15,6 @@ export declare enum TimeSlot {
15
15
  CLOSE_SOCIETY = 14,
16
16
  TAX_ADVICE_OR_COMPLEX_LEGAL_ARRANGEMENTS = 15,
17
17
  FIX_UNPAID = 16,
18
- POST_BILAN = 17,
19
18
  ANNUAL_FINANCIAL_STATEMENTS = 18,
20
19
  MANAGER_REVENUE = 19,
21
20
  SPECIALISED_FISCAL_QUESTIONS = 20,
@@ -28,13 +27,16 @@ export declare enum TimeSlotCategory {
28
27
  BILLING = 3,
29
28
  SPECIALISED = 4
30
29
  }
30
+ /**
31
+ * @param {number[]} idRole if idRole not set, return all users except customers
32
+ */
31
33
  export type TimeSlotDetailType = {
32
34
  id: number;
33
35
  name: string;
34
36
  internalName: string;
35
37
  category?: string;
36
38
  duration: number;
37
- idRole: number[];
39
+ idRole?: number[];
38
40
  forWholeService?: boolean;
39
41
  idRoleExcluded?: number[];
40
42
  idTimeCounterType: number;
@@ -1 +1 @@
1
- {"version":3,"file":"TimeSlot.d.ts","sourceRoot":"","sources":["../../../../ts/types/Enum/TimeSlot.ts"],"names":[],"mappings":"AAGA,oBAAY,QAAQ;IAClB,UAAU,IAAI;IACd,gBAAgB,IAAI;IACpB,KAAK,IAAI;IACT,GAAG,IAAI;IACP,WAAW,IAAI;IACf,mBAAmB,IAAI;IACvB,cAAc,IAAI;IAClB,OAAO,IAAI;IACX,KAAK,IAAI;IACT,WAAW,KAAK;IAChB,8BAA8B,KAAK;IACnC,sDAAsD,KAAK;IAC3D,YAAY,KAAK;IACjB,aAAa,KAAK;IAClB,wCAAwC,KAAK;IAC7C,UAAU,KAAK;IACf,UAAU,KAAK;IACf,2BAA2B,KAAK;IAChC,eAAe,KAAK;IACpB,4BAA4B,KAAK;IACjC,kBAAkB,KAAK;IACvB,gBAAgB,KAAK;CAEtB;AACD,oB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IACd,OAAO,IAAI;IACX,OAAO,IAAI;IACX,WAAW,IAAI;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AACF,MAAM,MAAM,0BAA0B,GAAG;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAC,0BAA0B,EAsB7D,CAAC;AAEF,eAAO,MAAM,cAAc,EAAC,kBAAkB,EA8M7C,CAAC"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
2
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.TimeSlotDetail = exports.TimeSlotCategoryDetail = exports.TimeSlotCategory = exports.TimeSlot = void 0;
5
5
  const Role_1 = require("./Role");
@@ -22,7 +22,6 @@ var TimeSlot;
22
22
  TimeSlot[TimeSlot["CLOSE_SOCIETY"] = 14] = "CLOSE_SOCIETY";
23
23
  TimeSlot[TimeSlot["TAX_ADVICE_OR_COMPLEX_LEGAL_ARRANGEMENTS"] = 15] = "TAX_ADVICE_OR_COMPLEX_LEGAL_ARRANGEMENTS";
24
24
  TimeSlot[TimeSlot["FIX_UNPAID"] = 16] = "FIX_UNPAID";
25
- TimeSlot[TimeSlot["POST_BILAN"] = 17] = "POST_BILAN";
26
25
  TimeSlot[TimeSlot["ANNUAL_FINANCIAL_STATEMENTS"] = 18] = "ANNUAL_FINANCIAL_STATEMENTS";
27
26
  TimeSlot[TimeSlot["MANAGER_REVENUE"] = 19] = "MANAGER_REVENUE";
28
27
  TimeSlot[TimeSlot["SPECIALISED_FISCAL_QUESTIONS"] = 20] = "SPECIALISED_FISCAL_QUESTIONS";
@@ -83,7 +82,7 @@ exports.TimeSlotDetail = [
83
82
  internalName: 'Rdv bilan',
84
83
  category: (_a = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.ACCOUNTING)) === null || _a === void 0 ? void 0 : _a.name,
85
84
  duration: 30,
86
- idRole: [Role_1.Role.ACCOUNTANT, Role_1.Role.TECHNICAL_ADVISOR],
85
+ idRole: [Role_1.Role.ACCOUNTANT],
87
86
  forWholeService: false,
88
87
  idTimeCounterType: TimeCounterType_1.TimeCounterType.CALENDLY.id,
89
88
  },
@@ -93,7 +92,7 @@ exports.TimeSlotDetail = [
93
92
  internalName: 'Rdv TVA',
94
93
  category: (_b = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.ACCOUNTING)) === null || _b === void 0 ? void 0 : _b.name,
95
94
  duration: 30,
96
- idRole: [Role_1.Role.ACCOUNTANT, Role_1.Role.TECHNICAL_ADVISOR],
95
+ idRole: [Role_1.Role.ACCOUNTANT],
97
96
  idRoleExcluded: [Role_1.Role.MANAGER],
98
97
  forWholeService: false,
99
98
  idTimeCounterType: TimeCounterType_1.TimeCounterType.CALENDLY.id,
@@ -121,7 +120,7 @@ exports.TimeSlotDetail = [
121
120
  internalName: 'Rdv Conseils',
122
121
  category: (_c = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.ACCOUNTING)) === null || _c === void 0 ? void 0 : _c.name,
123
122
  duration: 30,
124
- idRole: [Role_1.Role.ACCOUNTANT, Role_1.Role.TECHNICAL_ADVISOR],
123
+ idRole: [Role_1.Role.ACCOUNTANT],
125
124
  idRoleExcluded: [Role_1.Role.MANAGER],
126
125
  forWholeService: false,
127
126
  idTimeCounterType: TimeCounterType_1.TimeCounterType.CALENDLY.id,
@@ -150,7 +149,7 @@ exports.TimeSlotDetail = [
150
149
  name: 'Rdv',
151
150
  internalName: 'Rdv',
152
151
  duration: 20,
153
- idRole: [Role_1.Role.ACCOUNTANT, Role_1.Role.COMMERCIAL, Role_1.Role.SOCIAL, Role_1.Role.JURIDIC, Role_1.Role.EXPERT_ACCOUNTANT, Role_1.Role.FACTURATION, Role_1.Role.LITIGE, Role_1.Role.TECHNICAL_ADVISOR],
152
+ // idRole: [Role.ACCOUNTANT, Role.COMMERCIAL, Role.SOCIAL, Role.JURIDIC, Role.EXPERT_ACCOUNTANT, Role.FACTURATION, Role.LITIGE, Role.TECHNICAL_ADVISOR],
154
153
  forWholeService: false,
155
154
  idTimeCounterType: TimeCounterType_1.TimeCounterType.CALENDLY.id,
156
155
  },
@@ -201,7 +200,7 @@ exports.TimeSlotDetail = [
201
200
  category: (_j = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.JURIDIC)) === null || _j === void 0 ? void 0 : _j.name,
202
201
  duration: 60,
203
202
  idRole: [Role_1.Role.JURIDIC, Role_1.Role.DIRECTOR],
204
- forWholeService: true,
203
+ forWholeService: false,
205
204
  idTimeCounterType: TimeCounterType_1.TimeCounterType.CALENDLY.id,
206
205
  },
207
206
  {
@@ -214,21 +213,11 @@ exports.TimeSlotDetail = [
214
213
  forWholeService: true,
215
214
  idTimeCounterType: TimeCounterType_1.TimeCounterType.CALENDLY.id,
216
215
  },
217
- {
218
- id: TimeSlot.POST_BILAN,
219
- name: 'Prise de rendez-vous rendus bilan',
220
- internalName: 'Rdv rendus bilan',
221
- category: (_l = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.ACCOUNTING)) === null || _l === void 0 ? void 0 : _l.name,
222
- duration: 30,
223
- idRole: [Role_1.Role.TECHNICAL_ADVISOR],
224
- forWholeService: false,
225
- idTimeCounterType: TimeCounterType_1.TimeCounterType.CALENDLY.id,
226
- },
227
216
  {
228
217
  id: TimeSlot.ANNUAL_FINANCIAL_STATEMENTS,
229
218
  name: 'Lecture et explication des comptes annuels',
230
219
  internalName: 'Conseils spécialisés',
231
- category: (_m = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)) === null || _m === void 0 ? void 0 : _m.name,
220
+ category: (_l = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)) === null || _l === void 0 ? void 0 : _l.name,
232
221
  duration: 30,
233
222
  idRole: [Role_1.Role.TECHNICAL_ADVISOR],
234
223
  forWholeService: false,
@@ -238,7 +227,7 @@ exports.TimeSlotDetail = [
238
227
  id: TimeSlot.MANAGER_REVENUE,
239
228
  name: 'Rémunération du dirigeant & dividendes',
240
229
  internalName: 'Conseils spécialisés',
241
- category: (_o = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)) === null || _o === void 0 ? void 0 : _o.name,
230
+ category: (_m = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)) === null || _m === void 0 ? void 0 : _m.name,
242
231
  duration: 30,
243
232
  idRole: [Role_1.Role.TECHNICAL_ADVISOR],
244
233
  forWholeService: false,
@@ -248,7 +237,7 @@ exports.TimeSlotDetail = [
248
237
  id: TimeSlot.SPECIALISED_FISCAL_QUESTIONS,
249
238
  name: 'Questions fiscales spécifiques (crédits d\'impôts, ZFANG, autres statuts, etc.)',
250
239
  internalName: 'Conseils spécialisés',
251
- category: (_p = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)) === null || _p === void 0 ? void 0 : _p.name,
240
+ category: (_o = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)) === null || _o === void 0 ? void 0 : _o.name,
252
241
  duration: 30,
253
242
  idRole: [Role_1.Role.TECHNICAL_ADVISOR],
254
243
  forWholeService: false,
@@ -258,7 +247,7 @@ exports.TimeSlotDetail = [
258
247
  id: TimeSlot.VAT_TERRITORIALITY,
259
248
  name: 'Territorialité de TVA',
260
249
  internalName: 'Conseils spécialisés',
261
- category: (_q = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)) === null || _q === void 0 ? void 0 : _q.name,
250
+ category: (_p = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)) === null || _p === void 0 ? void 0 : _p.name,
262
251
  duration: 30,
263
252
  idRole: [Role_1.Role.TECHNICAL_ADVISOR],
264
253
  forWholeService: false,
@@ -268,7 +257,7 @@ exports.TimeSlotDetail = [
268
257
  id: TimeSlot.FINANCIAL_SOURCE,
269
258
  name: 'Sources de financement',
270
259
  internalName: 'Conseils spécialisés',
271
- category: (_r = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)) === null || _r === void 0 ? void 0 : _r.name,
260
+ category: (_q = exports.TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)) === null || _q === void 0 ? void 0 : _q.name,
272
261
  duration: 30,
273
262
  idRole: [Role_1.Role.TECHNICAL_ADVISOR],
274
263
  forWholeService: false,
@@ -1 +1 @@
1
- {"version":3,"file":"TimeSlot.js","sourceRoot":"","sources":["../../../../ts/types/Enum/TimeSlot.ts"],"names":[],"mappings":";;;;AAAA,iCAA8B;AAC9B,uDAAoD;AAEpD,IAAY,QAwBX;AAxBD,WAAY,QAAQ;IAClB,mDAAc,CAAA;IACd,+DAAoB,CAAA;IACpB,yCAAS,CAAA;IACT,qCAAO,CAAA;IACP,qDAAe,CAAA;IACf,qEAAuB,CAAA;IACvB,2DAAkB,CAAA;IAClB,6CAAW,CAAA;IACX,yCAAS,CAAA;IACT,sDAAgB,CAAA;IAChB,4FAAmC,CAAA;IACnC,4IAA2D,CAAA;IAC3D,wDAAiB,CAAA;IACjB,0DAAkB,CAAA;IAClB,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QACZ,MAAM,EAAE,CAAC,WAAI,CAAC,iBAAiB,CAAC;QAChC,eAAe,EAAE,KAAK;QACtB,iBAAiB,EAAE,iCAAe,CAAC,QAAQ,CAAC,EAAE;KAC/C;CACF,CAAC","sourcesContent":["import { Role } from './Role';\nimport { TimeCounterType } from './TimeCounterType';\n\nexport enum TimeSlot {\n ONBOARDING = 1,\n ONBOARDING_SHORT = 2,\n BILAN = 3,\n TVA = 4,\n TVA_MANAGER = 5,\n BALANCESHEET_OR_TIP = 6,\n ACCOUNTING_RDV = 7,\n BILLING = 8,\n SALES = 9,\n APPOINTMENT = 10,\n SUPPORTING_CREATION_OF_SOCIETY = 11,\n APPROVAL_FINANCIAL_STATEMENTS_AND_DISTRIBUTE_DIVIDENDS = 12,\n EDIT_SOCIETY = 13,\n CLOSE_SOCIETY = 14,\n TAX_ADVICE_OR_COMPLEX_LEGAL_ARRANGEMENTS = 15,\n FIX_UNPAID = 16,\n POST_BILAN = 17,\n ANNUAL_FINANCIAL_STATEMENTS = 18,\n MANAGER_REVENUE = 19,\n SPECIALISED_FISCAL_QUESTIONS = 20,\n VAT_TERRITORIALITY = 21,\n FINANCIAL_SOURCE = 22,\n\n}\nexport enum TimeSlotCategory {\n ACCOUNTING = 1,\n JURIDIC = 2,\n BILLING = 3,\n SPECIALISED = 4,\n}\n\nexport type TimeSlotDetailType = {\n id: number;\n name: string;\n internalName: string;\n category?: string,\n duration: number;\n idRole: number[];\n forWholeService?: boolean\n idRoleExcluded?: number[];\n idTimeCounterType: number;\n};\nexport type TimeSlotCategoryDetailType = {\n id: number;\n name: string;\n description: string;\n};\n\nexport const TimeSlotCategoryDetail:TimeSlotCategoryDetailType[] = [\n {\n id: TimeSlotCategory.ACCOUNTING,\n name: 'Comptable',\n description: 'Pour suivre l\\'avancement de votre bilan, vos déclarations de TVA ou pour toute question sur la vie de votre dossier, c\\'est par ici !',\n\n },\n {\n id: TimeSlotCategory.JURIDIC,\n name: 'Juridique',\n description: 'Si vous souhaitez ouvrir / modifier / fermer une entreprise ou pour tout besoin de montage juridique complexe, notre équipe est à votre disposition',\n },\n {\n id: TimeSlotCategory.BILLING,\n name: 'Facturation',\n description: 'Besoin d\\'échanger sur votre échéancier ou votre facturation (retards de paiement et autres) ? Prenez contact avec nous !',\n },\n {\n id: TimeSlotCategory.SPECIALISED,\n name: 'Conseils spécialisés',\n description: 'Vous souhaitez une explication de vos comptes annuels ? Vous avez des questions très pointues ou un besoin d\\'information spécifique ? Nous sommes là pour vous accompagner !',\n },\n];\n\nexport const TimeSlotDetail:TimeSlotDetailType[] = [\n {\n id: TimeSlot.ONBOARDING,\n name: 'OnBoarding',\n internalName: 'Rdv OnBoarding',\n duration: 45,\n idRole: [Role.ON_BOARDER],\n forWholeService: true,\n idTimeCounterType: TimeCounterType.ONBOARDING.id,\n },\n {\n id: TimeSlot.ONBOARDING_SHORT,\n name: 'OnBoarding',\n internalName: 'Rdv OnBoarding Court',\n duration: 45,\n idRole: [Role.ON_BOARDER],\n forWholeService: true,\n idTimeCounterType: TimeCounterType.ONBOARDING.id,\n },\n {\n id: TimeSlot.BILAN,\n name: 'Questions concernant mon bilan',\n internalName: 'Rdv bilan',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.ACCOUNTING)?.name,\n duration: 30,\n idRole: [Role.ACCOUNTANT, Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.TVA,\n name: 'Questions concernant ma TVA',\n internalName: 'Rdv TVA',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.ACCOUNTING)?.name,\n duration: 30,\n idRole:[Role.ACCOUNTANT, Role.TECHNICAL_ADVISOR],\n idRoleExcluded:[Role.MANAGER],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n // {\n // id: TimeSlot.TVA_MANAGER,\n // name: 'Tva',\n // internalName: 'Tva Manager',\n // duration: 15,\n // idRole:[Role.ACCOUNTANT, Role.MANAGER],\n // forWholeService: false,\n // },\n // {\n // id: TimeSlot.BALANCESHEET_OR_TIP,\n // name: 'Bilan ou Conseil',\n // internalName: 'Bilan ou Conseil',\n // duration: 30,\n // idRole:[Role.ACCOUNTANT],\n // idRoleExcluded:[Role.MANAGER],\n // forWholeService: false,\n // },\n {\n id: TimeSlot.ACCOUNTING_RDV,\n name: 'Conseils',\n internalName: 'Rdv Conseils',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.ACCOUNTING)?.name,\n duration: 30,\n idRole:[Role.ACCOUNTANT, Role.TECHNICAL_ADVISOR],\n idRoleExcluded:[Role.MANAGER],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.BILLING,\n name: 'Questions concernant ma facturation',\n internalName: 'Rdv facturation',\n duration: 30,\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.BILLING)?.name,\n idRole:[Role.FACTURATION],\n forWholeService: true,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.SALES,\n name: 'Rdv commercial',\n internalName: 'Rdv Commercial',\n duration: 20,\n idRole:[Role.COMMERCIAL],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.APPOINTMENT, //TODO: à commenter ? remplacé par idType 7 ?\n name: 'Rdv',\n internalName: 'Rdv',\n duration: 20,\n idRole: [Role.ACCOUNTANT, Role.COMMERCIAL, Role.SOCIAL, Role.JURIDIC, Role.EXPERT_ACCOUNTANT, Role.FACTURATION, Role.LITIGE, Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.SUPPORTING_CREATION_OF_SOCIETY,\n name: 'Accompagnement pour la création de mon entreprise',\n internalName: 'Rdv création',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.JURIDIC)?.name,\n duration: 30,\n idRole: [Role.JURIDIC],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.APPROVAL_FINANCIAL_STATEMENTS_AND_DISTRIBUTE_DIVIDENDS,\n name: 'Approuver les comptes et/ou distribuer des dividendes',\n internalName: 'Rdv juridique',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.JURIDIC)?.name,\n duration: 30,\n idRole: [Role.JURIDIC],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.EDIT_SOCIETY,\n name: 'Modifier mon entreprise',\n internalName: 'Rdv juridique',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.JURIDIC)?.name,\n duration: 30,\n idRole: [Role.JURIDIC],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.CLOSE_SOCIETY,\n name: 'Fermer mon entreprise',\n internalName: 'Rdv juridique',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.JURIDIC)?.name,\n duration: 30,\n idRole: [Role.JURIDIC],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.TAX_ADVICE_OR_COMPLEX_LEGAL_ARRANGEMENTS,\n name: 'Conseils fiscaux ou montages juridiques complexes',\n internalName: 'Rdv juridique',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.JURIDIC)?.name,\n duration: 60, \n idRole: [Role.JURIDIC, Role.DIRECTOR],\n forWholeService: true,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.FIX_UNPAID,\n name: 'Régulariser un paiement',\n internalName: 'Rdv impayés',\n duration: 30,\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.BILLING)?.name,\n idRole:[Role.FACTURATION],\n forWholeService: true,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.POST_BILAN,\n name: 'Prise de rendez-vous rendus bilan',\n internalName: 'Rdv rendus bilan',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.ACCOUNTING)?.name,\n duration: 30,\n idRole: [Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.ANNUAL_FINANCIAL_STATEMENTS,\n name: 'Lecture et explication des comptes annuels',\n internalName: 'Conseils spécialisés',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)?.name,\n duration: 30,\n idRole: [Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.MANAGER_REVENUE,\n name: 'Rémunération du dirigeant & dividendes',\n internalName: 'Conseils spécialisés',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)?.name,\n duration: 30,\n idRole: [Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.SPECIALISED_FISCAL_QUESTIONS,\n name: 'Questions fiscales spécifiques (crédits d\\'impôts, ZFANG, autres statuts, etc.)',\n internalName: 'Conseils spécialisés',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)?.name,\n duration: 30,\n idRole: [Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.VAT_TERRITORIALITY,\n name: 'Territorialité de TVA',\n internalName: 'Conseils spécialisés',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)?.name,\n duration: 30,\n idRole: [Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.FINANCIAL_SOURCE,\n name: 'Sources de financement',\n internalName: 'Conseils spécialisés',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)?.name,\n duration: 30,\n idRole: [Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n];"]}
1
+ {"version":3,"file":"TimeSlot.js","sourceRoot":"","sources":["../../../../ts/types/Enum/TimeSlot.ts"],"names":[],"mappings":";;;;AAAA,iCAA8B;AAC9B,uDAAoD;AAEpD,IAAY,QAuBX;AAvBD,WAAY,QAAQ;IAClB,mDAAc,CAAA;IACd,+DAAoB,CAAA;IACpB,yCAAS,CAAA;IACT,qCAAO,CAAA;IACP,qDAAe,CAAA;IACf,qEAAuB,CAAA;IACvB,2DAAkB,CAAA;IAClB,6CAAW,CAAA;IACX,yCAAS,CAAA;IACT,sDAAgB,CAAA;IAChB,4FAAmC,CAAA;IACnC,4IAA2D,CAAA;IAC3D,wDAAiB,CAAA;IACjB,0DAAkB,CAAA;IAClB,gHAA6C,CAAA;IAC7C,oDAAe,CAAA;IACf,sFAAgC,CAAA;IAChC,8DAAoB,CAAA;IACpB,wFAAiC,CAAA;IACjC,oEAAuB,CAAA;IACvB,gEAAqB,CAAA;AAEvB,CAAC,EAvBW,QAAQ,wBAAR,QAAQ,QAuBnB;AACD,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,mEAAc,CAAA;IACd,6DAAW,CAAA;IACX,6DAAW,CAAA;IACX,qEAAe,CAAA;AACjB,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AAsBY,QAAA,sBAAsB,GAAgC;IACjE;QACE,EAAE,EAAE,gBAAgB,CAAC,UAAU;QAC/B,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,wIAAwI;KAEtJ;IACD;QACE,EAAE,EAAE,gBAAgB,CAAC,OAAO;QAC5B,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,qJAAqJ;KACnK;IACD;QACE,EAAE,EAAE,gBAAgB,CAAC,OAAO;QAC5B,IAAI,EAAE,aAAa;Q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,CAAC,EAAE;KAC/C;CACF,CAAC","sourcesContent":["import { Role } from './Role';\nimport { TimeCounterType } from './TimeCounterType';\n\nexport enum TimeSlot {\n ONBOARDING = 1,\n ONBOARDING_SHORT = 2,\n BILAN = 3,\n TVA = 4,\n TVA_MANAGER = 5,\n BALANCESHEET_OR_TIP = 6,\n ACCOUNTING_RDV = 7,\n BILLING = 8,\n SALES = 9,\n APPOINTMENT = 10,\n SUPPORTING_CREATION_OF_SOCIETY = 11,\n APPROVAL_FINANCIAL_STATEMENTS_AND_DISTRIBUTE_DIVIDENDS = 12,\n EDIT_SOCIETY = 13,\n CLOSE_SOCIETY = 14,\n TAX_ADVICE_OR_COMPLEX_LEGAL_ARRANGEMENTS = 15,\n FIX_UNPAID = 16,\n ANNUAL_FINANCIAL_STATEMENTS = 18,\n MANAGER_REVENUE = 19,\n SPECIALISED_FISCAL_QUESTIONS = 20,\n VAT_TERRITORIALITY = 21,\n FINANCIAL_SOURCE = 22,\n\n}\nexport enum TimeSlotCategory {\n ACCOUNTING = 1,\n JURIDIC = 2,\n BILLING = 3,\n SPECIALISED = 4,\n}\n\n/**\n * @param {number[]} idRole if idRole not set, return all users except customers\n */\nexport type TimeSlotDetailType = {\n id: number;\n name: string;\n internalName: string;\n category?: string,\n duration: number;\n idRole?: number[];\n forWholeService?: boolean\n idRoleExcluded?: number[];\n idTimeCounterType: number;\n};\nexport type TimeSlotCategoryDetailType = {\n id: number;\n name: string;\n description: string;\n};\n\nexport const TimeSlotCategoryDetail:TimeSlotCategoryDetailType[] = [\n {\n id: TimeSlotCategory.ACCOUNTING,\n name: 'Comptable',\n description: 'Pour suivre l\\'avancement de votre bilan, vos déclarations de TVA ou pour toute question sur la vie de votre dossier, c\\'est par ici !',\n\n },\n {\n id: TimeSlotCategory.JURIDIC,\n name: 'Juridique',\n description: 'Si vous souhaitez ouvrir / modifier / fermer une entreprise ou pour tout besoin de montage juridique complexe, notre équipe est à votre disposition',\n },\n {\n id: TimeSlotCategory.BILLING,\n name: 'Facturation',\n description: 'Besoin d\\'échanger sur votre échéancier ou votre facturation (retards de paiement et autres) ? Prenez contact avec nous !',\n },\n {\n id: TimeSlotCategory.SPECIALISED,\n name: 'Conseils spécialisés',\n description: 'Vous souhaitez une explication de vos comptes annuels ? Vous avez des questions très pointues ou un besoin d\\'information spécifique ? Nous sommes là pour vous accompagner !',\n },\n];\n\nexport const TimeSlotDetail:TimeSlotDetailType[] = [\n {\n id: TimeSlot.ONBOARDING,\n name: 'OnBoarding',\n internalName: 'Rdv OnBoarding',\n duration: 45,\n idRole: [Role.ON_BOARDER],\n forWholeService: true,\n idTimeCounterType: TimeCounterType.ONBOARDING.id,\n },\n {\n id: TimeSlot.ONBOARDING_SHORT,\n name: 'OnBoarding',\n internalName: 'Rdv OnBoarding Court',\n duration: 45,\n idRole: [Role.ON_BOARDER],\n forWholeService: true,\n idTimeCounterType: TimeCounterType.ONBOARDING.id,\n },\n {\n id: TimeSlot.BILAN,\n name: 'Questions concernant mon bilan',\n internalName: 'Rdv bilan',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.ACCOUNTING)?.name,\n duration: 30,\n idRole: [Role.ACCOUNTANT],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.TVA,\n name: 'Questions concernant ma TVA',\n internalName: 'Rdv TVA',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.ACCOUNTING)?.name,\n duration: 30,\n idRole:[Role.ACCOUNTANT],\n idRoleExcluded:[Role.MANAGER],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n // {\n // id: TimeSlot.TVA_MANAGER,\n // name: 'Tva',\n // internalName: 'Tva Manager',\n // duration: 15,\n // idRole:[Role.ACCOUNTANT, Role.MANAGER],\n // forWholeService: false,\n // },\n // {\n // id: TimeSlot.BALANCESHEET_OR_TIP,\n // name: 'Bilan ou Conseil',\n // internalName: 'Bilan ou Conseil',\n // duration: 30,\n // idRole:[Role.ACCOUNTANT],\n // idRoleExcluded:[Role.MANAGER],\n // forWholeService: false,\n // },\n {\n id: TimeSlot.ACCOUNTING_RDV,\n name: 'Conseils',\n internalName: 'Rdv Conseils',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.ACCOUNTING)?.name,\n duration: 30,\n idRole:[Role.ACCOUNTANT],\n idRoleExcluded:[Role.MANAGER],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.BILLING,\n name: 'Questions concernant ma facturation',\n internalName: 'Rdv facturation',\n duration: 30,\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.BILLING)?.name,\n idRole:[Role.FACTURATION],\n forWholeService: true,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.SALES,\n name: 'Rdv commercial',\n internalName: 'Rdv Commercial',\n duration: 20,\n idRole:[Role.COMMERCIAL],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.APPOINTMENT, //TODO: à commenter ? remplacé par idType 7 ?\n name: 'Rdv',\n internalName: 'Rdv',\n duration: 20,\n // idRole: [Role.ACCOUNTANT, Role.COMMERCIAL, Role.SOCIAL, Role.JURIDIC, Role.EXPERT_ACCOUNTANT, Role.FACTURATION, Role.LITIGE, Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.SUPPORTING_CREATION_OF_SOCIETY,\n name: 'Accompagnement pour la création de mon entreprise',\n internalName: 'Rdv création',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.JURIDIC)?.name,\n duration: 30,\n idRole: [Role.JURIDIC],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.APPROVAL_FINANCIAL_STATEMENTS_AND_DISTRIBUTE_DIVIDENDS,\n name: 'Approuver les comptes et/ou distribuer des dividendes',\n internalName: 'Rdv juridique',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.JURIDIC)?.name,\n duration: 30,\n idRole: [Role.JURIDIC],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.EDIT_SOCIETY,\n name: 'Modifier mon entreprise',\n internalName: 'Rdv juridique',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.JURIDIC)?.name,\n duration: 30,\n idRole: [Role.JURIDIC],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.CLOSE_SOCIETY,\n name: 'Fermer mon entreprise',\n internalName: 'Rdv juridique',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.JURIDIC)?.name,\n duration: 30,\n idRole: [Role.JURIDIC],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.TAX_ADVICE_OR_COMPLEX_LEGAL_ARRANGEMENTS,\n name: 'Conseils fiscaux ou montages juridiques complexes',\n internalName: 'Rdv juridique',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.JURIDIC)?.name,\n duration: 60, \n idRole: [Role.JURIDIC, Role.DIRECTOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.FIX_UNPAID,\n name: 'Régulariser un paiement',\n internalName: 'Rdv impayés',\n duration: 30,\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.BILLING)?.name,\n idRole:[Role.FACTURATION],\n forWholeService: true,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.ANNUAL_FINANCIAL_STATEMENTS,\n name: 'Lecture et explication des comptes annuels',\n internalName: 'Conseils spécialisés',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)?.name,\n duration: 30,\n idRole: [Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.MANAGER_REVENUE,\n name: 'Rémunération du dirigeant & dividendes',\n internalName: 'Conseils spécialisés',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)?.name,\n duration: 30,\n idRole: [Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.SPECIALISED_FISCAL_QUESTIONS,\n name: 'Questions fiscales spécifiques (crédits d\\'impôts, ZFANG, autres statuts, etc.)',\n internalName: 'Conseils spécialisés',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)?.name,\n duration: 30,\n idRole: [Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.VAT_TERRITORIALITY,\n name: 'Territorialité de TVA',\n internalName: 'Conseils spécialisés',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)?.name,\n duration: 30,\n idRole: [Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n {\n id: TimeSlot.FINANCIAL_SOURCE,\n name: 'Sources de financement',\n internalName: 'Conseils spécialisés',\n category: TimeSlotCategoryDetail.find(c => c.id === TimeSlotCategory.SPECIALISED)?.name,\n duration: 30,\n idRole: [Role.TECHNICAL_ADVISOR],\n forWholeService: false,\n idTimeCounterType: TimeCounterType.CALENDLY.id,\n },\n];"]}
@@ -1 +1 @@
1
- {"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../ts/utils/payment.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAe,qBAAqB,EAAiB,WAAW,EAA0B,MAAM,UAAU,CAAC;AAK5H,UAAU,gBAAiB,SAAQ,QAAQ;IACzC,IAAI,EAAE,aAAa,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC;IAC7D,YAAY,EAAE,QAAQ,EAAE,CAAA;CACzB;AAED;;;;;;;;;GASG;AACH,QAAA,MAAM,0BAA0B,aAAc,QAAQ,EAAE,UAAS,CAAC,aAAa,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC,EAAE,KAA2D,gBAAgB,EAoCrM,CAAC;AAkBF;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,qBAAqB,WAAY,qBAAqB,KAAE,WAAW,EAoQxE,CAAC;AAEF,OAAO,EACL,0BAA0B,EAAE,qBAAqB,GAClD,CAAC"}
1
+ {"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../ts/utils/payment.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAe,qBAAqB,EAAiB,WAAW,EAA0B,MAAM,UAAU,CAAC;AAK5H,UAAU,gBAAiB,SAAQ,QAAQ;IACzC,IAAI,EAAE,aAAa,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC;IAC7D,YAAY,EAAE,QAAQ,EAAE,CAAA;CACzB;AAED;;;;;;;;;GASG;AACH,QAAA,MAAM,0BAA0B,aAAc,QAAQ,EAAE,UAAS,CAAC,aAAa,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC,EAAE,KAA2D,gBAAgB,EAoCrM,CAAC;AAkBF;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,qBAAqB,WAAY,qBAAqB,KAAE,WAAW,EAyQxE,CAAC;AAEF,OAAO,EACL,0BAA0B,EAAE,qBAAqB,GAClD,CAAC"}
@@ -89,6 +89,10 @@ const calculatePaymentsAuto = (params) => {
89
89
  throw new Error('Ce type de prestation ne correspond pas aux conditions attendues.');
90
90
  if (listPartialExercicePrestationExpress.length && (listPartialExercicePrestationExpress === null || listPartialExercicePrestationExpress === void 0 ? void 0 : listPartialExercicePrestationExpress.some((ep) => !(ep === null || ep === void 0 ? void 0 : ep.startDate))))
91
91
  throw new Error('Start date of some exercice are missing');
92
+ let yearlyAmountNonExpressClone = yearlyAmountNonExpress;
93
+ if (isWithApplicationFees) {
94
+ yearlyAmountNonExpressClone -= (0, prestation_1.getApplicationFeesAmount)(idLegalForm); //HT
95
+ }
92
96
  const nbExoExpress = listPartialExercicePrestationExpress.length;
93
97
  const listPayments = [];
94
98
  // on récupère le/les premiers réglements effectués, non alloués
@@ -211,7 +215,7 @@ const calculatePaymentsAuto = (params) => {
211
215
  let countMonthsBeforeExerciceEnd = Math.ceil(dayjs(exerciceEndDate).diff(paymentDate, 'months', true));
212
216
  if (countMonthsBeforeExerciceEnd < 3)
213
217
  countMonthsBeforeExerciceEnd = 3;
214
- const exoAmount = isFirstNonExpress ? yearlyAmountNonExpress : nextYearlyAmountNonExpress;
218
+ const exoAmount = isFirstNonExpress ? yearlyAmountNonExpressClone : nextYearlyAmountNonExpress;
215
219
  const remainingBeforeThisExo = remainingAmount;
216
220
  remainingAmount += priceWithTaxesIncluded ? exoAmount : (0, types_1.getTaxesIncludedAmount)(exoAmount, idVat);
217
221
  // Si le premier règlement couvre le coût de cet exercicePrestation,
@@ -1 +1 @@
1
- {"version":3,"file":"payment.js","sourceRoot":"","sources":["../../../ts/utils/payment.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,oCAA4H;AAC5H,+BAA+B;AAE/B,6CAAsE;AAOtE;;;;;;;;;GASG;AACH,MAAM,0BAA0B,GAAG,CAAC,QAAoB,EAAE,QAAoE,CAAC,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,CAAC,EAAsB,EAAE;IACzM,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,mBAAC,OAAA,MAAA,MAAA,MAAA,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,mBAAmB,0CAAE,eAAe,0CAAE,WAAW,mCAAI,KAAK,CAAA,EAAA,CAAC,CAAC;IAChH,MAAM,YAAY,GAAG,QAAQ,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AI,4BAA4B,GAAG,CAAC;QAAE,4BAA4B,GAAG,CAAC,CAAC;IAEvE,uDAAuD;IACvD,mCAAmC,IAAI,uBAAuB,CAAC;IAE/D,MAAM,aAAa,GAAG,mCAAmC,GAAG,4BAA4B,CAAC;IAEzF,yCAAyC;IACzC,IAAI,CAAC,YAAY,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAEpC,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC;QACjE,IAAI,MAAM,GAAG,aAAa,CAAC;QAE3B,iDAAiD;QACjD,yGAAyG;QACzG,uDAAuD;QACvD,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;QAExD,YAAY,CAAC,IAAI,CAAC;YAChB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,GAAG;YACtC,WAAW,EAAE,WAAW;YACxB,YAAY;YACZ,eAAe,EAAE,qBAAa,CAAC,YAAY,CAAC,EAAE;YAC9C,WAAW,EAAE,eAAe;SAC7B,CAAC,CAAC;QACH,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7E,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAG4B,sDAAqB","sourcesContent":["'use strict';\n\nimport { IPayment, IRegulation, ParamsForPaymentsAuto, PaymentMethod, PaymentAuto, getTaxesIncludedAmount } from '../types';\nimport * as dayjs from 'dayjs';\nimport { PartialExercicePrestationExpress } from '../types/Interface/api/payment/Util';\nimport { getApplicationFeesAmount, getPriceGrid } from './prestation';\n\ninterface PaymentsWithList extends IPayment {\n type: 'isComptable' | 'isJuridique' | 'isSocial' | 'isOther',\n listPayments: IPayment[]\n}\n\n/**\n * A partir d'une liste de payment (avec include jusqu'à prestationList, \n * avec en attributs 'isComptable' | 'isJuridique' | 'isSocial' | 'isOther')\n * permet de récupérer uniquement le premier paiement de chaque type \n * et les autres payments dans listPayments\n * avec possibilité de filtrer avec le tableau de filtres\n * @param payments \n * @param types \n * @returns \n */\nconst groupPaymentsByServiceType = (payments: IPayment[], types: ('isComptable' | 'isJuridique' | 'isSocial' | 'isOther')[] = ['isComptable', 'isJuridique', 'isSocial', 'isOther']): PaymentsWithList[] => {\n const prestaComptable = payments.filter((el) => el?.paymentsPrestations?.prestationsList?.isComptable ?? false);\n const prestaSocial = payments.filter((el) => !el?.paymentsPrestations?.prestationsList?.isComptable && el?.paymentsPrestations?.prestationsList?.isSocial);\n const prestaJuridique = payments.filter((el) => !el?.paymentsPrestations?.prestationsList?.isComptable && el?.paymentsPrestations?.prestationsList?.isJuridique);\n const prestaOther = payments.filter((el) => !el?.paymentsPrestations?.prestationsList?.isComptable && !el?.paymentsPrestations?.prestationsList?.isJuridique && !el?.paymentsPrestations?.prestationsList?.isSocial);\n \n const societyPayment: PaymentsWithList[] = [];\n if (prestaComptable.length && types.includes('isComptable')) {\n societyPayment.push({\n ...prestaComptable[0], // Données de base\n type: 'isComptable',\n listPayments: prestaComptable,\n });\n }\n if (prestaSocial.length && types.includes('isSocial')) {\n societyPayment.push({\n ...prestaSocial[0], // Données de base\n type: 'isSocial',\n listPayments: prestaSocial,\n });\n }\n if (prestaJuridique.length && types.includes('isJuridique')) {\n societyPayment.push({\n ...prestaJuridique[0], // Données de base\n type: 'isJuridique',\n listPayments: prestaJuridique,\n });\n }\n if (prestaOther.length && types.includes('isOther')) {\n societyPayment.push({\n ...prestaOther[0], // Données de base\n type: 'isOther',\n listPayments: prestaOther,\n });\n }\n return societyPayment;\n};\n\nconst calculateFees = (amount: number, goToClient: Date, paymentDate: Date):number => {\n const yearlyPriceIncreasing = 1.0275;\n\n const oneYearLessIfIn3LastMonthsOfYear = dayjs(goToClient).month() >= 9 ? 1 : 0;\n\n if (dayjs(paymentDate).year() - dayjs().year() > 0) {\n const nbYearsMore = dayjs(paymentDate).year() - dayjs().year() - oneYearLessIfIn3LastMonthsOfYear;\n // on applique X fois l'augmentation\n // ex. : si on lance l'appel en 2024, et qu'on génére un paiement pour 2026, on applique 2 fois l'augmentation\n // soit amount * yearlyPriceIncreasing * yearlyPriceIncreasing\n // soit amount * yearlyPriceIncreasing ^ nbYearsMore\n amount = amount * Math.pow(yearlyPriceIncreasing, nbYearsMore);\n }\n return amount;\n};\n\n/**\n// * @param {number} firstPaymentAmount - amount of the first payment (first regulation of the customer)\n * @param {Date} firstExerciceNonExpresssEndDate - end date of the first exercice non express\n * @param {number} idPrestation - prestation id\n * @param {number} idLegalForm - legal form id of the society\n * @param {boolean} isWithApplicationFees - if the prestation has application fees to paid\n * @param {IPrestationList} prestationList - type of prestation (hidden: 0, isCatalog: 1, isComptable: 1)\n * @param {number} idVat - vat id of society linked\n * @param {number} yearlyAmountNonExpress - yearly amount of non express prestation (HT)\n * @param {number} nextYearlyAmountNonExpress - yearly amount of non express prestation for next years (HT)\n * @param {PartialExercicePrestationExpress[]} listPartialExercicePrestationExpress - list of exercicePrestation linked to idPrestation -> used to get express\n * @param {IRegulation[]} listRegulations - list of regulations linked to idPrestation (TTC)\n * @param {Date} recoveryDate - date of recovery of the society\n * @returns { IPayment[] } list of payment to create for billing auto, after each presta go to onBoarding\n */\nconst calculatePaymentsAuto = (params: ParamsForPaymentsAuto):PaymentAuto[] => {\n const { idTypeBrand, goToClient, isWithApplicationFees, firstExerciceNonExpresssEndDate, idPrestation, idLegalForm, prestationList, idVat, yearlyAmountNonExpress, nextYearlyAmountNonExpress, listPartialExercicePrestationExpress, listRegulations, recoveryDate } = params;\n \n if (!yearlyAmountNonExpress) throw new Error('Le montant annuel des prestations non express ne peut pas être nul.');\n\n let initializedPaymentDate = dayjs().endOf('month').diff(dayjs(), 'day') < 3/* || dayjs().date() >= 15 */\n ? dayjs().add(2, 'month').startOf('month').toDate()\n : dayjs().add(1, 'month').startOf('month').toDate();\n \n //Si date de reprise, alors on initialise à cette date\n if (recoveryDate && dayjs(recoveryDate).isAfter(dayjs(), 'month')) {\n initializedPaymentDate = dayjs(recoveryDate).startOf('month').toDate();\n }\n\n // On récupère la grille tarifaire pour savoir si les tarifs sont HT ou TTC \n // et pour connaitre le montant du coût de l'app\n if (!prestationList.id) throw new Error('idPrestationList manquant');\n const priceGrid = getPriceGrid(idTypeBrand, prestationList.id);\n if (!priceGrid) throw new Error('Impossible de trouver la grille tarifaire correspondante');\n const { applicationCost, priceWithTaxesIncluded } = priceGrid;\n const applicationCostTotalTTC = (priceWithTaxesIncluded ? applicationCost : getTaxesIncludedAmount(applicationCost, idVat)) * 12;\n const applicationFeesAmountTTC = getApplicationFeesAmount(idLegalForm, idVat);\n\n if (prestationList?.isCatalog || !prestationList?.isComptable) throw new Error('Ce type de prestation ne correspond pas aux conditions attendues.');\n if (listPartialExercicePrestationExpress.length && listPartialExercicePrestationExpress?.some((ep: PartialExercicePrestationExpress) => !ep?.startDate)) throw new Error('Start date of some exercice are missing');\n\n const nbExoExpress = listPartialExercicePrestationExpress.length;\n const listPayments:PaymentAuto[] = [];\n\n // on récupère le/les premiers réglements effectués, non alloués\n // const isApplicationFeesAlreadyPaid = false;\n const sumRegulations = listRegulations.reduce((acc: number, r:IRegulation) => {\n //Si la regulation est rattachée à un paymentExpectation, on récupère le détail\n // et on ne prend que les frais de dossier (applicationFee) + le montant de la compta (accountingFee)\n \n // Commenté temporairement :\n // Pour l'instant, on ne prend plus en compte les paymentExpectation :\n // On part du principe que si isWithApplicationFees = true, alors les regulations contiennent les frais de dossier\n // sinon, ils sont offerts et n'apparaissent pas\n /* if (r.paymentsExpectation?.payload) {\n const payload = JSON.parse(r.paymentsExpectation?.payload);\n if (+payload?.applicationFee > 0) {\n isApplicationFeesAlreadyPaid = true;\n acc += +payload?.applicationFee;\n }\n if (+payload?.accountingFee > 0) acc += +payload?.accountingFee;\n return acc;\n } else {\n return acc + r.amount - r.amountUsed;\n } */\n return acc + r.amount - r.amountUsed;\n }, 0);\n let remainingAmount = -sumRegulations; //TTC\n let paymentDate = initializedPaymentDate;\n\n //On order les exercicePrestation par startDate ASC et id ASC\n listPartialExercicePrestationExpress.sort((a, b) => {\n const aStartDate = a?.startDate as Date;\n const bStartDate = b?.startDate as Date;\n return dayjs(aStartDate).diff(bStartDate);\n });\n\n // Si les frais de dossiers sont facturés, on ajoute un paiement sur le mois en cours\n if (isWithApplicationFees) {\n listPayments.push({\n amount: applicationFeesAmountTTC, //TTC\n isPaid: true,\n datePayment: dayjs().toDate(),\n idPrestation,\n idPaymentMethod: listRegulations[0]?.idPaymentMethod ?? PaymentMethod.DIRECT_DEBIT.id,\n closingDate: listPartialExercicePrestationExpress?.length ? listPartialExercicePrestationExpress[0].endDate : firstExerciceNonExpresssEndDate,\n comment: 'Frais de dossier',\n });\n remainingAmount += applicationFeesAmountTTC;\n }\n \n // =========================\n // EXPRESS\n // =========================\n listPartialExercicePrestationExpress.forEach((exercicePrestation:PartialExercicePrestationExpress, indexEP: number) => {\n const remainingBeforeThisExo = remainingAmount;\n\n remainingAmount += !priceWithTaxesIncluded \n ? getTaxesIncludedAmount(exercicePrestation.totalAmount, idVat) \n : exercicePrestation.totalAmount; //TTC\n \n \n // Si le premier règlement couvre le coût de cet exercicePrestation, \n // on créé un paiement pour cet exo et on passe au suivant\n if (remainingAmount <= 0) {\n listPayments.push({\n amount: Math.round(100 * (!priceWithTaxesIncluded \n ? getTaxesIncludedAmount(exercicePrestation.totalAmount, idVat) \n : exercicePrestation.totalAmount)) / 100, //TTC\n isPaid: true,\n datePayment: dayjs().toDate(),\n idPrestation,\n idPaymentMethod: listRegulations[0]?.idPaymentMethod ?? PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exercicePrestation.endDate,\n });\n return;\n } else if (remainingBeforeThisExo < 0 && remainingAmount > 0) {\n // Si le paiement couvre une partie du paiement, on créé un paiement pour cette partie lié à l'exo \n listPayments.push({\n amount: Math.round(100 * -remainingBeforeThisExo) / 100, //TTC\n isPaid: true,\n datePayment: dayjs().toDate(),\n idPrestation,\n idPaymentMethod: listRegulations[0]?.idPaymentMethod ?? PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exercicePrestation.endDate,\n });\n }\n \n //express : on étale en countExpressMonthlyPayment (nb de mensualités)\n let remainingAmountByExercicePrestation = remainingAmount; //TTC\n let countExpressMonthlyPayment = exercicePrestation?.countExpressMonthlyPayment ?? 3; //TTC\n //Si un premier règlement est généré avec le montant des regulations, on le considère comme une mensualité (unioquement pour le premier express et la première mensualité)\n if (indexEP === 0 && sumRegulations > 0) countExpressMonthlyPayment -= 1;\n\n const monthlyAmount = remainingAmountByExercicePrestation / countExpressMonthlyPayment; //TTC\n for (let index = 1; index <= countExpressMonthlyPayment; index++) {\n // On arrondis les 11 premières mensualités, mais on récupère le reste pour la dernière mensualité, pour éviter les centimes perdus en arrondis\n // et on applique le taux de tva de la société\n const amount = index < countExpressMonthlyPayment ? monthlyAmount : remainingAmountByExercicePrestation; //TTC\n \n // On évite les paiements de moins d'0,01 € (pour les paymentsExpectations ayant une différence de 1 cents)\n if (amount >= 0.005)\n listPayments.push({\n amount: Math.round(100 * amount) / 100,\n datePayment: paymentDate,\n idPrestation,\n idPaymentMethod: PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exercicePrestation.endDate,\n });\n remainingAmountByExercicePrestation -= monthlyAmount; \n paymentDate = dayjs(paymentDate).add(1, 'month').startOf('month').toDate();\n }\n remainingAmount = 0;\n });\n\n // =========================\n // NON EXPRESS\n // =========================\n // on lisse sur le nb de mois restants (avec au minimum 3 mensualités)\n // Si un seul exo express, alors on met les paiements de l'exo actuel en parallèle\n // sinon, ils sont à la suite des express\n if (nbExoExpress <= 1) paymentDate = initializedPaymentDate;\n let exerciceEndDate = dayjs(firstExerciceNonExpresssEndDate).toDate();\n\n let hasGeneratedWholeYear = false;\n let isFirstNonExpress = true;\n \n //On génère des paiements jusqu'à ce qu'un exercice soit entier (12 mois), non express\n while (!hasGeneratedWholeYear) {\n \n //On compte le nb de mois restants entre la date à laquelle le paiement va être créé et la date de fin d'exercice\n let countMonthsBeforeExerciceEnd = Math.ceil(dayjs(exerciceEndDate).diff(paymentDate, 'months', true));\n if (countMonthsBeforeExerciceEnd < 3) countMonthsBeforeExerciceEnd = 3;\n\n const exoAmount = isFirstNonExpress ? yearlyAmountNonExpress : nextYearlyAmountNonExpress;\n const remainingBeforeThisExo = remainingAmount;\n remainingAmount += priceWithTaxesIncluded ? exoAmount : getTaxesIncludedAmount(exoAmount, idVat);\n\n // Si le premier règlement couvre le coût de cet exercicePrestation, \n // on créé un paiement pour cet exo et on passe au suivant\n if (remainingAmount <= 0) {\n listPayments.push({\n amount: Math.round(100 * (priceWithTaxesIncluded ? exoAmount : getTaxesIncludedAmount(exoAmount, idVat))) / 100, //TTC\n isPaid: true,\n datePayment: dayjs().toDate(),\n idPrestation,\n idPaymentMethod: listRegulations[0]?.idPaymentMethod ?? PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exerciceEndDate,\n });\n exerciceEndDate = dayjs(exerciceEndDate).startOf('month').add(1, 'year').endOf('month').toDate();\n continue;\n } else if (remainingBeforeThisExo < 0 && remainingAmount > 0) {\n // Si le paiement couvre une partie du paiement, on créé un paiement pour cette partie lié à l'exo \n listPayments.push({\n amount: Math.round(100 * -remainingBeforeThisExo) / 100, //TTC\n isPaid: true,\n datePayment: dayjs().toDate(),\n idPrestation,\n idPaymentMethod: listRegulations[0]?.idPaymentMethod ?? PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exerciceEndDate,\n });\n }\n\n let remainingAmountByExercicePrestation = remainingAmount;\n\n // - frais d'application dès les second exo non express\n if (!isFirstNonExpress) remainingAmountByExercicePrestation += applicationCostTotalTTC;\n\n const monthlyAmount = remainingAmountByExercicePrestation / countMonthsBeforeExerciceEnd; //TTC\n\n if (monthlyAmount > 0) {\n for (let index = 1; index <= countMonthsBeforeExerciceEnd; index++) {\n let amount = index < countMonthsBeforeExerciceEnd ? monthlyAmount : remainingAmountByExercicePrestation;\n \n // Si besoin, on applique les frais nécessaires :\n // - 2,75% d'augmentation chaque année, sauf si souscriptiuon dans les 3 derniers mois de l'année civile)\n amount = calculateFees(amount, goToClient, paymentDate);\n \n listPayments.push({\n amount: Math.round(100 * amount) / 100,\n datePayment: paymentDate,\n idPrestation,\n idPaymentMethod: PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exerciceEndDate,\n });\n remainingAmountByExercicePrestation -= monthlyAmount; \n paymentDate = dayjs(paymentDate).add(1, 'month').startOf('month').toDate();\n }\n exerciceEndDate = dayjs(exerciceEndDate).startOf('month').add(1, 'year').endOf('month').toDate();\n }\n remainingAmount = 0;\n if (countMonthsBeforeExerciceEnd === 12) hasGeneratedWholeYear = true;\n isFirstNonExpress = false;\n }\n\n remainingAmount = 0;\n\n // =========================\n // JUSQU'EN DECEMBRE\n // =========================\n // On applique le taux de tva de la société, si besoin, selon la grille tarifaire\n remainingAmount += priceWithTaxesIncluded ? nextYearlyAmountNonExpress : getTaxesIncludedAmount(nextYearlyAmountNonExpress, idVat);\n\n let remainingAmountByExercicePrestation = remainingAmount;\n //On compte le nb de mois restants entre la date à laquelle le paiement va être créé et la date de fin d'exercice\n let countMonthsBeforeExerciceEnd = Math.ceil(dayjs(exerciceEndDate).diff(paymentDate, 'months', true));\n if (countMonthsBeforeExerciceEnd < 3) countMonthsBeforeExerciceEnd = 3;\n\n // - frais d'application dès les second exo non express\n remainingAmountByExercicePrestation += applicationCostTotalTTC;\n \n const monthlyAmount = remainingAmountByExercicePrestation / countMonthsBeforeExerciceEnd;\n \n // Si aucun paiement généré, on stoppe là\n if (!listPayments.length) return [];\n\n while (dayjs(listPayments.slice(-1)[0].datePayment).month() < 11) {\n let amount = monthlyAmount;\n\n // Si besoin, on applique les frais nécessaires :\n // - 2,75% d'augmentation chaque année, sauf si souscriptiuon dans les 3 derniers mois de l'année civile)\n // - frais d'application dès les second exo non express\n amount = calculateFees(amount, goToClient, paymentDate);\n\n listPayments.push({\n amount: Math.round(100 * amount) / 100,\n datePayment: paymentDate,\n idPrestation,\n idPaymentMethod: PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exerciceEndDate,\n });\n paymentDate = dayjs(paymentDate).add(1, 'month').startOf('month').toDate();\n }\n\n return listPayments;\n};\n\nexport {\n groupPaymentsByServiceType, calculatePaymentsAuto,\n};"]}
1
+ {"version":3,"file":"payment.js","sourceRoot":"","sources":["../../../ts/utils/payment.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,oCAA4H;AAC5H,+BAA+B;AAE/B,6CAAsE;AAOtE;;;;;;;;;GASG;AACH,MAAM,0BAA0B,GAAG,CAAC,QAAoB,EAAE,QAAoE,CAAC,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,CAAC,EAAsB,EAAE;IACzM,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,mBAAC,OAAA,MAAA,MAAA,MAAA,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,mBAAmB,0CAAE,eAAe,0CAAE,WAAW,mCAAI,KAAK,CAAA,EAAA,CAAC,CAAC;IAChH,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,uBAAC,OAAA,CAAC,CAAA,MAAA,MAAA,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,mBAAmB,0CAAE,eAAe,0CAAE,WAAW,CAAA,KAAI,MAAA,MAAA,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,mBAAmB,0CAAE,eAAe,0CAAE,QAAQ,CAAA,CAAA,EAAA,CAAC,CAAC;IAC3J,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,uBAAC,OAAA,CAAC,CAAA,MAAA,MAA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CAAC;IAEpC,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC;QACjE,IAAI,MAAM,GAAG,aAAa,CAAC;QAE3B,iDAAiD;QACjD,yGAAyG;QACzG,uDAAuD;QACvD,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;QAExD,YAAY,CAAC,IAAI,CAAC;YAChB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,GAAG;YACtC,WAAW,EAAE,WAAW;YACxB,YAAY;YACZ,eAAe,EAAE,qBAAa,CAAC,YAAY,CAAC,EAAE;YAC9C,WAAW,EAAE,eAAe;SAC7B,CAAC,CAAC;QACH,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7E,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAG4B,sDAAqB","sourcesContent":["'use strict';\n\nimport { IPayment, IRegulation, ParamsForPaymentsAuto, PaymentMethod, PaymentAuto, getTaxesIncludedAmount } from '../types';\nimport * as dayjs from 'dayjs';\nimport { PartialExercicePrestationExpress } from '../types/Interface/api/payment/Util';\nimport { getApplicationFeesAmount, getPriceGrid } from './prestation';\n\ninterface PaymentsWithList extends IPayment {\n type: 'isComptable' | 'isJuridique' | 'isSocial' | 'isOther',\n listPayments: IPayment[]\n}\n\n/**\n * A partir d'une liste de payment (avec include jusqu'à prestationList, \n * avec en attributs 'isComptable' | 'isJuridique' | 'isSocial' | 'isOther')\n * permet de récupérer uniquement le premier paiement de chaque type \n * et les autres payments dans listPayments\n * avec possibilité de filtrer avec le tableau de filtres\n * @param payments \n * @param types \n * @returns \n */\nconst groupPaymentsByServiceType = (payments: IPayment[], types: ('isComptable' | 'isJuridique' | 'isSocial' | 'isOther')[] = ['isComptable', 'isJuridique', 'isSocial', 'isOther']): PaymentsWithList[] => {\n const prestaComptable = payments.filter((el) => el?.paymentsPrestations?.prestationsList?.isComptable ?? false);\n const prestaSocial = payments.filter((el) => !el?.paymentsPrestations?.prestationsList?.isComptable && el?.paymentsPrestations?.prestationsList?.isSocial);\n const prestaJuridique = payments.filter((el) => !el?.paymentsPrestations?.prestationsList?.isComptable && el?.paymentsPrestations?.prestationsList?.isJuridique);\n const prestaOther = payments.filter((el) => !el?.paymentsPrestations?.prestationsList?.isComptable && !el?.paymentsPrestations?.prestationsList?.isJuridique && !el?.paymentsPrestations?.prestationsList?.isSocial);\n \n const societyPayment: PaymentsWithList[] = [];\n if (prestaComptable.length && types.includes('isComptable')) {\n societyPayment.push({\n ...prestaComptable[0], // Données de base\n type: 'isComptable',\n listPayments: prestaComptable,\n });\n }\n if (prestaSocial.length && types.includes('isSocial')) {\n societyPayment.push({\n ...prestaSocial[0], // Données de base\n type: 'isSocial',\n listPayments: prestaSocial,\n });\n }\n if (prestaJuridique.length && types.includes('isJuridique')) {\n societyPayment.push({\n ...prestaJuridique[0], // Données de base\n type: 'isJuridique',\n listPayments: prestaJuridique,\n });\n }\n if (prestaOther.length && types.includes('isOther')) {\n societyPayment.push({\n ...prestaOther[0], // Données de base\n type: 'isOther',\n listPayments: prestaOther,\n });\n }\n return societyPayment;\n};\n\nconst calculateFees = (amount: number, goToClient: Date, paymentDate: Date):number => {\n const yearlyPriceIncreasing = 1.0275;\n\n const oneYearLessIfIn3LastMonthsOfYear = dayjs(goToClient).month() >= 9 ? 1 : 0;\n\n if (dayjs(paymentDate).year() - dayjs().year() > 0) {\n const nbYearsMore = dayjs(paymentDate).year() - dayjs().year() - oneYearLessIfIn3LastMonthsOfYear;\n // on applique X fois l'augmentation\n // ex. : si on lance l'appel en 2024, et qu'on génére un paiement pour 2026, on applique 2 fois l'augmentation\n // soit amount * yearlyPriceIncreasing * yearlyPriceIncreasing\n // soit amount * yearlyPriceIncreasing ^ nbYearsMore\n amount = amount * Math.pow(yearlyPriceIncreasing, nbYearsMore);\n }\n return amount;\n};\n\n/**\n// * @param {number} firstPaymentAmount - amount of the first payment (first regulation of the customer)\n * @param {Date} firstExerciceNonExpresssEndDate - end date of the first exercice non express\n * @param {number} idPrestation - prestation id\n * @param {number} idLegalForm - legal form id of the society\n * @param {boolean} isWithApplicationFees - if the prestation has application fees to paid\n * @param {IPrestationList} prestationList - type of prestation (hidden: 0, isCatalog: 1, isComptable: 1)\n * @param {number} idVat - vat id of society linked\n * @param {number} yearlyAmountNonExpress - yearly amount of non express prestation (HT)\n * @param {number} nextYearlyAmountNonExpress - yearly amount of non express prestation for next years (HT)\n * @param {PartialExercicePrestationExpress[]} listPartialExercicePrestationExpress - list of exercicePrestation linked to idPrestation -> used to get express\n * @param {IRegulation[]} listRegulations - list of regulations linked to idPrestation (TTC)\n * @param {Date} recoveryDate - date of recovery of the society\n * @returns { IPayment[] } list of payment to create for billing auto, after each presta go to onBoarding\n */\nconst calculatePaymentsAuto = (params: ParamsForPaymentsAuto):PaymentAuto[] => {\n const { idTypeBrand, goToClient, isWithApplicationFees, firstExerciceNonExpresssEndDate, idPrestation, idLegalForm, prestationList, idVat, yearlyAmountNonExpress, nextYearlyAmountNonExpress, listPartialExercicePrestationExpress, listRegulations, recoveryDate } = params;\n \n if (!yearlyAmountNonExpress) throw new Error('Le montant annuel des prestations non express ne peut pas être nul.');\n\n let initializedPaymentDate = dayjs().endOf('month').diff(dayjs(), 'day') < 3/* || dayjs().date() >= 15 */\n ? dayjs().add(2, 'month').startOf('month').toDate()\n : dayjs().add(1, 'month').startOf('month').toDate();\n \n //Si date de reprise, alors on initialise à cette date\n if (recoveryDate && dayjs(recoveryDate).isAfter(dayjs(), 'month')) {\n initializedPaymentDate = dayjs(recoveryDate).startOf('month').toDate();\n }\n\n // On récupère la grille tarifaire pour savoir si les tarifs sont HT ou TTC \n // et pour connaitre le montant du coût de l'app\n if (!prestationList.id) throw new Error('idPrestationList manquant');\n const priceGrid = getPriceGrid(idTypeBrand, prestationList.id);\n if (!priceGrid) throw new Error('Impossible de trouver la grille tarifaire correspondante');\n const { applicationCost, priceWithTaxesIncluded } = priceGrid;\n const applicationCostTotalTTC = (priceWithTaxesIncluded ? applicationCost : getTaxesIncludedAmount(applicationCost, idVat)) * 12;\n const applicationFeesAmountTTC = getApplicationFeesAmount(idLegalForm, idVat);\n\n if (prestationList?.isCatalog || !prestationList?.isComptable) throw new Error('Ce type de prestation ne correspond pas aux conditions attendues.');\n if (listPartialExercicePrestationExpress.length && listPartialExercicePrestationExpress?.some((ep: PartialExercicePrestationExpress) => !ep?.startDate)) throw new Error('Start date of some exercice are missing');\n \n let yearlyAmountNonExpressClone = yearlyAmountNonExpress;\n if (isWithApplicationFees) {\n yearlyAmountNonExpressClone -= getApplicationFeesAmount(idLegalForm); //HT\n }\n\n const nbExoExpress = listPartialExercicePrestationExpress.length;\n const listPayments:PaymentAuto[] = [];\n\n // on récupère le/les premiers réglements effectués, non alloués\n // const isApplicationFeesAlreadyPaid = false;\n const sumRegulations = listRegulations.reduce((acc: number, r:IRegulation) => {\n //Si la regulation est rattachée à un paymentExpectation, on récupère le détail\n // et on ne prend que les frais de dossier (applicationFee) + le montant de la compta (accountingFee)\n \n // Commenté temporairement :\n // Pour l'instant, on ne prend plus en compte les paymentExpectation :\n // On part du principe que si isWithApplicationFees = true, alors les regulations contiennent les frais de dossier\n // sinon, ils sont offerts et n'apparaissent pas\n /* if (r.paymentsExpectation?.payload) {\n const payload = JSON.parse(r.paymentsExpectation?.payload);\n if (+payload?.applicationFee > 0) {\n isApplicationFeesAlreadyPaid = true;\n acc += +payload?.applicationFee;\n }\n if (+payload?.accountingFee > 0) acc += +payload?.accountingFee;\n return acc;\n } else {\n return acc + r.amount - r.amountUsed;\n } */\n return acc + r.amount - r.amountUsed;\n }, 0);\n let remainingAmount = -sumRegulations; //TTC\n let paymentDate = initializedPaymentDate;\n\n //On order les exercicePrestation par startDate ASC et id ASC\n listPartialExercicePrestationExpress.sort((a, b) => {\n const aStartDate = a?.startDate as Date;\n const bStartDate = b?.startDate as Date;\n return dayjs(aStartDate).diff(bStartDate);\n });\n\n // Si les frais de dossiers sont facturés, on ajoute un paiement sur le mois en cours\n if (isWithApplicationFees) {\n listPayments.push({\n amount: applicationFeesAmountTTC, //TTC\n isPaid: true,\n datePayment: dayjs().toDate(),\n idPrestation,\n idPaymentMethod: listRegulations[0]?.idPaymentMethod ?? PaymentMethod.DIRECT_DEBIT.id,\n closingDate: listPartialExercicePrestationExpress?.length ? listPartialExercicePrestationExpress[0].endDate : firstExerciceNonExpresssEndDate,\n comment: 'Frais de dossier',\n });\n remainingAmount += applicationFeesAmountTTC;\n }\n \n // =========================\n // EXPRESS\n // =========================\n listPartialExercicePrestationExpress.forEach((exercicePrestation:PartialExercicePrestationExpress, indexEP: number) => {\n const remainingBeforeThisExo = remainingAmount;\n\n remainingAmount += !priceWithTaxesIncluded \n ? getTaxesIncludedAmount(exercicePrestation.totalAmount, idVat) \n : exercicePrestation.totalAmount; //TTC\n \n \n // Si le premier règlement couvre le coût de cet exercicePrestation, \n // on créé un paiement pour cet exo et on passe au suivant\n if (remainingAmount <= 0) {\n listPayments.push({\n amount: Math.round(100 * (!priceWithTaxesIncluded \n ? getTaxesIncludedAmount(exercicePrestation.totalAmount, idVat) \n : exercicePrestation.totalAmount)) / 100, //TTC\n isPaid: true,\n datePayment: dayjs().toDate(),\n idPrestation,\n idPaymentMethod: listRegulations[0]?.idPaymentMethod ?? PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exercicePrestation.endDate,\n });\n return;\n } else if (remainingBeforeThisExo < 0 && remainingAmount > 0) {\n // Si le paiement couvre une partie du paiement, on créé un paiement pour cette partie lié à l'exo \n listPayments.push({\n amount: Math.round(100 * -remainingBeforeThisExo) / 100, //TTC\n isPaid: true,\n datePayment: dayjs().toDate(),\n idPrestation,\n idPaymentMethod: listRegulations[0]?.idPaymentMethod ?? PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exercicePrestation.endDate,\n });\n }\n \n //express : on étale en countExpressMonthlyPayment (nb de mensualités)\n let remainingAmountByExercicePrestation = remainingAmount; //TTC\n let countExpressMonthlyPayment = exercicePrestation?.countExpressMonthlyPayment ?? 3; //TTC\n //Si un premier règlement est généré avec le montant des regulations, on le considère comme une mensualité (unioquement pour le premier express et la première mensualité)\n if (indexEP === 0 && sumRegulations > 0) countExpressMonthlyPayment -= 1;\n\n const monthlyAmount = remainingAmountByExercicePrestation / countExpressMonthlyPayment; //TTC\n for (let index = 1; index <= countExpressMonthlyPayment; index++) {\n // On arrondis les 11 premières mensualités, mais on récupère le reste pour la dernière mensualité, pour éviter les centimes perdus en arrondis\n // et on applique le taux de tva de la société\n const amount = index < countExpressMonthlyPayment ? monthlyAmount : remainingAmountByExercicePrestation; //TTC\n \n // On évite les paiements de moins d'0,01 € (pour les paymentsExpectations ayant une différence de 1 cents)\n if (amount >= 0.005)\n listPayments.push({\n amount: Math.round(100 * amount) / 100,\n datePayment: paymentDate,\n idPrestation,\n idPaymentMethod: PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exercicePrestation.endDate,\n });\n remainingAmountByExercicePrestation -= monthlyAmount; \n paymentDate = dayjs(paymentDate).add(1, 'month').startOf('month').toDate();\n }\n remainingAmount = 0;\n });\n\n // =========================\n // NON EXPRESS\n // =========================\n // on lisse sur le nb de mois restants (avec au minimum 3 mensualités)\n // Si un seul exo express, alors on met les paiements de l'exo actuel en parallèle\n // sinon, ils sont à la suite des express\n if (nbExoExpress <= 1) paymentDate = initializedPaymentDate;\n let exerciceEndDate = dayjs(firstExerciceNonExpresssEndDate).toDate();\n\n let hasGeneratedWholeYear = false;\n let isFirstNonExpress = true;\n \n //On génère des paiements jusqu'à ce qu'un exercice soit entier (12 mois), non express\n while (!hasGeneratedWholeYear) {\n \n //On compte le nb de mois restants entre la date à laquelle le paiement va être créé et la date de fin d'exercice\n let countMonthsBeforeExerciceEnd = Math.ceil(dayjs(exerciceEndDate).diff(paymentDate, 'months', true));\n if (countMonthsBeforeExerciceEnd < 3) countMonthsBeforeExerciceEnd = 3;\n\n const exoAmount = isFirstNonExpress ? yearlyAmountNonExpressClone : nextYearlyAmountNonExpress;\n const remainingBeforeThisExo = remainingAmount;\n remainingAmount += priceWithTaxesIncluded ? exoAmount : getTaxesIncludedAmount(exoAmount, idVat);\n\n // Si le premier règlement couvre le coût de cet exercicePrestation, \n // on créé un paiement pour cet exo et on passe au suivant\n if (remainingAmount <= 0) {\n listPayments.push({\n amount: Math.round(100 * (priceWithTaxesIncluded ? exoAmount : getTaxesIncludedAmount(exoAmount, idVat))) / 100, //TTC\n isPaid: true,\n datePayment: dayjs().toDate(),\n idPrestation,\n idPaymentMethod: listRegulations[0]?.idPaymentMethod ?? PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exerciceEndDate,\n });\n exerciceEndDate = dayjs(exerciceEndDate).startOf('month').add(1, 'year').endOf('month').toDate();\n continue;\n } else if (remainingBeforeThisExo < 0 && remainingAmount > 0) {\n // Si le paiement couvre une partie du paiement, on créé un paiement pour cette partie lié à l'exo \n listPayments.push({\n amount: Math.round(100 * -remainingBeforeThisExo) / 100, //TTC\n isPaid: true,\n datePayment: dayjs().toDate(),\n idPrestation,\n idPaymentMethod: listRegulations[0]?.idPaymentMethod ?? PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exerciceEndDate,\n });\n }\n\n let remainingAmountByExercicePrestation = remainingAmount;\n\n // - frais d'application dès les second exo non express\n if (!isFirstNonExpress) remainingAmountByExercicePrestation += applicationCostTotalTTC;\n\n const monthlyAmount = remainingAmountByExercicePrestation / countMonthsBeforeExerciceEnd; //TTC\n\n if (monthlyAmount > 0) {\n for (let index = 1; index <= countMonthsBeforeExerciceEnd; index++) {\n let amount = index < countMonthsBeforeExerciceEnd ? monthlyAmount : remainingAmountByExercicePrestation;\n \n // Si besoin, on applique les frais nécessaires :\n // - 2,75% d'augmentation chaque année, sauf si souscriptiuon dans les 3 derniers mois de l'année civile)\n amount = calculateFees(amount, goToClient, paymentDate);\n \n listPayments.push({\n amount: Math.round(100 * amount) / 100,\n datePayment: paymentDate,\n idPrestation,\n idPaymentMethod: PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exerciceEndDate,\n });\n remainingAmountByExercicePrestation -= monthlyAmount; \n paymentDate = dayjs(paymentDate).add(1, 'month').startOf('month').toDate();\n }\n exerciceEndDate = dayjs(exerciceEndDate).startOf('month').add(1, 'year').endOf('month').toDate();\n }\n remainingAmount = 0;\n if (countMonthsBeforeExerciceEnd === 12) hasGeneratedWholeYear = true;\n isFirstNonExpress = false;\n }\n\n remainingAmount = 0;\n\n // =========================\n // JUSQU'EN DECEMBRE\n // =========================\n // On applique le taux de tva de la société, si besoin, selon la grille tarifaire\n remainingAmount += priceWithTaxesIncluded ? nextYearlyAmountNonExpress : getTaxesIncludedAmount(nextYearlyAmountNonExpress, idVat);\n\n let remainingAmountByExercicePrestation = remainingAmount;\n //On compte le nb de mois restants entre la date à laquelle le paiement va être créé et la date de fin d'exercice\n let countMonthsBeforeExerciceEnd = Math.ceil(dayjs(exerciceEndDate).diff(paymentDate, 'months', true));\n if (countMonthsBeforeExerciceEnd < 3) countMonthsBeforeExerciceEnd = 3;\n\n // - frais d'application dès les second exo non express\n remainingAmountByExercicePrestation += applicationCostTotalTTC;\n \n const monthlyAmount = remainingAmountByExercicePrestation / countMonthsBeforeExerciceEnd;\n \n // Si aucun paiement généré, on stoppe là\n if (!listPayments.length) return [];\n\n while (dayjs(listPayments.slice(-1)[0].datePayment).month() < 11) {\n let amount = monthlyAmount;\n\n // Si besoin, on applique les frais nécessaires :\n // - 2,75% d'augmentation chaque année, sauf si souscriptiuon dans les 3 derniers mois de l'année civile)\n // - frais d'application dès les second exo non express\n amount = calculateFees(amount, goToClient, paymentDate);\n\n listPayments.push({\n amount: Math.round(100 * amount) / 100,\n datePayment: paymentDate,\n idPrestation,\n idPaymentMethod: PaymentMethod.DIRECT_DEBIT.id,\n closingDate: exerciceEndDate,\n });\n paymentDate = dayjs(paymentDate).add(1, 'month').startOf('month').toDate();\n }\n\n return listPayments;\n};\n\nexport {\n groupPaymentsByServiceType, calculatePaymentsAuto,\n};"]}
@@ -47,7 +47,7 @@ const isExpress = (idPrestationList) => {
47
47
  };
48
48
  exports.isExpress = isExpress;
49
49
  const calculateScoringOfPrestation = (idPrestationType, prestations) => {
50
- const prestationsSignedPaid = prestations.filter((prestation) => prestation.paid && prestation.signed && prestation.terminationList === null);
50
+ const prestationsSignedPaid = prestations.filter((prestation) => prestation.terminationList === null);
51
51
  // Get the list of prestations that are half price
52
52
  const prestationHalfPriceList = Object.values(PrestationType_1.PrestationDetail).filter((p) => p.isComptable && !p.isCatalog);
53
53
  const prestationHalfPriceIds = prestationHalfPriceList.map((t) => t.id);
@@ -1 +1 @@
1
- {"version":3,"file":"prestation.js","sourceRoot":"","sources":["../../../ts/utils/prestation.ts"],"names":[],"mappings":";;;AACA,uCAAqD;AACrD,yCAA0C;AAC1C,iEAAgF;AAChF,uDAA4D;AAC5D,qEAAwF;AACxF,2EAAwE;AACxE,6EAA0E;AAC1E,2EAAwE;AACxE,mFAAgF;AAChF,2DAAwD;AACxD,qCAAiD;AACjD,+BAA+B;AAC/B,yCAA4C;AA4E5C,MAAM,yBAAyB,GAAG,CAAC,gBAAwB,EAAW,EAAE,CAAC;IACvE,+BAAc,CAAC,YAAY;IAC3B,+BAAc,CAAC,mBAAmB;IAClC,+BAAc,CAAC,wCAAwC;IACvD,+BAAc,CAAC,uBAAuB;IACtC,+BAAc,CAAC,GAAG;IAClB,+BAAc,CAAC,aAAa;IAC5B,+BAAc,CAAC,kBAAkB;CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AA+U9D,8DAAyB;AA7U3B,MAAM,wBAAwB,GAAG,CAAC,WAAmB,EAAE,SAAiB,EAAE,gBAAwB,E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,CAAC,kBAAkB,EAAE,+BAAc,CAAC,0BAA0B,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,CAAC,eAAe,CAAC,gBAAgB,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,aAAa,GAAG,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC1O,aAAa;aACR,IAAI,CAAC,+BAAc,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,aAAa,GAAG,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC5N,aAAa;aACR,IAAI,CAAC,+BAAc,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,aAAa,GAAG,QAAQ;YAAE,OAAO,IAAI,CAAC;;YAChN,OAAO,KAAK,CAAC;IACpB,CAAC;IACD,OAAO,KAAK,CAAC;AAEf,CAAC,CAAC;AAGoQ,kDAAmB","sourcesContent":["import { IExercice, IPrestation, IPrestationList } from '../types';\nimport { getTaxesIncludedAmount } from './vat/utils';\nimport { intersection } from './noLodash';\nimport { PrestationDetail, PrestationType } from '../types/Enum/PrestationType';\nimport { LegalFormTypeEnum } from '../types/Enum/LegalForm';\nimport { PrestationOptionType, PrestationOption } from '../types/Enum/PrestationOption';\nimport { PriceGridClementine } from '../types/Enum/PriceGridClementine';\nimport { PriceGridPourcentage } from '../types/Enum/PriceGridPourcentage';\nimport { PriceGridLegalstart } from '../types/Enum/PriceGridLegalstart';\nimport { PriceGridStatutsExpress } from '../types/Enum/PriceGridStatutsExpress';\nimport { ClosingType } from '../types/Enum/ClosingType';\nimport { getBrandNameByNodeEnv } from './brands';\nimport * as dayjs from 'dayjs';\nimport { exerciceNumber } from './exercice';\n\ntype priceGridBrand = {\n idTypeBrand: number,\n price: priceGrid[]\n};\n\ntype priceGrid = {\n idPrestationList: number[],\n priceWithTaxesIncluded: boolean,\n applicationCost: number,\n monthlyNbr?: monthlyNbr[],\n exerciceNbr?: exerciceNbr[],\n turnoverCreatedYear?: turnover[],\n turnoverPastYear?: turnover[],\n turnoverMonthly?: turnover[],\n turnoverYearly?: turnover[],\n employee?: employee[],\n partner?: employee[],\n properties?: propertie[],\n vatRegimeMonthly?: vatRegime[],\n vatRegimeYearly?: vatRegime[],\n taxSystem?: taxSystem[],\n legalForm?: legalForm[],\n employeeByLegalForm?: employeeByLegalForm[],\n};\n\ntype monthlyNbr = {\n minimum: number,\n maximum: number,\n value: number,\n closingType: number[],\n};\n\ntype exerciceNbr = {\n minimum: number,\n maximum: number,\n price: number,\n};\n\ntype turnover = {\n turnoverValue: number,\n price: number,\n};\n\ntype legalForm = {\n idLegalForm: number,\n price: number,\n};\n\ntype employee = {\n amountMinimum: number,\n amountMaximum: number,\n price: number,\n};\n\ntype employeeByLegalForm = {\n idLegalForm: number,\n price: number,\n};\n\ntype propertie = {\n amount: number,\n price: number,\n};\n\ntype vatRegime = {\n type: number,\n price: number,\n};\n\ntype taxSystem = {\n id: number,\n price: number,\n};\n\nconst isOtherAccountingMissions = (idPrestationList: number): boolean => [\n PrestationType.PREVISIONNEL,\n PrestationType.BILAN_INTERMEDIAIRE,\n PrestationType.AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE,\n PrestationType.AUTRE_MISSION_COMPTABLE,\n PrestationType.TVS,\n PrestationType.ETUDE_FISCALE,\n PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList);\n\nconst isOtherJuridicalMissions = (isJuridique:boolean, isCatalog:boolean, idPrestationList: number): boolean => idPrestationList !== PrestationType.GESTION_JURIDIQUE && isCatalog && isJuridique;\n\nconst isOtherSocialMission = (idPrestationList: number): boolean => idPrestationList === PrestationType.AUTRE_MISSION_SOCIALE_HORS_PAIE;\n\nconst isAdditionalPresta = (hidden:boolean, isCatalog:boolean): boolean => !hidden && isCatalog;\n\nconst isOnlyPrevi = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.PREVISIONNEL, PrestationType.BILAN_PREVISIONNEL, PrestationType.PV_AG].includes(idPL)).length;\n\nconst isOnlySocial = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.FRUCTUPAIE, PrestationType.SOCIAL].includes(idPL)).length;\n\nconst isOnlyJuridic = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.GESTION_JURIDIQUE].includes(idPL)).length;\n\nconst isCreation = (idPrestationList: number[]):boolean => !!intersection(idPrestationList, [PrestationType.CREATION_SOCIETE, PrestationType.STATUTS_FREE, PrestationType.STATUTS_OPTION_1, PrestationType.STATUTS_OPTION_2, PrestationType.STATUTS_OPTION_AE]).length;\n\nconst isFromStatutsExpress = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.STATUTS_FREE, PrestationType.STATUTS_OPTION_1, PrestationType.STATUTS_OPTION_2, PrestationType.STATUTS_OPTION_AE].includes(idPL)).length;\n\nconst isExpress = (idPrestationList: number):boolean => {\n const prestationDetailValues = Object.values(PrestationDetail) as any;\n const prestaList = prestationDetailValues.find((pr:any) => pr.id === idPrestationList);\n return !!prestaList.isBack;\n};\n\nconst calculateScoringOfPrestation = (idPrestationType: PrestationType, prestations: IPrestation[]): number => {\n const prestationsSignedPaid = prestations.filter((prestation) => prestation.paid && prestation.signed && prestation.terminationList === null);\n\n // Get the list of prestations that are half price\n const prestationHalfPriceList = Object.values(PrestationDetail).filter((p) => p.isComptable && !p.isCatalog);\n const prestationHalfPriceIds = prestationHalfPriceList.map((t) => t.id);\n\n // Get the number of points for the new prestation\n const prestaDetails = Object.values(PrestationDetail).find((prestaDetail) => prestaDetail.id === idPrestationType);\n const numberPoint = prestaDetails?.point || 0;\n\n // Get list of prestations that are already done and check if one of them is in the list of prestations that are half price\n const prestationsExistIds = prestationsSignedPaid.map((prestation) => prestation.idPrestationList);\n const prestationHalfPriceAlreadyDoneIds = prestationsExistIds.filter((id) => prestationHalfPriceIds.includes(id));\n\n // If one of the prestations already done is in the list of prestations that are half price and if the idPrestationType is in prestationHalfPriceIds, return 50% of points\n if (prestationHalfPriceAlreadyDoneIds.length && prestationHalfPriceIds.includes(idPrestationType)) return Math.floor(numberPoint * 0.3);\n\n return numberPoint;\n};\n\nexport const getPriceGrid = (idTypeBrand: number, idPrestationList: number): priceGrid | undefined => {\n let currentBrandPriceGrid: priceGridBrand | undefined;\n let currentPriceGrid: priceGrid | undefined;\n\n const currentEnvName = getBrandNameByNodeEnv(process.env.NODE_ENV);\n const listEnvEnum = {\n PriceGridClementine, PriceGridPourcentage, PriceGridLegalstart, PriceGridStatutsExpress,\n };\n // @ts-ignore\n const currentPriceGridFile: priceGridBrand[] = listEnvEnum[`PriceGrid${currentEnvName}`];\n if (currentPriceGridFile) currentBrandPriceGrid = currentPriceGridFile.find((priceGrid: priceGridBrand) => priceGrid.idTypeBrand === idTypeBrand);\n if (currentBrandPriceGrid) currentPriceGrid = currentBrandPriceGrid?.price.find((price: priceGrid) => price.idPrestationList.includes(idPrestationList));\n return currentPriceGrid;\n};\n\nconst calculatePrestationPriceWithPriceGrid = (\n idPrestationList: number, \n endDate: string, \n NbrMonth: number, /* Nbr de mois dans l'exercice */\n turnover: number, \n rentsNumber: number, \n employeesNumber: number, \n associatesNumber: number, \n idTypeBrand: number, \n idVatRegime: number, \n pastBalanceSheet: boolean, \n isYearly: boolean, /* Prestation annuel ou mensuel */\n totalMonth: number, /* Nbr de moiis offer */\n idTaxSystem: number, \n idLegalForm: number, \n exerciceNbr: number,\n balanceSheetOffered: number = 0, /* montant du bilan offer */\n): { \n totalPrestation: number, \n reduceMonth: number, \n canBeCreated: boolean, \n monthNbr: number, \n price: number \n} => {\n let totalPrestation: number = 0;\n let reduceMonth: number = 0;\n let monthNbr: number = NbrMonth;\n let yearlyPrice: number | undefined;\n let finalMonthlyPrice: number | undefined;\n let canBeCreated: boolean = true;\n let recalculateMonthly: boolean = false;\n\n /* Récupération de la grille tarifaire */\n const currentPriceGrid: priceGrid | undefined = getPriceGrid(idTypeBrand, idPrestationList);\n \n if (currentPriceGrid) {\n let monthlyPrice: number | undefined;\n let vatRegimePrice: number | undefined;\n let taxSystemPrice: number | undefined;\n\n /* Gestion du régime de TVA */\n if (currentPriceGrid.vatRegimeMonthly && !isYearly) vatRegimePrice = currentPriceGrid.vatRegimeMonthly?.find(regime => regime.type === idVatRegime)?.price;\n else if (currentPriceGrid.vatRegimeYearly && isYearly) vatRegimePrice = currentPriceGrid.vatRegimeYearly?.find(regime => regime.type === idVatRegime)?.price;\n\n /* Gestion du Régime d'imposition */\n if (currentPriceGrid.taxSystem && idTaxSystem) taxSystemPrice = currentPriceGrid.taxSystem?.find(tax => tax.id === idTaxSystem)?.price;\n\n /* Gestion des montants */\n /* Récupératioin des prix mensuels */\n if (currentPriceGrid.turnoverMonthly && !isYearly) monthlyPrice = currentPriceGrid.turnoverMonthly?.find(turn => turnover < turn.turnoverValue)?.price;\n else if (currentPriceGrid.properties) monthlyPrice = currentPriceGrid.properties?.find(property => property.amount === rentsNumber)?.price;\n else if (currentPriceGrid.employee) {\n monthlyPrice = currentPriceGrid.employee?.find(emp => emp.amountMinimum <= employeesNumber && emp.amountMaximum >= employeesNumber)?.price;\n monthlyPrice = monthlyPrice ? monthlyPrice * employeesNumber : 0;\n } else if (currentPriceGrid.employeeByLegalForm) {\n monthlyPrice = currentPriceGrid.employeeByLegalForm?.find(emp => emp.idLegalForm === idLegalForm)?.price;\n monthlyPrice = monthlyPrice ? monthlyPrice * employeesNumber : 0;\n /* Récupération des prix annuels */\n } else if (currentPriceGrid.turnoverYearly && isYearly) yearlyPrice = currentPriceGrid.turnoverYearly?.find(turn => turnover < turn.turnoverValue)?.price;\n else if (!pastBalanceSheet && currentPriceGrid.turnoverCreatedYear) yearlyPrice = currentPriceGrid.turnoverCreatedYear?.find(turn => turnover < turn.turnoverValue)?.price;\n else if (pastBalanceSheet && currentPriceGrid.turnoverPastYear) yearlyPrice = currentPriceGrid.turnoverPastYear?.find(turn => turnover < turn.turnoverValue)?.price;\n else if (currentPriceGrid.partner) yearlyPrice = currentPriceGrid.partner?.find(part => part.amountMinimum <= associatesNumber && part.amountMaximum >= associatesNumber)?.price;\n else if (currentPriceGrid.legalForm) yearlyPrice = currentPriceGrid.legalForm?.find(form => form.idLegalForm === idLegalForm)?.price;\n else if (currentPriceGrid.exerciceNbr) yearlyPrice = currentPriceGrid.exerciceNbr?.find(el => el.minimum <= exerciceNbr && exerciceNbr <= el.maximum )?.price;\n /* Calcul du prix mensuel final */\n finalMonthlyPrice = (monthlyPrice ? monthlyPrice : 0) + (vatRegimePrice ? vatRegimePrice : 0) + (taxSystemPrice ? taxSystemPrice : 0);\n\n /* Gestion des mois */\n let cloturedPast: boolean = false;\n if (dayjs(endDate, 'YYYY-MM-DD').subtract(15, 'day').isBefore(dayjs())) cloturedPast = true;\n let monthlyNbrList: monthlyNbr[] | undefined;\n let monthlyNbr: monthlyNbr | undefined;\n if (currentPriceGrid.monthlyNbr) {\n monthlyNbrList = currentPriceGrid.monthlyNbr?.filter(el => el.closingType.includes(cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS));\n if (monthlyNbrList) {\n monthlyNbr = monthlyNbrList.find(el => (el.minimum <= monthNbr) && (monthNbr <= el.maximum));\n if (monthlyNbr) {\n monthNbr = monthlyNbr.value;\n }\n }\n }\n /* Gestion des offres, mois offer */\n if (totalMonth > 0) {\n if (monthlyNbr && ((monthNbr - totalMonth) < monthlyNbr?.minimum)) canBeCreated = false; \n monthNbr = monthNbr - totalMonth;\n recalculateMonthly = true;\n }\n\n /* Calcul du nombre de mois soustraient */\n reduceMonth = (monthNbr === NbrMonth - totalMonth ? totalMonth : 0);\n\n /* Gestion des offres, bilan offer */\n if (balanceSheetOffered > 0) {\n yearlyPrice = undefined;\n recalculateMonthly = false;\n finalMonthlyPrice = balanceSheetOffered / monthNbr;\n }\n \n /* Prix Final */\n totalPrestation = (yearlyPrice ? yearlyPrice : finalMonthlyPrice * monthNbr);\n }\n return { totalPrestation, reduceMonth, canBeCreated, monthNbr: yearlyPrice ? 0 : recalculateMonthly ? NbrMonth : monthNbr, price: yearlyPrice ? yearlyPrice : recalculateMonthly ? (totalPrestation / monthNbr) : (finalMonthlyPrice ? finalMonthlyPrice : 0) };\n};\n\nconst calculatePrestationPriceWithPrestationList = (prestationList: IPrestationList): number => {\n let totalPrestation: number = 0;\n\n totalPrestation = prestationList?.price || 0;\n\n return totalPrestation;\n};\n\n/**\n * From idLegalForm, get application fees amount (without taxes included if no idVat passed, or with taxes included calculated by given idVat)\n * @param idLegalForm \n * @param idVat \n * @returns amount of application fees, without taxes included\n */\nconst getApplicationFeesAmount = (idLegalForm: number, idVat?: number) =>{\n let applicationFeesAmount = 50;\n if (idLegalForm === LegalFormTypeEnum.SCI) applicationFeesAmount = 150;\n\n //Sans tva, on envoie le montant HT\n if (!idVat) return applicationFeesAmount;\n\n //Avec tva, on envoie le montant TTC\n return getTaxesIncludedAmount(applicationFeesAmount, idVat);\n};\n\nconst calculatePrestationPrice = (\n idPrestationList: number, \n prestationList: IPrestationList, \n endDate: string, \n NbrMonth: number, /* Nbr de mois dans l'exercice */\n turnover: number, \n rentsNumber: number, \n employeesNumber: number, \n associatesNumber: number, \n idTypeBrand: number, \n idVatRegime: number, \n pastBalanceSheet: boolean, \n optionsList: number[], \n totalPercentage: number, /* total pourcentage offer (%) */\n totalAmount: number, /* total montant offer (€) */\n totalMonth: number, /* total mois offer (mois) */\n isWithApplicationFees: boolean, /* frais de dossier */\n idTaxSystem: number, \n idLegalForm: number, \n isYearly: boolean = false, /* prestation annuel ou mensuel */\n isSubPrestation: boolean = false,\n balanceSheetOffered: number = 0,\n exerciceList: IExercice[] = [],\n): { \n totalPrestation: number, \n reduceMonth: number, \n canBeCreated: boolean, \n calculDetail: string, \n monthlyPrice: string, \n price: number \n} => {\n let totalPrestation: number = 0;\n let reduceMonth: number = 0;\n let canBeCreated: boolean = true;\n let monthNbr: number = 0;\n let price: number = 0;\n let totalWithReduce: { totalPrestation: number, reduceMonth: number, canBeCreated: boolean, monthNbr: number, price: number } = { totalPrestation: 0, reduceMonth: 0, canBeCreated: true, monthNbr: 0, price: 0 };\n\n /* Gestion du prix en fonction de la prestation */\n if (\n [\n PrestationType.COMPTA_PRO,\n PrestationType.COMPTA_PRO_EXPRESS,\n PrestationType.COMPTA_ENTREPRISE,\n PrestationType.COMPTA_ENTREPRISE_EXPRESS,\n PrestationType.COMPTA_SCI,\n PrestationType.COMPTA_SCI_EXPRESS,\n PrestationType.BILAN_PREVISIONNEL,\n PrestationType.COMPTA_PREMIUM,\n PrestationType.COMPTA_POURCENTAGE_PREMIUM,\n PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS,\n PrestationType.COMPTA_POURCENTAGE,\n PrestationType.COMPTA_POURCENTAGE_EXPRESS,\n PrestationType.SOCIAL,\n PrestationType.GESTION_JURIDIQUE,\n PrestationType.COMPTA_PRO_COMPTASTART,\n PrestationType.COMPTA_PRO_COMPTASTART_EXPRESS,\n PrestationType.COMPTA_EI_KLEMS,\n PrestationType.COMPTA_EI_KLEMS_EXPRESS,\n PrestationType.COMPTA_MICRO_KLEMS,\n PrestationType.COMPTA_MICRO_KLEMS_EXPRESS,\n PrestationType.COMPTA_LOUEUR_MEUBLE_NON_PRO_KLEMS,\n PrestationType.COMPTA_LOUEUR_MEUBLE_NON_PRO_KLEMS_EXPRESS,\n PrestationType.STATUTS_OPTION_2,\n ].includes(idPrestationList)\n ) {\n let exerciceNbr: number = 0;\n if (exerciceList.length) exerciceNbr = exerciceNumber(dayjs(endDate, 'YYYY-MM-DD').toDate(), exerciceList);\n totalWithReduce = calculatePrestationPriceWithPriceGrid(\n idPrestationList, \n endDate, \n NbrMonth, \n turnover, \n rentsNumber, \n employeesNumber, \n associatesNumber, \n idTypeBrand, \n idVatRegime, \n pastBalanceSheet, \n isYearly, \n totalMonth, \n idTaxSystem, \n idLegalForm, \n exerciceNbr,\n balanceSheetOffered,\n );\n totalPrestation = totalWithReduce.totalPrestation;\n reduceMonth = totalWithReduce.reduceMonth;\n canBeCreated = totalWithReduce.canBeCreated;\n monthNbr = totalWithReduce.monthNbr;\n price = totalWithReduce.price;\n } else {\n totalPrestation = calculatePrestationPriceWithPrestationList(prestationList);\n if ([PrestationType.CREATION_SOCIETE].includes(idPrestationList) && !isSubPrestation) totalPrestation += 50;\n }\n /* Gestion des offres */\n /* Offre montant offer */\n if (totalAmount > 0) totalPrestation = totalPrestation - totalAmount;\n /* Offre pourcentage offer */\n if (totalPercentage > 0) totalPrestation = totalPrestation - (totalPrestation * (totalPercentage / 100));\n /* Gesstioin du prix minimum acceptable pour la prestation */\n if (prestationList.minimumPrice && totalPrestation < prestationList.minimumPrice) totalPrestation = prestationList.minimumPrice;\n /* Gestion des options */\n let OptionTotalPrice: number = 0;\n if (optionsList.length) {\n optionsList.forEach((optionId) => {\n const optionPrice: number | undefined = Object.values(PrestationOption).find((option) => option.id === optionId)?.price;\n if (optionPrice) OptionTotalPrice += optionPrice;\n });\n }\n totalPrestation += (OptionTotalPrice ? OptionTotalPrice : 0);\n /* Gestion des frais de dossier */\n if (isWithApplicationFees) {\n const applicationFeesAmount = getApplicationFeesAmount(idLegalForm);\n totalPrestation += applicationFeesAmount;\n }\n\n const calculDetail = `${monthNbr > 0 ? monthNbr + ' mois x ' + (Math.round(price * 100) / 100) + '€' : (Math.round(price * 100) / 100) + '€'} ${totalAmount > 0 ? '- ' + totalAmount + '€' : ''} ${totalPercentage > 0 ? '- ' + totalPercentage + '%' : ''} ${isWithApplicationFees ? '+ 50€' : ''}`;\n\n return { totalPrestation, reduceMonth, canBeCreated, calculDetail, monthlyPrice: monthNbr > 0 ? (Math.round(price * 100) / 100) + '€/mois' : (Math.round(price * 100) / 100) + '€', price };\n};\n\nconst getPrestationOptions = (idPrestationList: number): PrestationOptionType[] => {\n const PrestationOptionList: PrestationOptionType[] = Object.values(PrestationOption).filter(option => option.brand.includes(getBrandNameByNodeEnv(process.env.NODE_ENV)));\n return PrestationOptionList.filter(option => option.prestationList.includes(idPrestationList));\n};\n\nconst isAbleToUpdatePrice = (idTypeBrand: number, idPrestationList: number, turnover: number, pastBalanceSheet: boolean): boolean => {\n /* Récupération de la grille tarifaire */\n const currentPriceGrid: priceGrid | undefined = getPriceGrid(idTypeBrand, idPrestationList);\n if (currentPriceGrid) {\n // @ts-ignore\n if ([PrestationType.COMPTA_PREMIUM, PrestationType.COMPTA_POURCENTAGE_PREMIUM, PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS].includes(idPrestationList) && currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 2].turnoverValue < turnover) return true;\n // @ts-ignore\n else if ([PrestationType.COMPTA_POURCENTAGE, PrestationType.COMPTA_POURCENTAGE_EXPRESS].includes(idPrestationList) && currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 1].turnoverValue < turnover) return true;\n // @ts-ignore\n else if ([PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) && !pastBalanceSheet && currentPriceGrid.turnoverCreatedYear[currentPriceGrid.turnoverCreatedYear.length - 1].turnoverValue < turnover) return true;\n // @ts-ignore\n else if ([PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) && pastBalanceSheet && currentPriceGrid.turnoverPastYear[currentPriceGrid.turnoverPastYear.length - 1].turnoverValue < turnover) return true;\n else return false;\n }\n return false;\n\n};\n\nexport {\n isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isFromStatutsExpress, isExpress, calculateScoringOfPrestation, calculatePrestationPrice, getPrestationOptions, isAbleToUpdatePrice, calculatePrestationPriceWithPriceGrid, getApplicationFeesAmount,\n};"]}
1
+ {"version":3,"file":"prestation.js","sourceRoot":"","sources":["../../../ts/utils/prestation.ts"],"names":[],"mappings":";;;AACA,uCAAqD;AACrD,yCAA0C;AAC1C,iEAAgF;AAChF,uDAA4D;AAC5D,qEAAwF;AACxF,2EAAwE;AACxE,6EAA0E;AAC1E,2EAAwE;AACxE,mFAAgF;AAChF,2DAAwD;AACxD,qCAAiD;AACjD,+BAA+B;AAC/B,yCAA4C;AA4E5C,MAAM,yBAAyB,GAAG,CAAC,gBAAwB,EAAW,EAAE,CAAC;IACvE,+BAAc,CAAC,YAAY;IAC3B,+BAAc,CAAC,mBAAmB;IAClC,+BAAc,CAAC,wCAAwC;IACvD,+BAAc,CAAC,uBAAuB;IACtC,+BAAc,CAAC,GAAG;IAClB,+BAAc,CAAC,aAAa;IAC5B,+BAAc,CAAC,kBAAkB;CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AA+U9D,8DAAyB;AA7U3B,MAAM,wBAAwB,GAAG,CAAC,WAAmB,EAAE,SAAiB,EAAE,gBAAwB,EAAW,EAAE,CAAC,gBAAgB,KAAK,+BAAc,CAAC,iBAAiB,IAAI,SAAS,IAAI,WAAW,CAAC;AA6UrK,4DAAwB;AA3UrD,MAAM,oBAAoB,GAAG,CAAC,gBAAwB,EAAW,EAAE,CAAC,gBAAgB,KAAK,+BAAc,CAAC,+BAA+B,CAAC;AA2U7D,oDAAoB;AAzU/F,MAAM,kBAAkB,GAAG,CAAC,MAAc,EAAE,SAAiB,EAAW,EAAE,CAAC,CAAC,MAAM,IAAI,SAAS,CAAC;AAyUzC,gDAAkB;AAvUzE,MAAM,WAAW,GAAG,CAAC,gBAA0B,EAAU,EAAE,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,IAAW,EAAE,EAAE,CAAC,CAAC,CAAC,+BAAc,CAAC,YAAY,EAAE,+BAAc,CAAC,kBAAkB,EAAE,+B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gBAAgB,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,aAAa,GAAG,QAAQ;YAAE,OAAO,IAAI,CAAC;;YAChN,OAAO,KAAK,CAAC;IACpB,CAAC;IACD,OAAO,KAAK,CAAC;AAEf,CAAC,CAAC;AAGoQ,kDAAmB","sourcesContent":["import { IExercice, IPrestation, IPrestationList } from '../types';\nimport { getTaxesIncludedAmount } from './vat/utils';\nimport { intersection } from './noLodash';\nimport { PrestationDetail, PrestationType } from '../types/Enum/PrestationType';\nimport { LegalFormTypeEnum } from '../types/Enum/LegalForm';\nimport { PrestationOptionType, PrestationOption } from '../types/Enum/PrestationOption';\nimport { PriceGridClementine } from '../types/Enum/PriceGridClementine';\nimport { PriceGridPourcentage } from '../types/Enum/PriceGridPourcentage';\nimport { PriceGridLegalstart } from '../types/Enum/PriceGridLegalstart';\nimport { PriceGridStatutsExpress } from '../types/Enum/PriceGridStatutsExpress';\nimport { ClosingType } from '../types/Enum/ClosingType';\nimport { getBrandNameByNodeEnv } from './brands';\nimport * as dayjs from 'dayjs';\nimport { exerciceNumber } from './exercice';\n\ntype priceGridBrand = {\n idTypeBrand: number,\n price: priceGrid[]\n};\n\ntype priceGrid = {\n idPrestationList: number[],\n priceWithTaxesIncluded: boolean,\n applicationCost: number,\n monthlyNbr?: monthlyNbr[],\n exerciceNbr?: exerciceNbr[],\n turnoverCreatedYear?: turnover[],\n turnoverPastYear?: turnover[],\n turnoverMonthly?: turnover[],\n turnoverYearly?: turnover[],\n employee?: employee[],\n partner?: employee[],\n properties?: propertie[],\n vatRegimeMonthly?: vatRegime[],\n vatRegimeYearly?: vatRegime[],\n taxSystem?: taxSystem[],\n legalForm?: legalForm[],\n employeeByLegalForm?: employeeByLegalForm[],\n};\n\ntype monthlyNbr = {\n minimum: number,\n maximum: number,\n value: number,\n closingType: number[],\n};\n\ntype exerciceNbr = {\n minimum: number,\n maximum: number,\n price: number,\n};\n\ntype turnover = {\n turnoverValue: number,\n price: number,\n};\n\ntype legalForm = {\n idLegalForm: number,\n price: number,\n};\n\ntype employee = {\n amountMinimum: number,\n amountMaximum: number,\n price: number,\n};\n\ntype employeeByLegalForm = {\n idLegalForm: number,\n price: number,\n};\n\ntype propertie = {\n amount: number,\n price: number,\n};\n\ntype vatRegime = {\n type: number,\n price: number,\n};\n\ntype taxSystem = {\n id: number,\n price: number,\n};\n\nconst isOtherAccountingMissions = (idPrestationList: number): boolean => [\n PrestationType.PREVISIONNEL,\n PrestationType.BILAN_INTERMEDIAIRE,\n PrestationType.AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE,\n PrestationType.AUTRE_MISSION_COMPTABLE,\n PrestationType.TVS,\n PrestationType.ETUDE_FISCALE,\n PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList);\n\nconst isOtherJuridicalMissions = (isJuridique:boolean, isCatalog:boolean, idPrestationList: number): boolean => idPrestationList !== PrestationType.GESTION_JURIDIQUE && isCatalog && isJuridique;\n\nconst isOtherSocialMission = (idPrestationList: number): boolean => idPrestationList === PrestationType.AUTRE_MISSION_SOCIALE_HORS_PAIE;\n\nconst isAdditionalPresta = (hidden:boolean, isCatalog:boolean): boolean => !hidden && isCatalog;\n\nconst isOnlyPrevi = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.PREVISIONNEL, PrestationType.BILAN_PREVISIONNEL, PrestationType.PV_AG].includes(idPL)).length;\n\nconst isOnlySocial = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.FRUCTUPAIE, PrestationType.SOCIAL].includes(idPL)).length;\n\nconst isOnlyJuridic = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.GESTION_JURIDIQUE].includes(idPL)).length;\n\nconst isCreation = (idPrestationList: number[]):boolean => !!intersection(idPrestationList, [PrestationType.CREATION_SOCIETE, PrestationType.STATUTS_FREE, PrestationType.STATUTS_OPTION_1, PrestationType.STATUTS_OPTION_2, PrestationType.STATUTS_OPTION_AE]).length;\n\nconst isFromStatutsExpress = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.STATUTS_FREE, PrestationType.STATUTS_OPTION_1, PrestationType.STATUTS_OPTION_2, PrestationType.STATUTS_OPTION_AE].includes(idPL)).length;\n\nconst isExpress = (idPrestationList: number):boolean => {\n const prestationDetailValues = Object.values(PrestationDetail) as any;\n const prestaList = prestationDetailValues.find((pr:any) => pr.id === idPrestationList);\n return !!prestaList.isBack;\n};\n\nconst calculateScoringOfPrestation = (idPrestationType: PrestationType, prestations: IPrestation[]): number => {\n const prestationsSignedPaid = prestations.filter((prestation) => prestation.terminationList === null);\n\n // Get the list of prestations that are half price\n const prestationHalfPriceList = Object.values(PrestationDetail).filter((p) => p.isComptable && !p.isCatalog);\n const prestationHalfPriceIds = prestationHalfPriceList.map((t) => t.id);\n\n // Get the number of points for the new prestation\n const prestaDetails = Object.values(PrestationDetail).find((prestaDetail) => prestaDetail.id === idPrestationType);\n const numberPoint = prestaDetails?.point || 0;\n\n // Get list of prestations that are already done and check if one of them is in the list of prestations that are half price\n const prestationsExistIds = prestationsSignedPaid.map((prestation) => prestation.idPrestationList);\n const prestationHalfPriceAlreadyDoneIds = prestationsExistIds.filter((id) => prestationHalfPriceIds.includes(id));\n\n // If one of the prestations already done is in the list of prestations that are half price and if the idPrestationType is in prestationHalfPriceIds, return 50% of points\n if (prestationHalfPriceAlreadyDoneIds.length && prestationHalfPriceIds.includes(idPrestationType)) return Math.floor(numberPoint * 0.3);\n\n return numberPoint;\n};\n\nexport const getPriceGrid = (idTypeBrand: number, idPrestationList: number): priceGrid | undefined => {\n let currentBrandPriceGrid: priceGridBrand | undefined;\n let currentPriceGrid: priceGrid | undefined;\n\n const currentEnvName = getBrandNameByNodeEnv(process.env.NODE_ENV);\n const listEnvEnum = {\n PriceGridClementine, PriceGridPourcentage, PriceGridLegalstart, PriceGridStatutsExpress,\n };\n // @ts-ignore\n const currentPriceGridFile: priceGridBrand[] = listEnvEnum[`PriceGrid${currentEnvName}`];\n if (currentPriceGridFile) currentBrandPriceGrid = currentPriceGridFile.find((priceGrid: priceGridBrand) => priceGrid.idTypeBrand === idTypeBrand);\n if (currentBrandPriceGrid) currentPriceGrid = currentBrandPriceGrid?.price.find((price: priceGrid) => price.idPrestationList.includes(idPrestationList));\n return currentPriceGrid;\n};\n\nconst calculatePrestationPriceWithPriceGrid = (\n idPrestationList: number, \n endDate: string, \n NbrMonth: number, /* Nbr de mois dans l'exercice */\n turnover: number, \n rentsNumber: number, \n employeesNumber: number, \n associatesNumber: number, \n idTypeBrand: number, \n idVatRegime: number, \n pastBalanceSheet: boolean, \n isYearly: boolean, /* Prestation annuel ou mensuel */\n totalMonth: number, /* Nbr de moiis offer */\n idTaxSystem: number, \n idLegalForm: number, \n exerciceNbr: number,\n balanceSheetOffered: number = 0, /* montant du bilan offer */\n): { \n totalPrestation: number, \n reduceMonth: number, \n canBeCreated: boolean, \n monthNbr: number, \n price: number \n} => {\n let totalPrestation: number = 0;\n let reduceMonth: number = 0;\n let monthNbr: number = NbrMonth;\n let yearlyPrice: number | undefined;\n let finalMonthlyPrice: number | undefined;\n let canBeCreated: boolean = true;\n let recalculateMonthly: boolean = false;\n\n /* Récupération de la grille tarifaire */\n const currentPriceGrid: priceGrid | undefined = getPriceGrid(idTypeBrand, idPrestationList);\n \n if (currentPriceGrid) {\n let monthlyPrice: number | undefined;\n let vatRegimePrice: number | undefined;\n let taxSystemPrice: number | undefined;\n\n /* Gestion du régime de TVA */\n if (currentPriceGrid.vatRegimeMonthly && !isYearly) vatRegimePrice = currentPriceGrid.vatRegimeMonthly?.find(regime => regime.type === idVatRegime)?.price;\n else if (currentPriceGrid.vatRegimeYearly && isYearly) vatRegimePrice = currentPriceGrid.vatRegimeYearly?.find(regime => regime.type === idVatRegime)?.price;\n\n /* Gestion du Régime d'imposition */\n if (currentPriceGrid.taxSystem && idTaxSystem) taxSystemPrice = currentPriceGrid.taxSystem?.find(tax => tax.id === idTaxSystem)?.price;\n\n /* Gestion des montants */\n /* Récupératioin des prix mensuels */\n if (currentPriceGrid.turnoverMonthly && !isYearly) monthlyPrice = currentPriceGrid.turnoverMonthly?.find(turn => turnover < turn.turnoverValue)?.price;\n else if (currentPriceGrid.properties) monthlyPrice = currentPriceGrid.properties?.find(property => property.amount === rentsNumber)?.price;\n else if (currentPriceGrid.employee) {\n monthlyPrice = currentPriceGrid.employee?.find(emp => emp.amountMinimum <= employeesNumber && emp.amountMaximum >= employeesNumber)?.price;\n monthlyPrice = monthlyPrice ? monthlyPrice * employeesNumber : 0;\n } else if (currentPriceGrid.employeeByLegalForm) {\n monthlyPrice = currentPriceGrid.employeeByLegalForm?.find(emp => emp.idLegalForm === idLegalForm)?.price;\n monthlyPrice = monthlyPrice ? monthlyPrice * employeesNumber : 0;\n /* Récupération des prix annuels */\n } else if (currentPriceGrid.turnoverYearly && isYearly) yearlyPrice = currentPriceGrid.turnoverYearly?.find(turn => turnover < turn.turnoverValue)?.price;\n else if (!pastBalanceSheet && currentPriceGrid.turnoverCreatedYear) yearlyPrice = currentPriceGrid.turnoverCreatedYear?.find(turn => turnover < turn.turnoverValue)?.price;\n else if (pastBalanceSheet && currentPriceGrid.turnoverPastYear) yearlyPrice = currentPriceGrid.turnoverPastYear?.find(turn => turnover < turn.turnoverValue)?.price;\n else if (currentPriceGrid.partner) yearlyPrice = currentPriceGrid.partner?.find(part => part.amountMinimum <= associatesNumber && part.amountMaximum >= associatesNumber)?.price;\n else if (currentPriceGrid.legalForm) yearlyPrice = currentPriceGrid.legalForm?.find(form => form.idLegalForm === idLegalForm)?.price;\n else if (currentPriceGrid.exerciceNbr) yearlyPrice = currentPriceGrid.exerciceNbr?.find(el => el.minimum <= exerciceNbr && exerciceNbr <= el.maximum )?.price;\n /* Calcul du prix mensuel final */\n finalMonthlyPrice = (monthlyPrice ? monthlyPrice : 0) + (vatRegimePrice ? vatRegimePrice : 0) + (taxSystemPrice ? taxSystemPrice : 0);\n\n /* Gestion des mois */\n let cloturedPast: boolean = false;\n if (dayjs(endDate, 'YYYY-MM-DD').subtract(15, 'day').isBefore(dayjs())) cloturedPast = true;\n let monthlyNbrList: monthlyNbr[] | undefined;\n let monthlyNbr: monthlyNbr | undefined;\n if (currentPriceGrid.monthlyNbr) {\n monthlyNbrList = currentPriceGrid.monthlyNbr?.filter(el => el.closingType.includes(cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS));\n if (monthlyNbrList) {\n monthlyNbr = monthlyNbrList.find(el => (el.minimum <= monthNbr) && (monthNbr <= el.maximum));\n if (monthlyNbr) {\n monthNbr = monthlyNbr.value;\n }\n }\n }\n /* Gestion des offres, mois offer */\n if (totalMonth > 0) {\n if (monthlyNbr && ((monthNbr - totalMonth) < monthlyNbr?.minimum)) canBeCreated = false; \n monthNbr = monthNbr - totalMonth;\n recalculateMonthly = true;\n }\n\n /* Calcul du nombre de mois soustraient */\n reduceMonth = (monthNbr === NbrMonth - totalMonth ? totalMonth : 0);\n\n /* Gestion des offres, bilan offer */\n if (balanceSheetOffered > 0) {\n yearlyPrice = undefined;\n recalculateMonthly = false;\n finalMonthlyPrice = balanceSheetOffered / monthNbr;\n }\n \n /* Prix Final */\n totalPrestation = (yearlyPrice ? yearlyPrice : finalMonthlyPrice * monthNbr);\n }\n return { totalPrestation, reduceMonth, canBeCreated, monthNbr: yearlyPrice ? 0 : recalculateMonthly ? NbrMonth : monthNbr, price: yearlyPrice ? yearlyPrice : recalculateMonthly ? (totalPrestation / monthNbr) : (finalMonthlyPrice ? finalMonthlyPrice : 0) };\n};\n\nconst calculatePrestationPriceWithPrestationList = (prestationList: IPrestationList): number => {\n let totalPrestation: number = 0;\n\n totalPrestation = prestationList?.price || 0;\n\n return totalPrestation;\n};\n\n/**\n * From idLegalForm, get application fees amount (without taxes included if no idVat passed, or with taxes included calculated by given idVat)\n * @param idLegalForm \n * @param idVat \n * @returns amount of application fees, without taxes included\n */\nconst getApplicationFeesAmount = (idLegalForm: number, idVat?: number) =>{\n let applicationFeesAmount = 50;\n if (idLegalForm === LegalFormTypeEnum.SCI) applicationFeesAmount = 150;\n\n //Sans tva, on envoie le montant HT\n if (!idVat) return applicationFeesAmount;\n\n //Avec tva, on envoie le montant TTC\n return getTaxesIncludedAmount(applicationFeesAmount, idVat);\n};\n\nconst calculatePrestationPrice = (\n idPrestationList: number, \n prestationList: IPrestationList, \n endDate: string, \n NbrMonth: number, /* Nbr de mois dans l'exercice */\n turnover: number, \n rentsNumber: number, \n employeesNumber: number, \n associatesNumber: number, \n idTypeBrand: number, \n idVatRegime: number, \n pastBalanceSheet: boolean, \n optionsList: number[], \n totalPercentage: number, /* total pourcentage offer (%) */\n totalAmount: number, /* total montant offer (€) */\n totalMonth: number, /* total mois offer (mois) */\n isWithApplicationFees: boolean, /* frais de dossier */\n idTaxSystem: number, \n idLegalForm: number, \n isYearly: boolean = false, /* prestation annuel ou mensuel */\n isSubPrestation: boolean = false,\n balanceSheetOffered: number = 0,\n exerciceList: IExercice[] = [],\n): { \n totalPrestation: number, \n reduceMonth: number, \n canBeCreated: boolean, \n calculDetail: string, \n monthlyPrice: string, \n price: number \n} => {\n let totalPrestation: number = 0;\n let reduceMonth: number = 0;\n let canBeCreated: boolean = true;\n let monthNbr: number = 0;\n let price: number = 0;\n let totalWithReduce: { totalPrestation: number, reduceMonth: number, canBeCreated: boolean, monthNbr: number, price: number } = { totalPrestation: 0, reduceMonth: 0, canBeCreated: true, monthNbr: 0, price: 0 };\n\n /* Gestion du prix en fonction de la prestation */\n if (\n [\n PrestationType.COMPTA_PRO,\n PrestationType.COMPTA_PRO_EXPRESS,\n PrestationType.COMPTA_ENTREPRISE,\n PrestationType.COMPTA_ENTREPRISE_EXPRESS,\n PrestationType.COMPTA_SCI,\n PrestationType.COMPTA_SCI_EXPRESS,\n PrestationType.BILAN_PREVISIONNEL,\n PrestationType.COMPTA_PREMIUM,\n PrestationType.COMPTA_POURCENTAGE_PREMIUM,\n PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS,\n PrestationType.COMPTA_POURCENTAGE,\n PrestationType.COMPTA_POURCENTAGE_EXPRESS,\n PrestationType.SOCIAL,\n PrestationType.GESTION_JURIDIQUE,\n PrestationType.COMPTA_PRO_COMPTASTART,\n PrestationType.COMPTA_PRO_COMPTASTART_EXPRESS,\n PrestationType.COMPTA_EI_KLEMS,\n PrestationType.COMPTA_EI_KLEMS_EXPRESS,\n PrestationType.COMPTA_MICRO_KLEMS,\n PrestationType.COMPTA_MICRO_KLEMS_EXPRESS,\n PrestationType.COMPTA_LOUEUR_MEUBLE_NON_PRO_KLEMS,\n PrestationType.COMPTA_LOUEUR_MEUBLE_NON_PRO_KLEMS_EXPRESS,\n PrestationType.STATUTS_OPTION_2,\n ].includes(idPrestationList)\n ) {\n let exerciceNbr: number = 0;\n if (exerciceList.length) exerciceNbr = exerciceNumber(dayjs(endDate, 'YYYY-MM-DD').toDate(), exerciceList);\n totalWithReduce = calculatePrestationPriceWithPriceGrid(\n idPrestationList, \n endDate, \n NbrMonth, \n turnover, \n rentsNumber, \n employeesNumber, \n associatesNumber, \n idTypeBrand, \n idVatRegime, \n pastBalanceSheet, \n isYearly, \n totalMonth, \n idTaxSystem, \n idLegalForm, \n exerciceNbr,\n balanceSheetOffered,\n );\n totalPrestation = totalWithReduce.totalPrestation;\n reduceMonth = totalWithReduce.reduceMonth;\n canBeCreated = totalWithReduce.canBeCreated;\n monthNbr = totalWithReduce.monthNbr;\n price = totalWithReduce.price;\n } else {\n totalPrestation = calculatePrestationPriceWithPrestationList(prestationList);\n if ([PrestationType.CREATION_SOCIETE].includes(idPrestationList) && !isSubPrestation) totalPrestation += 50;\n }\n /* Gestion des offres */\n /* Offre montant offer */\n if (totalAmount > 0) totalPrestation = totalPrestation - totalAmount;\n /* Offre pourcentage offer */\n if (totalPercentage > 0) totalPrestation = totalPrestation - (totalPrestation * (totalPercentage / 100));\n /* Gesstioin du prix minimum acceptable pour la prestation */\n if (prestationList.minimumPrice && totalPrestation < prestationList.minimumPrice) totalPrestation = prestationList.minimumPrice;\n /* Gestion des options */\n let OptionTotalPrice: number = 0;\n if (optionsList.length) {\n optionsList.forEach((optionId) => {\n const optionPrice: number | undefined = Object.values(PrestationOption).find((option) => option.id === optionId)?.price;\n if (optionPrice) OptionTotalPrice += optionPrice;\n });\n }\n totalPrestation += (OptionTotalPrice ? OptionTotalPrice : 0);\n /* Gestion des frais de dossier */\n if (isWithApplicationFees) {\n const applicationFeesAmount = getApplicationFeesAmount(idLegalForm);\n totalPrestation += applicationFeesAmount;\n }\n\n const calculDetail = `${monthNbr > 0 ? monthNbr + ' mois x ' + (Math.round(price * 100) / 100) + '€' : (Math.round(price * 100) / 100) + '€'} ${totalAmount > 0 ? '- ' + totalAmount + '€' : ''} ${totalPercentage > 0 ? '- ' + totalPercentage + '%' : ''} ${isWithApplicationFees ? '+ 50€' : ''}`;\n\n return { totalPrestation, reduceMonth, canBeCreated, calculDetail, monthlyPrice: monthNbr > 0 ? (Math.round(price * 100) / 100) + '€/mois' : (Math.round(price * 100) / 100) + '€', price };\n};\n\nconst getPrestationOptions = (idPrestationList: number): PrestationOptionType[] => {\n const PrestationOptionList: PrestationOptionType[] = Object.values(PrestationOption).filter(option => option.brand.includes(getBrandNameByNodeEnv(process.env.NODE_ENV)));\n return PrestationOptionList.filter(option => option.prestationList.includes(idPrestationList));\n};\n\nconst isAbleToUpdatePrice = (idTypeBrand: number, idPrestationList: number, turnover: number, pastBalanceSheet: boolean): boolean => {\n /* Récupération de la grille tarifaire */\n const currentPriceGrid: priceGrid | undefined = getPriceGrid(idTypeBrand, idPrestationList);\n if (currentPriceGrid) {\n // @ts-ignore\n if ([PrestationType.COMPTA_PREMIUM, PrestationType.COMPTA_POURCENTAGE_PREMIUM, PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS].includes(idPrestationList) && currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 2].turnoverValue < turnover) return true;\n // @ts-ignore\n else if ([PrestationType.COMPTA_POURCENTAGE, PrestationType.COMPTA_POURCENTAGE_EXPRESS].includes(idPrestationList) && currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 1].turnoverValue < turnover) return true;\n // @ts-ignore\n else if ([PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) && !pastBalanceSheet && currentPriceGrid.turnoverCreatedYear[currentPriceGrid.turnoverCreatedYear.length - 1].turnoverValue < turnover) return true;\n // @ts-ignore\n else if ([PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) && pastBalanceSheet && currentPriceGrid.turnoverPastYear[currentPriceGrid.turnoverPastYear.length - 1].turnoverValue < turnover) return true;\n else return false;\n }\n return false;\n\n};\n\nexport {\n isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isFromStatutsExpress, isExpress, calculateScoringOfPrestation, calculatePrestationPrice, getPrestationOptions, isAbleToUpdatePrice, calculatePrestationPriceWithPriceGrid, getApplicationFeesAmount,\n};"]}