fix: wrong price
This commit is contained in:
parent
34ede08244
commit
033251c79d
1 changed files with 10 additions and 14 deletions
|
|
@ -55,7 +55,7 @@ function openList(index: number) {
|
|||
|
||||
function calcPricePerUnit(product: RequestWork['productService']['product']) {
|
||||
return product.vatIncluded
|
||||
? precisionRound(product.serviceCharge / (1 + (config.value?.vat || 0.07)))
|
||||
? product.serviceCharge / (1 + (config.value?.vat || 0.07))
|
||||
: product.serviceCharge;
|
||||
}
|
||||
|
||||
|
|
@ -63,21 +63,17 @@ function calcPrice(
|
|||
product: RequestWork['productService']['product'],
|
||||
amount: number,
|
||||
) {
|
||||
const disc =
|
||||
const pricePerUnit = product.serviceCharge;
|
||||
const discount =
|
||||
taskProduct.value.find((v) => v.productId === product.id)?.discount || 0;
|
||||
const pricePerUnit = calcPricePerUnit(product);
|
||||
const priceNoVat = product.vatIncluded
|
||||
? pricePerUnit / (1 + (config.value?.vat || 0.07))
|
||||
: pricePerUnit;
|
||||
const priceDiscountNoVat = priceNoVat * amount - discount;
|
||||
|
||||
return precisionRound(
|
||||
pricePerUnit * amount -
|
||||
disc +
|
||||
precisionRound(
|
||||
product.calcVat
|
||||
? (pricePerUnit * (disc ? amount : 1) - disc) *
|
||||
(config.value?.vat || 0.07)
|
||||
: 0,
|
||||
) *
|
||||
(!disc ? amount : 1),
|
||||
);
|
||||
const rawVatTotal = priceDiscountNoVat * (config.value?.vat || 0.07);
|
||||
|
||||
return precisionRound(priceNoVat * amount + rawVatTotal);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue