merge dyn-1673_minor_improvements
This commit is contained in:
parent
8f7bb3948d
commit
e0cbbb6949
@ -46,6 +46,7 @@ export const calculationResults: ISection[] = [
|
||||
'labelResultDopMPLLeasing',
|
||||
'labelResultBonusDopProd',
|
||||
'labelResultBonusSafeFinance',
|
||||
'labelResultParticipationAmount',
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
@ -164,6 +164,7 @@ export default {
|
||||
labelResultBonusDopProd: Label,
|
||||
labelResultBonusSafeFinance: Label,
|
||||
labelResultFirstPaymentRiskPolicy: Label,
|
||||
labelResultParticipationAmount: Label,
|
||||
|
||||
/** Button Elements */
|
||||
btnCreateKP: Button,
|
||||
|
||||
@ -399,6 +399,7 @@ const moneyResultElementsProps = (
|
||||
'labelResultBonusDopProd',
|
||||
'labelSubsidySum',
|
||||
'labelResultBonusSafeFinance',
|
||||
'labelResultParticipationAmount',
|
||||
] as ElementsNames[]
|
||||
).reduce(
|
||||
(ac, a) => ({
|
||||
|
||||
@ -150,6 +150,7 @@ export const elementsTitles: Partial<Record<AllElementsNames, string>> = {
|
||||
labelResultBonusDopProd: 'Бонус МПЛ за доп.продукты, без НДФЛ',
|
||||
labelResultBonusSafeFinance: 'Бонус за Safe Finance без НДФЛ',
|
||||
labelResultFirstPaymentRiskPolicy: 'Первый платеж по риск политике, %',
|
||||
labelResultParticipationAmount: 'Сумма участия (для принятия решения)',
|
||||
};
|
||||
|
||||
export const tablesTitles: Record<TableNames, string> = {
|
||||
|
||||
@ -156,6 +156,7 @@ const elementsValues: Record<ElementsNames, ValuesNames> = {
|
||||
labelResultBonusDopProd: 'resultBonusDopProd',
|
||||
labelResultBonusSafeFinance: 'resultBonusSafeFinance',
|
||||
labelResultFirstPaymentRiskPolicy: 'resultFirstPaymentRiskPolicy',
|
||||
labelResultParticipationAmount: 'resultParticipationAmount',
|
||||
};
|
||||
|
||||
const elementsComputedValues: Record<
|
||||
|
||||
@ -141,7 +141,8 @@ export type ElementsNames =
|
||||
| 'labelResultDopMPLLeasing'
|
||||
| 'labelResultBonusDopProd'
|
||||
| 'labelResultBonusSafeFinance'
|
||||
| 'labelResultFirstPaymentRiskPolicy';
|
||||
| 'labelResultFirstPaymentRiskPolicy'
|
||||
| 'labelResultParticipationAmount';
|
||||
|
||||
export type ButtonElementsNames = 'btnCreateKP' | 'btnCalculate';
|
||||
export type LinkElementsNames = 'linkDownloadKp';
|
||||
|
||||
@ -12,12 +12,52 @@ export default function ($calculation: ICalculationStore) {
|
||||
* из поля Продукт selectProduct evo_evo_coefficient_evo_baseproduct
|
||||
* Если продукта нет или нет коэффициента по условиям, то поле tbxSaleBonus = 0 и закрыто для редактирования
|
||||
*/
|
||||
|
||||
reaction(
|
||||
() => $calculation.getValues(['saleBonus', 'product']),
|
||||
({ saleBonus, product }) => {
|
||||
() => {
|
||||
return $calculation.getValue('product');
|
||||
},
|
||||
product => {
|
||||
$calculation.setStatus('tbxSaleBonus', ElementStatus.Default);
|
||||
const systemuser = $calculation.getStaticData('systemuser');
|
||||
|
||||
if (systemuser && product) {
|
||||
const evo_sot_coefficient_type = $calculation
|
||||
.getStaticData('evo_sot_coefficient_type')
|
||||
.find(x => x.evo_id === 'BONUS_LEASING');
|
||||
const evo_coefficient_bonus = $calculation
|
||||
.getStaticData('evo_coefficient')
|
||||
.find(
|
||||
x =>
|
||||
x.evo_job_titleid === systemuser[0].evo_job_titleid &&
|
||||
x.evo_sot_coefficient_typeid ===
|
||||
evo_sot_coefficient_type?.evo_sot_coefficient_typeid &&
|
||||
x.evo_baseproducts?.map(x => x.evo_id).includes(product),
|
||||
);
|
||||
|
||||
if (evo_coefficient_bonus?.evo_sot_coefficient) {
|
||||
$calculation.setValue(
|
||||
'saleBonus',
|
||||
evo_coefficient_bonus?.evo_sot_coefficient * 100,
|
||||
);
|
||||
|
||||
$calculation.setStatus('tbxSaleBonus', ElementStatus.Default);
|
||||
} else {
|
||||
$calculation.setValue('saleBonus', 0);
|
||||
$calculation.setStatus('tbxSaleBonus', ElementStatus.Disabled);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => {
|
||||
return $calculation.getValues(['saleBonus', 'product']);
|
||||
},
|
||||
({ saleBonus, product }) => {
|
||||
$calculation.setValidation('tbxSaleBonus', undefined);
|
||||
const systemuser = $calculation.getStaticData('systemuser');
|
||||
|
||||
if (systemuser && product) {
|
||||
const evo_sot_coefficient_type = $calculation
|
||||
.getStaticData('evo_sot_coefficient_type')
|
||||
@ -47,9 +87,6 @@ export default function ($calculation: ICalculationStore) {
|
||||
} else {
|
||||
$calculation.setValidation('tbxSaleBonus', undefined);
|
||||
}
|
||||
} else {
|
||||
$calculation.setValue('saleBonus', 0);
|
||||
$calculation.setStatus('tbxSaleBonus', ElementStatus.Disabled);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -28,6 +28,7 @@ export const RESULT_VALUES: ValuesNames[] = [
|
||||
'resultBonusMPL',
|
||||
'resultDopMPLLeasing',
|
||||
'resultBonusDopProd',
|
||||
'resultParticipationAmount',
|
||||
];
|
||||
|
||||
export default function (this: ICalculationStore) {
|
||||
|
||||
@ -149,6 +149,25 @@ export default {
|
||||
'resultFirstPaymentRiskPolicy',
|
||||
(preparedData?.preparedValues?.firstPayment || 0) * 100,
|
||||
);
|
||||
const { preparedValues, columns } = res;
|
||||
this.setValue(
|
||||
'resultParticipationAmount',
|
||||
(preparedValues.niAtInception || 0) +
|
||||
((preparedValues.ratBonus || 0) +
|
||||
(preparedValues.nsBonus || 0) +
|
||||
(preparedValues.nsibBonus || 0)) *
|
||||
(preparedValues.marketRate || 0) *
|
||||
(preparedValues.districtRate || 0) +
|
||||
Math.abs(columns.npvBonusExpensesColumn.values.at(0)) +
|
||||
Math.abs(columns.extraBonusSumColumn.values.at(0)) +
|
||||
(preparedValues.importerSum || 0) +
|
||||
(preparedValues.agentsSum || 0) +
|
||||
(preparedValues.extraBonusSumColumn || 0) +
|
||||
(preparedValues.deliverySum || 0) +
|
||||
(preparedValues.brokerSum || 0) +
|
||||
(preparedValues.brokerOfDeliverySum || 0) +
|
||||
(preparedValues.financialDeptOfDeliverySum || 0),
|
||||
);
|
||||
},
|
||||
setResValues: function (
|
||||
this: ICalculationStore,
|
||||
|
||||
@ -81,6 +81,47 @@ function validateInsuranceTable(this: ICalculationStore) {
|
||||
validation: !isNil(kaskoRow.insured),
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Если в таблице страхования в строке КАСКО Плательщик = ЛД и в поле "Стоимость за первый период" значение меньше 1000, то выводить ошибку
|
||||
* Если в таблице страхования в строке ОСАГО Плательщик = ЛД и в поле "Стоимость за первый период" значение меньше 1000, то выводить ошибку
|
||||
*/
|
||||
|
||||
if (osagoRow.insured === 100_000_001 && osagoRow.insCost < 1000) {
|
||||
this.setTableRow('tableInsurance', rows =>
|
||||
rows.findIndex(x => x?.key === 'osago'),
|
||||
)({
|
||||
insCost: {
|
||||
validation: false,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.setTableRow('tableInsurance', rows =>
|
||||
rows.findIndex(x => x?.key === 'osago'),
|
||||
)({
|
||||
insCost: {
|
||||
validation: undefined,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (kaskoRow.insured === 100_000_001 && kaskoRow.insCost < 1000) {
|
||||
this.setTableRow('tableInsurance', rows =>
|
||||
rows.findIndex(x => x?.key === 'kasko'),
|
||||
)({
|
||||
insCost: {
|
||||
validation: false,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.setTableRow('tableInsurance', rows =>
|
||||
rows.findIndex(x => x?.key === 'kasko'),
|
||||
)({
|
||||
insCost: {
|
||||
validation: undefined,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function validatePaymentsTable(this: ICalculationStore) {
|
||||
|
||||
@ -1173,7 +1173,7 @@ const reactionEffects: IReactionEffect[] = [
|
||||
effect: ({ evo_base_rate }) => {
|
||||
calculationStore.setValue(
|
||||
'creditRate',
|
||||
evo_base_rate || valuesConstants.RATE,
|
||||
evo_base_rate !== undefined ? evo_base_rate : valuesConstants.RATE,
|
||||
);
|
||||
},
|
||||
}),
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
export interface PreparedValues {
|
||||
extraBonusSumColumn?: number;
|
||||
importProgramSum?: number;
|
||||
calcDate?: Date;
|
||||
calcType?: number;
|
||||
|
||||
@ -137,6 +137,7 @@ export type ValuesNames =
|
||||
| 'resultBonusDopProd'
|
||||
| 'resultBonusSafeFinance'
|
||||
| 'resultFirstPaymentRiskPolicy'
|
||||
| 'resultParticipationAmount'
|
||||
| 'leaseObjectPriceWthtVAT'
|
||||
| 'VATInLeaseObjectPrice'
|
||||
| 'engineHours'
|
||||
|
||||
Reference in New Issue
Block a user