@silexpert/core 1.1.161 → 1.1.162

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 (200) hide show
  1. package/dist/cjs/api/resources/CommercialOffer.d.ts +47 -0
  2. package/dist/cjs/api/resources/CommercialOffer.d.ts.map +1 -0
  3. package/dist/cjs/api/resources/CommercialOffer.js +64 -0
  4. package/dist/cjs/api/resources/CommercialOffer.js.map +1 -0
  5. package/dist/cjs/api/resources/prestation.d.ts +14 -1
  6. package/dist/cjs/api/resources/prestation.d.ts.map +1 -1
  7. package/dist/cjs/api/resources/prestation.js +17 -0
  8. package/dist/cjs/api/resources/prestation.js.map +1 -1
  9. package/dist/cjs/api/resources.d.ts +2 -0
  10. package/dist/cjs/api/resources.d.ts.map +1 -1
  11. package/dist/cjs/api/resources.js +2 -0
  12. package/dist/cjs/api/resources.js.map +1 -1
  13. package/dist/cjs/types/Enum/ClosingType.d.ts +7 -0
  14. package/dist/cjs/types/Enum/ClosingType.d.ts.map +1 -0
  15. package/dist/cjs/types/Enum/ClosingType.js +19 -0
  16. package/dist/cjs/types/Enum/ClosingType.js.map +1 -0
  17. package/dist/cjs/types/Enum/CommercialOfferType.d.ts +97 -0
  18. package/dist/cjs/types/Enum/CommercialOfferType.d.ts.map +1 -0
  19. package/dist/cjs/types/Enum/CommercialOfferType.js +71 -0
  20. package/dist/cjs/types/Enum/CommercialOfferType.js.map +1 -0
  21. package/dist/cjs/types/Enum/PrestationOption.d.ts +8 -0
  22. package/dist/cjs/types/Enum/PrestationOption.d.ts.map +1 -1
  23. package/dist/cjs/types/Enum/PrestationOption.js.map +1 -1
  24. package/dist/cjs/types/Enum/PrestationType.d.ts.map +1 -1
  25. package/dist/cjs/types/Enum/PrestationType.js +175 -0
  26. package/dist/cjs/types/Enum/PrestationType.js.map +1 -1
  27. package/dist/cjs/types/Enum/PriceGridClementine.d.ts +101 -0
  28. package/dist/cjs/types/Enum/PriceGridClementine.d.ts.map +1 -0
  29. package/dist/cjs/types/Enum/PriceGridClementine.js +338 -0
  30. package/dist/cjs/types/Enum/PriceGridClementine.js.map +1 -0
  31. package/dist/cjs/types/Enum/PriceGridLegalstart.d.ts +34 -0
  32. package/dist/cjs/types/Enum/PriceGridLegalstart.d.ts.map +1 -0
  33. package/dist/cjs/types/Enum/PriceGridLegalstart.js +103 -0
  34. package/dist/cjs/types/Enum/PriceGridLegalstart.js.map +1 -0
  35. package/dist/cjs/types/Enum/PriceGridPourcentage.d.ts +52 -0
  36. package/dist/cjs/types/Enum/PriceGridPourcentage.d.ts.map +1 -0
  37. package/dist/cjs/types/Enum/PriceGridPourcentage.js +1125 -0
  38. package/dist/cjs/types/Enum/PriceGridPourcentage.js.map +1 -0
  39. package/dist/cjs/types/Interface/api/commercial/QueryGetStats.d.ts +1 -0
  40. package/dist/cjs/types/Interface/api/commercial/QueryGetStats.d.ts.map +1 -1
  41. package/dist/cjs/types/Interface/api/commercial/QueryGetStats.js +6 -0
  42. package/dist/cjs/types/Interface/api/commercial/QueryGetStats.js.map +1 -1
  43. package/dist/cjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.d.ts +1 -0
  44. package/dist/cjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.d.ts.map +1 -1
  45. package/dist/cjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.js +6 -0
  46. package/dist/cjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.js.map +1 -1
  47. package/dist/cjs/types/Interface/api/commercialOffer/Query.d.ts +13 -0
  48. package/dist/cjs/types/Interface/api/commercialOffer/Query.d.ts.map +1 -0
  49. package/dist/cjs/types/Interface/api/commercialOffer/Query.js +69 -0
  50. package/dist/cjs/types/Interface/api/commercialOffer/Query.js.map +1 -0
  51. package/dist/cjs/types/Interface/api/prestation/Query.d.ts +19 -0
  52. package/dist/cjs/types/Interface/api/prestation/Query.d.ts.map +1 -0
  53. package/dist/cjs/types/Interface/api/prestation/Query.js +77 -0
  54. package/dist/cjs/types/Interface/api/prestation/Query.js.map +1 -0
  55. package/dist/cjs/types/Interface/api/prestations/QueryUpdate.d.ts +1 -0
  56. package/dist/cjs/types/Interface/api/prestations/QueryUpdate.d.ts.map +1 -1
  57. package/dist/cjs/types/Interface/api/prestations/QueryUpdate.js +6 -0
  58. package/dist/cjs/types/Interface/api/prestations/QueryUpdate.js.map +1 -1
  59. package/dist/cjs/types/Interface/models/ICommercialOffer.d.ts +16 -0
  60. package/dist/cjs/types/Interface/models/ICommercialOffer.d.ts.map +1 -0
  61. package/dist/cjs/types/Interface/models/ICommercialOffer.js +3 -0
  62. package/dist/cjs/types/Interface/models/ICommercialOffer.js.map +1 -0
  63. package/dist/cjs/types/Interface/models/IExercicePrestation.d.ts +2 -1
  64. package/dist/cjs/types/Interface/models/IExercicePrestation.d.ts.map +1 -1
  65. package/dist/cjs/types/Interface/models/IExercicePrestation.js.map +1 -1
  66. package/dist/cjs/types/Interface/models/IExercicePrestationOffer.d.ts +10 -0
  67. package/dist/cjs/types/Interface/models/IExercicePrestationOffer.d.ts.map +1 -0
  68. package/dist/cjs/types/Interface/models/IExercicePrestationOffer.js +3 -0
  69. package/dist/cjs/types/Interface/models/IExercicePrestationOffer.js.map +1 -0
  70. package/dist/cjs/types/Interface/models/IPrestationList.d.ts +1 -0
  71. package/dist/cjs/types/Interface/models/IPrestationList.d.ts.map +1 -1
  72. package/dist/cjs/types/Interface/models/IPrestationList.js.map +1 -1
  73. package/dist/cjs/types/index.d.ts +9 -0
  74. package/dist/cjs/types/index.d.ts.map +1 -1
  75. package/dist/cjs/types/index.js +9 -0
  76. package/dist/cjs/types/index.js.map +1 -1
  77. package/dist/cjs/utils/commercialOffer.d.ts +6 -0
  78. package/dist/cjs/utils/commercialOffer.d.ts.map +1 -0
  79. package/dist/cjs/utils/commercialOffer.js +39 -0
  80. package/dist/cjs/utils/commercialOffer.js.map +1 -0
  81. package/dist/cjs/utils/index.d.ts +1 -0
  82. package/dist/cjs/utils/index.d.ts.map +1 -1
  83. package/dist/cjs/utils/index.js +1 -0
  84. package/dist/cjs/utils/index.js.map +1 -1
  85. package/dist/cjs/utils/prestation.d.ts +9 -2
  86. package/dist/cjs/utils/prestation.d.ts.map +1 -1
  87. package/dist/cjs/utils/prestation.js +155 -1
  88. package/dist/cjs/utils/prestation.js.map +1 -1
  89. package/dist/mjs/api/resources/CommercialOffer.d.ts +47 -0
  90. package/dist/mjs/api/resources/CommercialOffer.d.ts.map +1 -0
  91. package/dist/mjs/api/resources/CommercialOffer.js +60 -0
  92. package/dist/mjs/api/resources/CommercialOffer.js.map +1 -0
  93. package/dist/mjs/api/resources/prestation.d.ts +14 -1
  94. package/dist/mjs/api/resources/prestation.d.ts.map +1 -1
  95. package/dist/mjs/api/resources/prestation.js +17 -0
  96. package/dist/mjs/api/resources/prestation.js.map +1 -1
  97. package/dist/mjs/api/resources.d.ts +2 -0
  98. package/dist/mjs/api/resources.d.ts.map +1 -1
  99. package/dist/mjs/api/resources.js +2 -0
  100. package/dist/mjs/api/resources.js.map +1 -1
  101. package/dist/mjs/types/Enum/ClosingType.d.ts +7 -0
  102. package/dist/mjs/types/Enum/ClosingType.d.ts.map +1 -0
  103. package/dist/mjs/types/Enum/ClosingType.js +16 -0
  104. package/dist/mjs/types/Enum/ClosingType.js.map +1 -0
  105. package/dist/mjs/types/Enum/CommercialOfferType.d.ts +97 -0
  106. package/dist/mjs/types/Enum/CommercialOfferType.d.ts.map +1 -0
  107. package/dist/mjs/types/Enum/CommercialOfferType.js +68 -0
  108. package/dist/mjs/types/Enum/CommercialOfferType.js.map +1 -0
  109. package/dist/mjs/types/Enum/PrestationOption.d.ts +8 -0
  110. package/dist/mjs/types/Enum/PrestationOption.d.ts.map +1 -1
  111. package/dist/mjs/types/Enum/PrestationOption.js.map +1 -1
  112. package/dist/mjs/types/Enum/PrestationType.d.ts.map +1 -1
  113. package/dist/mjs/types/Enum/PrestationType.js +175 -0
  114. package/dist/mjs/types/Enum/PrestationType.js.map +1 -1
  115. package/dist/mjs/types/Enum/PriceGridClementine.d.ts +101 -0
  116. package/dist/mjs/types/Enum/PriceGridClementine.d.ts.map +1 -0
  117. package/dist/mjs/types/Enum/PriceGridClementine.js +335 -0
  118. package/dist/mjs/types/Enum/PriceGridClementine.js.map +1 -0
  119. package/dist/mjs/types/Enum/PriceGridLegalstart.d.ts +34 -0
  120. package/dist/mjs/types/Enum/PriceGridLegalstart.d.ts.map +1 -0
  121. package/dist/mjs/types/Enum/PriceGridLegalstart.js +100 -0
  122. package/dist/mjs/types/Enum/PriceGridLegalstart.js.map +1 -0
  123. package/dist/mjs/types/Enum/PriceGridPourcentage.d.ts +52 -0
  124. package/dist/mjs/types/Enum/PriceGridPourcentage.d.ts.map +1 -0
  125. package/dist/mjs/types/Enum/PriceGridPourcentage.js +1122 -0
  126. package/dist/mjs/types/Enum/PriceGridPourcentage.js.map +1 -0
  127. package/dist/mjs/types/Interface/api/commercial/QueryGetStats.d.ts +1 -0
  128. package/dist/mjs/types/Interface/api/commercial/QueryGetStats.d.ts.map +1 -1
  129. package/dist/mjs/types/Interface/api/commercial/QueryGetStats.js +7 -0
  130. package/dist/mjs/types/Interface/api/commercial/QueryGetStats.js.map +1 -1
  131. package/dist/mjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.d.ts +1 -0
  132. package/dist/mjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.d.ts.map +1 -1
  133. package/dist/mjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.js +7 -0
  134. package/dist/mjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.js.map +1 -1
  135. package/dist/mjs/types/Interface/api/commercialOffer/Query.d.ts +13 -0
  136. package/dist/mjs/types/Interface/api/commercialOffer/Query.d.ts.map +1 -0
  137. package/dist/mjs/types/Interface/api/commercialOffer/Query.js +72 -0
  138. package/dist/mjs/types/Interface/api/commercialOffer/Query.js.map +1 -0
  139. package/dist/mjs/types/Interface/api/prestation/Query.d.ts +19 -0
  140. package/dist/mjs/types/Interface/api/prestation/Query.d.ts.map +1 -0
  141. package/dist/mjs/types/Interface/api/prestation/Query.js +82 -0
  142. package/dist/mjs/types/Interface/api/prestation/Query.js.map +1 -0
  143. package/dist/mjs/types/Interface/api/prestations/QueryUpdate.d.ts +1 -0
  144. package/dist/mjs/types/Interface/api/prestations/QueryUpdate.d.ts.map +1 -1
  145. package/dist/mjs/types/Interface/api/prestations/QueryUpdate.js +7 -0
  146. package/dist/mjs/types/Interface/api/prestations/QueryUpdate.js.map +1 -1
  147. package/dist/mjs/types/Interface/models/ICommercialOffer.d.ts +16 -0
  148. package/dist/mjs/types/Interface/models/ICommercialOffer.d.ts.map +1 -0
  149. package/dist/mjs/types/Interface/models/ICommercialOffer.js +2 -0
  150. package/dist/mjs/types/Interface/models/ICommercialOffer.js.map +1 -0
  151. package/dist/mjs/types/Interface/models/IExercicePrestation.d.ts +2 -1
  152. package/dist/mjs/types/Interface/models/IExercicePrestation.d.ts.map +1 -1
  153. package/dist/mjs/types/Interface/models/IExercicePrestation.js.map +1 -1
  154. package/dist/mjs/types/Interface/models/IExercicePrestationOffer.d.ts +10 -0
  155. package/dist/mjs/types/Interface/models/IExercicePrestationOffer.d.ts.map +1 -0
  156. package/dist/mjs/types/Interface/models/IExercicePrestationOffer.js +2 -0
  157. package/dist/mjs/types/Interface/models/IExercicePrestationOffer.js.map +1 -0
  158. package/dist/mjs/types/Interface/models/IPrestationList.d.ts +1 -0
  159. package/dist/mjs/types/Interface/models/IPrestationList.d.ts.map +1 -1
  160. package/dist/mjs/types/Interface/models/IPrestationList.js.map +1 -1
  161. package/dist/mjs/types/index.d.ts +9 -0
  162. package/dist/mjs/types/index.d.ts.map +1 -1
  163. package/dist/mjs/types/index.js +9 -0
  164. package/dist/mjs/types/index.js.map +1 -1
  165. package/dist/mjs/utils/commercialOffer.d.ts +6 -0
  166. package/dist/mjs/utils/commercialOffer.d.ts.map +1 -0
  167. package/dist/mjs/utils/commercialOffer.js +33 -0
  168. package/dist/mjs/utils/commercialOffer.js.map +1 -0
  169. package/dist/mjs/utils/index.d.ts +1 -0
  170. package/dist/mjs/utils/index.d.ts.map +1 -1
  171. package/dist/mjs/utils/index.js +1 -0
  172. package/dist/mjs/utils/index.js.map +1 -1
  173. package/dist/mjs/utils/prestation.d.ts +9 -2
  174. package/dist/mjs/utils/prestation.d.ts.map +1 -1
  175. package/dist/mjs/utils/prestation.js +150 -1
  176. package/dist/mjs/utils/prestation.js.map +1 -1
  177. package/package.json +1 -1
  178. package/ts/api/resources/CommercialOffer.ts +67 -0
  179. package/ts/api/resources/prestation.ts +21 -1
  180. package/ts/api/resources.ts +2 -0
  181. package/ts/types/Enum/ClosingType.ts +17 -0
  182. package/ts/types/Enum/CommercialOfferType.ts +84 -0
  183. package/ts/types/Enum/PrestationOption.ts +9 -0
  184. package/ts/types/Enum/PrestationType.ts +175 -0
  185. package/ts/types/Enum/PriceGridClementine.ts +335 -0
  186. package/ts/types/Enum/PriceGridLegalstart.ts +100 -0
  187. package/ts/types/Enum/PriceGridPourcentage.ts +1122 -0
  188. package/ts/types/Interface/api/commercial/QueryGetStats.ts +5 -0
  189. package/ts/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.ts +5 -0
  190. package/ts/types/Interface/api/commercialOffer/Query.ts +46 -0
  191. package/ts/types/Interface/api/prestation/Query.ts +56 -0
  192. package/ts/types/Interface/api/prestations/QueryUpdate.ts +5 -0
  193. package/ts/types/Interface/models/ICommercialOffer.ts +18 -0
  194. package/ts/types/Interface/models/IExercicePrestation.ts +2 -1
  195. package/ts/types/Interface/models/IExercicePrestationOffer.ts +13 -0
  196. package/ts/types/Interface/models/IPrestationList.ts +1 -0
  197. package/ts/types/index.ts +9 -0
  198. package/ts/utils/commercialOffer.ts +37 -0
  199. package/ts/utils/index.ts +1 -0
  200. package/ts/utils/prestation.ts +193 -2
