diff --git a/src/client/Containers/Calculation/Components/Sections/sectionsList.ts b/src/client/Containers/Calculation/Components/Sections/sectionsList.ts index d7665b0..644ffcf 100644 --- a/src/client/Containers/Calculation/Components/Sections/sectionsList.ts +++ b/src/client/Containers/Calculation/Components/Sections/sectionsList.ts @@ -60,6 +60,14 @@ const sections: ISection[] = [ { elements: ['labelSubsidySum'] }, ], }, + { + style: { gridTemplateColumns: '1fr 1fr 1fr' }, + blocks: [ + { elements: ['selectImportProgram'] }, + { elements: ['labelImportProgramSum'] }, + { elements: ['tbxAddEquipmentPrice'] }, + ], + }, { style: { columnsNumber: 3 }, blocks: [ diff --git a/src/client/Containers/Calculation/Elements/builders/index.ts b/src/client/Containers/Calculation/Elements/builders/index.ts index 74f2c19..a3553d1 100644 --- a/src/client/Containers/Calculation/Elements/builders/index.ts +++ b/src/client/Containers/Calculation/Elements/builders/index.ts @@ -29,6 +29,7 @@ const overrideBuilders: Record< btnCreateKP: buildAction, btnCalculate: buildAction, linkDownloadKp: buildLink, + labelImportProgramSum: buildComputed, componentElt: () => ELT, componentfinGAP: () => finGAP, tablePayments: ({ name, Component }) => diff --git a/src/client/Containers/Calculation/Elements/components.ts b/src/client/Containers/Calculation/Elements/components.ts index b3f5938..8bbd648 100644 --- a/src/client/Containers/Calculation/Elements/components.ts +++ b/src/client/Containers/Calculation/Elements/components.ts @@ -133,12 +133,15 @@ export default { selectFuelCard: Select, labelSubsidySum: Label, tbxMinPriceChange: InputNumber, + selectImportProgram: Select, + tbxAddEquipmentPrice: InputNumber, /** Computed Elements */ labelLeaseObjectRisk: Label, tbxInsKaskoPriceLeasePeriod: InputNumber, labelIrrInfo: Label, labelRegistrationDescription: Label, + labelImportProgramSum: Label, /** Result Elements */ labelResultTotalGraphwithNDS: Label, diff --git a/src/client/Containers/Calculation/Elements/props/common.ts b/src/client/Containers/Calculation/Elements/props/common.ts index 5f9a221..34f7b57 100644 --- a/src/client/Containers/Calculation/Elements/props/common.ts +++ b/src/client/Containers/Calculation/Elements/props/common.ts @@ -359,6 +359,16 @@ const elementsProps: Partial> = { radioInfuranceOPF: { style: 'button', }, + tbxAddEquipmentPrice: { + min: '0', + max: '1000000000', + step: '10000.00', + precision: 2, + formatter: formatNumber, + }, + labelImportProgramSum: { + middleware: value => formatMoney(value), + }, }; export const numberElementsProps: Partial> = diff --git a/src/client/Containers/Calculation/Elements/titles.ts b/src/client/Containers/Calculation/Elements/titles.ts index 2fa6c00..d025b1b 100644 --- a/src/client/Containers/Calculation/Elements/titles.ts +++ b/src/client/Containers/Calculation/Elements/titles.ts @@ -125,6 +125,9 @@ export const elementsTitles: Partial> = { tbxEngineHours: 'Моточасы', tbxLeaseObjectPriceWthtVAT: 'Стоимость ПЛ без НДС', tbxVATInLeaseObjectPrice: 'НДС в стоимости ПЛ', + selectImportProgram: 'Программа от производителя', + labelImportProgramSum: 'Скидка от производителя, руб., с НДС', + tbxAddEquipmentPrice: 'Стоимость доп.оборудования', /** Result Elements */ labelResultTotalGraphwithNDS: 'Итого по графику, с НДС', diff --git a/src/client/Containers/Calculation/Elements/values.ts b/src/client/Containers/Calculation/Elements/values.ts index 59bf090..bba0602 100644 --- a/src/client/Containers/Calculation/Elements/values.ts +++ b/src/client/Containers/Calculation/Elements/values.ts @@ -132,6 +132,8 @@ const elementsValues: Record = { labelSubsidySum: 'subsidySum', selectFuelCard: 'fuelCard', tbxMinPriceChange: 'minPriceChange', + selectImportProgram: 'importProgram', + tbxAddEquipmentPrice: 'addEquipmentPrice', /** Result Elements */ labelResultTotalGraphwithNDS: 'resultTotalGraphwithNDS', @@ -162,6 +164,7 @@ const elementsComputedValues: Record< tbxInsKaskoPriceLeasePeriod: 'insKaskoPriceLeasePeriod', labelIrrInfo: 'irrInfo', labelRegistrationDescription: 'registrationDescription', + labelImportProgramSum: 'importProgramSum', }; const elementsActions: Record = { diff --git a/src/client/Containers/Calculation/types/elements.ts b/src/client/Containers/Calculation/types/elements.ts index ee927f3..b628711 100644 --- a/src/client/Containers/Calculation/types/elements.ts +++ b/src/client/Containers/Calculation/types/elements.ts @@ -116,6 +116,11 @@ export type ElementsNames = | 'labelSubsidySum' | 'selectFuelCard' | 'tbxMinPriceChange' + | 'tbxEngineHours' + | 'selectImportProgram' + | 'tbxLeaseObjectPriceWthtVAT' + | 'tbxVATInLeaseObjectPrice' + | 'tbxAddEquipmentPrice' /** Result Elements */ | 'labelResultTotalGraphwithNDS' | 'labelResultPlPrice' @@ -134,10 +139,7 @@ export type ElementsNames = | 'labelResultDopMPLLeasing' | 'labelResultBonusDopProd' | 'labelResultBonusSafeFinance' - | 'labelResultFirstPaymentRiskPolicy' - | 'tbxLeaseObjectPriceWthtVAT' - | 'tbxVATInLeaseObjectPrice' - | 'tbxEngineHours'; + | 'labelResultFirstPaymentRiskPolicy'; export type ButtonElementsNames = 'btnCreateKP' | 'btnCalculate'; export type LinkElementsNames = 'linkDownloadKp'; @@ -145,7 +147,8 @@ export type ComputedElementsNames = | 'labelLeaseObjectRisk' | 'tbxInsKaskoPriceLeasePeriod' | 'labelIrrInfo' - | 'labelRegistrationDescription'; + | 'labelRegistrationDescription' + | 'labelImportProgramSum'; export type CustomComponents = 'componentElt' | 'componentfinGAP'; diff --git a/src/client/Elements/Label.jsx b/src/client/Elements/Label.jsx index 9aec46e..ff8ec2d 100644 --- a/src/client/Elements/Label.jsx +++ b/src/client/Elements/Label.jsx @@ -7,7 +7,7 @@ const Text = styled.span` font-size: 0.85rem; `; -const Label = ({ value = '-', middleware }) => { +const Label = ({ value, middleware }) => { //TODO: Hide if no value return ( diff --git a/src/client/process/configurator/reactions/filters.ts b/src/client/process/configurator/reactions/filters.ts index 922fc4f..fd764dd 100644 --- a/src/client/process/configurator/reactions/filters.ts +++ b/src/client/process/configurator/reactions/filters.ts @@ -10,8 +10,9 @@ export default function ($calculation: ICalculationStore) { () => ({ product: $calculation.getOption('selectProduct'), subsidy: $calculation.getOption('selectSubsidy'), + importProgram: $calculation.getOption('selectImportProgram'), }), - ({ product, subsidy }) => { + ({ product, subsidy, importProgram }) => { /** * * @description @@ -29,26 +30,42 @@ export default function ($calculation: ICalculationStore) { в поле Тип предмета лизинга selectLeaseObjectType - указываются те, которые связаны с продуктом. Если с Продуктом нет связанных Типов предмета лизинга, то указывается весь список. Это надо добавить в текущие условия фильтрации данного поля + + #3 + Тип предмета лизинга selectLeaseObjectType + если с записью Субсидия нет связанных Типов предмета лизинга, + то указываются все записи согласно текущей фильтрации, + иначе указываются те записи, которые связаны с Субсидией, указанной в поле selectImportProgram */ $calculation.setFilter('selectLeaseObjectType', types => types.filter( pipe( - type => + leasingObjectType => (!product?.evo_leasingobject_types?.length || product.evo_leasingobject_types.filter( x => x.evo_leasingobject_typeid === - type?.evo_leasingobject_typeid, + leasingObjectType?.evo_leasingobject_typeid, )?.length) && - type, - type => + leasingObjectType, + leasingObjectType => //@ts-ignore - type && + leasingObjectType && (!subsidy?.evo_leasingobject_types?.length || subsidy.evo_leasingobject_types.filter( x => x.evo_leasingobject_typeid === - type.evo_leasingobject_typeid, + leasingObjectType.evo_leasingobject_typeid, + )?.length) && + leasingObjectType, + leasingObjectType => + //@ts-ignore + leasingObjectType && + (!importProgram?.evo_leasingobject_types?.length || + importProgram.evo_leasingobject_types.filter( + x => + x.evo_leasingobject_typeid === + leasingObjectType.evo_leasingobject_typeid, )?.length), ), ), @@ -56,19 +73,40 @@ export default function ($calculation: ICalculationStore) { $calculation.setFilter('selectDealer', dealers => dealers.filter( - dealer => - !subsidy?.accounts?.length || - subsidy.accounts.filter(x => x.accountid === dealer.accountid) - ?.length, + pipe( + dealer => + (!subsidy?.accounts?.length || + subsidy.accounts.filter(x => x.accountid === dealer.accountid) + ?.length) && + dealer, + dealer => + //@ts-ignore + !importProgram?.accounts?.length || + importProgram.accounts.filter( + //@ts-ignore + x => x.accountid === dealer.accountid, + )?.length, + ), ), ); $calculation.setFilter('selectDealerPerson', dealerPersons => dealerPersons.filter( - dealerPerson => - !subsidy?.accounts?.length || - subsidy.accounts.filter(x => x.accountid === dealerPerson.accountid) - ?.length, + pipe( + dealerPerson => + (!subsidy?.accounts?.length || + subsidy.accounts.filter( + x => x.accountid === dealerPerson.accountid, + )?.length) && + dealerPerson, + dealerPerson => + //@ts-ignore + !importProgram?.accounts?.length || + importProgram.accounts.filter( + //@ts-ignore + x => x.accountid === dealerPerson.accountid, + )?.length, + ), ), ); }, diff --git a/src/client/process/subsidy-import-program/reactions.ts b/src/client/process/subsidy-import-program/reactions.ts new file mode 100644 index 0000000..3cbc42b --- /dev/null +++ b/src/client/process/subsidy-import-program/reactions.ts @@ -0,0 +1,111 @@ +import { ICalculationStore } from 'core/types/Calculation/Store'; +import { reaction } from 'mobx'; +import { ElementStatus } from 'types/elements'; + +export default function ($calculation: ICalculationStore) { + /** + * @description + * на изменение selectProduct, selectSubsidy или selectImportProgram +если selectSusidy или selectImportProgram содержит данные, то selectSupplierCurrency закрыта для редактирования, +иначе + если selectProduct не содержит данные, то selectSupplierCurrency закрыта для редактирования, иначе + если (в поле Продукт selectProduct выбрана запись, у которой БУбезНДС evo_sale_without_nds = True), + то selectSupplierCurrency закрыта для редактирования + иначе selectSupplierCurrency открыто для редактирования + */ + + reaction( + () => { + const product = $calculation.getOption('selectProduct'); + const { subsidy, importProgram } = $calculation.values; + return { product, subsidy, importProgram }; + }, + ({ product, subsidy, importProgram }) => { + const supplierCurrency = + $calculation.options.selectSupplierCurrency?.find( + x => x.isocurrencycode === 'RUB', + ); + if (subsidy || importProgram) { + $calculation.setValue( + 'supplierCurrency', + supplierCurrency?.transactioncurrencyid, + ); + } else if (!product) { + $calculation.setValue( + 'supplierCurrency', + supplierCurrency?.transactioncurrencyid, + ); + } else { + if (product.evo_sale_without_nds) { + $calculation.setValue( + 'supplierCurrency', + supplierCurrency?.transactioncurrencyid, + ); + } + } + }, + ); + + /** + * @description + * на изменение selectProduct, selectSubsidy или selectImportProgram +если selectSusidy или selectItProgram содержит данные, то selectSupplierCurrency = RUB, +иначе +если selectProduct не содержит данные, то selectSupplierCurrency = RUB, иначе +если (в поле Продукт selectProduct выбрана запись, у которой БУбезНДС evo_sale_without_nds = True), + то selectSupplierCurrency = RUB +иначе без изменения + + + */ + reaction( + () => { + const product = $calculation.getOption('selectProduct'); + const { subsidy, importProgram } = $calculation.values; + return { product, subsidy, importProgram }; + }, + ({ product, subsidy, importProgram }) => { + if (subsidy || importProgram) { + $calculation.setStatus( + 'selectSupplierCurrency', + ElementStatus.Disabled, + ); + } else if (!product) { + $calculation.setStatus( + 'selectSupplierCurrency', + ElementStatus.Disabled, + ); + } else { + if (product.evo_sale_without_nds) { + $calculation.setStatus( + 'selectSupplierCurrency', + ElementStatus.Disabled, + ); + } else { + $calculation.setStatus( + 'selectSupplierCurrency', + ElementStatus.Default, + ); + } + } + }, + ); + /** + * @description + * При изменении "Программа от производителя" selectImportProgram (работает при загрузке КП) +Если поле "Программа от производителя" selectImportProgram не содержит данные, +то поле "Стоимость доп.оборудования" tbxAddEquipmentPrice закрыть для редактирования и значение равно 0, + иначе оставлять открытым для редактирования + */ + reaction( + () => $calculation.getValue('importProgram'), + importProgram => { + if (!importProgram) { + $calculation.setStatus('tbxAddEquipmentPrice', ElementStatus.Disabled); + $calculation.setValue('addEquipmentPrice', 0); + } else { + $calculation.setStatus('tbxAddEquipmentPrice', ElementStatus.Default); + } + }, + ); +} diff --git a/src/client/process/used-pl/reactions.ts b/src/client/process/used-pl/reactions.ts index f290fa8..6ce589a 100644 --- a/src/client/process/used-pl/reactions.ts +++ b/src/client/process/used-pl/reactions.ts @@ -43,11 +43,6 @@ export default function ($calculation: ICalculationStore) { }), ({ product }) => { if (!product) { - $calculation.setStatus( - 'selectSupplierCurrency', - ElementStatus.Disabled, - ); - $calculation.setStatus( 'tbxSupplierDiscountRub', ElementStatus.Disabled, @@ -64,16 +59,12 @@ export default function ($calculation: ICalculationStore) { 'tbxVATInLeaseObjectPrice', ElementStatus.Disabled, ); + $calculation.setStatus('selectImportProgram', ElementStatus.Default); } else { const { evo_sale_without_nds } = product; if (evo_sale_without_nds) { $calculation.setStatus('cbxLeaseObjectUsed', ElementStatus.Disabled); - $calculation.setStatus( - 'selectSupplierCurrency', - ElementStatus.Disabled, - ); - $calculation.setStatus( 'tbxSupplierDiscountRub', ElementStatus.Disabled, @@ -90,14 +81,11 @@ export default function ($calculation: ICalculationStore) { 'tbxVATInLeaseObjectPrice', ElementStatus.Default, ); + + $calculation.setStatus('selectImportProgram', ElementStatus.Disabled); } else { $calculation.setStatus('cbxLeaseObjectUsed', ElementStatus.Default); - $calculation.setStatus( - 'selectSupplierCurrency', - ElementStatus.Default, - ); - $calculation.setStatus( 'tbxSupplierDiscountRub', ElementStatus.Default, @@ -114,6 +102,8 @@ export default function ($calculation: ICalculationStore) { 'tbxVATInLeaseObjectPrice', ElementStatus.Disabled, ); + + $calculation.setStatus('selectImportProgram', ElementStatus.Default); } } }, @@ -127,15 +117,6 @@ export default function ($calculation: ICalculationStore) { if ($calculation.stores.calculationProcess.hasProcess(Process.LoadKp)) return; if (!product) { - const supplierCurrency = - $calculation.options.selectSupplierCurrency?.find( - x => x.isocurrencycode === 'RUB', - ); - $calculation.setValue( - 'supplierCurrency', - supplierCurrency?.transactioncurrencyid, - ); - $calculation.setValue('supplierDiscountRub', 0); $calculation.setValue('supplierDiscountRub', 0); @@ -145,23 +126,18 @@ export default function ($calculation: ICalculationStore) { $calculation.setValue('leaseObjectPriceWthtVAT', 0); $calculation.setValue('VATInLeaseObjectPrice', 0); + + $calculation.setValue('importProgram', null); } else { const { evo_sale_without_nds } = product; if (evo_sale_without_nds) { $calculation.setValue('leaseObjectUsed', true); - const supplierCurrency = - $calculation.options.selectSupplierCurrency?.find( - x => x.isocurrencycode === 'RUB', - ); - $calculation.setValue( - 'supplierCurrency', - supplierCurrency?.transactioncurrencyid, - ); - $calculation.setValue('supplierDiscountRub', 0); $calculation.setValue('supplierDiscountRub', 0); + + $calculation.setValue('importProgram', null); } } }, diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts index 3833bf6..4a7855e 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/prepareData.ts @@ -209,26 +209,32 @@ export default function (this: ICalculationStore): PreparedData { preparedValues.plPrice = convertPrice( supplierCurrency?.isocurrencycode, - values.leaseObjectPriceWthtVAT, + values.leaseObjectPriceWthtVAT + + values.addEquipmentPrice / (1 + valuesConstants.VAT), evo_currencychange?.evo_currencychange || 1, ); preparedValues.plPriceWithVAT = convertPrice( supplierCurrency?.isocurrencycode, - values.leaseObjectPrice, + values.leaseObjectPrice + values.addEquipmentPrice, evo_currencychange?.evo_currencychange || 1, ); preparedValues.plPriceVAT = convertPrice( supplierCurrency?.isocurrencycode, - values.VATInLeaseObjectPrice, + values.VATInLeaseObjectPrice + + (values.addEquipmentPrice - + values.addEquipmentPrice / (1 + valuesConstants.VAT)), evo_currencychange?.evo_currencychange || 1, ); + //@ts-ignore + const importProgramSum = this.importProgramSum(); + preparedValues.discount = convertPrice( supplierCurrency?.isocurrencycode, - values.supplierDiscountRub, + values.supplierDiscountRub + importProgramSum, evo_currencychange?.evo_currencychange || 1, ) / (1 + valuesConstants.VAT); diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/results.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/results.ts index 7687254..8de78cb 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/results.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/results.ts @@ -47,9 +47,13 @@ export default { 'resultTotalGraphwithNDS', (sumWithVatColumn?.values[0] || 0) - (this.getValue('subsidySum') || 0), ); + //@ts-ignore + const importProgramSum = this.importProgramSum(); this.setValue( 'resultPlPrice', - preparedData?.preparedValues?.plPriceWithVAT || 0, + (preparedData?.preparedValues?.plPriceWithVAT || 0) - + this.values.supplierDiscountRub - + importProgramSum, ); this.setValue( 'resultPriceUpPr', diff --git a/src/client/stores/CalculationStore/Effects/autorun.ts b/src/client/stores/CalculationStore/Effects/autorun.ts index 00c48c8..9a75daf 100644 --- a/src/client/stores/CalculationStore/Effects/autorun.ts +++ b/src/client/stores/CalculationStore/Effects/autorun.ts @@ -110,14 +110,20 @@ const autorunEffects: IAutorunEffect[] = [ } }, + // TODO: move to computed + // TODO: для нового калькулятора: перенести в process/subsidy + calculationStore => () => { const subsidy = calculationStore.getOption('selectSubsidy'); if (subsidy?.evo_subsidy_summ && subsidy?.evo_subsidy_summ > 0) { calculationStore.setValue('subsidySum', subsidy?.evo_subsidy_summ); } else { if (subsidy?.evo_max_subsidy_summ) { - const { leaseObjectPrice, supplierDiscountRub } = - calculationStore.values; + const { + leaseObjectPrice, + supplierDiscountRub, + addEquipmentPrice = 0, + } = calculationStore.values; const supplierCurrency = calculationStore.getOption( 'selectSupplierCurrency', ); @@ -130,7 +136,11 @@ const autorunEffects: IAutorunEffect[] = [ ); const plPriceRub = convertPrice( supplierCurrency?.isocurrencycode, - leaseObjectPrice - supplierDiscountRub, + leaseObjectPrice - + supplierDiscountRub - + // @ts-ignore + calculationStore.importProgramSum() + + addEquipmentPrice, evo_currencychange?.evo_currencychange, ); diff --git a/src/client/stores/CalculationStore/Effects/computed.ts b/src/client/stores/CalculationStore/Effects/computed.ts index 8b41861..6524d19 100644 --- a/src/client/stores/CalculationStore/Effects/computed.ts +++ b/src/client/stores/CalculationStore/Effects/computed.ts @@ -96,6 +96,24 @@ const computedEffects: Record = { evo_currencychange?.evo_currencychange || 1, ); }, + + //TODO для нового калькулятора: перенести в process/subsidy + importProgramSum: function () { + const importProgram = this.getOption('selectImportProgram'); + + if (!importProgram) return 0; + if ( + importProgram?.evo_subsidy_summ && + importProgram?.evo_subsidy_summ > 0 + ) { + return importProgram?.evo_subsidy_summ; + } else { + const sum = + //@ts-ignore + (this.plPriceRub() * (importProgram?.evo_percent_subsidy || 0)) / 100; + return Math.min(sum, importProgram?.evo_max_subsidy_summ || 0); + } + }, }; export default computedEffects; diff --git a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/mapKpToValues.ts b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/mapKpToValues.ts index fccd961..bfd7db8 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/mapKpToValues.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/mapKpToValues.ts @@ -95,6 +95,8 @@ const mapKPtoValues: Partial> = { evo_pts_type: 'typePTS', evo_subsidyid: 'subsidy', evo_subsidy_summ: 'subsidySum', + evo_program_import_subsidyid: 'importProgram', + evo_equip_price: 'addEquipmentPrice', }; export function getValuesFromKP(quote: IQuote) { diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index fa54293..b6d7764 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -1377,9 +1377,10 @@ const reactionEffects: IReactionEffect[] = [ leaseObjectType: calculationStore.getOption('selectLeaseObjectType'), product: calculationStore.getOption('selectProduct'), subsidy: calculationStore.getOption('selectSubsidy'), + importProgram: calculationStore.getOption('selectImportProgram'), }; }, - effect: ({ leaseObjectType, product, subsidy }) => { + effect: ({ leaseObjectType, product, subsidy, importProgram }) => { calculationStore.setStatus( 'selectBrand', leaseObjectType ? ElementStatus.Default : ElementStatus.Disabled, @@ -1408,6 +1409,13 @@ const reactionEffects: IReactionEffect[] = [ (!subsidy?.evo_brands?.length || subsidy?.evo_brands?.filter( x => x.evo_brandid === brand.evo_brandid, + )?.length) && + brand, + brand => + brand && + (!importProgram?.evo_brands?.length || + importProgram?.evo_brands?.filter( + x => x.evo_brandid === brand.evo_brandid, )?.length), ), ), @@ -1424,9 +1432,10 @@ const reactionEffects: IReactionEffect[] = [ selectBrandOptions: calculationStore.getOption('selectBrand'), selectBrandFilter: calculationStore.getFilter('selectBrand'), subsidy: calculationStore.getOption('selectSubsidy'), + importProgram: calculationStore.getOption('selectImportProgram'), }; }, - effect: ({ subsidy }) => { + effect: ({ subsidy, importProgram }) => { const leaseObjectType = calculationStore.getOption( 'selectLeaseObjectType', ); @@ -1444,6 +1453,13 @@ const reactionEffects: IReactionEffect[] = [ (!subsidy?.evo_models?.length || subsidy?.evo_models?.filter( x => x.evo_modelid === model.evo_modelid, + )?.length) && + model, + model => + model && + (!importProgram?.evo_models?.length || + importProgram?.evo_models?.filter( + x => x.evo_modelid === model.evo_modelid, )?.length), ), ), diff --git a/src/client/stores/CalculationStore/Effects/reactions/priceReactions/index.ts b/src/client/stores/CalculationStore/Effects/reactions/priceReactions/index.ts index b6bf488..ee5c91a 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/priceReactions/index.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/priceReactions/index.ts @@ -48,10 +48,16 @@ export default [ (calculationStore, calculationProcess) => ({ expression: () => { - const { firstPaymentRub } = calculationStore.values; - return firstPaymentRub; + //@ts-ignore + const importProgramSum = calculationStore.importProgramSum(); + const { firstPaymentRub, addEquipmentPrice } = calculationStore.values; + return { firstPaymentRub, addEquipmentPrice, importProgramSum }; }, - effect: (firstPaymentRub = 0) => { + effect: ({ + firstPaymentRub = 0, + addEquipmentPrice = 0, + importProgramSum = 0, + }) => { if (calculationProcess.hasProcess(Process.LoadKp)) { return; } @@ -59,7 +65,7 @@ export default [ if (leaseObjectPrice) { const perc = calculatePerc(calculationStore)( supplierCurrency, - leaseObjectPrice, + leaseObjectPrice + addEquipmentPrice - importProgramSum, firstPaymentRub, ); calculationStore.setValue('firstPaymentPerc', perc); @@ -74,18 +80,32 @@ export default [ calculationStore => ({ expression: () => { - const { supplierCurrency, leaseObjectPrice, firstPaymentPerc } = - calculationStore.values; - return [supplierCurrency, leaseObjectPrice, firstPaymentPerc]; + //@ts-ignore + const importProgramSum = calculationStore.importProgramSum(); + const { + supplierCurrency, + leaseObjectPrice, + firstPaymentPerc, + addEquipmentPrice, + } = calculationStore.values; + return [ + supplierCurrency, + leaseObjectPrice, + firstPaymentPerc, + addEquipmentPrice, + importProgramSum, + ]; }, effect: ([ supplierCurrencyId, leaseObjectPrice = 0, firstPaymentPerc = 0, + addEquipmentPrice = 0, + importProgramSum = 0, ]) => { const rub = calculateRub(calculationStore)( supplierCurrencyId, - leaseObjectPrice, + leaseObjectPrice + addEquipmentPrice - importProgramSum, firstPaymentPerc, ); @@ -147,17 +167,22 @@ export default [ (calculationStore, calculationProcess) => ({ expression: () => { + //@ts-ignore + const importProgramSum = calculationStore.importProgramSum(); const { supplierCurrency, leaseObjectPrice, lastPaymentPerc, lastPaymentRule, + addEquipmentPrice, } = calculationStore.values; return [ supplierCurrency, leaseObjectPrice, lastPaymentPerc, lastPaymentRule, + addEquipmentPrice, + importProgramSum, ]; }, effect: ([ @@ -165,6 +190,8 @@ export default [ leaseObjectPrice, lastPaymentPerc = 0, lastPaymentRule, + addEquipmentPrice = 0, + importProgramSum = 0, ]) => { if ( lastPaymentRule === 100000000 || @@ -175,7 +202,7 @@ export default [ const rub = calculateRub(calculationStore)( supplierCurrencyId, - leaseObjectPrice, + leaseObjectPrice + addEquipmentPrice - importProgramSum, lastPaymentPerc, ); calculationStore.setValue('lastPaymentRub', rub); @@ -186,17 +213,22 @@ export default [ }), (calculationStore, calculationProcess) => ({ expression: () => { + //@ts-ignore + const importProgramSum = calculationStore.importProgramSum(); const { supplierCurrency, leaseObjectPrice, lastPaymentRub, lastPaymentRule, + addEquipmentPrice, } = calculationStore.values; return [ supplierCurrency, leaseObjectPrice, lastPaymentRub, lastPaymentRule, + addEquipmentPrice, + importProgramSum, ]; }, effect: ([ @@ -204,6 +236,8 @@ export default [ leaseObjectPrice, lastPaymentRub = 0, lastPaymentRule, + addEquipmentPrice = 0, + importProgramSum = 0, ]) => { if ( lastPaymentRule === 100000001 || @@ -214,7 +248,7 @@ export default [ if (leaseObjectPrice) { const perc = calculatePerc(calculationStore)( supplierCurrencyId, - leaseObjectPrice, + leaseObjectPrice + addEquipmentPrice - importProgramSum, lastPaymentRub, ); calculationStore.setValue('lastPaymentPerc', perc); diff --git a/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts index eb9a8b4..599774b 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts @@ -19,13 +19,18 @@ const reactionEffects: IReactionEffect[] = [ supplierDiscountRub, supplierDiscountPerc, leaseObjectPrice, + addEquipmentPrice, } = calculationStore.values; + //@ts-ignore + const importProgramSum = calculationStore.importProgramSum(); return [ recalcWithRevision, supplierCurrency, supplierDiscountRub, supplierDiscountPerc, leaseObjectPrice, + importProgramSum, + addEquipmentPrice, ]; }, effect: ([ @@ -34,13 +39,15 @@ const reactionEffects: IReactionEffect[] = [ supplierDiscountRub, supplierDiscountPerc, leaseObjectPrice, + importProgramSum = 0, + addEquipmentPrice = 0, ]) => { if (recalcWithRevision === true) { return; } const price = getPrice( supplierCurrencyId, - leaseObjectPrice, + leaseObjectPrice + addEquipmentPrice - importProgramSum, calculationStore, ); diff --git a/src/client/stores/CalculationStore/config/initialFilters.ts b/src/client/stores/CalculationStore/config/initialFilters.ts index fffdd13..46c32bb 100644 --- a/src/client/stores/CalculationStore/config/initialFilters.ts +++ b/src/client/stores/CalculationStore/config/initialFilters.ts @@ -1,7 +1,14 @@ import { ElementsNames } from 'client/Containers/Calculation/types/elements'; import { TElementFilter } from 'core/types/Calculation/Store/filters'; -const initialFilters: Partial> = {}; +const initialFilters: Partial> = { + selectSubsidy: subsidies => + subsidies.filter(x => + [100_000_000, 100_000_001].includes(x.evo_subsidy_type), + ), + selectImportProgram: subsidies => + subsidies.filter(x => [100_000_002].includes(x.evo_subsidy_type)), +}; export const noResetValueElements: ElementsNames[] = [ 'selectTechnicalCard', diff --git a/src/client/stores/CalculationStore/config/initialValues.ts b/src/client/stores/CalculationStore/config/initialValues.ts index 60a006b..7c192d2 100644 --- a/src/client/stores/CalculationStore/config/initialValues.ts +++ b/src/client/stores/CalculationStore/config/initialValues.ts @@ -92,5 +92,6 @@ const initialValues: Partial> = { legalClientRegion: null, legalClientTown: null, infuranceOPF: null, + addEquipmentPrice: 0, }; export default initialValues; diff --git a/src/client/stores/CalculationStore/index.ts b/src/client/stores/CalculationStore/index.ts index edd62a4..c2922c8 100644 --- a/src/client/stores/CalculationStore/index.ts +++ b/src/client/stores/CalculationStore/index.ts @@ -1,5 +1,6 @@ import { injectConfiguratorReactions } from 'client/process/configurator/reactions'; import { injectFinGapReactions } from 'client/process/fingap/reactions'; +import injectSubsidyReactions from 'client/process/subsidy-import-program/reactions'; import injectUsedWhthVATReactions from 'client/process/used-pl/reactions'; import { ICalculationStore } from 'core/types/Calculation/Store'; import { isEqual } from 'lodash'; @@ -39,6 +40,7 @@ reactionEffects.map(reactionEffectBuilder => { injectFinGapReactions(CalculationStore); injectUsedWhthVATReactions(CalculationStore); injectConfiguratorReactions(CalculationStore); +injectSubsidyReactions(CalculationStore); whenEffects.map(whenEffectBuilder => { const whenEffect = whenEffectBuilder(CalculationStore); 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 2724bae..77ae76c 100644 --- a/src/core/services/CrmService/graphql/query/options/main_options.graphql +++ b/src/core/services/CrmService/graphql/query/options/main_options.graphql @@ -245,6 +245,7 @@ query GetMainOptions( accounts { accountid } + evo_subsidy_type } selectFuelCard: evo_addproduct_types( statecode: $statecode @@ -258,4 +259,29 @@ query GetMainOptions( evo_leasingobject_typeid } } + selectImportProgram: evo_subsidies( + statecode: $statecode + evo_datefrom_param: { lte: $currentDate } + evo_dateto_param: { gte: $currentDate } + ) { + evo_name + evo_subsidyid + evo_percent_subsidy + evo_subsidy_summ + evo_max_subsidy_summ + evo_get_subsidy_payment + evo_brands { + evo_brandid + } + evo_models { + evo_modelid + } + evo_leasingobject_types { + evo_leasingobject_typeid + } + accounts { + accountid + } + evo_subsidy_type + } } 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 e1536a7..d2cffb9 100644 --- a/src/core/services/CrmService/graphql/query/quote/fragments/quoteFields.graphql +++ b/src/core/services/CrmService/graphql/query/quote/fragments/quoteFields.graphql @@ -136,4 +136,6 @@ fragment quoteFields on quote { evo_price_without_nds_supplier_currency evo_nds_in_price_supplier_currency evo_engine_hours + evo_program_import_subsidyid + evo_equip_price } diff --git a/src/core/services/CrmService/graphql/schema.graphql b/src/core/services/CrmService/graphql/schema.graphql index f43d6b4..ff34c98 100644 --- a/src/core/services/CrmService/graphql/schema.graphql +++ b/src/core/services/CrmService/graphql/schema.graphql @@ -1,15 +1,9 @@ -""" -The cost directives is used to express the complexity of a field. -""" +"""The cost directives is used to express the complexity of a field.""" directive @cost( - """ - Defines the complexity of the field. - """ + """Defines the complexity of the field.""" complexity: Int! = 1 - """ - Defines field arguments that act as complexity multipliers. - """ + """Defines field arguments that act as complexity multipliers.""" multipliers: [MultiplierPath!] ) on FIELD_DEFINITION @@ -29,9 +23,7 @@ Export this locally resolved field as a variable to be used in the remainder of https://www.apollographql.com/docs/react/essentials/local-state/#using-client-fields-as-variables """ directive @export( - """ - The variable name to export this field as. - """ + """The variable name to export this field as.""" as: String! ) on FIELD @@ -40,9 +32,7 @@ Specify a custom store key for this result. See https://www.apollographql.com/docs/react/advanced/caching/#the-connection-directive """ directive @connection( - """ - Specify the store key. - """ + """Specify the store key.""" key: String! """ @@ -59,202 +49,78 @@ scalar MultiplierPath type Query { account(accountid: Uuid!): account - """ - Контрагенты. statecode по умолчанию 0 - """ - accounts( - evo_accnumber: String - evo_account_type: [Int!] - evo_broker_accountid: Uuid - evo_fin_department_accountid: Uuid - evo_id_elt: String - evo_inn: String - evo_kpp: String - evo_legal_form: Int - evo_type_ins_policy: [Int!] - ownerid: Uuid - owner_domainname: String - statecode: Int - ): [account] + """Контрагенты. statecode по умолчанию 0""" + accounts(evo_accnumber: String, evo_account_type: [Int!], evo_broker_accountid: Uuid, evo_fin_department_accountid: Uuid, evo_id_elt: String, evo_inn: String, evo_kpp: String, evo_legal_form: Int, evo_type_ins_policy: [Int!], ownerid: Uuid, owner_domainname: String, statecode: Int): [account] - """ - Брокер. statecode по умолчанию 0 - """ + """Брокер. statecode по умолчанию 0""" broker_agents(ownnerid: Uuid!, statecode: Int): [account] contacts(parentcustomerid: Uuid, statecode: Int): [contact] email(activityid: Uuid!): email evo_addcontract(evo_addcontractid: Uuid!): evo_addcontract evo_addproduct(evo_addproductid: Uuid!): evo_addproduct evo_addproduct_type(evo_addproduct_typeid: Uuid!): evo_addproduct_type - evo_addproduct_types( - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - evo_max_period_param: DecimalParamInput - evo_min_period_param: DecimalParamInput - evo_product_type: Int - statecode: Int - ): [evo_addproduct_type] + evo_addproduct_types(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_max_period_param: DecimalParamInput, evo_min_period_param: DecimalParamInput, evo_product_type: Int, statecode: Int): [evo_addproduct_type] evo_address(evo_addressid: Uuid!): evo_address - evo_addresses( - evo_address_name: String - evo_fias: Boolean - statecode: Int - ): [evo_address] + evo_addresses(evo_address_name: String, evo_fias: Boolean, statecode: Int): [evo_address] evo_agency_agreement(evo_agency_agreementid: Uuid!): evo_agency_agreement - evo_bank_detailses( - evo_accountid: Uuid - orderby: OrderByInput - statecode: Int = 0 - ): [evo_bank_details] + evo_bank_detailses(evo_accountid: Uuid, orderby: OrderByInput, statecode: Int = 0): [evo_bank_details] 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_baseproducts(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_relation: [Int!], statecode: Int): [evo_baseproduct] 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] - evo_coefficients( - evo_client_riskid: Uuid - evo_client_typeid: Uuid - evo_corfficient_type: Int - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - evo_job_titleid: Uuid - evo_max_period_param: DecimalParamInput - evo_min_period_param: DecimalParamInput - statecode: Int - ): [evo_coefficient] + evo_coefficients(evo_client_riskid: Uuid, evo_client_typeid: Uuid, evo_corfficient_type: Int, evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_job_titleid: Uuid, evo_max_period_param: DecimalParamInput, evo_min_period_param: DecimalParamInput, statecode: Int): [evo_coefficient] evo_contract(evo_contractid: Uuid!): evo_contract evo_contracts(evo_name: String, statecode: Int): [evo_contract] evo_countries(evo_code_numeric: String): [evo_countryGraphQL] evo_country(evo_countryid: Uuid!): evo_countryGraphQL - evo_currencychanges( - evo_coursedate_param: DateParamInput - evo_ref_transactioncurrency: Uuid - statecode: Int - ): [evo_currencychange] + evo_currencychanges(evo_coursedate_param: DateParamInput, evo_ref_transactioncurrency: Uuid, statecode: Int): [evo_currencychange] + evo_debtwork_contract(debtworkContractId: Uuid!): evo_debtwork_contract evo_equipments(evo_modelid: Uuid, statecode: Int): [evo_equipment] - evo_external_supplier_codes( - evo_id: String - statecode: Int - ): [evo_external_supplier_code] - evo_external_system_request( - evo_external_system_requestid: Uuid! - ): evo_external_system_request - evo_external_system_requests( - evo_integration_status: Int - evo_name: String - evo_system: Int - statecode: Int - ): [evo_external_system_request] + evo_external_supplier_codes(evo_id: String, statecode: Int): [evo_external_supplier_code] + evo_external_system_request(evo_external_system_requestid: Uuid!): evo_external_system_request + evo_external_system_requests(evo_integration_status: Int, evo_name: String, evo_system: Int, statecode: Int): [evo_external_system_request] evo_finegibdd(evo_finegibddid: Uuid!): evo_finegibdd evo_gps_brands(statecode: Int): [evo_gps_brand] evo_gps_models(evo_gps_brandid: Uuid, statecode: Int): [evo_gps_model] evo_graphs(evo_contractid: Uuid, statecode: Int): [evo_graph] - evo_identity_documents( - evo_employee_systemuserid: Uuid! - ): [evo_identity_document] + evo_identity_documents(evo_employee_systemuserid: Uuid!): [evo_identity_document] evo_impairment_groups(statecode: Int): [evo_impairment_group] - evo_insurance_periods( - evo_contractid: Uuid - statecode: Int - ): [evo_insurance_period] + evo_insurance_periods(evo_contractid: Uuid, statecode: Int): [evo_insurance_period] evo_job_titles(statecode: Int): [evo_job_title] evo_leasingobject(evo_leasingobjectid: Uuid!): evo_leasingobject - evo_leasingobject_type( - evo_leasingobject_typeid: Uuid! - ): evo_leasingobject_type + 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_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] - evo_planpayments( - evo_addproduct_typeid: Uuid - statecode: Int - ): [evo_planpayment] + 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] + evo_planpayments(evo_addproduct_typeid: Uuid, statecode: Int): [evo_planpayment] evo_product_risk(evo_product_riskid: Uuid!): evo_product_risk evo_product_risks(statecode: Int): [evo_product_risk] evo_rate(evo_rateid: Uuid!): evo_rate - evo_rates( - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - statecode: Int - ): [evo_rate] + evo_rates(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, statecode: Int): [evo_rate] - """ - Регион. statecode по умолчанию 0 - """ - evo_regions( - evo_businessunit_evolution: Boolean - evo_creditregistry_id: Int - statecode: Int - ): [evo_region] + """Регион. statecode по умолчанию 0""" + evo_regions(evo_businessunit_evolution: Boolean, evo_creditregistry_id: Int, statecode: Int): [evo_region] evo_request_payment(evo_request_paymentid: Uuid!): evo_request_payment - evo_request_payments( - evo_id: String - evo_name: String - statecode: Int - ): [evo_request_payment] + evo_request_payments(evo_id: String, evo_name: String, statecode: Int): [evo_request_payment] evo_reward_condition(evo_reward_conditionid: Uuid!): evo_reward_condition - evo_reward_conditions( - evo_agency_agreementid_param: GuidParamInput - evo_agent_accountid: Uuid - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - statecode: Int - ): [evo_reward_condition] + evo_reward_conditions(evo_agency_agreementid_param: GuidParamInput, evo_agent_accountid: Uuid, evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, statecode: Int): [evo_reward_condition] evo_sot_coefficient_types(statecode: Int): [evo_sot_coefficient_type] evo_statuscode(evo_id: String, evo_statuscodeid: Uuid): evo_statuscode evo_statuscodes(statecode: Int): [evo_statuscode] - evo_subsidies( - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - statecode: Int - ): [evo_subsidy] + evo_subsidies(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, statecode: Int): [evo_subsidy] evo_tarif(evo_tarifid: Uuid!): evo_tarif - evo_tarifs( - evo_balance_holder: [Int!] - evo_baseproductid: Uuid - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - evo_graphtype_exception: [Int!] - evo_ins_type: [Int!] - evo_max_first_payment_param: DecimalParamInput - evo_max_last_payment_param: DecimalParamInput - evo_max_period_param: DecimalParamInput - evo_min_first_payment_param: DecimalParamInput - evo_min_last_payment_param: DecimalParamInput - evo_min_period_param: DecimalParamInput - evo_used: Boolean - statecode: Int - ): [evo_tarif] + evo_tarifs(evo_balance_holder: [Int!], evo_baseproductid: Uuid, evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_graphtype_exception: [Int!], evo_ins_type: [Int!], evo_max_first_payment_param: DecimalParamInput, evo_max_last_payment_param: DecimalParamInput, evo_max_period_param: DecimalParamInput, evo_min_first_payment_param: DecimalParamInput, evo_min_last_payment_param: DecimalParamInput, evo_min_period_param: DecimalParamInput, evo_used: Boolean, statecode: Int): [evo_tarif] evo_town(evo_fias_id: String, evo_townid: Uuid): evo_town - """ - Города. statecode по умолчанию 0 - """ + """Города. statecode по умолчанию 0""" evo_towns(evo_regionid: Uuid, statecode: Int): [evo_town] - evo_vehicle_body_type( - evo_vehicle_body_typeid: Uuid! - ): evo_vehicle_body_typeGraphQL + evo_typedocpackages(statecode: Int): [evo_typedocpackage] + evo_vehicle_body_type(evo_vehicle_body_typeid: Uuid!): evo_vehicle_body_typeGraphQL """ Лизинговые сделки. statecode по умолчанию 0, можно отфильтровать по ownerid и/или domainName @@ -264,18 +130,8 @@ type Query { """ Интересы. statecode по умолчанию 0, можно отфильтровать по ownerid и/или domainName """ - leads( - evo_opportunityid: Uuid - ownerid: Uuid - owner_domainname: String - statecode: Int - ): [lead] - opportunities( - evo_leadid: Uuid - ownerid: Uuid - owner_domainname: String - statecode: Int - ): [opportunity] + leads(evo_opportunityid: Uuid, ownerid: Uuid, owner_domainname: String, statecode: Int): [lead] + opportunities(evo_leadid: Uuid, ownerid: Uuid, owner_domainname: String, statecode: Int): [opportunity] opportunity(opportunityid: Uuid!): opportunity queue(emailaddress: String): queue quote(quoteId: Uuid!): quote @@ -283,33 +139,18 @@ type Query { """ Предложения. statecode по умолчанию 0, можно отфильтровать по ownerid и/или domainName """ - quotes( - condition: ConditionInput - evo_leadid: Uuid - ownerid: Uuid - owner_domainname: String - statecode: Int - ): [quote] + quotes(condition: ConditionInput, evo_leadid: Uuid, ownerid: Uuid, owner_domainname: String, statecode: Int): [quote] - """ - Агенты салона. statecode по умолчанию 0 - """ + """Агенты салона. statecode по умолчанию 0""" salon_agents(salonaccountid: Uuid!, statecode: Int): [account] - """ - Поставщики ЮЛ салона. statecode по умолчанию 0 - """ + """Поставщики ЮЛ салона. statecode по умолчанию 0""" salon_providers(salonaccountid: Uuid!, statecode: Int): [account] systemuser(domainname: String, systemuserid: Uuid): systemuser - systemusers( - evo_employee_id: String - isdisabled: Boolean = false - ): [systemuser] + systemusers(evo_employee_id: String, isdisabled: Boolean = false): [systemuser] templates(description: String): [template] - """ - Валюта. statecode по умолчанию 0 - """ + """Валюта. statecode по умолчанию 0""" transactioncurrencies(statecode: Int): [transactioncurrency] transactioncurrency(transactioncurrencyid: Uuid!): transactioncurrency } @@ -345,6 +186,7 @@ type account { evo_dadatdalog: String evo_dealer_responsible_systemuserid: Uuid evo_div_12month: Boolean + evo_documents(evo_documenttypeid_param: GuidParamInput, latestversion: Boolean = true): [evo_document] evo_economic_security_systemuserid: Uuid evo_employee_count: Int evo_fingap_number_rules: Int @@ -392,6 +234,7 @@ type account { evo_subsidies(statecode: Int): [evo_subsidy] evo_tax_system: Int evo_type_ins_policy: [Int!] + link: String modifiedon: DateTime name: String ownerid: Uuid @@ -432,11 +275,10 @@ input ConditionInput { input GuidParamInput { eq: Uuid has: Boolean + in: [Uuid!] } -""" -The built-in `Decimal` scalar type. -""" +"""The built-in `Decimal` scalar type.""" scalar Decimal input OrderByInput { @@ -590,6 +432,7 @@ type evo_insurance_period { evo_age_drivers: Int evo_base_reward_factor: Decimal evo_base_reward_rub: Decimal + evo_change_insurer_accountid: Uuid evo_close: Boolean evo_comment: String evo_contractid: Uuid @@ -710,6 +553,7 @@ type evo_statuscode { evo_id: String evo_name: String evo_statuscodeid: Uuid + link: String modifiedon: DateTime toObjectString: String } @@ -730,6 +574,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 @@ -783,6 +628,7 @@ type evo_leasingobject { evo_vehicle_type_tax: Int evo_vin: String evo_year: Int + link: String modifiedon: DateTime statecode: Int toObjectString: String @@ -850,6 +696,7 @@ type lead { evo_firstname: String evo_inn: String evo_kpp: String + evo_lastname: String evo_new_client: String evo_opportunityid: Uuid evo_opportunityidData: opportunity @@ -889,6 +736,7 @@ type opportunity { evo_approvallogs: [evo_approvallog] evo_businessunitid: Uuid evo_businessunitidData: businessunit + evo_check_type: [Int!] evo_client_riskid: Uuid evo_client_riskidData: evo_client_risk evo_comment_description: String @@ -929,6 +777,9 @@ type opportunity { evo_programsolution: Int evo_report_year: Int evo_sfm_comment: [Int!] + evo_solution_average_cost: Int + evo_solution_average_cost_com: String + evo_solution_db: Int evo_statuscodeid: Uuid evo_statuscodeidData: evo_statuscode evo_statuscode_reason: String @@ -957,11 +808,14 @@ type quote { customerid_account: Uuid customerid_contact: Uuid evo_accept_control_addproduct_typeid: Uuid + evo_accept_period: Int evo_accept_quoteid: Uuid evo_acquisition_costs: Decimal evo_addproduct_types: [evo_addproduct_type] evo_add_bonus_summ: Decimal + evo_add_director_bonus: Decimal evo_add_equipment: Boolean + evo_add_region_director_bonus: Decimal evo_agent_accountid: Uuid evo_agent_reward_conditionid: Uuid evo_agent_reward_summ: Decimal @@ -994,6 +848,7 @@ type quote { evo_contact_name: String evo_cost_increace: Boolean evo_cost_increase_perc: Decimal + evo_db_accept_registration: Int evo_dealer_broker_accountid: Uuid evo_dealer_broker_reward_conditionid: Uuid evo_dealer_broker_reward_summ: Decimal @@ -1026,6 +881,7 @@ type quote { evo_engine_type: Int evo_engine_volume: Decimal evo_equipmentid: Uuid + evo_equip_price: Decimal evo_equity_capital: Decimal evo_exp_drivers: Int evo_fingap_accountid: Uuid @@ -1092,6 +948,7 @@ type quote { evo_kasko_payer: Int evo_kasko_price: Decimal evo_kasko_price_leasperiod: Decimal + evo_key_return: Boolean evo_kilometrage_limit: Int evo_kilometrage_limit_period: Int evo_last_payment_calc: Int @@ -1153,6 +1010,8 @@ type quote { evo_price_wthout_discount_nds_sup_currency: Decimal evo_product_risks: [evo_product_risk] evo_programsolution: Int + evo_program_import_subsidyid: Uuid + evo_program_import_subsidy_sum: Decimal evo_pts_type: Int evo_purchases_participation: Boolean evo_quotename: String @@ -1163,6 +1022,8 @@ type quote { evo_recalc_quoteid: Uuid evo_redemption_graph: Boolean evo_regionid: Uuid + evo_region_director_bonus: Decimal + evo_region_director_fingap_bonus: Decimal evo_region_director_nsib_bonus: Decimal evo_registration: Boolean evo_registration_quote: Boolean @@ -1222,12 +1083,7 @@ type quote { type evo_brand { createdon: DateTime - evo_baseproducts( - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - evo_relation: [Int!] - statecode: Int - ): [evo_baseproduct] + evo_baseproducts(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_relation: [Int!], statecode: Int): [evo_baseproduct] evo_brandid: Uuid evo_brand_owner: Int evo_id: String @@ -1243,12 +1099,7 @@ type evo_brand { type evo_model { createdon: DateTime - evo_baseproducts( - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - evo_relation: [Int!] - statecode: Int - ): [evo_baseproduct] + evo_baseproducts(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_relation: [Int!], statecode: Int): [evo_baseproduct] evo_brandid: Uuid evo_gps: Boolean evo_high_risk_vehicle: Boolean @@ -1274,12 +1125,7 @@ type evo_model { type evo_equipment { createdon: DateTime - evo_baseproducts( - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - evo_relation: [Int!] - statecode: Int - ): [evo_baseproduct] + evo_baseproducts(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_relation: [Int!], statecode: Int): [evo_baseproduct] evo_equipmentid: Uuid evo_id: String evo_impairment_groupid: Uuid @@ -1446,11 +1292,13 @@ type evo_request_payment { evo_corresponding_account: String evo_director_decision: Int evo_director_systemuserid: Uuid + evo_evobank_detailsid: Uuid evo_final_accept: Int evo_finegibddid: Uuid 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 @@ -1545,6 +1393,7 @@ 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 @@ -1560,6 +1409,8 @@ type evo_contract { evo_double_agent_reward_summ: Decimal evo_economic: Decimal evo_economic_actual: Decimal + evo_economic_with_nds: Decimal + evo_economic_with_nds_actual: Decimal evo_end_date_of_pledge_claim: DateTime evo_end_date_of_pledge_leasobject: DateTime evo_expinput_actual_date: DateTime @@ -1567,6 +1418,7 @@ type evo_contract { evo_finegibdds: [evo_finegibdd] evo_fingap_bonus_sum: Decimal evo_fingap_period: Int + evo_finmon_message_date: DateTime evo_fin_department_accountid: Uuid evo_fin_department_reward: Decimal evo_fin_department_reward_conditionid: Uuid @@ -1604,6 +1456,8 @@ type evo_contract { evo_msfo_irr: Decimal evo_msfo_irr_actual: Decimal evo_name: String + evo_nds_in_price_supplier_currency: Decimal + evo_nds_perc: Decimal evo_net_irr: Decimal evo_niatinception_msfo: Decimal evo_niatinception_msfo_actual: Decimal @@ -1634,6 +1488,8 @@ type evo_contract { evo_registration_addproductid: Uuid evo_registration_addproductidData: evo_addproduct evo_registration_addproduct_typeid: Uuid + evo_return_leasing: Boolean + evo_sale_without_nds: Boolean evo_signer_different_contactid: Uuid evo_signer_different_dkpid: Uuid evo_signer_different_systemuserid: Uuid @@ -1672,6 +1528,7 @@ type evo_contract { evo_uncritical_scan: Boolean evo_vehicle_tax_period: Decimal evo_vehicle_tax_year: Decimal + link: String modifiedon: DateTime ownerid: Uuid toObjectString: String @@ -1965,6 +1822,7 @@ type systemuser { fullname: String jobtitle: String lastname: String + link: String middlename: String mobilephone: String modifiedon: DateTime @@ -2158,6 +2016,7 @@ type evo_addcontract { evo_ecological_class: Int evo_ecological_class_new: Int evo_economic: Decimal + evo_economic_with_nds: Decimal evo_emailaddress: String evo_emailaddress_new: String evo_engine_model: String @@ -2223,9 +2082,15 @@ type evo_addcontract { evo_motor_power_1_new: String evo_msfo_irr: Decimal evo_name: String + evo_nds_in_price_calc: Decimal + evo_nds_in_price_supplier_currency: Decimal + evo_nds_in_price_supplier_currency_new: Decimal + evo_nds_perc: Decimal + evo_nds_perc_new: Decimal evo_net_irr: Decimal evo_niatinception_msfo: Decimal evo_ni_at_inception: Decimal + evo_not_require_signing: Boolean evo_npvni_msfo: Decimal evo_npvni_msfo_final: Decimal evo_ns_bonus_summ: Decimal @@ -2266,6 +2131,7 @@ type evo_addcontract { evo_payment_redemption: Int evo_period: Int evo_period_new: Int + evo_price_calc: Decimal evo_price_without_discount: Decimal evo_price_without_discount_new: Decimal evo_price_without_discount_supplier_rub: Decimal @@ -2280,6 +2146,7 @@ type evo_addcontract { evo_pts_type: Int evo_pts_type_new: Int evo_quoteid: Uuid + evo_reasons_calc: [Int!] evo_recalculate_demand: Boolean evo_refuse_reason: Int evo_regionid: Uuid @@ -2404,11 +2271,132 @@ type template { toObjectString: String } +type evo_typedocpackage { + createdon: DateTime + evo_account: Boolean + evo_addcontract: Boolean + evo_agency_agreement: Boolean + evo_contract: Boolean + evo_debtwork_contract: Boolean + evo_finegibdd: Boolean + evo_id: String + evo_incident: Boolean + evo_insurance_period: Boolean + evo_name: String + evo_opportunity: Boolean + evo_programsolution: [Int!] + evo_request_payment: Boolean + evo_typedocpackageid: Uuid + modifiedon: DateTime + toObjectString: String +} + +type evo_debtwork_contract { + createdon: DateTime + evo_accountid: Uuid + evo_accountidData: account + evo_contractid: Uuid + evo_contractidData: evo_contract + evo_date_change_statuscode: DateTime + evo_db_region_com: String + evo_debtwork_contractid: Uuid + evo_debt_restruct_description: String + evo_documents: [evo_document] + evo_economic_security_com: String + evo_erroneous_pay_contractname: String + evo_inspection_done: Boolean + evo_inspection_impossible: Boolean + evo_inspection_impossible_reason: String + evo_inspection_link_report: String + evo_inspection_systemuserid: Uuid + evo_inspection_systemuseridData: systemuser + evo_insurance_case_dateend: DateTime + evo_leasingobjectid: Uuid + evo_leasingobjectidData: evo_leasingobject + evo_non_payment_count: Decimal + evo_opportunityid: Uuid + evo_plan_date_transfer_pay: DateTime + evo_redemption_com: String + evo_redemption_type: [Int!] + evo_result_debt_restruct: Boolean + evo_result_error_payment: Boolean + evo_result_inspection: Boolean + evo_result_insurance_case: Boolean + evo_result_redemption: Boolean + evo_result_termination: Boolean + evo_result_wait_payment: Boolean + evo_result_withdrawal: Boolean + evo_statuscodeid: Uuid + evo_statuscodeidData: evo_statuscode + evo_statuscode_reason: String + evo_storage: String + evo_termination_add_registry: Int + evo_termination_com: String + evo_termination_com_lawyer: String + evo_termination_lawyer_systemuserid: Uuid + evo_termination_lawyer_systemuseridData: systemuser + evo_termination_reason_terms: Int + evo_termination_reason_terms_doc: String + evo_termination_reason_terms_text: String + evo_termination_send_notice: Boolean + evo_termination_send_notice_date: DateTime + evo_termination_send_notice_repeat: Boolean + evo_termination_solution: Int + evo_termination_status_work: Int + evo_termination_suspended_until: DateTime + evo_termination_unique_notice: Boolean + evo_withdrawal_businessunitid: Uuid + evo_withdrawal_businessunitidData: businessunit + evo_withdrawal_done: Boolean + evo_withdrawal_impossible: Boolean + evo_withdrawal_impossible_reason: String + evo_withdrawal_issue_agreed: Int + evo_withdrawal_issue_done: Int + evo_withdrawal_parking_addressid: Uuid + evo_withdrawal_parking_addressidData: evo_address + evo_withdrawal_plan_date: DateTime + evo_withdrawal_systemuserid: Uuid + evo_withdrawal_systemuseridData: systemuser + link: String + modifiedon: DateTime + ownerid: Uuid + ownerid_systemuser: Uuid + ownerid_systemuserData: systemuser + ownerid_team: Uuid + toObjectString: String +} + type MutationBy { createEntity(data: EntityDataInput): Uuid! updateEntity(data: EntityDataInput): Boolean! } +type evo_document { + createdon: DateTime + evo_accountid: Uuid + evo_changed_record_systemuserid: Uuid + evo_comment_original: String + evo_comment_previous: String + evo_comment_scan: String + evo_documentid: Uuid + evo_documenttypeid: Uuid + evo_documenttypeidData: evo_documenttype + evo_doc_number: String + evo_init_entity_id: String + evo_init_entity_name: String + evo_name: String + evo_original_correct: Boolean + evo_original_received: Boolean + evo_scan_correct: Boolean + evo_url: String + evo_validity_date: DateTime + evo_version: Int + modifiedon: DateTime + statecode: Int + statuscode: Int + toObjectString: String +} + type team { createdon: DateTime evo_baseproducts(statecode: Int): [evo_baseproduct] @@ -2419,9 +2407,7 @@ type team { toObjectString: String } -""" -The `DateTime` scalar represents an ISO-8601 compliant date time type. -""" +"""The `DateTime` scalar represents an ISO-8601 compliant date time type.""" scalar DateTime input FilterInput { @@ -2504,6 +2490,7 @@ type evo_approvallog { evo_incidentid: Uuid evo_insurance_policyid: Uuid evo_leadid: Uuid + evo_logid: Uuid evo_opportunityid: Uuid evo_predate_change_statuscode: DateTime evo_prestatuscodeid: Uuid @@ -2516,68 +2503,6 @@ type evo_approvallog { toObjectString: String } -type evo_debtwork_contract { - createdon: DateTime - evo_accountid: Uuid - evo_contractid: Uuid - evo_date_change_statuscode: DateTime - evo_db_region_com: String - evo_debtwork_contractid: Uuid - evo_debt_restruct_description: String - evo_economic_security_com: String - evo_erroneous_pay_contractname: String - evo_inspection_done: Boolean - evo_inspection_impossible: Boolean - evo_inspection_impossible_reason: String - evo_inspection_link_report: String - evo_inspection_systemuserid: Uuid - evo_insurance_case_dateend: DateTime - evo_leasingobjectid: Uuid - evo_non_payment_count: Decimal - evo_opportunityid: Uuid - evo_plan_date_transfer_pay: DateTime - evo_redemption_com: String - evo_redemption_type: [Int!] - evo_result_debt_restruct: Boolean - evo_result_error_payment: Boolean - evo_result_inspection: Boolean - evo_result_insurance_case: Boolean - evo_result_redemption: Boolean - evo_result_termination: Boolean - evo_result_wait_payment: Boolean - evo_result_withdrawal: Boolean - evo_statuscodeid: Uuid - evo_statuscodeidData: evo_statuscode - evo_statuscode_reason: String - evo_storage: String - evo_termination_add_registry: Int - evo_termination_com: String - evo_termination_com_lawyer: String - evo_termination_lawyer_systemuserid: Uuid - evo_termination_reason_terms: Int - evo_termination_reason_terms_doc: String - evo_termination_reason_terms_text: String - evo_termination_send_notice: Boolean - evo_termination_send_notice_date: DateTime - evo_termination_send_notice_repeat: Boolean - evo_termination_solution: Int - evo_termination_status_work: Int - evo_termination_suspended_until: DateTime - evo_termination_unique_notice: Boolean - evo_withdrawal_businessunitid: Uuid - evo_withdrawal_done: Boolean - evo_withdrawal_impossible: Boolean - evo_withdrawal_impossible_reason: String - evo_withdrawal_issue_agreed: Int - evo_withdrawal_issue_done: Int - evo_withdrawal_parking_addressid: Uuid - evo_withdrawal_plan_date: DateTime - evo_withdrawal_systemuserid: Uuid - modifiedon: DateTime - ownerid: Uuid - toObjectString: String -} - type tisa_phonecallprocessing { createdon: DateTime modifiedon: DateTime @@ -2589,6 +2514,7 @@ type tisa_phonecallprocessing { type role { createdon: DateTime + evo_documenttypes: [evo_documenttype] modifiedon: DateTime name: String roleid: Uuid @@ -2614,6 +2540,24 @@ input EntityDataInput { logicalName: String } +type evo_documenttype { + createdon: DateTime + evo_comment: String + evo_documenttypeid: Uuid + evo_draftdoc: Boolean + evo_edit_namedoc: Boolean + evo_fill_docname: Boolean + evo_id: String + evo_name: String + evo_name_save_file: String + evo_place_upload_doc: [Int!] + evo_storagedoc: Int + evo_typedocpackages: [evo_typedocpackage] + evo_validitydoc: Int + modifiedon: DateTime + toObjectString: String +} + enum FilterOperation { ISNULL EQUAL diff --git a/src/core/services/CrmService/types/entities.ts b/src/core/services/CrmService/types/entities.ts index 0088a43..56f1bfc 100644 --- a/src/core/services/CrmService/types/entities.ts +++ b/src/core/services/CrmService/types/entities.ts @@ -178,6 +178,8 @@ export interface IQuote extends BaseEntity { evo_product_risks?: { evo_addproduct_typeid: string; }[]; + evo_program_import_subsidyid?: string; + evo_equip_price?: number; } export interface IEvoGraph extends BaseEntity { @@ -466,6 +468,7 @@ export interface IEvoSubsidy extends BaseEntity { evo_brands?: IEvoBrand[]; evo_models?: IEvoModel[]; accounts?: IAccount[]; + evo_subsidy_type?: number; } export type CRMEntity = IAccount & diff --git a/src/core/types/Calculation/Store/index.ts b/src/core/types/Calculation/Store/index.ts index 6f206ad..24137d2 100644 --- a/src/core/types/Calculation/Store/index.ts +++ b/src/core/types/Calculation/Store/index.ts @@ -22,7 +22,7 @@ import { import { ElementStatus } from 'types/elements'; import { TElementFilter } from './filters'; import { TStaticData } from './staticData'; -import { AllValues, ValuesNames } from './values'; +import { ValuesNames } from './values'; export type ElementParam = | 'value' @@ -62,12 +62,12 @@ interface ICalculationValues { ) => void; // applyFilters: (filters: TElementFilter[]) => void; - values: Record; + values: Record; getValue: (sourceValueName: ValuesNames) => any; - getValues: (valuesNames: ValuesNames[]) => Partial>; + getValues: (valuesNames: ValuesNames[]) => Partial>; setValue: (sourceValueName: ValuesNames, newValue: any) => void; setValues: ( - values: Partial>, + values: Partial>, override?: boolean, ) => void; diff --git a/src/core/types/Calculation/Store/values.ts b/src/core/types/Calculation/Store/values.ts index c370459..93ce7c8 100644 --- a/src/core/types/Calculation/Store/values.ts +++ b/src/core/types/Calculation/Store/values.ts @@ -138,7 +138,9 @@ export type ValuesNames = | 'resultFirstPaymentRiskPolicy' | 'leaseObjectPriceWthtVAT' | 'VATInLeaseObjectPrice' - | 'engineHours'; + | 'engineHours' + | 'importProgram' + | 'addEquipmentPrice'; export type ComputedValuesNames = | 'leaseObjectRiskName' @@ -146,6 +148,7 @@ export type ComputedValuesNames = | 'irrInfo' | 'registrationDescription' | 'plPriceRub' - | 'discountRub'; + | 'discountRub' + | 'importProgramSum'; export type AllValues = ValuesNames | ComputedValuesNames;