@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.
- package/dist/cjs/api/resources/Society.d.ts +2 -1
- package/dist/cjs/api/resources/Society.d.ts.map +1 -1
- package/dist/cjs/api/resources/Society.js +3 -0
- package/dist/cjs/api/resources/Society.js.map +1 -1
- package/dist/cjs/api/resources/Subscription.d.ts +2 -0
- package/dist/cjs/api/resources/Subscription.d.ts.map +1 -1
- package/dist/cjs/api/resources/Subscription.js +3 -0
- package/dist/cjs/api/resources/Subscription.js.map +1 -1
- package/dist/cjs/types/Enum/BrandPourcentage.d.ts +4 -0
- package/dist/cjs/types/Enum/BrandPourcentage.d.ts.map +1 -1
- package/dist/cjs/types/Enum/BrandPourcentage.js +92 -1
- package/dist/cjs/types/Enum/BrandPourcentage.js.map +1 -1
- package/dist/cjs/types/Enum/Contract.d.ts +4 -0
- package/dist/cjs/types/Enum/Contract.d.ts.map +1 -1
- package/dist/cjs/types/Enum/Contract.js +11 -1
- package/dist/cjs/types/Enum/Contract.js.map +1 -1
- package/dist/cjs/types/Enum/Log.d.ts +8 -1
- package/dist/cjs/types/Enum/Log.d.ts.map +1 -1
- package/dist/cjs/types/Enum/Log.js +7 -0
- package/dist/cjs/types/Enum/Log.js.map +1 -1
- package/dist/cjs/types/Enum/PartnerType.d.ts +4 -0
- package/dist/cjs/types/Enum/PartnerType.d.ts.map +1 -1
- package/dist/cjs/types/Enum/PartnerType.js +6 -1
- package/dist/cjs/types/Enum/PartnerType.js.map +1 -1
- package/dist/cjs/types/Interface/api/prestation/Query.d.ts +1 -0
- package/dist/cjs/types/Interface/api/prestation/Query.d.ts.map +1 -1
- package/dist/cjs/types/Interface/api/prestation/Query.js +8 -0
- package/dist/cjs/types/Interface/api/prestation/Query.js.map +1 -1
- package/dist/cjs/types/Interface/api/society/Export.d.ts +69 -0
- package/dist/cjs/types/Interface/api/society/Export.d.ts.map +1 -0
- package/dist/cjs/types/Interface/api/society/Export.js +37 -0
- package/dist/cjs/types/Interface/api/society/Export.js.map +1 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/utils/prestation.d.ts +4 -1
- package/dist/cjs/utils/prestation.d.ts.map +1 -1
- package/dist/cjs/utils/prestation.js +31 -11
- package/dist/cjs/utils/prestation.js.map +1 -1
- package/dist/mjs/api/resources/Society.d.ts +2 -1
- package/dist/mjs/api/resources/Society.d.ts.map +1 -1
- package/dist/mjs/api/resources/Society.js +3 -0
- package/dist/mjs/api/resources/Society.js.map +1 -1
- package/dist/mjs/api/resources/Subscription.d.ts +2 -0
- package/dist/mjs/api/resources/Subscription.d.ts.map +1 -1
- package/dist/mjs/api/resources/Subscription.js +3 -0
- package/dist/mjs/api/resources/Subscription.js.map +1 -1
- package/dist/mjs/types/Enum/BrandPourcentage.d.ts +4 -0
- package/dist/mjs/types/Enum/BrandPourcentage.d.ts.map +1 -1
- package/dist/mjs/types/Enum/BrandPourcentage.js +92 -1
- package/dist/mjs/types/Enum/BrandPourcentage.js.map +1 -1
- package/dist/mjs/types/Enum/Contract.d.ts +4 -0
- package/dist/mjs/types/Enum/Contract.d.ts.map +1 -1
- package/dist/mjs/types/Enum/Contract.js +10 -0
- package/dist/mjs/types/Enum/Contract.js.map +1 -1
- package/dist/mjs/types/Enum/Log.d.ts +8 -1
- package/dist/mjs/types/Enum/Log.d.ts.map +1 -1
- package/dist/mjs/types/Enum/Log.js +7 -0
- package/dist/mjs/types/Enum/Log.js.map +1 -1
- package/dist/mjs/types/Enum/PartnerType.d.ts +4 -0
- package/dist/mjs/types/Enum/PartnerType.d.ts.map +1 -1
- package/dist/mjs/types/Enum/PartnerType.js +5 -0
- package/dist/mjs/types/Enum/PartnerType.js.map +1 -1
- package/dist/mjs/types/Interface/api/prestation/Query.d.ts +1 -0
- package/dist/mjs/types/Interface/api/prestation/Query.d.ts.map +1 -1
- package/dist/mjs/types/Interface/api/prestation/Query.js +10 -1
- package/dist/mjs/types/Interface/api/prestation/Query.js.map +1 -1
- package/dist/mjs/types/Interface/api/society/Export.d.ts +69 -0
- package/dist/mjs/types/Interface/api/society/Export.d.ts.map +1 -0
- package/dist/mjs/types/Interface/api/society/Export.js +36 -0
- package/dist/mjs/types/Interface/api/society/Export.js.map +1 -0
- package/dist/mjs/types/index.d.ts +1 -0
- package/dist/mjs/types/index.d.ts.map +1 -1
- package/dist/mjs/types/index.js +1 -0
- package/dist/mjs/types/index.js.map +1 -1
- package/dist/mjs/utils/prestation.d.ts +4 -1
- package/dist/mjs/utils/prestation.d.ts.map +1 -1
- package/dist/mjs/utils/prestation.js +31 -11
- package/dist/mjs/utils/prestation.js.map +1 -1
- package/package.json +2 -1
- package/ts/api/resources/Society.ts +5 -0
- package/ts/api/resources/Subscription.ts +5 -0
- package/ts/types/Enum/BrandPourcentage.ts +92 -1
- package/ts/types/Enum/Contract.ts +12 -1
- package/ts/types/Enum/Log.ts +7 -0
- package/ts/types/Enum/PartnerType.ts +7 -1
- package/ts/types/Interface/api/prestation/Query.ts +8 -1
- package/ts/types/Interface/api/society/Export.ts +91 -0
- package/ts/types/index.ts +1 -1
- package/ts/utils/prestation.ts +32 -11
package/ts/utils/prestation.ts
CHANGED
|
@@ -119,16 +119,20 @@ const getPriceGrid = (idTypeBrand: number, idPrestationList: number): priceGrid
|
|
|
119
119
|
return currentPriceGrid;
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
-
const 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 } => {
|
|
122
|
+
const 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 } => {
|
|
123
123
|
let totalPrestation: number = 0;
|
|
124
124
|
let reduceMonth: number = 0;
|
|
125
|
+
let monthNbr: number = NbrMonth;
|
|
126
|
+
let yearlyPrice: number | undefined;
|
|
127
|
+
let finalMonthlyPrice: number | undefined;
|
|
128
|
+
let canBeCreated: boolean = true;
|
|
129
|
+
let recalculateMonthly: boolean = false;
|
|
125
130
|
|
|
126
131
|
/* Récupération de la grille tarifaire */
|
|
127
132
|
const currentPriceGrid: priceGrid | undefined = getPriceGrid(idTypeBrand, idPrestationList);
|
|
128
133
|
|
|
129
134
|
if (currentPriceGrid) {
|
|
130
135
|
let monthlyPrice: number | undefined;
|
|
131
|
-
let yearlyPrice: number | undefined;
|
|
132
136
|
let vatRegimePrice: number | undefined;
|
|
133
137
|
|
|
134
138
|
/* Gestion du régime de TVA */
|
|
@@ -143,24 +147,31 @@ const calculatePrestationPriceWithPriceGrid = (idPrestationList: number, endDate
|
|
|
143
147
|
else if (!pastBalanceSheet && currentPriceGrid.turnoverCreatedYear) yearlyPrice = currentPriceGrid.turnoverCreatedYear?.find(turn => turnover < turn.turnoverValue)?.price;
|
|
144
148
|
else if (pastBalanceSheet && currentPriceGrid.turnoverPastYear) yearlyPrice = currentPriceGrid.turnoverPastYear?.find(turn => turnover < turn.turnoverValue)?.price;
|
|
145
149
|
else if (currentPriceGrid.partner) yearlyPrice = currentPriceGrid.partner?.find(part => part.amountMinimum <= associatesNumber && part.amountMaximum >= associatesNumber)?.price;
|
|
146
|
-
|
|
150
|
+
finalMonthlyPrice = (monthlyPrice ? monthlyPrice : 0) + (vatRegimePrice ? vatRegimePrice : 0);
|
|
147
151
|
|
|
148
152
|
/* Gestion des mois */
|
|
149
153
|
let cloturedPast: boolean = false;
|
|
150
154
|
if (dayjs(endDate, 'YYYY-MM-DD').subtract(15, 'day').isBefore(dayjs())) cloturedPast = true;
|
|
151
155
|
const minimumMonth: number | undefined = currentPriceGrid.minimumMonthlyPayment?.find(monthlyPayment => monthlyPayment.id === (cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS))?.month;
|
|
152
156
|
const maximumMonth: number | undefined = currentPriceGrid.maximumMonthlyPayment?.find(monthlyPayment => monthlyPayment.id === (cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS))?.month;
|
|
153
|
-
let monthNbr: number = NbrMonth;
|
|
154
157
|
if (totalMonth > 0) monthNbr = monthNbr - totalMonth;
|
|
155
|
-
if (minimumMonth && monthNbr < minimumMonth)
|
|
156
|
-
|
|
158
|
+
if (minimumMonth && monthNbr < minimumMonth) {
|
|
159
|
+
monthNbr = minimumMonth;
|
|
160
|
+
recalculateMonthly = true;
|
|
161
|
+
if (totalMonth > 0) canBeCreated = false;
|
|
162
|
+
}
|
|
163
|
+
if (maximumMonth && monthNbr > maximumMonth) {
|
|
164
|
+
monthNbr = maximumMonth;
|
|
165
|
+
recalculateMonthly = true;
|
|
166
|
+
if (totalMonth > 0) canBeCreated = false;
|
|
167
|
+
}
|
|
157
168
|
|
|
158
169
|
reduceMonth = (monthNbr === NbrMonth - totalMonth ? totalMonth : 0);
|
|
159
170
|
|
|
160
171
|
/* Prix Final */
|
|
161
172
|
totalPrestation = (yearlyPrice ? yearlyPrice : finalMonthlyPrice * monthNbr);
|
|
162
173
|
}
|
|
163
|
-
return { totalPrestation, reduceMonth };
|
|
174
|
+
return { totalPrestation, reduceMonth, canBeCreated, monthNbr: yearlyPrice ? 0 : recalculateMonthly ? NbrMonth : monthNbr, price: yearlyPrice ? yearlyPrice : recalculateMonthly ? (totalPrestation / NbrMonth) : (finalMonthlyPrice ? finalMonthlyPrice : 0) };
|
|
164
175
|
};
|
|
165
176
|
|
|
166
177
|
const calculatePrestationPriceWithPrestationList = (prestationList: IPrestationList): number => {
|
|
@@ -171,10 +182,13 @@ const calculatePrestationPriceWithPrestationList = (prestationList: IPrestationL
|
|
|
171
182
|
return totalPrestation;
|
|
172
183
|
};
|
|
173
184
|
|
|
174
|
-
const 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 } => {
|
|
185
|
+
const 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 } => {
|
|
175
186
|
let totalPrestation: number = 0;
|
|
176
187
|
let reduceMonth: number = 0;
|
|
177
|
-
let
|
|
188
|
+
let canBeCreated: boolean = true;
|
|
189
|
+
let monthNbr: number = 0;
|
|
190
|
+
let price: number = 0;
|
|
191
|
+
let totalWithReduce: { totalPrestation: number, reduceMonth: number, canBeCreated: boolean, monthNbr: number, price: number } = { totalPrestation: 0, reduceMonth: 0, canBeCreated: true, monthNbr: 0, price: 0 };
|
|
178
192
|
|
|
179
193
|
/* Gestion du prix en fonction de la prestation */
|
|
180
194
|
if (
|
|
@@ -200,11 +214,14 @@ const calculatePrestationPrice = (idPrestationList: number, prestationList: IPre
|
|
|
200
214
|
totalWithReduce = calculatePrestationPriceWithPriceGrid(idPrestationList, endDate, NbrMonth, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, isYearly, totalMonth);
|
|
201
215
|
totalPrestation = totalWithReduce.totalPrestation;
|
|
202
216
|
reduceMonth = totalWithReduce.reduceMonth;
|
|
217
|
+
canBeCreated = totalWithReduce.canBeCreated;
|
|
218
|
+
monthNbr = totalWithReduce.monthNbr;
|
|
219
|
+
price = totalWithReduce.price;
|
|
203
220
|
} else {
|
|
204
221
|
totalPrestation = calculatePrestationPriceWithPrestationList(prestationList);
|
|
205
222
|
}
|
|
206
|
-
if (totalPercentage > 0) totalPrestation = totalPrestation - (totalPrestation * (totalPercentage / 100));
|
|
207
223
|
if (totalAmount > 0) totalPrestation = totalPrestation - totalAmount;
|
|
224
|
+
if (totalPercentage > 0) totalPrestation = totalPrestation - (totalPrestation * (totalPercentage / 100));
|
|
208
225
|
if (prestationList.minimumPrice && totalPrestation < prestationList.minimumPrice) totalPrestation = prestationList.minimumPrice;
|
|
209
226
|
/* Gestion des options */
|
|
210
227
|
let OptionTotalPrice: number = 0;
|
|
@@ -216,7 +233,11 @@ const calculatePrestationPrice = (idPrestationList: number, prestationList: IPre
|
|
|
216
233
|
}
|
|
217
234
|
totalPrestation += (OptionTotalPrice ? OptionTotalPrice : 0);
|
|
218
235
|
|
|
219
|
-
|
|
236
|
+
if (isWithApplicationFees) totalPrestation += 50;
|
|
237
|
+
|
|
238
|
+
const calculDetail = `${monthNbr > 0 ? monthNbr + ' mois x ' + price + '€' : price + '€'} ${totalAmount > 0 ? '- ' + totalAmount + '€' : ''} ${totalPercentage > 0 ? '- ' + totalPercentage + '%' : ''} ${isWithApplicationFees ? '+ 50€' : ''}`;
|
|
239
|
+
|
|
240
|
+
return { totalPrestation, reduceMonth, canBeCreated, calculDetail, price };
|
|
220
241
|
};
|
|
221
242
|
|
|
222
243
|
const getPrestationOptions = (idPrestationList: number): PrestationOptionType[] => {
|