fix tbxLastPaymentRub & tbxLastPaymentPerc
This commit is contained in:
parent
09c9028a93
commit
445d527c5a
@ -169,28 +169,40 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
'lastPaymentPerc',
|
||||
'addEquipmentPrice',
|
||||
'importProgramSum',
|
||||
'lastPaymentRule',
|
||||
]),
|
||||
({ addEquipmentPrice, lastPaymentPerc, plPriceRub, importProgramSum }) => {
|
||||
({ addEquipmentPrice, lastPaymentPerc, plPriceRub, importProgramSum, lastPaymentRule }) => {
|
||||
if (lastPaymentRule === 100_000_000) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rub = (lastPaymentPerc * (plPriceRub + addEquipmentPrice - importProgramSum)) / 100;
|
||||
$calculation.element('tbxLastPaymentRub').setValue(rub);
|
||||
}
|
||||
),
|
||||
() => $calculation.element('radioLastPaymentRule').getValue() === 100_000_000
|
||||
() => $process.has('LoadKP')
|
||||
);
|
||||
|
||||
makeDisposable(
|
||||
() =>
|
||||
reaction(
|
||||
() => $calculation.element('tbxLastPaymentRub').getValue(),
|
||||
(lastPaymentRub) => {
|
||||
const { plPriceRub, addEquipmentPrice, importProgramSum } =
|
||||
$calculation.$values.getValues();
|
||||
() =>
|
||||
$calculation.$values.getValues([
|
||||
'plPriceRub',
|
||||
'lastPaymentRub',
|
||||
'addEquipmentPrice',
|
||||
'importProgramSum',
|
||||
'lastPaymentRule',
|
||||
]),
|
||||
({ lastPaymentRub, plPriceRub, addEquipmentPrice, importProgramSum, lastPaymentRule }) => {
|
||||
if (lastPaymentRule === 100_000_001) {
|
||||
return;
|
||||
}
|
||||
|
||||
const perc = (lastPaymentRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100;
|
||||
$calculation.element('tbxLastPaymentPerc').setValue(perc);
|
||||
}
|
||||
),
|
||||
() =>
|
||||
$process.has('LoadKP') ||
|
||||
$calculation.element('radioLastPaymentRule').getValue() === 100_000_001
|
||||
() => $process.has('LoadKP')
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user