From e1b330b1a024aec9d04dc2d266f8ee0b97cc1c34 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Thu, 22 Sep 2022 16:58:09 +0300 Subject: [PATCH 01/22] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=20=D0=BD=D0=BE=D0=B2=D0=BE=D0=B5=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D0=B5=20selectLeasingWithoutKasko?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Sections/sectionsList.ts | 1 + .../Calculation/Elements/components.ts | 1 + .../Containers/Calculation/Elements/titles.ts | 1 + .../Containers/Calculation/Elements/values.ts | 1 + .../Containers/Calculation/types/elements.ts | 1 + .../CalculationStore/config/initialValues.ts | 1 + .../stores/CalculationStore/init/variables.ts | 1 + .../query/options/main_options.graphql | 13 +++++++ .../CrmService/graphql/schema.graphql | 37 ++++++++++++------- .../services/CrmService/types/entities.ts | 1 + src/core/types/Calculation/Store/values.ts | 1 + 11 files changed, 45 insertions(+), 14 deletions(-) diff --git a/src/client/Containers/Calculation/Components/Sections/sectionsList.ts b/src/client/Containers/Calculation/Components/Sections/sectionsList.ts index 36bb55b..c11507c 100644 --- a/src/client/Containers/Calculation/Components/Sections/sectionsList.ts +++ b/src/client/Containers/Calculation/Components/Sections/sectionsList.ts @@ -284,6 +284,7 @@ const sections: ISection[] = [ 'selectLeaseObjectCategory', 'tbxLeaseObjectMotorPower', 'tbxEngineVolume', + 'selectLeasingWithoutKasko', ], }, { diff --git a/src/client/Containers/Calculation/Elements/components.ts b/src/client/Containers/Calculation/Elements/components.ts index 27da392..27e9f9e 100644 --- a/src/client/Containers/Calculation/Elements/components.ts +++ b/src/client/Containers/Calculation/Elements/components.ts @@ -144,6 +144,7 @@ export default { labelIrrInfo: Label, labelRegistrationDescription: Label, labelImportProgramSum: Label, + selectLeasingWithoutKasko: Select, /** Result Elements */ labelResultTotalGraphwithNDS: Label, diff --git a/src/client/Containers/Calculation/Elements/titles.ts b/src/client/Containers/Calculation/Elements/titles.ts index 6e0a107..8367d67 100644 --- a/src/client/Containers/Calculation/Elements/titles.ts +++ b/src/client/Containers/Calculation/Elements/titles.ts @@ -130,6 +130,7 @@ export const elementsTitles: Partial> = { labelImportProgramSum: 'Скидка от производителя, руб., с НДС', tbxAddEquipmentPrice: 'Стоимость доп.оборудования', tbxVIN: 'VIN', + selectLeasingWithoutKasko: 'Лизинг без КАСКО', /** Result Elements */ labelResultTotalGraphwithNDS: 'Итого по графику, с НДС', diff --git a/src/client/Containers/Calculation/Elements/values.ts b/src/client/Containers/Calculation/Elements/values.ts index d1a63f0..3eda07c 100644 --- a/src/client/Containers/Calculation/Elements/values.ts +++ b/src/client/Containers/Calculation/Elements/values.ts @@ -136,6 +136,7 @@ const elementsValues: Record = { selectImportProgram: 'importProgram', tbxAddEquipmentPrice: 'addEquipmentPrice', tbxVIN: 'vin', + selectLeasingWithoutKasko: 'leasingWithoutKasko', /** Result Elements */ labelResultTotalGraphwithNDS: 'resultTotalGraphwithNDS', diff --git a/src/client/Containers/Calculation/types/elements.ts b/src/client/Containers/Calculation/types/elements.ts index 598a760..7259059 100644 --- a/src/client/Containers/Calculation/types/elements.ts +++ b/src/client/Containers/Calculation/types/elements.ts @@ -123,6 +123,7 @@ export type ElementsNames = | 'tbxVATInLeaseObjectPrice' | 'tbxAddEquipmentPrice' | 'tbxVIN' + | 'selectLeasingWithoutKasko' /** Result Elements */ | 'labelResultTotalGraphwithNDS' | 'labelResultPlPrice' diff --git a/src/client/stores/CalculationStore/config/initialValues.ts b/src/client/stores/CalculationStore/config/initialValues.ts index 209452c..7085736 100644 --- a/src/client/stores/CalculationStore/config/initialValues.ts +++ b/src/client/stores/CalculationStore/config/initialValues.ts @@ -94,5 +94,6 @@ const initialValues: Partial> = { legalClientTown: null, infuranceOPF: null, addEquipmentPrice: 0, + leasingWithoutKasko: null, }; export default initialValues; diff --git a/src/client/stores/CalculationStore/init/variables.ts b/src/client/stores/CalculationStore/init/variables.ts index b2a26ec..59bb579 100644 --- a/src/client/stores/CalculationStore/init/variables.ts +++ b/src/client/stores/CalculationStore/init/variables.ts @@ -15,6 +15,7 @@ export const mainOptionsVariables: telematic_product_type: 100000004, techcard_product_type: 100000000, fuelcard_product_type: 100000005, + leasing_without_kasko_product_type: 100000007, }; export const insuranceVariables: Partial> = { 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 c99ee71..73d79d4 100644 --- a/src/core/services/CrmService/graphql/query/options/main_options.graphql +++ b/src/core/services/CrmService/graphql/query/options/main_options.graphql @@ -13,6 +13,7 @@ query GetMainOptions( $telematic_product_type: Int $fuelcard_product_type: Int $techcard_product_type: Int + $leasing_without_kasko_product_type: Int ) { selectSupplierCurrency: transactioncurrencies(statecode: $statecode) { transactioncurrencyid @@ -296,4 +297,16 @@ query GetMainOptions( } evo_subsidy_type } + selectLeasingWithoutKasko: evo_addproduct_types( + statecode: $statecode + evo_product_type: $leasing_without_kasko_product_type + evo_datefrom_param: { lte: $currentDate } + evo_dateto_param: { gte: $currentDate } + ) { + ...evo_addproduct_types_fields + evo_leasingobject_types { + evo_leasingobject_typeid + } + evo_visible_calc + } } diff --git a/src/core/services/CrmService/graphql/schema.graphql b/src/core/services/CrmService/graphql/schema.graphql index c310c4b..dc9dd33 100644 --- a/src/core/services/CrmService/graphql/schema.graphql +++ b/src/core/services/CrmService/graphql/schema.graphql @@ -50,7 +50,7 @@ type Query { account(accountid: Uuid!): account """Контрагенты. statecode по умолчанию 0""" - accounts(evo_accnumber: String, evo_account_type: [Int!], evo_agency_agreementid: Uuid, evo_broker_accountid: Uuid, evo_fin_department_accountid: Uuid, evo_id_elt: String, evo_inn: String, evo_inn_param: StringParamInput, evo_kpp: String, evo_kpp_param: StringParamInput, evo_legal_form: Int, evo_type_ins_policy: [Int!], name: String, ownerid: Uuid, owner_domainname: String, statecode: Int): [account] + accounts(evo_accnumber: String, evo_account_type: [Int!], evo_agency_agreementid: Uuid, evo_broker_accountid: Uuid, evo_fin_department_accountid: Uuid, evo_id_elt: String, evo_inn: String, evo_inn_param: StringParamInput, evo_kpp: String, evo_kpp_param: StringParamInput, evo_legal_form: Int, evo_type_ins_policy: [Int!], ownerid: Uuid, owner_domainname: String, statecode: Int): [account] """Брокер. statecode по умолчанию 0""" broker_agents(ownnerid: Uuid!, statecode: Int): [account] @@ -68,7 +68,7 @@ type Query { evo_baseproduct(evo_baseproductid: Uuid!): evo_baseproduct evo_baseproducts(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_relation: [Int!], statecode: Int): [evo_baseproduct] evo_brand(evo_brandid: Uuid!): evo_brand - evo_brands(evo_name: String, evo_vehicle_type: [Int!], statecode: Int): [evo_brand] + evo_brands(evo_vehicle_type: [Int!], statecode: Int): [evo_brand] evo_businessunits(statecode: Int): [evo_businessunit] evo_client_risks(statecode: Int): [evo_client_risk] evo_client_types(statecode: Int): [evo_client_type] @@ -96,7 +96,7 @@ type Query { evo_leasingobject_type(evo_leasingobject_typeid: Uuid!): evo_leasingobject_type evo_leasingobject_types(statecode: Int): [evo_leasingobject_type] evo_model(evo_modelid: Uuid!): evo_model - evo_models(evo_brandid: Uuid, evo_name: String, evo_vehicle_type: Int, statecode: Int): [evo_model] + evo_models(evo_brandid: Uuid, evo_vehicle_type: Int, statecode: Int): [evo_model] evo_orglegalform(evo_orglegalformid: Uuid!): evo_orglegalform evo_orglegalforms(statecode: Int = 0): [evo_orglegalform] evo_paymentorders(evo_dds_1c: String, evo_name: String, evo_paydate_param: DateParamInput, evo_payment_number_1c: String, evo_paysum: Decimal, statecode: Int, statuscode: Int): [evo_paymentorder] @@ -183,6 +183,10 @@ type evo_request_client { evo_owner_systemuseridData: systemuser evo_phonecallid: Uuid evo_request_clientid: Uuid + evo_site_email: String + evo_site_name: String + evo_site_telephone: String + evo_site_text: String evo_statuscodeid: Uuid evo_statuscodeidData: evo_statuscode evo_storage: String @@ -258,6 +262,7 @@ type incidentGraphQL { evo_accountid_new: Uuid evo_cession_opportunityid: Uuid evo_contracts: [evo_contract] + evo_creat_request_client: Uuid evo_fast_advice: Boolean evo_plan_execut_date: DateTime evo_statuscodeid: Uuid @@ -415,7 +420,6 @@ type account { evo_ifns_code_branch: String evo_ifns_name: String evo_inn: String - evo_insurance_agent_accountid: Uuid evo_invoice_number_fix: String evo_invoice_number_rules: Int evo_kpp: String @@ -444,7 +448,6 @@ type account { evo_state_liquidation_date: DateTime evo_state_registration_date: DateTime evo_state_status: Int - evo_storage: String evo_subsidies(statecode: Int): [evo_subsidy] evo_supplier_type: Int evo_tax_system: Int @@ -544,6 +547,7 @@ type evo_addproduct_type { evo_description: String evo_equipment_1_name: String evo_equip_cost: Decimal + evo_evokasko_calc_type: Int evo_gibdd_region: Boolean evo_graph_price: Decimal evo_graph_price_withoutnds: Decimal @@ -606,7 +610,6 @@ type evo_graph { evo_cost_price_telematics_withoutnds_sum: Decimal evo_cost_telematics_sum: Decimal evo_cost_telematics_withoutnds_sum: Decimal - evo_graf_date_approve: DateTime evo_graphid: Uuid evo_name: String evo_nds: Decimal @@ -635,6 +638,7 @@ type evo_insurance_period { evo_dateto: DateTime evo_dgo_price: Decimal evo_elt_id: String + evo_evokasko_price: Decimal evo_exp_drivers: Int evo_franchise: Decimal evo_id: String @@ -702,6 +706,9 @@ type evo_addproduct { evo_addproductnumberidData: evo_addproductnumber evo_addproduct_typeid: Uuid evo_addproduct_typeidData: evo_addproduct_type + evo_beacon1_imei: String + evo_beacon2_imei: String + evo_connect_telematics_evo_addproductid: Uuid evo_contractid: Uuid evo_cs_actualdate: DateTime evo_date_instal: DateTime @@ -783,7 +790,6 @@ type evo_leasingobject { evo_color: String evo_contractid: Uuid evo_create_contract_purchase: Boolean - evo_date_withdrawal: DateTime evo_delivery_time: Int evo_driving_axle: String evo_ecological_class: Int @@ -1035,6 +1041,7 @@ type quote { evo_agent_accountid: Uuid evo_agent_reward_conditionid: Uuid evo_agent_reward_summ: Decimal + evo_agent_reward_tech: Decimal evo_agent_reward_total: Decimal evo_age_drivers: Int evo_another_payments: Decimal @@ -1048,6 +1055,7 @@ type quote { evo_broker_accountid: Uuid evo_broker_reward_conditionid: Uuid evo_broker_reward_summ: Decimal + evo_broker_reward_tech: Decimal evo_broker_reward_total: Decimal evo_calc_irr: Decimal evo_calc_profit: Decimal @@ -1070,8 +1078,10 @@ type quote { evo_dealer_broker_accountid: Uuid evo_dealer_broker_reward_conditionid: Uuid evo_dealer_broker_reward_summ: Decimal + evo_dealer_broker_reward_tech: Decimal evo_dealer_broker_reward_total: Decimal evo_dealer_person_accountid: Uuid + evo_dealer_person_reward_tech: Decimal evo_dealer_reward_conditionid: Uuid evo_dealer_reward_summ: Decimal evo_dealer_reward_total: Decimal @@ -1093,6 +1103,7 @@ type quote { evo_double_agent_accountid: Uuid evo_double_agent_reward_conditionid: Uuid evo_double_agent_reward_summ: Decimal + evo_double_agent_reward_tech: Decimal evo_double_agent_reward_total: Decimal evo_economic: Decimal evo_economic_with_nds: Decimal @@ -1102,6 +1113,9 @@ type quote { evo_equipmentid: Uuid evo_equip_price: Decimal evo_equity_capital: Decimal + evo_evokasko_insurer_accountid: Uuid + evo_evokasko_insurer_accountidData: account + evo_evokasko_price: Decimal evo_exp_drivers: Int evo_fingap_accountid: Uuid evo_fingap_bonus_sum: Decimal @@ -1112,6 +1126,7 @@ type quote { evo_fin_department_accountid: Uuid evo_fin_department_reward_conditionid: Uuid evo_fin_department_reward_summ: Decimal + evo_fin_department_reward_tech: Decimal evo_fin_department_reward_total: Decimal evo_first_dgo_price: Decimal evo_first_kasko_accountid: Uuid @@ -1543,7 +1558,6 @@ type evo_request_payment { evo_finegibddidData: evo_finegibdd evo_id: String evo_inn: String - evo_insurance_addcontractid: Uuid evo_insurance_periodid: Uuid evo_insurance_policyid: Uuid evo_insurance_policyidData: evo_insurance_policy @@ -1656,7 +1670,6 @@ type evo_contract { evo_debt_penalty_fee: Decimal evo_debt_total: Decimal evo_delay_days_count: Int - evo_delay_period: DateTime evo_director_bonus: Decimal evo_director_fingap_bonus: Decimal evo_director_nsib_bonus: Decimal @@ -1732,7 +1745,6 @@ type evo_contract { evo_name: String evo_nds_in_price_supplier_currency: Decimal evo_nds_perc: Decimal - evo_nearest_payment_num: String evo_net_irr: Decimal evo_niatinception_msfo: Decimal evo_niatinception_msfo_actual: Decimal @@ -1760,7 +1772,6 @@ type evo_contract { evo_rate: Decimal evo_rateid: Uuid evo_reason_change_account: Int - evo_redemption_archive_date: DateTime evo_ref_opportunityid: Uuid evo_region_director_bonus: Decimal evo_region_director_fingap_bonus: Decimal @@ -2293,7 +2304,6 @@ type evo_addcontract { evo_date_addcontract: DateTime evo_date_calculation_done: DateTime evo_date_offset_change: Boolean - evo_date_offset_type: Int evo_deadline_date: DateTime evo_dealer_broker_accountid: Uuid evo_dealer_broker_accountid_new: Uuid @@ -2313,7 +2323,6 @@ type evo_addcontract { evo_dealer_person_reward_summ_new: Decimal evo_deviation_investments_withoutnds: Decimal evo_deviation_irr: Decimal - evo_deviation_irr_change: Boolean evo_dgo_price: Decimal evo_dgo_price_new: Decimal evo_director_bonus: Decimal @@ -2550,12 +2559,12 @@ type email { evo_accountid: Uuid modifiedon: DateTime regardingobjectid_account: Uuid - regardingobjectid_evo_addcontract: Uuid regardingobjectid_evo_contract: Uuid regardingobjectid_evo_insurance_period: Uuid regardingobjectid_evo_insurance_policy: Uuid regardingobjectid_evo_insurance_policyData: evo_insurance_policy regardingobjectid_evo_list: Uuid + regardingobjectid_incident: Uuid regardingobjectid_opportunity: Uuid statuscode: Int subject: String diff --git a/src/core/services/CrmService/types/entities.ts b/src/core/services/CrmService/types/entities.ts index 89a8b15..9c97126 100644 --- a/src/core/services/CrmService/types/entities.ts +++ b/src/core/services/CrmService/types/entities.ts @@ -402,6 +402,7 @@ export interface IEvoAddproductType extends BaseEntity { evo_gibdd_region?: boolean; evo_type_calc_cerebellum?: number; evo_addproduct_types?: IEvoAddproductType[]; + evo_evokasko_calc_type?: number; } export interface IEvoTarif extends BaseEntity { diff --git a/src/core/types/Calculation/Store/values.ts b/src/core/types/Calculation/Store/values.ts index a330754..d9f967e 100644 --- a/src/core/types/Calculation/Store/values.ts +++ b/src/core/types/Calculation/Store/values.ts @@ -119,6 +119,7 @@ export type ValuesNames = | 'fuelCard' | 'minPriceChange' | 'vin' + | 'leasingWithoutKasko' | 'resultTotalGraphwithNDS' | 'resultPlPrice' | 'resultPriceUpPr' From 7b158a2c1fe37f320a5b833bb1a0ea77461b51df Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Thu, 22 Sep 2022 16:59:37 +0300 Subject: [PATCH 02/22] =?UTF-8?q?=D0=9D=D0=B0=D0=B9=D1=82=D0=B8=20=D1=80?= =?UTF-8?q?=D0=B5=D0=B0=D0=BA=D1=86=D0=B8=D1=8E,=20=D0=BF=D0=BE=20=D0=BA?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D1=80=D0=BE=D0=B9=20=D1=81=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D1=81=D1=8B=D0=B2=D0=B0=D1=8E=D1=82=D1=81=D1=8F=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0=D1=82=D1=8B=20=D1=80=D0=B0?= =?UTF-8?q?=D1=81=D1=87=D0=B5=D1=82=D0=B0=20ELT=20=D0=BF=D0=BE=20=D0=9A?= =?UTF-8?q?=D0=90=D0=A1=D0=9A=D0=9E=20=D0=B8=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D1=82=D1=8C=20=D1=87=D1=82=D0=BE=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0=D1=82=D1=8B=20=D1=82=D0=B0?= =?UTF-8?q?=D0=BA=D0=B6=D0=B5=20=D1=81=D0=B1=D1=80=D0=B0=D1=81=D1=8B=D0=B2?= =?UTF-8?q?=D0=B0=D1=8E=D1=82=D1=81=D1=8F=20=D0=BD=D0=B0=20=D0=B8=D0=B7?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D1=8F=20"=D0=9B=D0=B8=D0=B7=D0=B8=D0=BD=D0=B3=20=D0=B1=D0=B5?= =?UTF-8?q?=D0=B7=20=D0=9A=D0=90=D0=A1=D0=9A=D0=9E"=20(SelectLeasingWithou?= =?UTF-8?q?tKasko)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit В валидацию расчета КАСКО в ELT необходимо добавить условие: если поле "Лизинг без КАСКО" (SelectLeasingWithoutKasko) содержит данные, то расчет не производить и выводить сообщение "Вы осуществляете расчет с Лизинг без КАСКО, расчет ЭЛТ в данном случае е требуется" --- .../Components/ELT/Kasko/lib/validation.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/client/Containers/Calculation/Components/ELT/Kasko/lib/validation.ts b/src/client/Containers/Calculation/Components/ELT/Kasko/lib/validation.ts index 576e20d..2cd0102 100644 --- a/src/client/Containers/Calculation/Components/ELT/Kasko/lib/validation.ts +++ b/src/client/Containers/Calculation/Components/ELT/Kasko/lib/validation.ts @@ -109,6 +109,19 @@ export const conditions: Partial> = { isValid: true, }; }, + + selectLeasingWithoutKasko: calculationStore => { + if (calculationStore.getValue('leasingWithoutKasko')) { + return { + isValid: false, + message: + 'Вы осуществляете расчет с Лизинг без КАСКО, расчет ЭЛТ в данном случае не требуется', + }; + } + return { + isValid: true, + }; + }, }; export const resetFields: ElementsNames[] = [ @@ -119,6 +132,7 @@ export const resetFields: ElementsNames[] = [ 'selectLegalClientTown', 'selectLegalClientRegion', 'tbxVIN', + 'selectLeasingWithoutKasko', ]; export default { From 5a020824570d786d5f2becb8a7c49430334d96e0 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Thu, 22 Sep 2022 17:06:33 +0300 Subject: [PATCH 03/22] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BD=D0=BE=D0=B2=D0=BE=D0=B5=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D0=B5=20=D0=B2=20=D1=80=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=20=D0=A1=D1=82=D1=80=D0=B0=D1=85=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20"=D0=9B=D0=B8=D0=B7=D0=B8=D0=BD=D0=B3=20=D0=B1?= =?UTF-8?q?=D0=B5=D0=B7=20=D0=9A=D0=90=D0=A1=D0=9A=D0=9E"=20(SelectLeasing?= =?UTF-8?q?WithoutKasko)=20-=20=D0=B8=20=D1=80=D0=B5=D0=B0=D0=BA=D1=86?= =?UTF-8?q?=D0=B8=D1=8E=20=D0=BD=D0=B0=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D1=8E=20=D0=B2=D1=8B=D0=BF=D0=B0=D0=B4?= =?UTF-8?q?=D0=B0=D1=8E=D1=89=D0=B5=D0=B3=D0=BE=20=D1=81=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B8=D0=B7=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=B5=D0=B9=20addproducttype,=20=D1=83=20=D0=BA=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D1=8B=D1=85:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Статус (evo_addproduct_type.statecode) = Активный (0) Тип продукта (evo_addproduct_type.evo_product_type) = Evo_КАСКО (100000007) Начало действия (evo_addproduct_type.evo_datefrom) меньше или равно текущей даты Окончание действия (evo_addproduct_type.evo_dateto) больше или равно текущей даты Min срок лизинга (evo_addproduct_type.evo_min_period) меньше или равно значению из поля "Срок лизинга, мес" (tbxLeasingPeriod) Max срок лизинга (evo_addproduct_type.evo_max_period) больше или равно значению из поля "Срок лизинга, мес" (tbxLeasingPeriod) По связи evo_evo_addproduct_type_evo_leasingobject_typ связана с карточкой Типа предмета лизинга (evo_leasingobject_type),указанной в поле "Тип предмета лизинга" (selectLeaseObjectType) Max стоимость ПЛ (evo_addproduct_type.evo_max_price) больше или равно значению ([Стоимость ПЛ tbxLeaseObjectPrice - Скидка tbxSupplierDiscountRub], переведенное в рубли - labelImportProgramSum + tbxAddEquipmentPrice) Min стоимость ПЛ (evo_addproduct_type.evo_min_price) меньше или равно значению ([Стоимость ПЛ tbxLeaseObjectPrice - Скидка tbxSupplierDiscountRub], переведенное в рубли - labelImportProgramSum + tbxAddEquipmentPrice) Отображать для расчета в ЛК (evo_addproduct_type.evo_visible_calc) = True --- .../Effects/reactions/otherReactions.ts | 60 +++++++++++++++++++ .../CrmService/graphql/schema.graphql | 15 +++++ .../services/CrmService/types/entities.ts | 2 + 3 files changed, 77 insertions(+) diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index a1529e7..136764d 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -822,6 +822,66 @@ const reactionEffects: IReactionEffect[] = [ }, }), + /** + * сделали здесь для экономии времени + * перенести в отдельный процесс leasingWithoutKasko + */ + + calculationStore => ({ + expression: () => { + //@ts-ignore + const plPriceRub = calculationStore.plPriceRub(); + //@ts-ignore + const discountRub = calculationStore.discountRub(); + + const { + leasingPeriod, + leaseObjectType, + addEquipmentPrice, + importProgram, + } = calculationStore.values; + return { + leasingPeriod, + leaseObjectType, + plPriceRub, + discountRub, + addEquipmentPrice, + importProgram, + }; + }, + effect: ({ + leasingPeriod, + leaseObjectType, + plPriceRub, + discountRub, + addEquipmentPrice, + importProgram, + }) => { + calculationStore.setFilter('selectLeasingWithoutKasko', options => + options.filter( + x => + x?.evo_max_period && + x?.evo_min_period && + x.evo_max_period >= leasingPeriod && + x.evo_min_period <= leasingPeriod && + x?.evo_max_price && + x?.evo_min_price && + x.evo_max_price >= + plPriceRub - discountRub - importProgram + addEquipmentPrice && + x.evo_min_price <= + plPriceRub - discountRub - importProgram + addEquipmentPrice && + x.evo_leasingobject_types?.find( + x => x.evo_leasingobject_typeid === leaseObjectType, + ) && + x.evo_visible_calc, + ), + ); + }, + options: { + fireImmediately: true, + }, + }), + calculationStore => ({ expression: () => { const { leasingPeriod, leaseObjectType } = calculationStore.values; diff --git a/src/core/services/CrmService/graphql/schema.graphql b/src/core/services/CrmService/graphql/schema.graphql index dc9dd33..66ebcd0 100644 --- a/src/core/services/CrmService/graphql/schema.graphql +++ b/src/core/services/CrmService/graphql/schema.graphql @@ -556,8 +556,10 @@ type evo_addproduct_type { evo_leasingobject_types(statecode: Int): [evo_leasingobject_type] evo_max_age: Int evo_max_period: Decimal + evo_max_price: Decimal evo_min_age: Int evo_min_period: Decimal + evo_min_price: Decimal evo_name: String evo_nsib_limit: Decimal evo_planpayments(statecode: Int): [evo_planpayment] @@ -956,6 +958,7 @@ type opportunity { evo_assignor_accountid: Uuid evo_businessunitid: Uuid evo_businessunitidData: businessunit + evo_cession_incidentid: Uuid evo_check_type: [Int!] evo_check_type_fact: [Int!] evo_client_riskid: Uuid @@ -1617,6 +1620,7 @@ type evo_contract { evo_agent_reward: Decimal evo_agent_reward_conditionid: Uuid evo_agent_reward_summ: Decimal + evo_agent_reward_tech: Decimal evo_agent_service_list: [Int!] evo_approvallogs: [evo_approvallog] evo_balance_holder: Int @@ -1629,6 +1633,7 @@ type evo_contract { evo_broker_reward: Decimal evo_broker_reward_conditionid: Uuid evo_broker_reward_summ: Decimal + evo_broker_reward_tech: Decimal evo_broker_service_list: [Int!] evo_businessunitid: Uuid evo_calc_irr: Decimal @@ -1655,6 +1660,7 @@ type evo_contract { evo_dealer_broker_reward: Decimal evo_dealer_broker_reward_conditionid: Uuid evo_dealer_broker_reward_summ: Decimal + evo_dealer_broker_reward_tech: Decimal evo_dealer_broker_service_list: [Int!] evo_dealer_person_accountid: Uuid evo_dealer_person_accountidData: account @@ -1662,6 +1668,7 @@ type evo_contract { evo_dealer_person_reward: Decimal evo_dealer_person_reward_conditionid: Uuid evo_dealer_person_reward_summ: Decimal + evo_dealer_person_reward_tech: Decimal evo_dealer_person_service_list: [Int!] evo_debtwork_contractid: Uuid evo_debtwork_contractidData: evo_debtwork_contract @@ -1685,6 +1692,7 @@ type evo_contract { evo_double_agent_reward: Decimal evo_double_agent_reward_conditionid: Uuid evo_double_agent_reward_summ: Decimal + evo_double_agent_reward_tech: Decimal evo_double_agent_service_list: [Int!] evo_economic: Decimal evo_economic_actual: Decimal @@ -1704,6 +1712,7 @@ type evo_contract { evo_fin_department_reward: Decimal evo_fin_department_reward_conditionid: Uuid evo_fin_department_reward_summ: Decimal + evo_fin_department_reward_tech: Decimal evo_fin_department_service_list: [Int!] evo_first_payment_fact: Decimal evo_first_payment_fact_date: DateTime @@ -2261,6 +2270,7 @@ type evo_addcontract { evo_add_region_director_bonus: Decimal evo_agent_reward: Decimal evo_agent_reward_summ: Decimal + evo_agent_reward_tech: Decimal evo_age_drivers: Int evo_age_drivers_new: Int evo_approv_business_analyst: Boolean @@ -2276,6 +2286,7 @@ type evo_addcontract { evo_base_new: String evo_broker_reward: Decimal evo_broker_reward_summ: Decimal + evo_broker_reward_tech: Decimal evo_businessunitid: Uuid evo_calculation_method: Int evo_calculator_type: Int @@ -2313,6 +2324,7 @@ type evo_addcontract { evo_dealer_broker_reward_new: Decimal evo_dealer_broker_reward_summ: Decimal evo_dealer_broker_reward_summ_new: Decimal + evo_dealer_broker_reward_tech: Decimal evo_dealer_person_accountid: Uuid evo_dealer_person_accountid_new: Uuid evo_dealer_person_reward: Decimal @@ -2321,6 +2333,7 @@ type evo_addcontract { evo_dealer_person_reward_new: Decimal evo_dealer_person_reward_summ: Decimal evo_dealer_person_reward_summ_new: Decimal + evo_dealer_person_reward_tech: Decimal evo_deviation_investments_withoutnds: Decimal evo_deviation_irr: Decimal evo_dgo_price: Decimal @@ -2334,6 +2347,7 @@ type evo_addcontract { evo_dog_credit_new: Decimal evo_double_agent_reward: Decimal evo_double_agent_reward_summ: Decimal + evo_double_agent_reward_tech: Decimal evo_driving_axle: String evo_driving_axle_new: String evo_early_change_discount: Boolean @@ -2366,6 +2380,7 @@ type evo_addcontract { evo_fin_department_reward_new: Decimal evo_fin_department_reward_summ: Decimal evo_fin_department_reward_summ_new: Decimal + evo_fin_department_reward_tech: Decimal evo_fix_last_payment: Boolean evo_franchise: Decimal evo_franchise_new: Decimal diff --git a/src/core/services/CrmService/types/entities.ts b/src/core/services/CrmService/types/entities.ts index 9c97126..c9572d0 100644 --- a/src/core/services/CrmService/types/entities.ts +++ b/src/core/services/CrmService/types/entities.ts @@ -435,6 +435,8 @@ export interface IEvoTarif extends BaseEntity { evo_delivery_time?: number[]; evo_cut_irr_with_bonus_coefficient?: number; evo_margin_min?: number; + evo_min_price?: number; + evo_max_price?: number; } export interface IEvoRate extends BaseEntity { From 7ac869b552921a4861a49d6e7fcf0e721192c73f Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Thu, 22 Sep 2022 17:30:06 +0300 Subject: [PATCH 04/22] =?UTF-8?q?=D0=9D=D0=B0=D0=B9=D1=82=D0=B8=20=D1=80?= =?UTF-8?q?=D0=B5=D0=B0=D0=BA=D1=86=D0=B8=D1=8E,=20=D0=B3=D0=B4=D0=B5=20?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=8F=D1=8E=D1=82=D1=81=D1=8F=20=D0=B7=D0=BD?= =?UTF-8?q?=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B8=D0=BB=D0=B8=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D1=80=D1=8B=D0=B2=D0=B0=D1=8E=D1=82=D1=81?= =?UTF-8?q?=D1=8F/=D0=B7=D0=B0=D0=BA=D1=80=D1=8B=D0=B2=D0=B0=D1=8E=D1=82?= =?UTF-8?q?=D1=81=D1=8F=20=D0=BF=D0=BE=20=D0=BF=D0=BE=D0=BB=D0=B8=D1=81?= =?UTF-8?q?=D1=83=20=D0=9A=D0=90=D0=A1=D0=9A=D0=9E=20=D0=B8=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=B1=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BD=D0=B0=20=D0=B8?= =?UTF-8?q?=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D1=8F=20"=D0=9B=D0=B8=D0=B7=D0=B8=D0=BD=D0=B3=20=D0=B1?= =?UTF-8?q?=D0=B5=D0=B7=20=D0=9A=D0=90=D0=A1=D0=9A=D0=9E"=20(SelectLeasing?= =?UTF-8?q?WithoutKasko)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit если "Лизинг без КАСКО" (SelectLeasingWithoutKasko) содержит данные, то в таблице страхования в строке КАСКО: Страховая компания insCompany = ПРОЧИЕ (если в списке СК нет, но надо будет добавить, по аналогии как добавляем для ОСАГО если Тип ПЛ = Прицеп) и закрыто для редактирования Стоимость первого периода inscost = 0 и закрыто для редактирования Период страхования insTerm = 12 мес и закрыто для редактирования Плательщик insured = ЛП и закрыто для редактирования иначе как по текущей реакции --- .../Effects/reactions/tablesReactions.ts | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts index 2e82ec9..e07a5bd 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts @@ -149,11 +149,36 @@ export default [ (calculationStore, calculationProcess) => ({ expression: () => { - const { leasingPeriod } = calculationStore.values; - return leasingPeriod; + const { leasingPeriod, leasingWithoutKasko } = calculationStore.values; + return { leasingPeriod, leasingWithoutKasko }; }, - effect: leasingPeriod => { - if (leasingPeriod) { + effect: ({ leasingPeriod, leasingWithoutKasko }) => { + if (leasingWithoutKasko) { + const otherInsuranceCompany = + calculationStore.tables.tableInsurance.options?.insuranceCompany?.find( + x => x.name?.includes('ПРОЧИЕ'), + ); + calculationStore.setTableRow('tableInsurance', rows => + rows.findIndex(x => x?.key === 'kasko'), + )({ + insuranceCompany: { + value: otherInsuranceCompany?.value, + status: ElementStatus.Disabled, + }, + insCost: { + value: 0, + status: ElementStatus.Disabled, + }, + insTerm: { + value: 100_000_000, + status: ElementStatus.Disabled, + }, + insured: { + value: 100_000_000, + status: ElementStatus.Disabled, + }, + }); + } else if (leasingPeriod) { if (leasingPeriod < 12) { calculationStore.setTableRow('tableInsurance', rows => rows.findIndex(x => x?.key === 'osago'), From 4a11f56f87dd2bc34866f2a761becdce277d1bd7 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Thu, 22 Sep 2022 17:32:30 +0300 Subject: [PATCH 05/22] =?UTF-8?q?=D0=9F=D1=80=D0=B8=20=D0=B7=D0=B0=D0=B3?= =?UTF-8?q?=D1=80=D1=83=D0=B7=D0=BA=D0=B5=20=D0=9A=D0=9F=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=BD=D1=8F=D1=82=D1=8C=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D0=B5=20"=D0=9B=D0=B8=D0=B7=D0=B8=D0=BD=D0=B3=20=D0=B1=D0=B5?= =?UTF-8?q?=D0=B7=20=D0=9A=D0=90=D0=A1=D0=9A=D0=9E"=20(SelectLeasingWithou?= =?UTF-8?q?tKasko)=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D1=8C=D1=8E=20=D0=B8?= =?UTF-8?q?=D0=B7=20=D1=81=D0=B2=D1=8F=D0=B7=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= =?UTF-8?q?=20=D1=81=20quote=20addproducttype=20(=D0=BF=D0=BE=20=D0=B0?= =?UTF-8?q?=D0=BD=D0=B0=D0=BB=D0=BE=D0=B3=D0=B8=D0=B8=20=D1=81=20=D0=9D?= =?UTF-8?q?=D0=A1=D0=98=D0=91)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Effects/reactions/loadKpReaction/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts index c1953ff..cb7fb30 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts @@ -4,7 +4,7 @@ import { resetIns } from 'client/Containers/Calculation/Components/ELT/lib/reset import { numberElementsProps } from 'client/Containers/Calculation/Elements/props/common'; import { getTitle, - getValueName, + getValueName } from 'client/Containers/Calculation/Elements/tools'; import { ElementsNames } from 'client/Containers/Calculation/types/elements'; import { openNotification } from 'client/Elements/Notification'; @@ -14,7 +14,7 @@ import { mainOptionsForQuoteQuery, quoteQuery, secondaryOptionsForQuoteQuery, - singleOptionsForQuoteQuery, + singleOptionsForQuoteQuery } from 'core/services/CrmService/graphql/query/quote'; import { TOptionizedEntity } from 'core/services/CrmService/types/common'; import { @@ -23,7 +23,7 @@ import { IEvoGraph, IEvoRewardCondition, IEvoTown, - IQuote, + IQuote } from 'core/services/CrmService/types/entities'; import { currentISODate } from 'core/tools/date'; import { NIL } from 'core/tools/uuid'; @@ -40,6 +40,7 @@ const map_add_product_types_to_values = { tracker: 100000003, telematic: 100000004, fuelCard: 100000005, + leasingWithoutKasko: 100000007, }; const tablePaymentsStatuses = (graphType, seasonType, leasingPeriod) => { From e8919c75501e766af04676b6afb57d569cad3778 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 23 Sep 2022 15:45:12 +0300 Subject: [PATCH 06/22] =?UTF-8?q?fix:=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D1=8F=20selectLeasingWithoutKasko?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Effects/reactions/otherReactions.ts | 10 +++++----- .../graphql/query/options/main_options.graphql | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index 136764d..ef86699 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -850,12 +850,12 @@ const reactionEffects: IReactionEffect[] = [ }; }, effect: ({ - leasingPeriod, + leasingPeriod = 0, leaseObjectType, - plPriceRub, - discountRub, - addEquipmentPrice, - importProgram, + plPriceRub = 0, + discountRub = 0, + addEquipmentPrice = 0, + importProgram = 0, }) => { calculationStore.setFilter('selectLeasingWithoutKasko', options => options.filter( 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 73d79d4..833e6c0 100644 --- a/src/core/services/CrmService/graphql/query/options/main_options.graphql +++ b/src/core/services/CrmService/graphql/query/options/main_options.graphql @@ -308,5 +308,7 @@ query GetMainOptions( evo_leasingobject_typeid } evo_visible_calc + evo_min_price + evo_max_price } } From a800ad4b99bd3a2eb933288009b72d2b58fb79aa Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 23 Sep 2022 16:01:06 +0300 Subject: [PATCH 07/22] =?UTF-8?q?insuranceTables:=20=D0=BF=D1=83=D1=81?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D0=BE=D0=BA=D0=B0=20=D1=82=D0=B0=D0=BA=20?= =?UTF-8?q?=D0=B1=D1=83=D0=B4=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Effects/reactions/tablesReactions.ts | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts index e07a5bd..24821f5 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts @@ -158,12 +158,60 @@ export default [ calculationStore.tables.tableInsurance.options?.insuranceCompany?.find( x => x.name?.includes('ПРОЧИЕ'), ); + const insuranceOtherFilter = singleValueFilter( + otherInsuranceCompany?.value, + ); calculationStore.setTableRow('tableInsurance', rows => rows.findIndex(x => x?.key === 'kasko'), )({ insuranceCompany: { value: otherInsuranceCompany?.value, status: ElementStatus.Disabled, + filter: insuranceOtherFilter, + }, + insCost: { + value: 0, + status: ElementStatus.Disabled, + }, + insTerm: { + value: 100_000_000, + status: ElementStatus.Disabled, + }, + insured: { + value: 100_000_000, + status: ElementStatus.Disabled, + }, + }); + + calculationStore.setTableRow('tableInsurance', rows => + rows.findIndex(x => x?.key === 'dgo'), + )({ + insuranceCompany: { + value: otherInsuranceCompany?.value, + status: ElementStatus.Disabled, + filter: insuranceOtherFilter, + }, + insCost: { + value: 0, + status: ElementStatus.Disabled, + }, + insTerm: { + value: 100_000_000, + status: ElementStatus.Disabled, + }, + insured: { + value: 100_000_000, + status: ElementStatus.Disabled, + }, + }); + + calculationStore.setTableRow('tableInsurance', rows => + rows.findIndex(x => x?.key === 'ns'), + )({ + insuranceCompany: { + value: otherInsuranceCompany?.value, + status: ElementStatus.Disabled, + filter: insuranceOtherFilter, }, insCost: { value: 0, @@ -179,6 +227,24 @@ export default [ }, }); } else if (leasingPeriod) { + calculationStore.setTableRow('tableInsurance', rows => + rows.findIndex(x => x?.key === 'kasko'), + )({ + insuranceCompany: { filter: insuranceKaskoDefaultFilter }, + }); + + calculationStore.setTableRow('tableInsurance', rows => + rows.findIndex(x => x?.key === 'dgo'), + )({ + insuranceCompany: { filter: insuranceKaskoDefaultFilter }, + }); + + calculationStore.setTableRow('tableInsurance', rows => + rows.findIndex(x => x?.key === 'ns'), + )({ + insuranceCompany: { filter: insuranceKaskoDefaultFilter }, + }); + if (leasingPeriod < 12) { calculationStore.setTableRow('tableInsurance', rows => rows.findIndex(x => x?.key === 'osago'), From 952d26e9b4ac41099b34101564c62d45ed579947 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 23 Sep 2022 17:08:44 +0300 Subject: [PATCH 08/22] =?UTF-8?q?=D0=92=20=D1=84=D0=BE=D1=80=D0=BC=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20PreparedValues=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F=D0=B5=D0=BC=20=D1=81?= =?UTF-8?q?=D0=BB=D0=B5=D0=B4.=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5?= =?UTF-8?q?=D1=82=D1=80=D1=8B:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit InsuranceEvoKASKO если SelectLeasingWithoutKasko содержит данные, то считаем InsuranceEvoKASKO если в SelectLeasingWithoutKasko указана запись evo_addproduct_type, у которой evo_evokasko_calc_type = от стоимости минус ПП (100000001), то InsuranceEvoKASKO = (Стоимость ПЛ tbxLeaseObjectPrice - Скидка tbxSupplierDiscountRub - labelImportProgramSum + tbxAddEquipmentPrice), переведенное в рубли минус Первый платеж, руб. tbxFirstPaymentRub) * Себестоимость (закладываем в график), без НДС, руб evo_cost_service_provider_withoutnds из сущности addproducttype в SelectLeasingWithoutKasko иначе InsuranceEvoKASKO = (Стоимость ПЛ tbxLeaseObjectPrice - Скидка tbxSupplierDiscountRub - labelImportProgramSum + tbxAddEquipmentPrice), переведенное в рубли) * Себестоимость (закладываем в график), без НДС, руб evo_cost_service_provider_withoutnds из сущности addproducttype в SelectLeasingWithoutKasko иначе 0 --- .../Effects/actions/calculate/prepareData.ts | 26 +++++++++++++++++-- .../CoreService/types/Calculation/prepared.ts | 1 + 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts index 845b5d6..d6e4111 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts @@ -186,6 +186,30 @@ export default function (this: ICalculationStore): PreparedData { ? values.leasingPeriod : 12; + //@ts-ignore + const importProgramSum: number = this.importProgramSum(); + //@ts-ignore + const plPriceRub: number = this.plPriceRub(); + //@ts-ignore + const discountRub: number = this.discountRub(); + + preparedValues.insuranceEvoKasko = 0; + const selectLeasingWithoutKasko = this.getOption('selectLeasingWithoutKasko'); + + if (selectLeasingWithoutKasko?.evo_evokasko_calc_type === 100_000_001) { + preparedValues.insuranceEvoKasko = + (selectLeasingWithoutKasko?.evo_cost_service_provider_withoutnds || 0) * + (plPriceRub - + discountRub - + importProgramSum + + values.addEquipmentPrice - + values.firstPaymentRub); + } else { + preparedValues.insuranceEvoKasko = + (selectLeasingWithoutKasko?.evo_cost_service_provider_withoutnds || 0) * + (plPriceRub - discountRub - importProgramSum + values.addEquipmentPrice); + } + preparedValues.insuranceKaskoNmper = (preparedValues.nmperInsurance || 0) >= 16 ? ((preparedValues.insuranceKasko || 0) * @@ -230,8 +254,6 @@ export default function (this: ICalculationStore): PreparedData { evo_currencychange?.evo_currencychange || 1, ); - //@ts-ignore - const importProgramSum = this.importProgramSum(); preparedValues.importProgramSum = importProgramSum / (1 + valuesConstants.VAT); diff --git a/src/core/services/CoreService/types/Calculation/prepared.ts b/src/core/services/CoreService/types/Calculation/prepared.ts index c2cadaa..5c6ba2e 100644 --- a/src/core/services/CoreService/types/Calculation/prepared.ts +++ b/src/core/services/CoreService/types/Calculation/prepared.ts @@ -1,4 +1,5 @@ export interface PreparedValues { + insuranceEvoKasko?: number; extraBonusSumColumn?: number; importProgramSum?: number; calcDate?: Date; From 92eb52d47d7c5a2d998c6a3ba66c889944dbc8c0 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 23 Sep 2022 17:09:11 +0300 Subject: [PATCH 09/22] =?UTF-8?q?fix:=20=D1=80=D0=B5=D0=B0=D0=BA=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20selectLeasingWithoutKasko?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Effects/reactions/otherReactions.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index ef86699..c66d32f 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -833,20 +833,18 @@ const reactionEffects: IReactionEffect[] = [ const plPriceRub = calculationStore.plPriceRub(); //@ts-ignore const discountRub = calculationStore.discountRub(); + //@ts-ignore + const importProgramSum: number = calculationStore.importProgramSum(); - const { - leasingPeriod, - leaseObjectType, - addEquipmentPrice, - importProgram, - } = calculationStore.values; + const { leasingPeriod, leaseObjectType, addEquipmentPrice } = + calculationStore.values; return { leasingPeriod, leaseObjectType, plPriceRub, discountRub, addEquipmentPrice, - importProgram, + importProgramSum, }; }, effect: ({ @@ -855,7 +853,7 @@ const reactionEffects: IReactionEffect[] = [ plPriceRub = 0, discountRub = 0, addEquipmentPrice = 0, - importProgram = 0, + importProgramSum = 0, }) => { calculationStore.setFilter('selectLeasingWithoutKasko', options => options.filter( @@ -867,9 +865,9 @@ const reactionEffects: IReactionEffect[] = [ x?.evo_max_price && x?.evo_min_price && x.evo_max_price >= - plPriceRub - discountRub - importProgram + addEquipmentPrice && + plPriceRub - discountRub - importProgramSum + addEquipmentPrice && x.evo_min_price <= - plPriceRub - discountRub - importProgram + addEquipmentPrice && + plPriceRub - discountRub - importProgramSum + addEquipmentPrice && x.evo_leasingobject_types?.find( x => x.evo_leasingobject_typeid === leaseObjectType, ) && From 69512951cd176c3a9a1784afdfe6dc6a11d1fec9 Mon Sep 17 00:00:00 2001 From: Chika Date: Tue, 27 Sep 2022 16:09:34 +0300 Subject: [PATCH 10/22] =?UTF-8?q?=D0=B4=D0=BE=D0=B4=D0=B5=D0=BB=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=20=D0=B6=D1=83=D1=82=D0=BA=D1=83=D1=8E=20=D1=80?= =?UTF-8?q?=D0=B5=D0=B0=D0=BA=D1=86=D0=B8=D1=8E=20=D0=BF=D0=BE=20=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=B0=D1=85=D0=BE=D0=B2=D0=BA=D0=B5=20=D0=B8=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=D0=B8=20=D0=BA=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8B=D0=BB=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/calculate/validate/tables.ts | 43 +++++++++++++++++++ .../Effects/reactions/tablesReactions.ts | 7 ++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/tables.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/tables.ts index 4dba0dd..63c7d8d 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/tables.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/tables.ts @@ -122,6 +122,49 @@ function validateInsuranceTable(this: ICalculationStore) { }, }); } + + /** + * Самый откровенный костыль в истории калькулятора, + * потому что мне сейчас лень добавлять проверку текущего значения + * в отфильтрованном списке опций в таблице, + * да и это не имеет смысла + * (связано с самой жуткой реакцией по страховке) + * + * TODO: Для нового калькулятора: + * вместо костыля сбрасывать значение КАСКО на дефолтное, если текущего значения нет в списке опций + * + */ + const leasingWithoutKasko = this.getValue('leasingWithoutKasko'); + const otherInsuranceCompany = + this.tables.tableInsurance.options?.insuranceCompany?.find(x => + x.name?.includes('ПРОЧИЕ'), + ); + if ( + !leasingWithoutKasko && + kaskoRow.insuranceCompany === otherInsuranceCompany?.value + ) { + this.setTableRow('tableInsurance', rows => + rows.findIndex(x => x?.key === 'kasko'), + )({ + insuranceCompany: { + validation: false, + }, + }); + + openNotification({ + type: 'error', + message: 'Ошибка', + description: 'Укажите страховую компанию КАСКО из списка', + }); + } else { + this.setTableRow('tableInsurance', rows => + rows.findIndex(x => x?.key === 'kasko'), + )({ + insuranceCompany: { + validation: undefined, + }, + }); + } } function validatePaymentsTable(this: ICalculationStore) { diff --git a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts index 24821f5..01df5b8 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts @@ -147,6 +147,7 @@ export default [ }, }), + // самая жуткая реакция по страховке (calculationStore, calculationProcess) => ({ expression: () => { const { leasingPeriod, leasingWithoutKasko } = calculationStore.values; @@ -230,7 +231,11 @@ export default [ calculationStore.setTableRow('tableInsurance', rows => rows.findIndex(x => x?.key === 'kasko'), )({ - insuranceCompany: { filter: insuranceKaskoDefaultFilter }, + insuranceCompany: { + filter: insuranceKaskoDefaultFilter, + status: ElementStatus.Default, + }, + insCost: { status: ElementStatus.Default }, }); calculationStore.setTableRow('tableInsurance', rows => From 566ea42220b91047acda0e1b7ca335c56599a857 Mon Sep 17 00:00:00 2001 From: Chika Date: Tue, 27 Sep 2022 16:14:06 +0300 Subject: [PATCH 11/22] preparedValues: new insuranceBonusLoss --- .../Effects/actions/calculate/prepareData.ts | 8 ++++++++ .../services/CoreService/types/Calculation/prepared.ts | 1 + .../CrmService/graphql/query/options/main_options.graphql | 1 + src/core/services/CrmService/graphql/schema.graphql | 5 +++++ src/core/services/CrmService/types/entities.ts | 1 + 5 files changed, 16 insertions(+) diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts index d6e4111..be1f8c2 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts @@ -210,6 +210,14 @@ 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.insuranceKaskoNmper = (preparedValues.nmperInsurance || 0) >= 16 ? ((preparedValues.insuranceKasko || 0) * diff --git a/src/core/services/CoreService/types/Calculation/prepared.ts b/src/core/services/CoreService/types/Calculation/prepared.ts index 5c6ba2e..fcbea32 100644 --- a/src/core/services/CoreService/types/Calculation/prepared.ts +++ b/src/core/services/CoreService/types/Calculation/prepared.ts @@ -1,4 +1,5 @@ export interface PreparedValues { + insuranceBonusLoss?: number; insuranceEvoKasko?: number; extraBonusSumColumn?: number; importProgramSum?: number; 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 833e6c0..949d88d 100644 --- a/src/core/services/CrmService/graphql/query/options/main_options.graphql +++ b/src/core/services/CrmService/graphql/query/options/main_options.graphql @@ -310,5 +310,6 @@ query GetMainOptions( evo_visible_calc evo_min_price evo_max_price + evo_loss_kv } } diff --git a/src/core/services/CrmService/graphql/schema.graphql b/src/core/services/CrmService/graphql/schema.graphql index 66ebcd0..4eaf8c3 100644 --- a/src/core/services/CrmService/graphql/schema.graphql +++ b/src/core/services/CrmService/graphql/schema.graphql @@ -342,6 +342,7 @@ type evo_debtwork_contract { evo_termination_com_lawyer: String evo_termination_lawyer_systemuserid: Uuid evo_termination_lawyer_systemuseridData: systemuser + evo_termination_notice_date: DateTime evo_termination_reason_terms: Int evo_termination_reason_terms_doc: String evo_termination_reason_terms_text: String @@ -554,6 +555,7 @@ type evo_addproduct_type { evo_helpcard_type: Int evo_id: String evo_leasingobject_types(statecode: Int): [evo_leasingobject_type] + evo_loss_kv: Decimal evo_max_age: Int evo_max_period: Decimal evo_max_price: Decimal @@ -612,6 +614,7 @@ type evo_graph { evo_cost_price_telematics_withoutnds_sum: Decimal evo_cost_telematics_sum: Decimal evo_cost_telematics_withoutnds_sum: Decimal + evo_graf_date_approve: DateTime evo_graphid: Uuid evo_name: String evo_nds: Decimal @@ -792,6 +795,7 @@ type evo_leasingobject { evo_color: String evo_contractid: Uuid evo_create_contract_purchase: Boolean + evo_date_withdrawal: DateTime evo_delivery_time: Int evo_driving_axle: String evo_ecological_class: Int @@ -1203,6 +1207,7 @@ type quote { evo_lessor_bank_detailsid: Uuid evo_loan_appraisalid: Uuid evo_logid: Uuid + evo_loss_kv: Decimal evo_max_mass: Decimal evo_max_price_change: Decimal evo_max_speed: Decimal diff --git a/src/core/services/CrmService/types/entities.ts b/src/core/services/CrmService/types/entities.ts index c9572d0..0ecabf9 100644 --- a/src/core/services/CrmService/types/entities.ts +++ b/src/core/services/CrmService/types/entities.ts @@ -437,6 +437,7 @@ export interface IEvoTarif extends BaseEntity { evo_margin_min?: number; evo_min_price?: number; evo_max_price?: number; + evo_loss_kv?: number; } export interface IEvoRate extends BaseEntity { From 450eb18f248fdb8037d55e608a40cd6394397cd2 Mon Sep 17 00:00:00 2001 From: Chika Date: Thu, 29 Sep 2022 15:39:13 +0300 Subject: [PATCH 12/22] =?UTF-8?q?Min=20=D0=BF=D0=B5=D1=80=D0=B2=D1=8B?= =?UTF-8?q?=D0=B9=20=D0=BF=D0=BB=D0=B0=D1=82=D0=B5=D0=B6,=20%=20-=20(evo?= =?UTF-8?q?=5Faddproduct=5Ftype.evo=5Fmin=5Ffirst=5Fpayment=5Fperc)=20?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=8C=D1=88=D0=B5=20=D0=B8=D0=BB=D0=B8=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BD=D0=BE=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8E=20=D0=B8=D0=B7=20=D0=BF=D0=BE=D0=BB=D1=8F=20?= =?UTF-8?q?"=D0=9F=D0=B5=D1=80=D0=B2=D1=8B=D0=B9=20=D0=BF=D0=BB=D0=B0?= =?UTF-8?q?=D1=82=D0=B5=D0=B6,=20%"=20(tbxFirstPaymentPerc)=20Max=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B2=D1=8B=D0=B9=20=D0=BF=D0=BB=D0=B0=D1=82=D0=B5?= =?UTF-8?q?=D0=B6,=20%=20-=20(evo=5Faddproduct=5Ftype.evo=5Fmax=5Ffirst=5F?= =?UTF-8?q?payment=5Fperc)=20=D0=B1=D0=BE=D0=BB=D1=8C=D1=88=D0=B5=20=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=20=D1=80=D0=B0=D0=B2=D0=BD=D0=BE=20=D0=B7=D0=BD?= =?UTF-8?q?=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D1=8E=20=D0=B8=D0=B7=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D1=8F=20"=D0=9F=D0=B5=D1=80=D0=B2=D1=8B=D0=B9=20?= =?UTF-8?q?=D0=BF=D0=BB=D0=B0=D1=82=D0=B5=D0=B6,=20%"=20(tbxFirstPaymentPe?= =?UTF-8?q?rc)=20=D0=9F=D0=BE=20=D1=81=D0=B2=D1=8F=D0=B7=D0=B8=20evo=5Fevo?= =?UTF-8?q?=5Faddproduct=5Ftype=5Fevo=5Fmodel=20=D0=9D=D0=95=20=D1=81?= =?UTF-8?q?=D0=B2=D1=8F=D0=B7=D0=B0=D0=BD=D0=B0=20=D1=81=20=D0=BA=D0=B0?= =?UTF-8?q?=D1=80=D1=82=D0=BE=D1=87=D0=BA=D0=BE=D0=B9=20=D0=9C=D0=BE=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BC=D0=B5=D1=82?= =?UTF-8?q?=D0=B0=20=D0=BB=D0=B8=D1=89=D0=B8=D0=BD=D0=B3=D0=B0=20(evo=5Fmo?= =?UTF-8?q?del),=20=D1=83=D0=BA=D0=B0=D0=B7=D0=B0=D0=BD=D0=BD=D0=BE=D0=B9?= =?UTF-8?q?=20=D0=B2=20=D0=BF=D0=BE=D0=BB=D0=B5=20"=D0=9C=D0=BE=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C"=20(selectModel)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Effects/reactions/otherReactions.ts | 20 ++++++++++-- .../query/options/main_options.graphql | 5 +++ .../CrmService/graphql/schema.graphql | 31 +++++++++++++++++++ .../services/CrmService/types/entities.ts | 9 ++++-- 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index c66d32f..fbe74b2 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -836,8 +836,13 @@ const reactionEffects: IReactionEffect[] = [ //@ts-ignore const importProgramSum: number = calculationStore.importProgramSum(); - const { leasingPeriod, leaseObjectType, addEquipmentPrice } = - calculationStore.values; + const { + leasingPeriod, + leaseObjectType, + addEquipmentPrice, + firstPaymentPerc, + model, + } = calculationStore.values; return { leasingPeriod, leaseObjectType, @@ -845,6 +850,8 @@ const reactionEffects: IReactionEffect[] = [ discountRub, addEquipmentPrice, importProgramSum, + firstPaymentPerc, + modelId: model, }; }, effect: ({ @@ -854,6 +861,8 @@ const reactionEffects: IReactionEffect[] = [ discountRub = 0, addEquipmentPrice = 0, importProgramSum = 0, + firstPaymentPerc = 0, + modelId, }) => { calculationStore.setFilter('selectLeasingWithoutKasko', options => options.filter( @@ -871,7 +880,12 @@ const reactionEffects: IReactionEffect[] = [ x.evo_leasingobject_types?.find( x => x.evo_leasingobject_typeid === leaseObjectType, ) && - x.evo_visible_calc, + x.evo_visible_calc && + x.evo_min_first_payment_perc && + x.evo_min_first_payment_perc <= firstPaymentPerc && + x.evo_max_first_payment_perc && + x.evo_max_first_payment_perc >= firstPaymentPerc && + !x.evo_models?.map(x => x.evo_modelid).includes(modelId), ), ); }, 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 949d88d..d0bc4db 100644 --- a/src/core/services/CrmService/graphql/query/options/main_options.graphql +++ b/src/core/services/CrmService/graphql/query/options/main_options.graphql @@ -311,5 +311,10 @@ query GetMainOptions( evo_min_price evo_max_price evo_loss_kv + evo_min_first_payment_perc + evo_max_first_payment_perc + evo_models { + evo_modelid + } } } diff --git a/src/core/services/CrmService/graphql/schema.graphql b/src/core/services/CrmService/graphql/schema.graphql index 4eaf8c3..a9da930 100644 --- a/src/core/services/CrmService/graphql/schema.graphql +++ b/src/core/services/CrmService/graphql/schema.graphql @@ -405,6 +405,7 @@ type account { evo_div_12month: Boolean evo_documents(evo_documenttypeid_param: GuidParamInput, latestversion: Boolean = true): [evo_document] evo_economic_security_systemuserid: Uuid + evo_edos: [evo_edo] evo_employee_count: Int evo_fingap_number_rules: Int evo_fin_department_accountid: Uuid @@ -557,11 +558,14 @@ type evo_addproduct_type { evo_leasingobject_types(statecode: Int): [evo_leasingobject_type] evo_loss_kv: Decimal evo_max_age: Int + evo_max_first_payment_perc: Decimal evo_max_period: Decimal evo_max_price: Decimal evo_min_age: Int + evo_min_first_payment_perc: Decimal evo_min_period: Decimal evo_min_price: Decimal + evo_models: [evo_model] evo_name: String evo_nsib_limit: Decimal evo_planpayments(statecode: Int): [evo_planpayment] @@ -665,6 +669,7 @@ type evo_insurance_period { evo_invoice_date: DateTime evo_kasko_price: Decimal evo_leasingobjectid: Uuid + evo_loss_kv: Decimal evo_mobile_discount: Boolean evo_mobile_discount_factor: Decimal evo_mobile_discount_rub: Decimal @@ -2586,6 +2591,7 @@ type email { regardingobjectid_evo_list: Uuid regardingobjectid_incident: Uuid regardingobjectid_opportunity: Uuid + statecode: Int statuscode: Int subject: String templateid: Uuid @@ -2743,6 +2749,31 @@ type team { toObjectString: String } +type evo_edo { + createdon: DateTime + evo_accountid: Uuid + evo_accountidData: account + evo_activation_status: Int + evo_activation_statusname: String + evo_box_edoid: Uuid + evo_box_edoidData: evo_edo + evo_box_id: String + evo_box_name: String + evo_documentid: Uuid + evo_edoid: Uuid + evo_edo_status: Int + evo_edo_statusname: String + evo_edo_type: Int + evo_edo_typeename: String + evo_invite_crm_status: Int + evo_invite_crm_statusname: String + evo_name: String + evo_statuscodeid: Uuid + evo_statuscodeidData: evo_statuscode + modifiedon: DateTime + toObjectString: String +} + type evo_insurance_policy { createdon: DateTime evo_accountid: Uuid diff --git a/src/core/services/CrmService/types/entities.ts b/src/core/services/CrmService/types/entities.ts index 0ecabf9..df372ed 100644 --- a/src/core/services/CrmService/types/entities.ts +++ b/src/core/services/CrmService/types/entities.ts @@ -403,6 +403,12 @@ export interface IEvoAddproductType extends BaseEntity { evo_type_calc_cerebellum?: number; evo_addproduct_types?: IEvoAddproductType[]; evo_evokasko_calc_type?: number; + evo_min_price?: number; + evo_max_price?: number; + evo_loss_kv?: number; + evo_min_first_payment_perc?: number; + evo_max_first_payment_perc?: number; + evo_models?: IEvoModel; } export interface IEvoTarif extends BaseEntity { @@ -435,9 +441,6 @@ export interface IEvoTarif extends BaseEntity { evo_delivery_time?: number[]; evo_cut_irr_with_bonus_coefficient?: number; evo_margin_min?: number; - evo_min_price?: number; - evo_max_price?: number; - evo_loss_kv?: number; } export interface IEvoRate extends BaseEntity { From c6f8d2d2cac4c4b5ad882b797d526cb76d7ac636 Mon Sep 17 00:00:00 2001 From: Chika Date: Thu, 29 Sep 2022 16:35:12 +0300 Subject: [PATCH 13/22] fix 450eb18 --- .../Effects/reactions/otherReactions.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index fbe74b2..ba5532a 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -867,12 +867,12 @@ const reactionEffects: IReactionEffect[] = [ calculationStore.setFilter('selectLeasingWithoutKasko', options => options.filter( x => - x?.evo_max_period && - x?.evo_min_period && + x?.evo_max_period !== undefined && + x?.evo_min_period !== undefined && x.evo_max_period >= leasingPeriod && x.evo_min_period <= leasingPeriod && - x?.evo_max_price && - x?.evo_min_price && + x?.evo_max_price !== undefined && + x?.evo_min_price !== undefined && x.evo_max_price >= plPriceRub - discountRub - importProgramSum + addEquipmentPrice && x.evo_min_price <= @@ -881,9 +881,9 @@ const reactionEffects: IReactionEffect[] = [ x => x.evo_leasingobject_typeid === leaseObjectType, ) && x.evo_visible_calc && - x.evo_min_first_payment_perc && + x.evo_min_first_payment_perc !== undefined && x.evo_min_first_payment_perc <= firstPaymentPerc && - x.evo_max_first_payment_perc && + x.evo_max_first_payment_perc !== undefined && x.evo_max_first_payment_perc >= firstPaymentPerc && !x.evo_models?.map(x => x.evo_modelid).includes(modelId), ), From 5175283894a2de384d048c356e2d977925dced0f Mon Sep 17 00:00:00 2001 From: Chika Date: Tue, 4 Oct 2022 11:43:32 +0300 Subject: [PATCH 14/22] =?UTF-8?q?process/agents:=20=D0=BF=D0=BE=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D0=B8=20indAgentRewardSumm=20 indAgentRewardCondition.evo_min_reward_summ + indAgentRewardSumm < indAgentRewardCondition.evo_min_reward_summ ) { $calculation.setValidation('tbxIndAgentRewardSumm', false); openNotification({ @@ -553,7 +553,7 @@ export default function agentsReactions($calculation: ICalculationStore) { }); } else if ( selectCalcDoubleAgentRewardCondition?.evo_min_reward_summ && - calcDoubleAgentRewardSumm > + calcDoubleAgentRewardSumm < selectCalcDoubleAgentRewardCondition.evo_min_reward_summ ) { $calculation.setValidation('tbxCalcDoubleAgentRewardSumm', false); From 11f64d1a6ada929dc2cbf0bcb9a927b3ef7e024b Mon Sep 17 00:00:00 2001 From: Chika Date: Mon, 24 Oct 2022 11:40:44 +0300 Subject: [PATCH 15/22] =?UTF-8?q?[fix]=20process/bonuses:=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D0=B8=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D0=BA=D1=83=20sale=20bonus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/process/bonuses/reactions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/process/bonuses/reactions.ts b/src/client/process/bonuses/reactions.ts index dbffe4d..55dcef5 100644 --- a/src/client/process/bonuses/reactions.ts +++ b/src/client/process/bonuses/reactions.ts @@ -75,7 +75,7 @@ export default function ($calculation: ICalculationStore) { if (evo_coefficient_bonus?.evo_sot_coefficient) { const max_sale_bonus = evo_coefficient_bonus.evo_sot_coefficient * 100; - if (parseFloat(saleBonus) > round(max_sale_bonus, 2)) { + if (round(saleBonus, 2) > round(max_sale_bonus, 2)) { $calculation.setValidation('tbxSaleBonus', false); openNotification({ type: 'error', From ebfc5d5d861bca7f6c7bddee2a636cc6108ecf16 Mon Sep 17 00:00:00 2001 From: Chika Date: Mon, 24 Oct 2022 18:12:16 +0300 Subject: [PATCH 16/22] 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 } } From 7daff3cccea2e73fa370127c776df5b804d2bca4 Mon Sep 17 00:00:00 2001 From: Chika Date: Tue, 25 Oct 2022 13:37:33 +0300 Subject: [PATCH 17/22] =?UTF-8?q?recalc:=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=BA=D0=B0=20=D1=81=D1=82=D0=BE=D0=B8=D0=BC=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B8=20=D0=BF=D1=80=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D1=81=D1=87=D0=B5=D1=82=D0=B5=20=D0=B1=D0=B5=D0=B7=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D1=81=D0=BC=D0=BE=D1=82=D1=80=D0=B0=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=91=D0=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reactions/recalcWoRevisionReactions.ts | 15 ++++++++++++++- .../query/quote/fragments/quoteFields.graphql | 3 --- .../query/quote/fragments/quoteFieldsLite.graphql | 4 ++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts index 56eefd7..cdd5e10 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts @@ -134,19 +134,32 @@ const reactionEffects: IReactionEffect[] = [ const quote = calculationStore.getOption('selectQuote'); + const leaseObjectUsed = calculationStore.getValue('leaseObjectUsed'); + const maxCondition1 = + leaseObjectUsed === false && quote?.evo_max_price_change && !product?.evo_sale_without_nds && price - supplierDiscountRub + addEquipmentPrice - importProgramSum > quote.evo_max_price_change; const maxCondition2 = + leaseObjectUsed === false && quote?.evo_max_price_change && product?.evo_sale_without_nds && leaseObjectPriceWthtVAT > quote.evo_max_price_change - (quote.evo_nds_in_price_supplier_currency || 0); + const maxCondition3 = + leaseObjectUsed === true && + quote?.evo_supplier_currency_price && + price - supplierDiscountRub + addEquipmentPrice - importProgramSum > + quote.evo_supplier_currency_price - + (quote.evo_discount_supplier_currency || 0) + + (quote.evo_equip_price || 0) - + (quote.evo_program_import_subsidy_sum || 0); + const minCondition1 = quote?.evo_min_change_price && !product?.evo_sale_without_nds && @@ -160,7 +173,7 @@ const reactionEffects: IReactionEffect[] = [ quote.evo_min_change_price - (quote.evo_nds_in_price_supplier_currency || 0); - if (maxCondition1 || maxCondition2) { + if (maxCondition1 || maxCondition2 || maxCondition3) { calculationStore.setValidation('tbxLeaseObjectPrice', false); openNotification({ type: 'error', diff --git a/src/core/services/CrmService/graphql/query/quote/fragments/quoteFields.graphql b/src/core/services/CrmService/graphql/query/quote/fragments/quoteFields.graphql index 0d3b50e..27f90f3 100644 --- a/src/core/services/CrmService/graphql/query/quote/fragments/quoteFields.graphql +++ b/src/core/services/CrmService/graphql/query/quote/fragments/quoteFields.graphql @@ -72,9 +72,7 @@ fragment quoteFields on quote { evo_payment_redemption_sum evo_client_typeid - evo_supplier_currency_price evo_transactioncurrencyid - evo_discount_supplier_currency evo_discount_perc evo_last_payment_calc evo_last_payment_rub @@ -142,7 +140,6 @@ fragment quoteFields on quote { evo_nds_in_price_supplier_currency evo_engine_hours evo_program_import_subsidyid - evo_equip_price evo_accept_period evo_db_accept_registration evo_vin diff --git a/src/core/services/CrmService/graphql/query/quote/fragments/quoteFieldsLite.graphql b/src/core/services/CrmService/graphql/query/quote/fragments/quoteFieldsLite.graphql index 69b84fe..46bd182 100644 --- a/src/core/services/CrmService/graphql/query/quote/fragments/quoteFieldsLite.graphql +++ b/src/core/services/CrmService/graphql/query/quote/fragments/quoteFieldsLite.graphql @@ -25,4 +25,8 @@ fragment quoteFieldsLite on quote { evo_last_payment_perc evo_purchases_participation evo_baseproductid + evo_discount_supplier_currency + evo_program_import_subsidy_sum + evo_equip_price + evo_supplier_currency_price } From 9ec32586f2c0c74df32064e65bc5760ff97a0d64 Mon Sep 17 00:00:00 2001 From: Chika Date: Thu, 27 Oct 2022 11:53:57 +0300 Subject: [PATCH 18/22] =?UTF-8?q?process/leasingWithoutKasko:=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=D0=B8=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Effects/reactions/otherReactions.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index ba5532a..1c62666 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -894,6 +894,28 @@ const reactionEffects: IReactionEffect[] = [ }, }), + calculationStore => ({ + expression: () => { + return { + options: calculationStore.getOptions( + 'selectLeasingWithoutKasko', + undefined, + true, + ), + value: calculationStore.getValue('leasingWithoutKasko'), + }; + }, + effect: (nextValues, prevValues) => { + if (prevValues.value && !nextValues.value) { + openNotification({ + type: 'warning', + message: 'Внимание', + description: 'Лизинг без КАСКО был сброшен', + }); + } + }, + }), + calculationStore => ({ expression: () => { const { leasingPeriod, leaseObjectType } = calculationStore.values; From 7a3315df838a62b38f2a1f0da3d2fd744037e4b0 Mon Sep 17 00:00:00 2001 From: Chika Date: Mon, 31 Oct 2022 14:25:51 +0300 Subject: [PATCH 19/22] =?UTF-8?q?loadKP:=20=D0=BF=D0=BE=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D0=BB=D0=B8=20selectRegionRegistration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Effects/reactions/loadKpReaction/index.ts | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts index cb7fb30..37448af 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts @@ -4,7 +4,7 @@ import { resetIns } from 'client/Containers/Calculation/Components/ELT/lib/reset import { numberElementsProps } from 'client/Containers/Calculation/Elements/props/common'; import { getTitle, - getValueName + getValueName, } from 'client/Containers/Calculation/Elements/tools'; import { ElementsNames } from 'client/Containers/Calculation/types/elements'; import { openNotification } from 'client/Elements/Notification'; @@ -14,7 +14,7 @@ import { mainOptionsForQuoteQuery, quoteQuery, secondaryOptionsForQuoteQuery, - singleOptionsForQuoteQuery + singleOptionsForQuoteQuery, } from 'core/services/CrmService/graphql/query/quote'; import { TOptionizedEntity } from 'core/services/CrmService/types/common'; import { @@ -23,7 +23,7 @@ import { IEvoGraph, IEvoRewardCondition, IEvoTown, - IQuote + IQuote, } from 'core/services/CrmService/types/entities'; import { currentISODate } from 'core/tools/date'; import { NIL } from 'core/tools/uuid'; @@ -601,9 +601,24 @@ const loadKpReaction: IReactionEffect = calculationStore => ({ // regionRegistration if (objectRegistration === 100000001) { regionRegistration = quote.evo_regionid; - calculationStore.setFilter('selectRegionRegistration', regions => - regions.filter(x => x.evo_businessunit_evolution === true), - ); + + const filter = regions => + regions.filter(x => x.evo_businessunit_evolution === true); + + calculationStore.setFilter('selectRegionRegistration', filter); + + /** + * TODO: Для нового калькулятора: + * костыль: скидываем значение поля selectRegionRegistration + * после фильтрации чтобы не ставилось значение из КП которого нет в отфильтрованном списке + */ + if ( + !calculationStore + .getOptions('selectRegionRegistration', undefined, true) + ?.find(x => x.value === regionRegistration) + ) { + regionRegistration = null; + } calculationStore.setStatus( 'selectRegionRegistration', ElementStatus.Default, From fab79f81d09a8ad36a57c265131ed0f78489cf67 Mon Sep 17 00:00:00 2001 From: Chika Date: Mon, 31 Oct 2022 14:33:01 +0300 Subject: [PATCH 20/22] =?UTF-8?q?ELT/Osago:=20=D0=BD=D0=B5=20=D1=81=D1=87?= =?UTF-8?q?=D0=B8=D1=82=D0=B0=D0=B5=D0=BC=20=D0=BF=D1=80=D0=B8=D1=86=D0=B5?= =?UTF-8?q?=D0=BF=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/ELT/Osago/lib/validation.ts | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/client/Containers/Calculation/Components/ELT/Osago/lib/validation.ts b/src/client/Containers/Calculation/Components/ELT/Osago/lib/validation.ts index a86565d..2b549ed 100644 --- a/src/client/Containers/Calculation/Components/ELT/Osago/lib/validation.ts +++ b/src/client/Containers/Calculation/Components/ELT/Osago/lib/validation.ts @@ -20,6 +20,29 @@ export const requiredFields: ElementsNames[] = [ ]; const osagoConditions: Partial> = { + selectLeaseObjectType: calculationStore => { + const leaseObjectType = calculationStore.getOption('selectLeaseObjectType'); + // Проверяем на мотоцикл + if (leaseObjectType?.evo_id && ['11'].includes(leaseObjectType?.evo_id)) { + return { + isValid: false, + message: `По данному Типу предмета лизинга возможен только индивидуальный запрос тарифов КАСКО и ОСАГО. Просьба обратиться на адрес strakhovka@evoleasing.ru`, + }; + } + + if ( + leaseObjectType?.evo_id && + !['1', '2', '3', '6', '7', '9', '10'].includes(leaseObjectType?.evo_id) + ) { + return { + isValid: false, + message: `Для выбранной категории ТС расчет в ЭЛТ недоступен`, + }; + } + return { + isValid: true, + }; + }, selectTownRegistration: calculationStore => { const objectRegistration = calculationStore.getValue('objectRegistration'); if (objectRegistration === 100000001) { @@ -39,7 +62,7 @@ const osagoConditions: Partial> = { const conditions = Object.assign( osagoConditions, - omit(kaskoConditions, ['selectEngineType']), + omit(kaskoConditions, ['selectEngineType', 'selectLeaseObjectType']), ); export const resetFields: ElementsNames[] = [ From 48a00c301ff3192fafc9f2e657f2cca0006b7dbf Mon Sep 17 00:00:00 2001 From: Chika Date: Tue, 1 Nov 2022 19:09:59 +0300 Subject: [PATCH 21/22] =?UTF-8?q?=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=20=D1=80?= =?UTF-8?q?=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0=D1=82=D0=BE=D0=B2:?= =?UTF-8?q?=20=D1=81=D0=BA=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BB=D0=B8=20resultIRRGraphPerc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CalculationStore/Effects/actions/calculate/results.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/results.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/results.ts index 0e13dc8..4fb23e4 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/results.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/results.ts @@ -61,7 +61,7 @@ export default { ); this.setValue( 'resultIRRGraphPerc', - (res?.columns?.cashflowColumn?.irr || 0) * 100, + (res?.columns?.sumColumn?.irr || 0) * 100, ); this.setValue( 'resultIRRNominalPerc', From e22d25c64bbc16600fabd5a4f394ffc45ac4b368 Mon Sep 17 00:00:00 2001 From: Chika Date: Wed, 2 Nov 2022 16:00:31 +0300 Subject: [PATCH 22/22] =?UTF-8?q?elt:=20=D1=83=D0=B1=D1=80=D0=B0=D0=BB?= =?UTF-8?q?=D0=B8=20=D0=B8=D0=B7=20=D0=BE=D1=81=D0=B0=D0=B3=D0=BE=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D1=83=20=D0=BD=D0=B0=20evo?= =?UTF-8?q?-kasko?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Calculation/Components/ELT/Osago/lib/validation.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/Containers/Calculation/Components/ELT/Osago/lib/validation.ts b/src/client/Containers/Calculation/Components/ELT/Osago/lib/validation.ts index 2b549ed..246bccc 100644 --- a/src/client/Containers/Calculation/Components/ELT/Osago/lib/validation.ts +++ b/src/client/Containers/Calculation/Components/ELT/Osago/lib/validation.ts @@ -62,7 +62,11 @@ const osagoConditions: Partial> = { const conditions = Object.assign( osagoConditions, - omit(kaskoConditions, ['selectEngineType', 'selectLeaseObjectType']), + omit(kaskoConditions, [ + 'selectEngineType', + 'selectLeaseObjectType', + 'selectLeasingWithoutKasko', + ]), ); export const resetFields: ElementsNames[] = [