DYN-829: Расчет последнего лизингового платежа

This commit is contained in:
Chika 2022-02-03 16:30:00 +03:00
parent 1e1422f723
commit db21b16c6f
7 changed files with 32 additions and 8 deletions

View File

@ -17,7 +17,7 @@ export const elementsTitles: Partial<Record<AllElementsNames, string>> = {
tbxFirstPaymentRub: 'Первый платеж, руб.',
tbxLastPaymentPerc: 'Последний платеж, %',
tbxLastPaymentRub: 'Последний платеж, руб.',
radioLastPaymentRule: 'Последний платеж считается от ',
radioLastPaymentRule: 'Последний платеж',
tbxRedemptionPaymentSum: 'Сумма выкупного платежа, руб',
radioBalanceHolder: 'Балансодержатель',
radioGraphType: 'Вид графика',

View File

@ -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);

View File

@ -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(),
);
},
};

View File

@ -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,
);
}
}
},

View File

@ -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;

View File

@ -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,
},
],

View File

@ -17,6 +17,7 @@ export interface PreparedValues {
firstPaymentAbs?: number;
firstPaymentNdsAbs?: number;
firstPaymentWithNdsAbs?: number;
lastPaymentFix?: boolean;
lastPayment?: number;
lastPaymentSum?: number;
scheduleOfPayments?: number;