round priceWithVAT to 2

This commit is contained in:
vchikalkin 2023-04-05 18:34:36 +03:00
parent 591abe97c5
commit e6d7b17376

View File

@ -2,7 +2,7 @@ import { VAT } from '@/constants/values';
import * as CRMTypes from '@/graphql/crm.types';
import type { ProcessContext } from '@/process/types';
import { reaction } from 'mobx';
import { makeDisposable } from 'tools';
import { makeDisposable, round } from 'tools';
export default function reactions({ store, apolloClient }: ProcessContext) {
const { $calculation, $process } = store;
@ -95,7 +95,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
.element('tbxLeaseObjectPriceWthtVAT')
.setValue(leaseObjectPrice - VATInLeaseObjectPrice);
} else {
const priceWithVAT = leaseObjectPrice / (1 + VAT);
const priceWithVAT = round(leaseObjectPrice / (1 + VAT), 2);
const priceVAT = leaseObjectPrice - priceWithVAT;
$calculation.element('tbxLeaseObjectPriceWthtVAT').setValue(priceWithVAT);
$calculation.element('tbxVATInLeaseObjectPrice').setValue(priceVAT);