fix: discount not have effect
This commit is contained in:
parent
f44746978a
commit
8172bd4ab6
1 changed files with 8 additions and 4 deletions
|
|
@ -390,7 +390,9 @@ export class QuotationController extends Controller {
|
|||
a.totalPrice = precisionRound(a.totalPrice + c.pricePerUnit * c.amount);
|
||||
a.totalDiscount = precisionRound(a.totalDiscount + c.discount);
|
||||
a.vat = precisionRound(a.vat + c.vat);
|
||||
a.finalPrice = precisionRound(a.totalPrice - a.totalDiscount + a.vat);
|
||||
a.finalPrice = precisionRound(
|
||||
Math.max(a.totalPrice - a.totalDiscount + a.vat - (body.discount || 0), 0),
|
||||
);
|
||||
|
||||
return a;
|
||||
},
|
||||
|
|
@ -399,7 +401,7 @@ export class QuotationController extends Controller {
|
|||
totalDiscount: 0,
|
||||
vat: 0,
|
||||
discount: body.discount,
|
||||
finalPrice: -(body.discount || 0),
|
||||
finalPrice: 0,
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -611,7 +613,9 @@ export class QuotationController extends Controller {
|
|||
a.totalPrice = precisionRound(a.totalPrice + c.pricePerUnit * c.amount);
|
||||
a.totalDiscount = precisionRound(a.totalDiscount + c.discount);
|
||||
a.vat = precisionRound(a.vat + c.vat);
|
||||
a.finalPrice = precisionRound(a.totalPrice - a.totalDiscount + a.vat);
|
||||
a.finalPrice = precisionRound(
|
||||
Math.max(a.totalPrice - a.totalDiscount + a.vat - (body.discount || 0), 0),
|
||||
);
|
||||
|
||||
return a;
|
||||
},
|
||||
|
|
@ -620,7 +624,7 @@ export class QuotationController extends Controller {
|
|||
totalDiscount: 0,
|
||||
vat: 0,
|
||||
discount: body.discount,
|
||||
finalPrice: -(body.discount || 0),
|
||||
finalPrice: 0,
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue