5ea1fe3: поправили и добавили описание
This commit is contained in:
parent
fe43a92c4d
commit
51171b7cce
@ -363,7 +363,9 @@ export type GetConfigurations_ProcessLeasingObjectQueryVariables = Exact<{
|
||||
|
||||
export type GetConfigurations_ProcessLeasingObjectQuery = { __typename?: 'Query', evo_equipments: Array<{ __typename?: 'evo_equipment', label: string | null, value: string | null } | null> | null };
|
||||
|
||||
export type GetLeasingWithoutKaskoOptionsQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
export type GetLeasingWithoutKaskoOptionsQueryVariables = Exact<{
|
||||
currentDate: InputMaybe<Scalars['DateTime']>;
|
||||
}>;
|
||||
|
||||
|
||||
export type GetLeasingWithoutKaskoOptionsQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null, evo_min_period: number | null, evo_max_period: number | null, evo_min_price: number | null, evo_max_price: number | null, evo_visible_calc: boolean | null, evo_min_first_payment_perc: number | null, evo_max_first_payment_perc: number | null, label: string | null, value: string | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null, evo_models: Array<{ __typename?: 'evo_model', evo_modelid: string | null } | null> | null } | null> | null };
|
||||
|
||||
@ -14,8 +14,13 @@ dayjs.extend(utc);
|
||||
const NOTIFICATION_KEY = uid(7);
|
||||
|
||||
const QUERY_GET_LEASING_WITHOUT_KASKO_OPTIONS = gql`
|
||||
query GetLeasingWithoutKaskoOptions {
|
||||
evo_addproduct_types(statecode: 0, evo_product_type: 100000007) {
|
||||
query GetLeasingWithoutKaskoOptions($currentDate: DateTime) {
|
||||
evo_addproduct_types(
|
||||
statecode: 0
|
||||
evo_product_type: 100000007
|
||||
evo_datefrom_param: { lte: $currentDate }
|
||||
evo_dateto_param: { gte: $currentDate }
|
||||
) {
|
||||
label: evo_name
|
||||
value: evo_addproduct_typeid
|
||||
evo_product_type
|
||||
@ -52,6 +57,12 @@ export default function commonReactions({ store, apolloClient, queryClient }: Re
|
||||
}
|
||||
);
|
||||
|
||||
/* eslint-disable max-len */
|
||||
/**
|
||||
* если "Лизинг без КАСКО" (SelectLeasingWithoutKasko) содержит данные,
|
||||
* то в таблице страхования в строке ФинГАП: Страховая компания insCompany = null и закрыть для редактирования
|
||||
*/
|
||||
/* eslint-enable */
|
||||
reaction(
|
||||
() => $calculation.element('selectLeasingWithoutKasko').getValue(),
|
||||
(leasingWithoutKasko) => {
|
||||
@ -64,6 +75,8 @@ export default function commonReactions({ store, apolloClient, queryClient }: Re
|
||||
);
|
||||
|
||||
autorun(async () => {
|
||||
const currentDate = dayjs().utc(false).toISOString();
|
||||
|
||||
const {
|
||||
data: { evo_addproduct_types },
|
||||
} = await apolloClient.query<
|
||||
@ -71,6 +84,9 @@ export default function commonReactions({ store, apolloClient, queryClient }: Re
|
||||
CRMTypes.GetLeasingWithoutKaskoOptionsQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_LEASING_WITHOUT_KASKO_OPTIONS,
|
||||
variables: {
|
||||
currentDate,
|
||||
},
|
||||
});
|
||||
|
||||
const {
|
||||
|
||||
@ -14,11 +14,31 @@ const QUERY_GET_IMPORT_PROGRAM_SUBSIDY = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
/* eslint-disable max-len */
|
||||
/**
|
||||
* При изменении "Программа от производителя" selectImportProgram , Стоимости ПЛ tbxLeaseObjectPrice, Валюты selectSupplierCurrency, Скидка от поставщика, в валюте поставщика (tbxSupplierDiscountRub)
|
||||
* необходимо заполнять поле "Скидка от производителя, руб., с НДС" labelImportProgramSum:
|
||||
если поле selectImportProgram содержит данные,
|
||||
то
|
||||
если
|
||||
поле "Сумма субсидии с НДС" evo_subsidy.evo_subsidy_summ из selectImportProgram > 0,
|
||||
то указывает данное значение в поле labelImportProgramSum,
|
||||
иначе:
|
||||
1)labelImportProgramSum = ( (Стоимость ПЛ tbxLeaseObjectPrice ), переведенные в рубли - Скидка от поставщика, в валюте поставщика (tbxSupplierDiscountRub))* "% субсидии от стоимости ПЛ" evo_subsidy.evo_percent_subsidy из selectImportProgram / 100.
|
||||
2) Если полученное значение больше значения в поле "Максимальная сумма субсидии с НДС, руб." evo_subsidy.evo_max_subsidy_summ из записи Субсидия в поле selectImportProgram ,
|
||||
то в labelImportProgramSum указываем значение из поля "Максимальная сумма субсидии с НДС, руб." evo_subsidy.evo_max_subsidy_summ ,
|
||||
иначе результат расчета п.1
|
||||
иначе 0
|
||||
*/
|
||||
/* eslint-enable */
|
||||
|
||||
export function computedReactions({ store, apolloClient, queryClient }: ReactionsContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
autorun(async () => {
|
||||
const importProgramId = $calculation.element('selectImportProgram').getValue();
|
||||
const plPriceRub = $calculation.$values.getValue('plPriceRub');
|
||||
const supplierDiscountRub = $calculation.element('tbxSupplierDiscountRub').getValue();
|
||||
|
||||
if (importProgramId) {
|
||||
const {
|
||||
@ -36,8 +56,6 @@ export function computedReactions({ store, apolloClient, queryClient }: Reaction
|
||||
if (importProgram?.evo_subsidy_summ && importProgram?.evo_subsidy_summ > 0) {
|
||||
$calculation.element('tbxImportProgramSum').setValue(importProgram?.evo_subsidy_summ);
|
||||
} else {
|
||||
const plPriceRub = $calculation.$values.getValue('plPriceRub');
|
||||
const supplierDiscountRub = $calculation.element('tbxSupplierDiscountRub').getValue();
|
||||
const subsidyPercent = (importProgram?.evo_percent_subsidy || 0) / 100;
|
||||
|
||||
const sum = (plPriceRub - supplierDiscountRub) * subsidyPercent;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user