@@ -1 +1 @@
1
- {"version":3,"file":"prestation.d.ts","sourceRoot":"","sources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SAAS,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,mBAAmB,GAClQ,CAAC"}
@@ -1,4 +1,11 @@
1
1
  import { PrestationDetail, PrestationType } from '../types/Enum/PrestationType';
2
+ import { PrestationOption } from '../types/Enum/PrestationOption';
3
+ import { PriceGridClementine } from '../types/Enum/PriceGridClementine';
4
+ import { PriceGridPourcentage } from '../types/Enum/PriceGridPourcentage';
5
+ import { PriceGridLegalstart } from '../types/Enum/PriceGridLegalstart';
6
+ import { ClosingType } from '../types/Enum/ClosingType';
7
+ import { getBrandNameByNodeEnv } from './brands';
8
+ import * as dayjs from 'dayjs';
2
9
  const isOtherAccountingMissions = (idPrestationList) => [
3
10
  PrestationType.PREVISIONNEL,
4
11
  PrestationType.BILAN_INTERMEDIAIRE,
@@ -36,5 +43,147 @@ const calculateScoringOfPrestation = (idPrestationType, prestations) => {
36
43
  return Math.floor(numberPoint * 0.3);
37
44
  return numberPoint;
38
45
  };
39
- export { isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isExpress, calculateScoringOfPrestation, };
46
+ const getPriceGrid = (idTypeBrand, idPrestationList) => {
47
+ let currentBrandPriceGrid;
48
+ let currentPriceGrid;
49
+ const currentEnvName = getBrandNameByNodeEnv(process.env.NODE_ENV);
50
+ const listEnvEnum = {
51
+ PriceGridClementine, PriceGridPourcentage, PriceGridLegalstart,
52
+ };
53
+ // @ts-ignore
54
+ const currentPriceGridFile = listEnvEnum[`PriceGrid${currentEnvName}`];
55
+ if (currentPriceGridFile)
56
+ currentBrandPriceGrid = currentPriceGridFile.find((priceGrid) => priceGrid.idTypeBrand === idTypeBrand);
57
+ if (currentBrandPriceGrid)
58
+ currentPriceGrid = currentBrandPriceGrid?.price.find((price) => price.idPrestationList.includes(idPrestationList));
59
+ return currentPriceGrid;
60
+ };
61
+ const calculatePrestationPriceWithPriceGrid = (idPrestationList, endDate, NbrMonth, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, isYearly, totalMonth) => {
62
+ let totalPrestation = 0;
63
+ let reduceMonth = 0;
64
+ /* Récupération de la grille tarifaire */
65
+ const currentPriceGrid = getPriceGrid(idTypeBrand, idPrestationList);
66
+ if (currentPriceGrid) {
67
+ let monthlyPrice;
68
+ let yearlyPrice;
69
+ let vatRegimePrice;
70
+ /* Gestion du régime de TVA */
71
+ if (currentPriceGrid.vatRegimeMonthly && !isYearly)
72
+ vatRegimePrice = currentPriceGrid.vatRegimeMonthly?.find(regime => regime.type === idVatRegime)?.price;
73
+ else if (currentPriceGrid.vatRegimeYearly && isYearly)
74
+ vatRegimePrice = currentPriceGrid.vatRegimeYearly?.find(regime => regime.type === idVatRegime)?.price;
75
+ /* Gestion des montants */
76
+ if (currentPriceGrid.turnoverMonthly && !isYearly)
77
+ monthlyPrice = currentPriceGrid.turnoverMonthly?.find(turn => turnover < turn.turnoverValue)?.price;
78
+ else if (currentPriceGrid.properties)
79
+ monthlyPrice = currentPriceGrid.properties?.find(property => property.amount === rentsNumber)?.price;
80
+ else if (currentPriceGrid.employee)
81
+ monthlyPrice = currentPriceGrid.employee?.find(emp => emp.amountMinimum <= employeesNumber && emp.amountMaximum >= employeesNumber)?.price;
82
+ else if (currentPriceGrid.turnoverYearly && isYearly)
83
+ yearlyPrice = currentPriceGrid.turnoverYearly?.find(turn => turnover < turn.turnoverValue)?.price;
84
+ else if (!pastBalanceSheet && currentPriceGrid.turnoverCreatedYear)
85
+ yearlyPrice = currentPriceGrid.turnoverCreatedYear?.find(turn => turnover < turn.turnoverValue)?.price;
86
+ else if (pastBalanceSheet && currentPriceGrid.turnoverPastYear)
87
+ yearlyPrice = currentPriceGrid.turnoverPastYear?.find(turn => turnover < turn.turnoverValue)?.price;
88
+ else if (currentPriceGrid.partner)
89
+ yearlyPrice = currentPriceGrid.partner?.find(part => part.amountMinimum <= associatesNumber && part.amountMaximum >= associatesNumber)?.price;
90
+ const finalMonthlyPrice = (monthlyPrice ? monthlyPrice : 0) + (vatRegimePrice ? vatRegimePrice : 0);
91
+ /* Gestion des mois */
92
+ let cloturedPast = false;
93
+ if (dayjs(endDate, 'YYYY-MM-DD').subtract(15, 'day').isBefore(dayjs()))
94
+ cloturedPast = true;
95
+ const minimumMonth = currentPriceGrid.minimumMonthlyPayment?.find(monthlyPayment => monthlyPayment.id === (cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS))?.month;
96
+ const maximumMonth = currentPriceGrid.maximumMonthlyPayment?.find(monthlyPayment => monthlyPayment.id === (cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS))?.month;
97
+ let monthNbr = NbrMonth;
98
+ if (totalMonth > 0)
99
+ monthNbr = monthNbr - totalMonth;
100
+ if (minimumMonth && monthNbr < minimumMonth)
101
+ monthNbr = minimumMonth;
102
+ if (maximumMonth && monthNbr > maximumMonth)
103
+ monthNbr = maximumMonth;
104
+ reduceMonth = (monthNbr === NbrMonth - totalMonth ? totalMonth : 0);
105
+ /* Prix Final */
106
+ totalPrestation = (yearlyPrice ? yearlyPrice : finalMonthlyPrice * monthNbr);
107
+ }
108
+ return { totalPrestation, reduceMonth };
109
+ };
110
+ const calculatePrestationPriceWithPrestationList = (prestationList) => {
111
+ let totalPrestation = 0;
112
+ totalPrestation = prestationList.price || 0;
113
+ return totalPrestation;
114
+ };
115
+ const calculatePrestationPrice = (idPrestationList, prestationList, endDate, NbrMonth, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, optionsList, totalPercentage, totalAmount, totalMonth, isYearly = false) => {
116
+ let totalPrestation = 0;
117
+ let reduceMonth = 0;
118
+ let totalWithReduce = { totalPrestation: 0, reduceMonth: 0 };
119
+ /* Gestion du prix en fonction de la prestation */
120
+ if ([
121
+ PrestationType.COMPTA_PRO,
122
+ PrestationType.COMPTA_PRO_EXPRESS,
123
+ PrestationType.COMPTA_ENTREPRISE,
124
+ PrestationType.COMPTA_ENTREPRISE_EXPRESS,
125
+ PrestationType.COMPTA_SCI,
126
+ PrestationType.COMPTA_SCI_EXPRESS,
127
+ PrestationType.BILAN_PREVISIONNEL,
128
+ PrestationType.COMPTA_PREMIUM,
129
+ PrestationType.COMPTA_POURCENTAGE_PREMIUM,
130
+ PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS,
131
+ PrestationType.COMPTA_POURCENTAGE,
132
+ PrestationType.COMPTA_POURCENTAGE_EXPRESS,
133
+ PrestationType.SOCIAL,
134
+ PrestationType.GESTION_JURIDIQUE,
135
+ PrestationType.COMPTA_PRO_COMPTASTART,
136
+ PrestationType.COMPTA_PRO_COMPTASTART_EXPRESS,
137
+ ].includes(idPrestationList)) {
138
+ totalWithReduce = calculatePrestationPriceWithPriceGrid(idPrestationList, endDate, NbrMonth, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, isYearly, totalMonth);
139
+ totalPrestation = totalWithReduce.totalPrestation;
140
+ reduceMonth = totalWithReduce.reduceMonth;
141
+ }
142
+ else {
143
+ totalPrestation = calculatePrestationPriceWithPrestationList(prestationList);
144
+ }
145
+ if (totalPercentage > 0)
146
+ totalPrestation = totalPrestation - (totalPrestation * (totalPercentage / 100));
147
+ if (totalAmount > 0)
148
+ totalPrestation = totalPrestation - totalAmount;
149
+ if (prestationList.minimumPrice && totalPrestation < prestationList.minimumPrice)
150
+ totalPrestation = prestationList.minimumPrice;
151
+ /* Gestion des options */
152
+ let OptionTotalPrice = 0;
153
+ if (optionsList.length) {
154
+ optionsList.forEach((optionId) => {
155
+ const optionPrice = Object.values(PrestationOption).find((option) => option.id === optionId)?.price;
156
+ if (optionPrice)
157
+ OptionTotalPrice += optionPrice;
158
+ });
159
+ }
160
+ totalPrestation += (OptionTotalPrice ? OptionTotalPrice : 0);
161
+ return { totalPrestation, reduceMonth };
162
+ };
163
+ const getPrestationOptions = (idPrestationList) => {
164
+ const PrestationOptionList = Object.values(PrestationOption).filter(option => option.brand.includes(getBrandNameByNodeEnv(process.env.NODE_ENV)));
165
+ return PrestationOptionList.filter(option => option.prestationList.includes(idPrestationList));
166
+ };
167
+ const isAbleToUpdatePrice = (idTypeBrand, idPrestationList, turnover, pastBalanceSheet) => {
168
+ /* Récupération de la grille tarifaire */
169
+ const currentPriceGrid = getPriceGrid(idTypeBrand, idPrestationList);
170
+ if (currentPriceGrid) {
171
+ // @ts-ignore
172
+ if ([PrestationType.COMPTA_PREMIUM, PrestationType.COMPTA_POURCENTAGE_PREMIUM, PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS].includes(idPrestationList) && currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 2].turnoverValue < turnover)
173
+ return true;
174
+ // @ts-ignore
175
+ else if ([PrestationType.COMPTA_POURCENTAGE, PrestationType.COMPTA_POURCENTAGE_EXPRESS].includes(idPrestationList) && currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 1].turnoverValue < turnover)
176
+ return true;
177
+ // @ts-ignore
178
+ else if ([PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) && !pastBalanceSheet && currentPriceGrid.turnoverCreatedYear[currentPriceGrid.turnoverCreatedYear.length - 1].turnoverValue < turnover)
179
+ return true;
180
+ // @ts-ignore
181
+ else if ([PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) && pastBalanceSheet && currentPriceGrid.turnoverPastYear[currentPriceGrid.turnoverPastYear.length - 1].turnoverValue < turnover)
182
+ return true;
183
+ else
184
+ return false;
185
+ }
186
+ return false;
187
+ };
188
+ export { isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isExpress, calculateScoringOfPrestation, calculatePrestationPrice, getPrestationOptions, isAbleToUpdatePrice, };
40
189
  //# sourceMappingURL=prestation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prestation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M,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,KAAK,gBAAgB,CAAC,CAAC;IACnH,MAAM,WAAW,GAAG,aAAa,EAAE,KAAK,IAAI,CAAC,CAAC;IAE9C,2HAA2H;IAC3H,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;IACnG,MAAM,iCAAiC,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,sBAAsB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IAElH,0KAA0K;IAC1K,IAAI,iCAAiC,CAAC,MAAM,IAAI,sBAAsB,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC;IAExI,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,OAAO,EACL,yBAAyB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,4BAA4B,GAC7L,CAAC","sourcesContent":["import { IPrestation } from '../types';\nimport { PrestationDetail, PrestationType } from '../types/Enum/PrestationType';\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\nexport {\n isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isExpress, calculateScoringOfPrestation,\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,oBA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AE,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};"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.1.161",
3
+ "version": "1.1.162",
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",
@@ -0,0 +1,67 @@
1
+ import { BasePaginate, ICommercialOffer, QueryAllCommercialOffer, QueryPaginateCommercialOffer } from '../../types';
2
+ import { Resource } from '../Resource';
3
+
4
+ export class CommercialOffer extends Resource {
5
+ /**
6
+ * Create un enregistrement dans la table CommercialOffer
7
+ * @param { ICommercialOffer } payload
8
+ * @returns { ICommercialOffer }
9
+ */
10
+ public create(payload: ICommercialOffer): Promise<ICommercialOffer> {
11
+ return this.axios.$post('/commercial-offers', payload);
12
+ }
13
+
14
+ /**
15
+ * Get tous les enregistrements dans la table CommercialOffer
16
+ * @param { QueryAllCommercialOffer } params
17
+ * @returns { ICommercialOffer[] }
18
+ */
19
+ public getAll(params: QueryAllCommercialOffer): Promise<ICommercialOffer[]> {
20
+ return this.axios.$get('/commercial-offers/all', { params });
21
+ }
22
+
23
+ /**
24
+ * Get tous les enregistrements utilisable dans la table CommercialOffer
25
+ * @returns { ICommercialOffer[] }
26
+ */
27
+ public getAllUsable(): Promise<ICommercialOffer[]> {
28
+ return this.axios.$get('/commercial-offers/all-usable');
29
+ }
30
+
31
+ /**
32
+ * Get les enregistrements dans la table CommercialOffer sous format paginé
33
+ * @param { QueryPaginateCommercialOffer } params
34
+ * @returns { BasePaginate<ICommercialOffer> }
35
+ */
36
+ public getPaginate(params: QueryPaginateCommercialOffer): Promise<BasePaginate<ICommercialOffer>> {
37
+ return this.axios.$get('/commercial-offers/paginate', { params });
38
+ }
39
+
40
+ /**
41
+ * Update un enregistrement dans la table CommercialOffer
42
+ * @param { number } id
43
+ * @param { Partial<ICommercialOffer> } payload
44
+ * @returns { ICommercialOffer }
45
+ */
46
+ public update(id: number, payload: Partial<ICommercialOffer>): Promise<ICommercialOffer> {
47
+ return this.axios.$put(`/commercial-offers/${id}`, payload);
48
+ }
49
+
50
+ /**
51
+ * Delete un enregistrement dans la table CommercialOffer
52
+ * @param { number } id
53
+ * @returns { boolean }
54
+ */
55
+ public delete(id: number): Promise<boolean> {
56
+ return this.axios.$delete(`/commercial-offers/${id}`);
57
+ }
58
+
59
+ /**
60
+ * Get un enregistrement dans la table CommercialOffer
61
+ * @param { number } id
62
+ * @returns { ICommercialOffer }
63
+ */
64
+ public get(id: number): Promise<ICommercialOffer> {
65
+ return this.axios.$get(`/commercial-offers/${id}`);
66
+ }
67
+ }
@@ -2,10 +2,30 @@ import { CancelToken } from 'axios';
2
2
  import { Resource } from '../Resource';
3
3
  import {
4
4
  BasePaginate,
5
- IPrestation, ISociety, PrestationType, QueryGetPaginatedSocietiesFromPrestation, QueryPrestation,
5
+ IPrestation, ISociety, PrestationType, QueryCreatePrestation, QueryGetPaginatedSocietiesFromPrestation, QueryPrestation, QueryUpdatePrestation,
6
6
  } from '../../types';
7
7
 
8
8
  export class Prestation extends Resource {
9
+
10
+ /**
11
+ * Crée une prestationavec tous les éléments lié à celle-ci.
12
+ * @param { QueryCreatePrestation } params
13
+ * @returns { IPrestation }
14
+ */
15
+ public create(params: QueryCreatePrestation): Promise<IPrestation> {
16
+ return this.axios.$post('/prestation', params);
17
+ }
18
+
19
+ /**
20
+ * Crée une prestationavec tous les éléments lié à celle-ci.
21
+ * @param { number } id
22
+ * @param { QueryUpdatePrestation } params
23
+ * @returns { IPrestation }
24
+ */
25
+ public update(idPrestation: number, params: QueryUpdatePrestation): Promise<IPrestation> {
26
+ return this.axios.$put(`/prestation/${idPrestation}`, params);
27
+ }
28
+
9
29
  /**
10
30
  * retourne toutes les prestations juridique d'une société
11
31
  * @param { number } id
@@ -137,6 +137,7 @@ import { SalesContract } from './resources/SalesContract';
137
137
  import { LeadsToPartners } from './resources/LeadsToPartners';
138
138
  import { ChangeLog } from './resources/ChangeLog';
139
139
  import { ConstitutionHistory } from './resources/ConstitutionHistory';
140
+ import { CommercialOffer } from './resources/CommercialOffer';
140
141
 
141
142
  export const resources = {
142
143
  simulation: Simulation,
@@ -278,4 +279,5 @@ export const resources = {
278
279
  changeLog: ChangeLog,
279
280
  constitutionHistory: ConstitutionHistory,
280
281
  das: Das,
282
+ commercialOffer: CommercialOffer,
281
283
  };
@@ -0,0 +1,17 @@
1
+ import { List } from '../Interface/enum/Util';
2
+
3
+ export enum ClosingType {
4
+ IN_PROGRESS = 1,
5
+ OUTDATED = 2,
6
+ }
7
+
8
+ export const ClosingTypeList: List = [
9
+ {
10
+ id: ClosingType.IN_PROGRESS,
11
+ label: 'Clôture en cours',
12
+ },
13
+ {
14
+ id: ClosingType.OUTDATED,
15
+ label: 'Clôture dépassée',
16
+ },
17
+ ];
@@ -0,0 +1,84 @@
1
+ import { PrestationType } from './PrestationType';
2
+
3
+ type commercialOfferTypeAmount = {
4
+ id: number;
5
+ label: string;
6
+ };
7
+
8
+ export type CommercialOfferTypeType = {
9
+ id: number;
10
+ label: string;
11
+ amountType: commercialOfferTypeAmount;
12
+ idPrestationList: number[];
13
+ isComptable: boolean | null;
14
+ isCatalog: boolean | null;
15
+ isBack: boolean | null;
16
+ };
17
+
18
+ export const CommercialOfferAmountType = {
19
+ PERCENTAGE: {
20
+ id: 1,
21
+ label: '%',
22
+ },
23
+ MONTH: {
24
+ id: 2,
25
+ label: 'Mois',
26
+ },
27
+ MONEY: {
28
+ id: 3,
29
+ label: '€',
30
+ },
31
+ };
32
+
33
+ export const CommercialOfferTypeDetail = {
34
+ RECOVERY_MONTH : {
35
+ id: 1,
36
+ label: '% de reprise sur les mois',
37
+ text: '%value% % offert, valable jusqu\'au %dateEnd%.',
38
+ amountType: CommercialOfferAmountType.PERCENTAGE,
39
+ idPrestationList: [],
40
+ isComptable: true,
41
+ isCatalog: false,
42
+ isBack: false,
43
+ },
44
+ MONTH_OFFERED : {
45
+ id: 2,
46
+ label: 'Nb de mois offert',
47
+ text: '%value% mois offert, valable jusqu\'au %dateEnd%.',
48
+ amountType: CommercialOfferAmountType.MONTH,
49
+ idPrestationList: [],
50
+ isComptable: true,
51
+ isCatalog: false,
52
+ isBack: true,
53
+ },
54
+ AMOUNT_OFFERED : {
55
+ id: 3,
56
+ label: 'Montant offert',
57
+ text: '%value% euros offert, valable jusqu\'au %dateEnd%.',
58
+ amountType: CommercialOfferAmountType.MONEY,
59
+ idPrestationList: [],
60
+ isComptable: true,
61
+ isCatalog: false,
62
+ isBack: false,
63
+ },
64
+ SPONSORSHIP : {
65
+ id: 4,
66
+ label: 'Parrainage',
67
+ text: '%value% euros de parrainage, valable jusqu\'au %dateEnd%.',
68
+ amountType: CommercialOfferAmountType.MONEY,
69
+ idPrestationList: [],
70
+ isComptable: true,
71
+ isCatalog: false,
72
+ isBack: null,
73
+ },
74
+ COMPANY_SETUP: {
75
+ id: 5,
76
+ label: '% de la création d\'entreprise',
77
+ text: 'Création offerte, valable jusqu\'au %dateEnd%.',
78
+ amountType: CommercialOfferAmountType.PERCENTAGE,
79
+ idPrestationList: [PrestationType.CREATION_SOCIETE],
80
+ isComptable: null,
81
+ isCatalog: null,
82
+ isBack: null,
83
+ },
84
+ };
@@ -1,5 +1,14 @@
1
1
  import { PrestationType } from './PrestationType';
2
2
 
3
+ export type PrestationOptionType = {
4
+ id: number;
5
+ name: string;
6
+ description: string | null;
7
+ price: number;
8
+ brand: string[];
9
+ prestationList: PrestationType[];
10
+ };
11
+
3
12
  export const PrestationOption = {
4
13
  BUSINESS_PLAN_OPTION_1: {
5
14
  id: 1,