feat: add separate price vat calc

This commit is contained in:
Methapon2001 2025-01-28 09:44:18 +07:00
parent ef81a93690
commit 310464f834
7 changed files with 344 additions and 280 deletions

View file

@ -64,7 +64,7 @@ function calcPrice(c: (typeof rows.value)[number]) {
const finalPriceNoVat = finalPriceWithVat / (1 + (config.value?.vat || 0.07));
const price = finalPriceNoVat * c.amount - c.discount;
const vat = c.product.calcVat
const vat = c.product[props.agentPrice ? 'agentPriceCalcVat' : 'calcVat']
? (finalPriceNoVat * c.amount - c.discount) * (config.value?.vat || 0.07)
: 0;
return precisionRound(price + vat);
@ -387,7 +387,9 @@ watch(
{{
formatNumberDecimal(
props.row.pricePerUnit +
(props.row.product.calcVat
(props.row.product[
agentPrice ? 'agentPriceCalcVat' : 'calcVat'
]
? props.row.pricePerUnit * (config?.vat || 0.07)
: 0),
2,