diff --git a/src/client/process/configurator/reactions/filters.ts b/src/client/process/configurator/reactions/filters.ts index ec27732..f07fbd2 100644 --- a/src/client/process/configurator/reactions/filters.ts +++ b/src/client/process/configurator/reactions/filters.ts @@ -87,6 +87,12 @@ export default function ($calculation: ICalculationStore) { x => x.accountid === dealer.accountid, )?.length) && dealer, + dealer => + (!product?.accounts?.length || + //@ts-ignore + product.accounts.filter(x => x.accountid === dealer.accountid) + ?.length) && + dealer, dealer => { if (product?.evo_supplier_financing_accept) { //@ts-ignore @@ -116,6 +122,13 @@ export default function ($calculation: ICalculationStore) { x => x.accountid === dealerPerson.accountid, )?.length) && dealerPerson, + dealerPerson => + (!product?.accounts?.length || + product.accounts.filter( + //@ts-ignore + x => x.accountid === dealerPerson.accountid, + )?.length) && + dealerPerson, dealerPerson => { if (product?.evo_supplier_financing_accept) { //@ts-ignore diff --git a/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts index e9884b1..6d96bf3 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts @@ -20,6 +20,7 @@ const reactionEffects: IReactionEffect[] = [ supplierDiscountPerc, leaseObjectPrice, addEquipmentPrice, + leaseObjectType, } = calculationStore.values; //@ts-ignore const importProgramSum = calculationStore.importProgramSum(); @@ -31,6 +32,7 @@ const reactionEffects: IReactionEffect[] = [ leaseObjectPrice, importProgramSum, addEquipmentPrice, + leaseObjectType, ]; }, effect: ([ @@ -51,10 +53,19 @@ const reactionEffects: IReactionEffect[] = [ calculationStore, ); + const leaseObjectType = calculationStore.getOption( + 'selectLeaseObjectType', + ); + const maxPriceChangeValue = price - supplierDiscountRub < 800000 ? price - supplierDiscountRub + 50000 - : (price - supplierDiscountRub) * 1.05; + : (price - supplierDiscountRub) * + (leaseObjectType?.evo_vehicle_type?.includes(100_000_001) || + leaseObjectType?.evo_vehicle_type?.includes(100_000_005) + ? 1.01 + : 1.05); + calculationStore.setValue('maxPriceChange', maxPriceChangeValue); const minPriceChangeValue = @@ -180,7 +191,7 @@ const reactionEffects: IReactionEffect[] = [ quote.evo_min_change_price - (quote.evo_nds_in_price_supplier_currency || 0); - if (maxCondition1 || maxCondition2 || maxCondition3) { + if (maxCondition1 || maxCondition2) { calculationStore.setValidation('tbxLeaseObjectPrice', false); openNotification({ type: 'error', @@ -189,6 +200,14 @@ const reactionEffects: IReactionEffect[] = [ 'Указанная стоимость предмета лизинга больше возможного изменения стоимости предмета лизинга при пересчете без пересмотра. ' + 'Уменьшите стоимость предмета лизинга', }); + } else if (maxCondition3) { + calculationStore.setValidation('tbxLeaseObjectPrice', false); + openNotification({ + type: 'error', + message: 'Ошибка', + description: + 'При пересчете без пересмотра КП с ПЛ БУ или с непрофессиональным поставщиком недопустимо увеличение стоимости. Создайте новое КП и отправьте его на рассмотрение андеррайтингу для повторной проверки оценщиком.', + }); } else if (minCondition1 || minCondition2) { calculationStore.setValidation('tbxLeaseObjectPrice', false); openNotification({ 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 09ced7f..ab9db4c 100644 --- a/src/core/services/CrmService/graphql/query/options/main_options.graphql +++ b/src/core/services/CrmService/graphql/query/options/main_options.graphql @@ -89,6 +89,9 @@ query GetMainOptions( evo_baseproductid } evo_supplier_financing_accept + accounts { + accountid + } } selectRegistration: evo_addproduct_types( statecode: $statecode diff --git a/src/core/services/CrmService/graphql/schema.graphql b/src/core/services/CrmService/graphql/schema.graphql index ca0eef4..b18a604 100644 --- a/src/core/services/CrmService/graphql/schema.graphql +++ b/src/core/services/CrmService/graphql/schema.graphql @@ -685,6 +685,7 @@ type evo_baseproduct { statecode: Int systemusers(statecode: Int): [systemuser] toObjectString: String + accounts: [account] } type evo_graph { diff --git a/src/core/services/CrmService/types/entities.ts b/src/core/services/CrmService/types/entities.ts index 20af07c..a41ae5b 100644 --- a/src/core/services/CrmService/types/entities.ts +++ b/src/core/services/CrmService/types/entities.ts @@ -223,6 +223,7 @@ export interface IEvoBaseproduct extends BaseEntity { evo_calculation_method?: number[]; evo_baseproducts?: IEvoBaseproduct[]; evo_supplier_financing_accept?: boolean; + accounts?: IAccount[]; } export interface IEvoLeasingObjectType extends BaseEntity {