From ebfc5d5d861bca7f6c7bddee2a636cc6108ecf16 Mon Sep 17 00:00:00 2001 From: Chika Date: Mon, 24 Oct 2022 18:12:16 +0300 Subject: [PATCH] preparedValues: fix insuranceEvoKasko & insuranceBonusLoss --- .../Effects/actions/calculate/prepareData.ts | 27 ++++++++++++++----- .../query/options/main_options.graphql | 1 + 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts index be1f8c2..a20dd85 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts @@ -210,13 +210,26 @@ export default function (this: ICalculationStore): PreparedData { (plPriceRub - discountRub - importProgramSum + values.addEquipmentPrice); } - preparedValues.insuranceBonusLoss = - ((selectLeasingWithoutKasko?.evo_loss_kv || 0) * - (plPriceRub - - discountRub - - importProgramSum + - values.addEquipmentPrice)) / - 100; + preparedValues.insuranceBonusLoss = 0; + + if (selectLeasingWithoutKasko?.evo_evokasko_calc_type === 100_000_001) { + preparedValues.insuranceBonusLoss = + ((selectLeasingWithoutKasko?.evo_loss_kv || 0) * + (plPriceRub - + discountRub - + importProgramSum + + values.addEquipmentPrice - + values.firstPaymentRub)) / + 100; + } else { + preparedValues.insuranceBonusLoss = + ((selectLeasingWithoutKasko?.evo_loss_kv || 0) * + (plPriceRub - + discountRub - + importProgramSum + + values.addEquipmentPrice)) / + 100; + } preparedValues.insuranceKaskoNmper = (preparedValues.nmperInsurance || 0) >= 16 diff --git a/src/core/services/CrmService/graphql/query/options/main_options.graphql b/src/core/services/CrmService/graphql/query/options/main_options.graphql index d0bc4db..533014f 100644 --- a/src/core/services/CrmService/graphql/query/options/main_options.graphql +++ b/src/core/services/CrmService/graphql/query/options/main_options.graphql @@ -316,5 +316,6 @@ query GetMainOptions( evo_models { evo_modelid } + evo_evokasko_calc_type } }