fix: calculate price
This commit is contained in:
parent
bc3e450a75
commit
b999c9dd46
1 changed files with 7 additions and 7 deletions
|
|
@ -532,14 +532,14 @@ export class QuotationController extends Controller {
|
|||
|
||||
const price = list?.reduce(
|
||||
(a, c) => {
|
||||
const price = c.pricePerUnit * c.amount;
|
||||
const discount = price * c.discount;
|
||||
const vat = price - discount * c.vat;
|
||||
const price = precisionRound(c.pricePerUnit * c.amount);
|
||||
const discount = precisionRound(price - (c.discount || 0));
|
||||
const vat = precisionRound((price - discount) * c.vat);
|
||||
|
||||
a.totalPrice += price;
|
||||
a.totalDiscount += discount;
|
||||
a.vat += vat;
|
||||
a.finalPrice += price - discount + vat;
|
||||
a.totalPrice = precisionRound(a.totalPrice + price);
|
||||
a.totalDiscount = precisionRound(a.totalDiscount + discount);
|
||||
a.vat = precisionRound(a.vat + vat);
|
||||
a.finalPrice = precisionRound(a.totalPrice - a.totalDiscount + a.vat);
|
||||
|
||||
return a;
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue