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(
|
const price = list?.reduce(
|
||||||
(a, c) => {
|
(a, c) => {
|
||||||
const price = c.pricePerUnit * c.amount;
|
const price = precisionRound(c.pricePerUnit * c.amount);
|
||||||
const discount = price * c.discount;
|
const discount = precisionRound(price - (c.discount || 0));
|
||||||
const vat = price - discount * c.vat;
|
const vat = precisionRound((price - discount) * c.vat);
|
||||||
|
|
||||||
a.totalPrice += price;
|
a.totalPrice = precisionRound(a.totalPrice + price);
|
||||||
a.totalDiscount += discount;
|
a.totalDiscount = precisionRound(a.totalDiscount + discount);
|
||||||
a.vat += vat;
|
a.vat = precisionRound(a.vat + vat);
|
||||||
a.finalPrice += price - discount + vat;
|
a.finalPrice = precisionRound(a.totalPrice - a.totalDiscount + a.vat);
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue