remove collecting some props in preparedValues
This commit is contained in:
parent
d42ff2be86
commit
6bc5a52a37
@ -82,8 +82,14 @@ export default ({
|
||||
firstPaymentNdsAbs: 0,
|
||||
firstPaymentWithNdsAbs: 0,
|
||||
modelId: NIL,
|
||||
paymentDateNew: new Date(),
|
||||
paymentDateNew: currentDate,
|
||||
plTypeId: NIL,
|
||||
tlmCostPaymentSum: preparedPaymentsRows
|
||||
.map(x => x.tlmCostPayment || 0)
|
||||
.reduce((a, b) => a + b, 0),
|
||||
gpsCostPaymentSum: preparedPaymentsRows
|
||||
.map(x => x.gpsCostPayment || 0)
|
||||
.reduce((a, b) => a + b, 0),
|
||||
};
|
||||
|
||||
preparedValues.calcDate = currentDate;
|
||||
@ -160,17 +166,14 @@ export default ({
|
||||
? insuranceOSAGORow?.insCost?.value
|
||||
: 0;
|
||||
|
||||
preparedValues.insurance =
|
||||
(preparedValues.insuranceOsago || 0) + (preparedValues.insuranceKasko || 0);
|
||||
|
||||
preparedValues.insuranceKaskoNmper =
|
||||
(preparedValues.nmperInsurance || 0) >= 16
|
||||
? ((preparedValues.insuranceKasko || 0) *
|
||||
(preparedValues.nmperInsurance || 0)) /
|
||||
12
|
||||
: preparedValues.insuranceKasko;
|
||||
|
||||
preparedValues.insuranceContract =
|
||||
|
||||
preparedValues.insuranceContract =
|
||||
(preparedValues.insuranceKaskoNmper || 0) +
|
||||
(preparedValues.insuranceOsago || 0);
|
||||
|
||||
@ -443,12 +446,8 @@ export default ({
|
||||
(preparedValues.trackerCost || 0) +
|
||||
(preparedValues.tLMCost || 0) +
|
||||
preparedValues.transportTaxGr +
|
||||
preparedPaymentsRows
|
||||
.map(x => x.tlmCostPayment || 0)
|
||||
.reduce((a, b) => a + b, 0) +
|
||||
preparedPaymentsRows
|
||||
.map(x => x.gpsCostPayment || 0)
|
||||
.reduce((a, b) => a + b, 0)) *
|
||||
(preparedValues.tlmCostPaymentSum || 0) +
|
||||
(preparedValues.gpsCostPaymentSum || 0)) *
|
||||
preparedValues.leasing0K -
|
||||
preparedValues.firstPaymentSum -
|
||||
(values.product === 'LEASING0' ? 0 : preparedValues.discount || 0)) *
|
||||
@ -643,90 +642,6 @@ export default ({
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
plPrice = 0,
|
||||
insurance,
|
||||
rats = 0,
|
||||
registration = 0,
|
||||
trackerCost = 0,
|
||||
tLMCost = 0,
|
||||
transportTaxGr,
|
||||
leasing0K,
|
||||
nsibBrutto = 0,
|
||||
insuranceContract,
|
||||
comissionRub,
|
||||
discount = 0,
|
||||
baseRegistration = 0,
|
||||
nsibNetto = 0,
|
||||
nmper = 0,
|
||||
firstPaymentSum,
|
||||
} = preparedValues;
|
||||
|
||||
preparedValues.calculationCost =
|
||||
plPrice +
|
||||
(insurance + rats + registration + trackerCost + tLMCost + transportTaxGr) *
|
||||
leasing0K;
|
||||
|
||||
preparedValues.priceUpTotal =
|
||||
plPrice +
|
||||
trackerCost +
|
||||
tLMCost +
|
||||
preparedPaymentsRows
|
||||
.map(x => x.tlmCostPayment || 0)
|
||||
.reduce((a, b) => a + b, 0) +
|
||||
preparedPaymentsRows
|
||||
.map(x => x.gpsCostPayment || 0)
|
||||
.reduce((a, b) => a + b, 0) +
|
||||
registration +
|
||||
insuranceContract +
|
||||
rats +
|
||||
nsibBrutto +
|
||||
transportTaxGr;
|
||||
|
||||
preparedValues.acquisitionExpenses =
|
||||
plPrice +
|
||||
insurance -
|
||||
comissionRub -
|
||||
discount +
|
||||
trackerCost +
|
||||
tLMCost +
|
||||
baseRegistration +
|
||||
rats;
|
||||
|
||||
preparedValues.npvBase =
|
||||
plPrice +
|
||||
((nsibNetto * 12) / nmper +
|
||||
insurance +
|
||||
baseRegistration +
|
||||
trackerCost +
|
||||
tLMCost +
|
||||
rats -
|
||||
discount -
|
||||
comissionRub -
|
||||
firstPaymentSum);
|
||||
|
||||
preparedValues.niAtInception =
|
||||
preparedValues.acquisitionExpenses - firstPaymentSum;
|
||||
|
||||
preparedValues.dogCredit =
|
||||
plPrice +
|
||||
(insurance + rats + registration + trackerCost + tLMCost + transportTaxGr) *
|
||||
leasing0K -
|
||||
firstPaymentSum +
|
||||
(nsibNetto * 12) / nmper -
|
||||
(values.product === 'LEASING0' ? 0 : discount);
|
||||
|
||||
preparedValues.dogCreditLeasing =
|
||||
plPrice +
|
||||
insurance +
|
||||
registration +
|
||||
trackerCost +
|
||||
tLMCost +
|
||||
rats -
|
||||
discount -
|
||||
comissionRub -
|
||||
firstPaymentSum;
|
||||
|
||||
return {
|
||||
preparedPayments: { rows: preparedPaymentsRows },
|
||||
preparedValues,
|
||||
|
||||
@ -88,7 +88,6 @@ const validateTables = () => {
|
||||
};
|
||||
|
||||
export default () => {
|
||||
const v = toJS(CalculationStore.values);
|
||||
validateElements();
|
||||
validateTables();
|
||||
};
|
||||
|
||||
@ -89,6 +89,8 @@ export interface PreparedValues {
|
||||
directorBonus?: number;
|
||||
dogCredit?: number;
|
||||
dogCreditLeasing?: number;
|
||||
tlmCostPaymentSum?: number;
|
||||
gpsCostPaymentSum?: number;
|
||||
}
|
||||
|
||||
export interface PaymentRow {
|
||||
|
||||
Reference in New Issue
Block a user