fix: wrong decimal

This commit is contained in:
Methapon2001 2025-01-17 09:05:36 +07:00
parent 7cb8dd6000
commit 6d43d4e796
2 changed files with 11 additions and 16 deletions

View file

@ -57,17 +57,13 @@ const currentBtnOpen = ref<{ title: string; opened: boolean[] }[]>([
]);
function calcPrice(c: (typeof rows.value)[number]) {
return precisionRound(
c.pricePerUnit * c.amount -
c.discount +
precisionRound(
c.product.calcVat
? (c.pricePerUnit * (c.discount ? c.amount : 1) - c.discount) *
(config.value?.vat || 0.07)
: 0,
) *
(!c.discount ? c.amount : 1),
);
const price = c.pricePerUnit * c.amount;
const vat = c.product.calcVat
? (c.pricePerUnit * (c.discount ? c.amount : 1) - c.discount) *
(config.value?.vat || 0.07) *
(!c.discount ? c.amount : 1)
: 0;
return precisionRound(price + vat);
}
const discount4Show = ref<string[]>([]);