@silexpert/core 1.1.164 → 1.1.166

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/cjs/api/resources/Society.d.ts +2 -1
  2. package/dist/cjs/api/resources/Society.d.ts.map +1 -1
  3. package/dist/cjs/api/resources/Society.js +3 -0
  4. package/dist/cjs/api/resources/Society.js.map +1 -1
  5. package/dist/cjs/api/resources/Subscription.d.ts +2 -0
  6. package/dist/cjs/api/resources/Subscription.d.ts.map +1 -1
  7. package/dist/cjs/api/resources/Subscription.js +3 -0
  8. package/dist/cjs/api/resources/Subscription.js.map +1 -1
  9. package/dist/cjs/types/Enum/BrandPourcentage.d.ts +4 -0
  10. package/dist/cjs/types/Enum/BrandPourcentage.d.ts.map +1 -1
  11. package/dist/cjs/types/Enum/BrandPourcentage.js +92 -1
  12. package/dist/cjs/types/Enum/BrandPourcentage.js.map +1 -1
  13. package/dist/cjs/types/Enum/Contract.d.ts +4 -0
  14. package/dist/cjs/types/Enum/Contract.d.ts.map +1 -1
  15. package/dist/cjs/types/Enum/Contract.js +11 -1
  16. package/dist/cjs/types/Enum/Contract.js.map +1 -1
  17. package/dist/cjs/types/Enum/Log.d.ts +8 -1
  18. package/dist/cjs/types/Enum/Log.d.ts.map +1 -1
  19. package/dist/cjs/types/Enum/Log.js +7 -0
  20. package/dist/cjs/types/Enum/Log.js.map +1 -1
  21. package/dist/cjs/types/Enum/PartnerType.d.ts +4 -0
  22. package/dist/cjs/types/Enum/PartnerType.d.ts.map +1 -1
  23. package/dist/cjs/types/Enum/PartnerType.js +6 -1
  24. package/dist/cjs/types/Enum/PartnerType.js.map +1 -1
  25. package/dist/cjs/types/Interface/api/prestation/Query.d.ts +1 -0
  26. package/dist/cjs/types/Interface/api/prestation/Query.d.ts.map +1 -1
  27. package/dist/cjs/types/Interface/api/prestation/Query.js +8 -0
  28. package/dist/cjs/types/Interface/api/prestation/Query.js.map +1 -1
  29. package/dist/cjs/types/Interface/api/society/Export.d.ts +69 -0
  30. package/dist/cjs/types/Interface/api/society/Export.d.ts.map +1 -0
  31. package/dist/cjs/types/Interface/api/society/Export.js +37 -0
  32. package/dist/cjs/types/Interface/api/society/Export.js.map +1 -0
  33. package/dist/cjs/types/index.d.ts +1 -0
  34. package/dist/cjs/types/index.d.ts.map +1 -1
  35. package/dist/cjs/types/index.js +1 -0
  36. package/dist/cjs/types/index.js.map +1 -1
  37. package/dist/cjs/utils/prestation.d.ts +4 -1
  38. package/dist/cjs/utils/prestation.d.ts.map +1 -1
  39. package/dist/cjs/utils/prestation.js +31 -11
  40. package/dist/cjs/utils/prestation.js.map +1 -1
  41. package/dist/mjs/api/resources/Society.d.ts +2 -1
  42. package/dist/mjs/api/resources/Society.d.ts.map +1 -1
  43. package/dist/mjs/api/resources/Society.js +3 -0
  44. package/dist/mjs/api/resources/Society.js.map +1 -1
  45. package/dist/mjs/api/resources/Subscription.d.ts +2 -0
  46. package/dist/mjs/api/resources/Subscription.d.ts.map +1 -1
  47. package/dist/mjs/api/resources/Subscription.js +3 -0
  48. package/dist/mjs/api/resources/Subscription.js.map +1 -1
  49. package/dist/mjs/types/Enum/BrandPourcentage.d.ts +4 -0
  50. package/dist/mjs/types/Enum/BrandPourcentage.d.ts.map +1 -1
  51. package/dist/mjs/types/Enum/BrandPourcentage.js +92 -1
  52. package/dist/mjs/types/Enum/BrandPourcentage.js.map +1 -1
  53. package/dist/mjs/types/Enum/Contract.d.ts +4 -0
  54. package/dist/mjs/types/Enum/Contract.d.ts.map +1 -1
  55. package/dist/mjs/types/Enum/Contract.js +10 -0
  56. package/dist/mjs/types/Enum/Contract.js.map +1 -1
  57. package/dist/mjs/types/Enum/Log.d.ts +8 -1
  58. package/dist/mjs/types/Enum/Log.d.ts.map +1 -1
  59. package/dist/mjs/types/Enum/Log.js +7 -0
  60. package/dist/mjs/types/Enum/Log.js.map +1 -1
  61. package/dist/mjs/types/Enum/PartnerType.d.ts +4 -0
  62. package/dist/mjs/types/Enum/PartnerType.d.ts.map +1 -1
  63. package/dist/mjs/types/Enum/PartnerType.js +5 -0
  64. package/dist/mjs/types/Enum/PartnerType.js.map +1 -1
  65. package/dist/mjs/types/Interface/api/prestation/Query.d.ts +1 -0
  66. package/dist/mjs/types/Interface/api/prestation/Query.d.ts.map +1 -1
  67. package/dist/mjs/types/Interface/api/prestation/Query.js +10 -1
  68. package/dist/mjs/types/Interface/api/prestation/Query.js.map +1 -1
  69. package/dist/mjs/types/Interface/api/society/Export.d.ts +69 -0
  70. package/dist/mjs/types/Interface/api/society/Export.d.ts.map +1 -0
  71. package/dist/mjs/types/Interface/api/society/Export.js +36 -0
  72. package/dist/mjs/types/Interface/api/society/Export.js.map +1 -0
  73. package/dist/mjs/types/index.d.ts +1 -0
  74. package/dist/mjs/types/index.d.ts.map +1 -1
  75. package/dist/mjs/types/index.js +1 -0
  76. package/dist/mjs/types/index.js.map +1 -1
  77. package/dist/mjs/utils/prestation.d.ts +4 -1
  78. package/dist/mjs/utils/prestation.d.ts.map +1 -1
  79. package/dist/mjs/utils/prestation.js +31 -11
  80. package/dist/mjs/utils/prestation.js.map +1 -1
  81. package/package.json +2 -1
  82. package/ts/api/resources/Society.ts +5 -0
  83. package/ts/api/resources/Subscription.ts +5 -0
  84. package/ts/types/Enum/BrandPourcentage.ts +92 -1
  85. package/ts/types/Enum/Contract.ts +12 -1
  86. package/ts/types/Enum/Log.ts +7 -0
  87. package/ts/types/Enum/PartnerType.ts +7 -1
  88. package/ts/types/Interface/api/prestation/Query.ts +8 -1
  89. package/ts/types/Interface/api/society/Export.ts +91 -0
  90. package/ts/types/index.ts +1 -1
  91. package/ts/utils/prestation.ts +32 -11
@@ -61,11 +61,15 @@ const getPriceGrid = (idTypeBrand, idPrestationList) => {
61
61
  const calculatePrestationPriceWithPriceGrid = (idPrestationList, endDate, NbrMonth, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, isYearly, totalMonth) => {
62
62
  let totalPrestation = 0;
63
63
  let reduceMonth = 0;
64
+ let monthNbr = NbrMonth;
65
+ let yearlyPrice;
66
+ let finalMonthlyPrice;
67
+ let canBeCreated = true;
68
+ let recalculateMonthly = false;
64
69
  /* Récupération de la grille tarifaire */
65
70
  const currentPriceGrid = getPriceGrid(idTypeBrand, idPrestationList);
66
71
  if (currentPriceGrid) {
67
72
  let monthlyPrice;
68
- let yearlyPrice;
69
73
  let vatRegimePrice;
70
74
  /* Gestion du régime de TVA */
71
75
  if (currentPriceGrid.vatRegimeMonthly && !isYearly)
@@ -87,35 +91,45 @@ const calculatePrestationPriceWithPriceGrid = (idPrestationList, endDate, NbrMon
87
91
  yearlyPrice = currentPriceGrid.turnoverPastYear?.find(turn => turnover < turn.turnoverValue)?.price;
88
92
  else if (currentPriceGrid.partner)
89
93
  yearlyPrice = currentPriceGrid.partner?.find(part => part.amountMinimum <= associatesNumber && part.amountMaximum >= associatesNumber)?.price;
90
- const finalMonthlyPrice = (monthlyPrice ? monthlyPrice : 0) + (vatRegimePrice ? vatRegimePrice : 0);
94
+ finalMonthlyPrice = (monthlyPrice ? monthlyPrice : 0) + (vatRegimePrice ? vatRegimePrice : 0);
91
95
  /* Gestion des mois */
92
96
  let cloturedPast = false;
93
97
  if (dayjs(endDate, 'YYYY-MM-DD').subtract(15, 'day').isBefore(dayjs()))
94
98
  cloturedPast = true;
95
99
  const minimumMonth = currentPriceGrid.minimumMonthlyPayment?.find(monthlyPayment => monthlyPayment.id === (cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS))?.month;
96
100
  const maximumMonth = currentPriceGrid.maximumMonthlyPayment?.find(monthlyPayment => monthlyPayment.id === (cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS))?.month;
97
- let monthNbr = NbrMonth;
98
101
  if (totalMonth > 0)
99
102
  monthNbr = monthNbr - totalMonth;
100
- if (minimumMonth && monthNbr < minimumMonth)
103
+ if (minimumMonth && monthNbr < minimumMonth) {
101
104
  monthNbr = minimumMonth;
102
- if (maximumMonth && monthNbr > maximumMonth)
105
+ recalculateMonthly = true;
106
+ if (totalMonth > 0)
107
+ canBeCreated = false;
108
+ }
109
+ if (maximumMonth && monthNbr > maximumMonth) {
103
110
  monthNbr = maximumMonth;
111
+ recalculateMonthly = true;
112
+ if (totalMonth > 0)
113
+ canBeCreated = false;
114
+ }
104
115
  reduceMonth = (monthNbr === NbrMonth - totalMonth ? totalMonth : 0);
105
116
  /* Prix Final */
106
117
  totalPrestation = (yearlyPrice ? yearlyPrice : finalMonthlyPrice * monthNbr);
107
118
  }
108
- return { totalPrestation, reduceMonth };
119
+ return { totalPrestation, reduceMonth, canBeCreated, monthNbr: yearlyPrice ? 0 : recalculateMonthly ? NbrMonth : monthNbr, price: yearlyPrice ? yearlyPrice : recalculateMonthly ? (totalPrestation / NbrMonth) : (finalMonthlyPrice ? finalMonthlyPrice : 0) };
109
120
  };
110
121
  const calculatePrestationPriceWithPrestationList = (prestationList) => {
111
122
  let totalPrestation = 0;
112
123
  totalPrestation = prestationList.price || 0;
113
124
  return totalPrestation;
114
125
  };
115
- const calculatePrestationPrice = (idPrestationList, prestationList, endDate, NbrMonth, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, optionsList, totalPercentage, totalAmount, totalMonth, isYearly = false) => {
126
+ const calculatePrestationPrice = (idPrestationList, prestationList, endDate, NbrMonth, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, optionsList, totalPercentage, totalAmount, totalMonth, isWithApplicationFees, isYearly = false) => {
116
127
  let totalPrestation = 0;
117
128
  let reduceMonth = 0;
118
- let totalWithReduce = { totalPrestation: 0, reduceMonth: 0 };
129
+ let canBeCreated = true;
130
+ let monthNbr = 0;
131
+ let price = 0;
132
+ let totalWithReduce = { totalPrestation: 0, reduceMonth: 0, canBeCreated: true, monthNbr: 0, price: 0 };
119
133
  /* Gestion du prix en fonction de la prestation */
120
134
  if ([
121
135
  PrestationType.COMPTA_PRO,
@@ -138,14 +152,17 @@ const calculatePrestationPrice = (idPrestationList, prestationList, endDate, Nbr
138
152
  totalWithReduce = calculatePrestationPriceWithPriceGrid(idPrestationList, endDate, NbrMonth, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, isYearly, totalMonth);
139
153
  totalPrestation = totalWithReduce.totalPrestation;
140
154
  reduceMonth = totalWithReduce.reduceMonth;
155
+ canBeCreated = totalWithReduce.canBeCreated;
156
+ monthNbr = totalWithReduce.monthNbr;
157
+ price = totalWithReduce.price;
141
158
  }
142
159
  else {
143
160
  totalPrestation = calculatePrestationPriceWithPrestationList(prestationList);
144
161
  }
145
- if (totalPercentage > 0)
146
- totalPrestation = totalPrestation - (totalPrestation * (totalPercentage / 100));
147
162
  if (totalAmount > 0)
148
163
  totalPrestation = totalPrestation - totalAmount;
164
+ if (totalPercentage > 0)
165
+ totalPrestation = totalPrestation - (totalPrestation * (totalPercentage / 100));
149
166
  if (prestationList.minimumPrice && totalPrestation < prestationList.minimumPrice)
150
167
  totalPrestation = prestationList.minimumPrice;
151
168
  /* Gestion des options */
@@ -158,7 +175,10 @@ const calculatePrestationPrice = (idPrestationList, prestationList, endDate, Nbr
158
175
  });
159
176
  }
160
177
  totalPrestation += (OptionTotalPrice ? OptionTotalPrice : 0);
161
- return { totalPrestation, reduceMonth };
178
+ if (isWithApplicationFees)
179
+ totalPrestation += 50;
180
+ const calculDetail = `${monthNbr > 0 ? monthNbr + ' mois x ' + price + '€' : price + '€'} ${totalAmount > 0 ? '- ' + totalAmount + '€' : ''} ${totalPercentage > 0 ? '- ' + totalPercentage + '%' : ''} ${isWithApplicationFees ? '+ 50€' : ''}`;
181
+ return { totalPrestation, reduceMonth, canBeCreated, calculDetail, price };
162
182
  };
163
183
  const getPrestationOptions = (idPrestationList) => {
164
184
  const PrestationOptionList = Object.values(PrestationOption).filter(option => option.brand.includes(getBrandNameByNodeEnv(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AI,CAAC;QACpR,aAAa;aACR,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,cAAc,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,cAAc,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,cAAc,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;KACnB;IACD,OAAO,KAAK,CAAC;AAEf,CAAC,CAAC;AAEF,OAAO,EACL,yBAAyB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,mBAAmB,GAClQ,CAAC","sourcesContent":["import { IPrestation, IPrestationList } from '../types';\nimport { PrestationDetail, PrestationType } from '../types/Enum/PrestationType';\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 { ClosingType } from '../types/Enum/ClosingType';\nimport { getBrandNameByNodeEnv } from './brands';\nimport * as dayjs from 'dayjs';\n\ntype priceGridBrand = {\n idTypeBrand: number,\n price: priceGrid[]\n};\n\ntype priceGrid = {\n idPrestationList: number[],\n minimumMonthlyPayment?: monthlyPayment[],\n maximumMonthlyPayment?: monthlyPayment[],\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};\n\ntype monthlyPayment = {\n id: number,\n month: number,\n};\n\ntype turnover = {\n turnoverValue: number,\n price: number,\n};\n\ntype employee = {\n amountMinimum: number,\n amountMaximum: 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\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 => idPrestationList.includes(PrestationType.CREATION_SOCIETE);\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\nconst 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,\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 = (idPrestationList: number, endDate: string, NbrMonth: number, turnover: number, rentsNumber: number, employeesNumber: number, associatesNumber: number, idTypeBrand: number, idVatRegime: number, pastBalanceSheet: boolean, isYearly: boolean, totalMonth: number): { totalPrestation: number, reduceMonth: number } => {\n let totalPrestation: number = 0;\n let reduceMonth: number = 0;\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 yearlyPrice: number | undefined;\n let vatRegimePrice: 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 des montants */\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) monthlyPrice = currentPriceGrid.employee?.find(emp => emp.amountMinimum <= employeesNumber && emp.amountMaximum >= employeesNumber)?.price;\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 const finalMonthlyPrice: number | undefined = (monthlyPrice ? monthlyPrice : 0) + (vatRegimePrice ? vatRegimePrice : 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 const minimumMonth: number | undefined = currentPriceGrid.minimumMonthlyPayment?.find(monthlyPayment => monthlyPayment.id === (cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS))?.month;\n const maximumMonth: number | undefined = currentPriceGrid.maximumMonthlyPayment?.find(monthlyPayment => monthlyPayment.id === (cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS))?.month;\n let monthNbr: number = NbrMonth;\n if (totalMonth > 0) monthNbr = monthNbr - totalMonth;\n if (minimumMonth && monthNbr < minimumMonth) monthNbr = minimumMonth;\n if (maximumMonth && monthNbr > maximumMonth) monthNbr = maximumMonth;\n\n reduceMonth = (monthNbr === NbrMonth - totalMonth ? totalMonth : 0);\n \n /* Prix Final */\n totalPrestation = (yearlyPrice ? yearlyPrice : finalMonthlyPrice * monthNbr);\n }\n return { totalPrestation, reduceMonth };\n};\n\nconst calculatePrestationPriceWithPrestationList = (prestationList: IPrestationList): number => {\n let totalPrestation: number = 0;\n\n totalPrestation = prestationList.price || 0;\n\n return totalPrestation;\n};\n\nconst calculatePrestationPrice = (idPrestationList: number, prestationList: IPrestationList, endDate: string, NbrMonth: number, turnover: number, rentsNumber: number, employeesNumber: number, associatesNumber: number, idTypeBrand: number, idVatRegime: number, pastBalanceSheet: boolean, optionsList: number[], totalPercentage: number, totalAmount: number, totalMonth: number, isYearly: boolean = false): { totalPrestation: number, reduceMonth: number } => {\n let totalPrestation: number = 0;\n let reduceMonth: number = 0;\n let totalWithReduce: { totalPrestation: number, reduceMonth: number } = { totalPrestation: 0, reduceMonth: 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 ].includes(idPrestationList)\n ) {\n totalWithReduce = calculatePrestationPriceWithPriceGrid(idPrestationList, endDate, NbrMonth, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, isYearly, totalMonth);\n totalPrestation = totalWithReduce.totalPrestation;\n reduceMonth = totalWithReduce.reduceMonth;\n } else {\n totalPrestation = calculatePrestationPriceWithPrestationList(prestationList);\n }\n if (totalPercentage > 0) totalPrestation = totalPrestation - (totalPrestation * (totalPercentage / 100));\n if (totalAmount > 0) totalPrestation = totalPrestation - totalAmount;\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\n return { totalPrestation, reduceMonth };\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, isExpress, calculateScoringOfPrestation, calculatePrestationPrice, getPrestationOptions, isAbleToUpdatePrice,\n};"]}
1
+ {"version":3,"file":"prestation.js","sourceRoot":"","sources":["../../../ts/utils/prestation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAwB,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgD/B,MAAM,yBAAyB,GAAG,CAAC,gBAAwB,EAAW,EAAE,CAAC;IACvE,cAAc,CAAC,YAAY;IAC3B,cAAc,CAAC,mBAAmB;IAClC,cAAc,CAAC,wCAAwC;IACvD,cAAc,CAAC,uBAAuB;IACtC,cAAc,CAAC,GAAG;IAClB,cAAc,CAAC,aAAa;IAC5B,cAAc,CAAC,kBAAkB;CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AAEhE,MAAM,wBAAwB,GAAG,CAAC,WAAmB,EAAE,SAAiB,EAAE,gBAAwB,EAAW,EAAE,CAAC,gBAAgB,KAAK,cAAc,CAAC,iBAAiB,IAAI,SAAS,IAAI,WAAW,CAAC;AAElM,MAAM,oBAAoB,GAAG,CAAC,gBAAwB,EAAW,EAAE,CAAC,gBAAgB,KAAK,cAAc,CAAC,+BAA+B,CAAC;AAExI,MAAM,kBAAkB,GAAG,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,OAAO,EACL,yBAAyB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,mBAAmB,GAClQ,CAAC","sourcesContent":["import { IPrestation, IPrestationList } from '../types';\nimport { PrestationDetail, PrestationType } from '../types/Enum/PrestationType';\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 { ClosingType } from '../types/Enum/ClosingType';\nimport { getBrandNameByNodeEnv } from './brands';\nimport * as dayjs from 'dayjs';\n\ntype priceGridBrand = {\n idTypeBrand: number,\n price: priceGrid[]\n};\n\ntype priceGrid = {\n idPrestationList: number[],\n minimumMonthlyPayment?: monthlyPayment[],\n maximumMonthlyPayment?: monthlyPayment[],\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};\n\ntype monthlyPayment = {\n id: number,\n month: number,\n};\n\ntype turnover = {\n turnoverValue: number,\n price: number,\n};\n\ntype employee = {\n amountMinimum: number,\n amountMaximum: 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\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 => idPrestationList.includes(PrestationType.CREATION_SOCIETE);\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\nconst 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,\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 = (idPrestationList: number, endDate: string, NbrMonth: number, turnover: number, rentsNumber: number, employeesNumber: number, associatesNumber: number, idTypeBrand: number, idVatRegime: number, pastBalanceSheet: boolean, isYearly: boolean, totalMonth: number): { totalPrestation: number, reduceMonth: number, canBeCreated: boolean, monthNbr: number, price: number } => {\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\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 des montants */\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) monthlyPrice = currentPriceGrid.employee?.find(emp => emp.amountMinimum <= employeesNumber && emp.amountMaximum >= employeesNumber)?.price;\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 finalMonthlyPrice = (monthlyPrice ? monthlyPrice : 0) + (vatRegimePrice ? vatRegimePrice : 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 const minimumMonth: number | undefined = currentPriceGrid.minimumMonthlyPayment?.find(monthlyPayment => monthlyPayment.id === (cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS))?.month;\n const maximumMonth: number | undefined = currentPriceGrid.maximumMonthlyPayment?.find(monthlyPayment => monthlyPayment.id === (cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS))?.month;\n if (totalMonth > 0) monthNbr = monthNbr - totalMonth;\n if (minimumMonth && monthNbr < minimumMonth) {\n monthNbr = minimumMonth;\n recalculateMonthly = true;\n if (totalMonth > 0) canBeCreated = false;\n }\n if (maximumMonth && monthNbr > maximumMonth) {\n monthNbr = maximumMonth;\n recalculateMonthly = true;\n if (totalMonth > 0) canBeCreated = false;\n }\n\n reduceMonth = (monthNbr === NbrMonth - totalMonth ? totalMonth : 0);\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 / NbrMonth) : (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\nconst calculatePrestationPrice = (idPrestationList: number, prestationList: IPrestationList, endDate: string, NbrMonth: number, turnover: number, rentsNumber: number, employeesNumber: number, associatesNumber: number, idTypeBrand: number, idVatRegime: number, pastBalanceSheet: boolean, optionsList: number[], totalPercentage: number, totalAmount: number, totalMonth: number, isWithApplicationFees: boolean, isYearly: boolean = false): { totalPrestation: number, reduceMonth: number, canBeCreated: boolean, calculDetail: string, price: number } => {\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 ].includes(idPrestationList)\n ) {\n totalWithReduce = calculatePrestationPriceWithPriceGrid(idPrestationList, endDate, NbrMonth, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, isYearly, totalMonth);\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 }\n if (totalAmount > 0) totalPrestation = totalPrestation - totalAmount;\n if (totalPercentage > 0) totalPrestation = totalPrestation - (totalPrestation * (totalPercentage / 100));\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\n if (isWithApplicationFees) totalPrestation += 50;\n\n const calculDetail = `${monthNbr > 0 ? monthNbr + ' mois x ' + price + '€' : price + '€'} ${totalAmount > 0 ? '- ' + totalAmount + '€' : ''} ${totalPercentage > 0 ? '- ' + totalPercentage + '%' : ''} ${isWithApplicationFees ? '+ 50€' : ''}`;\n\n return { totalPrestation, reduceMonth, canBeCreated, calculDetail, 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, isExpress, calculateScoringOfPrestation, calculatePrestationPrice, getPrestationOptions, isAbleToUpdatePrice,\n};"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.1.164",
3
+ "version": "1.1.166",
4
4
  "description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
5
5
  "homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
6
6
  "main": "dist/cjs/index.js",
@@ -79,6 +79,7 @@
79
79
  "mailparser": "^3.4.0",
80
80
  "rxjs": "^7.0.1",
81
81
  "sms-segments-calculator": "^1.2.0",
82
+ "stripe": "^13.4.0",
82
83
  "ts-enum-util": "^4.0.2",
83
84
  "winston": "^3.3.3"
84
85
  }
@@ -22,6 +22,7 @@ import {
22
22
  BasePaginate,
23
23
  UpdateUserSociety,
24
24
  QueryArchivedSociety,
25
+ QueryExportSociety,
25
26
  } from '../../types';
26
27
  import { CancelToken } from 'axios';
27
28
 
@@ -125,4 +126,8 @@ export class Society extends Resource {
125
126
  params,
126
127
  });
127
128
  }
129
+
130
+ export(idSociety: number, payload: QueryExportSociety): Promise<void> {
131
+ return this.axios.$post(`/societies/${idSociety}/exports`, payload);
132
+ }
128
133
  }
@@ -1,8 +1,13 @@
1
1
  import { Resource } from '../Resource';
2
2
  import { RetrieveUpcomingInvoiceParams, ReadUpcomingInvoice } from '../../types';
3
+ import Stripe from 'stripe';
3
4
 
4
5
  export class Subscription extends Resource {
5
6
  retrieveUpcomingInvoice(params: RetrieveUpcomingInvoiceParams): Promise<ReadUpcomingInvoice> {
6
7
  return this.axios.$get('/subscription/next-invoice', { params });
7
8
  }
9
+
10
+ getBySociety(idSociety: number): Promise<Stripe.Response<Stripe.Subscription>> {
11
+ return this.axios.$get(`/societies/${idSociety}/subscriptions/`);
12
+ }
8
13
  }
@@ -561,7 +561,7 @@ export const BrandPourcentage = [
561
561
  idTypeBrand: 5,
562
562
  urlS3: 'https://s3.eu-west-3.amazonaws.com/resources-pourcentage/',
563
563
  logoS3: 'config/pourcentage-logo.png',
564
- name: 'Pourcentage Nice', // AMEX
564
+ name: 'Pourcentage ECE', // AMEX
565
565
  commercialName: 'Pourcentage',
566
566
  colors: {
567
567
  primary: '#1e6f5c',
@@ -634,6 +634,7 @@ export const BrandPourcentage = [
634
634
  cleRib: '89',
635
635
  },
636
636
  internalInvoicing: {
637
+ lastUsedNumber: 1685,
637
638
  statut: 'SAS',
638
639
  name: 'AMEX',
639
640
  address: '11, Boulevard Victor Hugo',
@@ -903,4 +904,94 @@ export const BrandPourcentage = [
903
904
  domain: '@pourcentage.fr',
904
905
  },
905
906
  },
907
+ {
908
+ idTypeBrand: 7,
909
+ urlS3: 'https://s3.eu-west-3.amazonaws.com/resources-pourcentage/',
910
+ logoS3: 'config/pourcentage-logo.png',
911
+ name: 'Pourcentage ECF', // Pourcentage Nice 2
912
+ commercialName: 'Pourcentage',
913
+ colors: {
914
+ primary: '#1e6f5c',
915
+ primary50: '#DFF9F1',
916
+ primary100: '#8ACAB7',
917
+ primary300: '#589E89',
918
+ primary500: '#386D5D',
919
+ primary700: '#1F493D',
920
+ footerColor: '#2e5449',
921
+ },
922
+ listPhones: {
923
+ contact: '01 86 90 82 15',
924
+ qualite: '01 86 90 82 15',
925
+ social: '01 86 90 82 15',
926
+ juridique: '01 86 90 82 15',
927
+ },
928
+ listMails: {
929
+ administratif: 'contact@pourcentage.fr',
930
+ app: 'contact@pourcentage.fr',
931
+ bonjour: 'bonjour@pourcentage.fr',
932
+ contact: 'contact@pourcentage.fr',
933
+ facturation: 'facturation@pourcentage.fr',
934
+ feedback: 'contact@pourcentage.fr',
935
+ juridique: 'juridique@pourcentage.fr',
936
+ informatique: 'contact@pourcentage.fr',
937
+ msd: 'contact@pourcentage.fr',
938
+ noreply: 'contact@pourcentage.fr',
939
+ qualite: 'contact@pourcentage.fr',
940
+ paiement: 'contact@pourcentage.fr',
941
+ rh: 'rh@pourcentage.fr',
942
+ social: 'social@pourcentage.fr',
943
+ support: 'contact@pourcentage.fr',
944
+ tva: 'contact@pourcentage.fr',
945
+ wb: 'contact@pourcentage.fr',
946
+ },
947
+ companyInformation: {
948
+ ape: '6920Z',
949
+ bp: '',
950
+ city: 'Laxou',
951
+ montantCapital: '150 000',
952
+ nomRaisonSociale: 'POURCENTAGE',
953
+ ECName: 'M. Jean-Louis BOICHÉ',
954
+ ECOrderCity: 'Nancy',
955
+ ECPosition: 'Président',
956
+ phone: '01 86 90 82 15',
957
+ postalAddress: '9, avenue du Rhin',
958
+ rcs: '891 501 181',
959
+ statut: 'SAS',
960
+ zipCode: '54 520',
961
+ },
962
+ idPrestationsListAuthorized: [197, 205, 12, 207, 208, 189],
963
+ logoUrl: 'logo-pourcentage.svg',
964
+ miniLogoUrl: 'logo-pourcentage-mini.svg',
965
+ hiddenPages: [],
966
+ recaptchaSecretKey: '6Le0o3kaAAAAAIEcSOib77JdK_W3cyIilK-p2yOG',
967
+ urlApp: 'https://app.pourcentage.fr',
968
+ urlApi1: 'https://api.pourcentage.fr',
969
+ urlApi2: 'https://api-next.pourcentage.fr',
970
+ urlExpert: 'https://pro.pourcentage.fr',
971
+ urlClient: 'https://www.pourcentage.fr',
972
+ bank: {
973
+ IBAN: '',
974
+ BIC: '',
975
+ Name: '',
976
+ Id: '',
977
+ },
978
+ internalInvoicing: {
979
+ statut: 'SASU',
980
+ name: 'POURCENTAGE',
981
+ address: '9, avenue du Rhin',
982
+ zipCode: '54520',
983
+ city: 'LAXOU',
984
+ country: 'FRANCE',
985
+ montantCapital: '150 000',
986
+ siret: '89150118100020',
987
+ ape: '6920Z',
988
+ rcs: '891 501 181',
989
+ phone: '01 86 90 82 15',
990
+ vatIntracom: 'FR58891501181',
991
+ email: 'facturation@pourcentage.fr',
992
+ },
993
+ webmail: {
994
+ domain: '@pourcentage.fr',
995
+ },
996
+ },
906
997
  ];
@@ -7,4 +7,15 @@ export enum ContractTypeEnum {
7
7
  TEMPORARY_CONTRACT_USAGE = 6,
8
8
  PERMANENT_CONTRACT = 7,
9
9
  INTERNSHIP = 8,
10
- }
10
+ }
11
+
12
+ export const ContractList: Array<{ id: ContractTypeEnum; name: string; }> = [
13
+ { id: ContractTypeEnum.TEMPORARY_CONTRACT_ACTIVITY, name: 'CDD accroissement d\'activité' },
14
+ { id: ContractTypeEnum.TEMPORARY_CONTRACT_LEARNING, name: 'CDD apprentissage' },
15
+ { id: ContractTypeEnum.TEMPORARY_CONTRACT_REPLACMENT, name: 'CDD de remplacement' },
16
+ { id: ContractTypeEnum.TEMPORARY_CONTRACT_EXTRA, name: 'CDD extra' },
17
+ { id: ContractTypeEnum.TEMPORARY_CONTRACT_PRO, name: 'CDD professionnaliste' },
18
+ { id: ContractTypeEnum.TEMPORARY_CONTRACT_USAGE, name: 'CDD usage' },
19
+ { id: ContractTypeEnum.PERMANENT_CONTRACT, name: 'CDI' },
20
+ { id: ContractTypeEnum.INTERNSHIP, name: 'Stage' },
21
+ ];
@@ -44,6 +44,7 @@ export enum LogType {
44
44
  APPROBATION = 32,
45
45
  ACCEPTATION = 33,
46
46
  IP = 34,
47
+ TYPE_CLIENT = 35,
47
48
  }
48
49
 
49
50
  export const LogTypeDetail = {
@@ -251,4 +252,10 @@ export const LogTypeDetail = {
251
252
  color: 'blue-grey darken-2',
252
253
  icon: null,
253
254
  },
255
+ TYPE_CLIENT: {
256
+ id: LogType.TYPE_CLIENT,
257
+ label: 'Type de client',
258
+ color: 'cyan',
259
+ icon: null,
260
+ },
254
261
  };
@@ -2,4 +2,10 @@ export enum PartnerType {
2
2
  EMPLOYEE = 1,
3
3
  PHYSICAL_PARTNER = 2,
4
4
  MORAL_PARTNER = 3,
5
- }
5
+ }
6
+
7
+ export const PartnerTypeList: Array<{ id: PartnerType; name: string; }> = [
8
+ { id: PartnerType.EMPLOYEE, name: 'Employé' },
9
+ { id: PartnerType.PHYSICAL_PARTNER, name: 'Associé personne physique' },
10
+ { id: PartnerType.MORAL_PARTNER, name: 'Associé personne morale' },
11
+ ];
@@ -1,9 +1,10 @@
1
- import { IsArray, IsNumber, IsObject, IsOptional, IsString } from 'class-validator';
1
+ import { IsArray, IsBoolean, IsNumber, IsObject, IsOptional, IsString } from 'class-validator';
2
2
  import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
3
3
  import { IPrestation } from '../../models/IPrestation';
4
4
  import { IExercicePrestation } from '../../models/IExercicePrestation';
5
5
  import { ICommercialOffer } from '../../models/ICommercialOffer';
6
6
  import { IExercice } from '../../models/IExercice';
7
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
7
8
 
8
9
  export class QueryCreatePrestation {
9
10
  @ApiProperty()
@@ -29,6 +30,12 @@ export class QueryUpdatePrestation {
29
30
  @IsString()
30
31
  commentPdf: string;
31
32
 
33
+ @ApiPropertyOptional()
34
+ @IsOptional()
35
+ @IsBoolean()
36
+ @ToBoolean()
37
+ isWithApplicationFees: boolean;
38
+
32
39
  @ApiPropertyOptional()
33
40
  @IsOptional()
34
41
  @IsObject()
@@ -0,0 +1,91 @@
1
+ import { IsArray, IsDateString, IsIn, IsOptional } from 'class-validator';
2
+ import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
3
+ import { AccountingFileType } from '../../../Enum/AccountingFileType';
4
+ import { AccountingJournal } from '../../../Enum/AccountingJournal';
5
+ import { EstimateInvoiceType } from '../../../Enum/EstimateInvoice';
6
+ import { GedCategory } from '../../../Enum/Ged';
7
+ import { ThirdPartyType } from '../../../Enum/ThirdPartyType';
8
+
9
+ export type ExportAccountingTransactionFilter = {
10
+ idSociety: number;
11
+ accountingJournals?: AccountingJournal[]
12
+ startDate?: string;
13
+ endDate?: string;
14
+ };
15
+
16
+ export type ExportThirdPartyFilter = {
17
+ idSociety: number;
18
+ thirdPartyType?: ThirdPartyType[]
19
+ };
20
+
21
+ export type ExportUserFilter = {
22
+ idSociety: number;
23
+ };
24
+
25
+ export type ExportSocietyFilter = {
26
+ idSociety: number;
27
+ };
28
+
29
+ export type ExportProductFilter = {
30
+ idSociety: number;
31
+ };
32
+
33
+ export type ExportEmployeeFilter = {
34
+ idSociety: number;
35
+ };
36
+
37
+ export type ExportVehicleFilter = {
38
+ idSociety: number;
39
+ };
40
+
41
+ export type ExportPartnerFilter = {
42
+ idSociety: number;
43
+ };
44
+
45
+ export type ExportGedFileFilter = {
46
+ idSociety: number;
47
+ gedCategory: GedCategory[];
48
+ startDate?: string;
49
+ endDate?: string;
50
+ };
51
+
52
+ export type ExportInvoiceFilter = {
53
+ idSociety: number;
54
+ idAccountingFileType: AccountingFileType[];
55
+ startDate?: string;
56
+ endDate?: string;
57
+ };
58
+
59
+ export type ExportAccrualInvoiceFilter = {
60
+ idSociety: number;
61
+ idAccountingJournal: AccountingJournal[];
62
+ startDate?: string;
63
+ endDate?: string;
64
+ };
65
+
66
+ export type ExportPreSaleDocumentFilter = {
67
+ idSociety: number;
68
+ idEstimateInvoiceType: EstimateInvoiceType[];
69
+ startDate?: string;
70
+ endDate?: string;
71
+ };
72
+
73
+ export type ReadFileExported = { name: string; buffer: Buffer };
74
+
75
+ export const ExportDataKeys = ['BANK_STATEMENT', 'CASHDESK', 'VEHICLE', 'COLLABORATER', 'PURCHASE_INVOICE', 'PERSONAL', 'PROVIDER', 'EMPLOYEE', 'SALE_INVOICE', 'ESTIMATE', 'CUSTOMER', 'PRODUCT', 'LIBRARY_GENERALITY', 'LIBRARY_COMPANY', 'LIBRARY_ACCOUNTANCY', 'LIBRARY_SOCIAL', 'LIBRARY_JURIDICAL', 'LIBRARY_INVOICING', 'LIBRARY_LETTER', 'LIBRARY_BANK_STATEMENT'];
76
+ export class QueryExportSociety {
77
+ @ApiProperty()
78
+ @IsArray()
79
+ @IsIn(ExportDataKeys, { each: true })
80
+ keys: typeof ExportDataKeys;
81
+
82
+ @ApiPropertyOptional()
83
+ @IsDateString()
84
+ @IsOptional()
85
+ startDate?: string;
86
+
87
+ @ApiPropertyOptional()
88
+ @IsDateString()
89
+ @IsOptional()
90
+ endDate?: string;
91
+ }
package/ts/types/index.ts CHANGED
@@ -973,7 +973,7 @@ export * from './Interface/api/accountsSectors/Create';
973
973
  export * from './Interface/api/fusion/FusionSocieties';
974
974
  export * from './Interface/api/changelog/Create';
975
975
  export * from './Interface/api/authentification/ReadAuthenticateCollaborater';
976
-
976
+ export * from './Interface/api/society/Export';
977
977
  export * from './Interface/api/businessSector/Create';
978
978
  export * from './Interface/api/businessSector/Query';
979
979
  export * from './Interface/api/businessSector/Delete';