feat: add separate price vat calc
This commit is contained in:
parent
ef81a93690
commit
310464f834
7 changed files with 344 additions and 280 deletions
|
|
@ -251,10 +251,13 @@ function getPrice(
|
|||
const vat =
|
||||
(finalPriceNoVat * c.amount - c.discount) * (config.value?.vat || 0.07);
|
||||
|
||||
const calcVat =
|
||||
c.product[agentPrice.value ? 'agentPriceCalcVat' : 'calcVat'];
|
||||
|
||||
a.totalPrice = precisionRound(a.totalPrice + price);
|
||||
a.totalDiscount = precisionRound(a.totalDiscount + Number(c.discount));
|
||||
a.vat = c.product.calcVat ? precisionRound(a.vat + vat) : a.vat;
|
||||
a.vatExcluded = c.product.calcVat
|
||||
a.vat = calcVat ? precisionRound(a.vat + vat) : a.vat;
|
||||
a.vatExcluded = calcVat
|
||||
? a.vatExcluded
|
||||
: precisionRound(a.vatExcluded + price);
|
||||
a.finalPrice = precisionRound(
|
||||
|
|
|
|||
|
|
@ -260,7 +260,11 @@ function mapNode() {
|
|||
const price = prop.agentPrice
|
||||
? p.product.agentPrice
|
||||
: p.product.price;
|
||||
const pricePerUnit = p.product.vatIncluded
|
||||
const pricePerUnit = (
|
||||
prop.agentPrice
|
||||
? p.product.agentPriceVatIncluded
|
||||
: p.product.vatIncluded
|
||||
)
|
||||
? precisionRound(price / (1 + (config.value?.vat || 0.07)))
|
||||
: price;
|
||||
productCount.value++;
|
||||
|
|
@ -334,7 +338,9 @@ function mapNode() {
|
|||
};
|
||||
} else {
|
||||
const price = prop.agentPrice ? v.raw.agentPrice : v.raw.price;
|
||||
const pricePerUnit = v.raw.vatIncluded
|
||||
const pricePerUnit = (
|
||||
prop.agentPrice ? v.raw.agentPriceVatIncluded : v.raw.vatIncluded
|
||||
)
|
||||
? precisionRound(price / (1 + (config.value?.vat || 0.07)))
|
||||
: price;
|
||||
productCount.value++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue