merge release/dyn-829_last-payment-calculation
This commit is contained in:
parent
1e1422f723
commit
c0dcaaf8fd
@ -209,12 +209,12 @@ const elementsProps: Partial<Record<AllElementsNames, ElementProps>> = {
|
||||
formatter: formatNumber,
|
||||
},
|
||||
tbxInsAgeDrivers: {
|
||||
min: '18',
|
||||
max: '99',
|
||||
// min: '18',
|
||||
// max: '99',
|
||||
},
|
||||
tbxInsExpDrivers: {
|
||||
min: '0',
|
||||
max: '99',
|
||||
// min: '0',
|
||||
// max: '99',
|
||||
},
|
||||
selectRegionRegistration: {
|
||||
showSearch: true,
|
||||
|
||||
@ -17,7 +17,7 @@ export const elementsTitles: Partial<Record<AllElementsNames, string>> = {
|
||||
tbxFirstPaymentRub: 'Первый платеж, руб.',
|
||||
tbxLastPaymentPerc: 'Последний платеж, %',
|
||||
tbxLastPaymentRub: 'Последний платеж, руб.',
|
||||
radioLastPaymentRule: 'Последний платеж считается от ',
|
||||
radioLastPaymentRule: 'Последний платеж',
|
||||
tbxRedemptionPaymentSum: 'Сумма выкупного платежа, руб',
|
||||
radioBalanceHolder: 'Балансодержатель',
|
||||
radioGraphType: 'Вид графика',
|
||||
|
||||
@ -109,6 +109,7 @@ export default function (this: ICalculationStore): PreparedData {
|
||||
preparedValues.firstPaymentAbs = undefined;
|
||||
preparedValues.firstPaymentNdsAbs = undefined;
|
||||
preparedValues.firstPaymentWithNdsAbs = undefined;
|
||||
preparedValues.lastPaymentFix = values.lastPaymentRule !== 100_000_002;
|
||||
preparedValues.lastPayment = (values.lastPaymentPerc as number) / 100;
|
||||
preparedValues.lastPaymentSum =
|
||||
(values.lastPaymentRub as number) / (1 + valuesConstants.VAT);
|
||||
|
||||
@ -157,5 +157,10 @@ export default {
|
||||
(res?.columns?.sumWithVatColumn?.values[0] || 0) -
|
||||
(this.getValue('subsidySum') || 0),
|
||||
);
|
||||
if (this.getValue('lastPaymentRule') === 100_000_002)
|
||||
this.setValue(
|
||||
'lastPaymentRub',
|
||||
res?.columns?.sumWithVatColumn?.values.pop(),
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@ -445,8 +445,8 @@ const reactionEffects: IReactionEffect[] = [
|
||||
return lastPaymentRule;
|
||||
},
|
||||
effect: lastPaymentRule => {
|
||||
if (lastPaymentRule) {
|
||||
if (lastPaymentRule === 100000000) {
|
||||
switch (lastPaymentRule) {
|
||||
case 100_000_000: {
|
||||
calculationStore.setStatus(
|
||||
'tbxLastPaymentPerc',
|
||||
ElementStatus.Disabled,
|
||||
@ -455,7 +455,9 @@ const reactionEffects: IReactionEffect[] = [
|
||||
'tbxLastPaymentRub',
|
||||
ElementStatus.Default,
|
||||
);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
case 100_000_001: {
|
||||
calculationStore.setStatus(
|
||||
'tbxLastPaymentPerc',
|
||||
ElementStatus.Default,
|
||||
@ -464,6 +466,17 @@ const reactionEffects: IReactionEffect[] = [
|
||||
'tbxLastPaymentRub',
|
||||
ElementStatus.Disabled,
|
||||
);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
calculationStore.setStatus(
|
||||
'tbxLastPaymentPerc',
|
||||
ElementStatus.Disabled,
|
||||
);
|
||||
calculationStore.setStatus(
|
||||
'tbxLastPaymentRub',
|
||||
ElementStatus.Disabled,
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -474,9 +487,7 @@ const reactionEffects: IReactionEffect[] = [
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { lastPaymentRub, lastPaymentPerc, insNSIB } =
|
||||
calculationStore.values;
|
||||
return { lastPaymentRub, lastPaymentPerc, insNSIB };
|
||||
return calculationStore.getValues(['lastPaymentRub', 'insNSIB']);
|
||||
},
|
||||
effect: ({ lastPaymentRub, insNSIB }) => {
|
||||
if (insNSIB && lastPaymentRub && lastPaymentRub < 3500) {
|
||||
@ -487,18 +498,9 @@ const reactionEffects: IReactionEffect[] = [
|
||||
description:
|
||||
'Последний платеж меньше 3500 руб. не может быть при наличии НСИБ, укажите большее значение',
|
||||
})();
|
||||
return;
|
||||
} else if (lastPaymentRub && lastPaymentRub < 1000) {
|
||||
calculationStore.setValidation('tbxLastPaymentRub', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка',
|
||||
description:
|
||||
'Последний платеж меньше 1000 руб. не может быть, укажите большее значение',
|
||||
})();
|
||||
return;
|
||||
} else {
|
||||
calculationStore.setValidation('tbxLastPaymentRub', true);
|
||||
}
|
||||
calculationStore.setValidation('tbxLastPaymentRub', true);
|
||||
},
|
||||
}),
|
||||
|
||||
|
||||
@ -173,7 +173,7 @@ export default [
|
||||
lastPaymentRule,
|
||||
]) => {
|
||||
if (
|
||||
lastPaymentRule !== 100000001 ||
|
||||
lastPaymentRule === 100000000 ||
|
||||
calculationProcess.hasProcess(Process.LoadKp)
|
||||
) {
|
||||
return;
|
||||
@ -212,7 +212,7 @@ export default [
|
||||
lastPaymentRule,
|
||||
]) => {
|
||||
if (
|
||||
lastPaymentRule !== 100000000 ||
|
||||
lastPaymentRule === 100000001 ||
|
||||
calculationProcess.hasProcess(Process.LoadKp)
|
||||
) {
|
||||
return;
|
||||
|
||||
@ -540,7 +540,11 @@ const reactionEffects: IReactionEffect[] = [
|
||||
|
||||
calculationStore => ({
|
||||
expression: () =>
|
||||
calculationStore.getValues(['lastPaymentPerc', 'balanceHolder']),
|
||||
calculationStore.getValues([
|
||||
'lastPaymentPerc',
|
||||
'balanceHolder',
|
||||
'lastPaymentRule',
|
||||
]),
|
||||
effect: ({ lastPaymentPerc, balanceHolder }) => {
|
||||
if (balanceHolder && balanceHolder === 100000001) {
|
||||
if (!lastPaymentPerc || parseFloat(lastPaymentPerc) < 1) {
|
||||
|
||||
@ -5,11 +5,15 @@ import { orderBy } from 'lodash';
|
||||
const initialOptions: Partial<Record<ElementsNames, IBaseOption[]>> = {
|
||||
radioLastPaymentRule: [
|
||||
{
|
||||
name: 'рублей',
|
||||
name: 'равен платежу',
|
||||
value: 100000002,
|
||||
},
|
||||
{
|
||||
name: 'в рублях',
|
||||
value: 100000000,
|
||||
},
|
||||
{
|
||||
name: '%',
|
||||
name: 'в %',
|
||||
value: 100000001,
|
||||
},
|
||||
],
|
||||
|
||||
@ -17,6 +17,7 @@ export interface PreparedValues {
|
||||
firstPaymentAbs?: number;
|
||||
firstPaymentNdsAbs?: number;
|
||||
firstPaymentWithNdsAbs?: number;
|
||||
lastPaymentFix?: boolean;
|
||||
lastPayment?: number;
|
||||
lastPaymentSum?: number;
|
||||
scheduleOfPayments?: number;
|
||||
|
||||
Reference in New Issue
Block a user