fix: get actual price from final price instead
This commit is contained in:
parent
06c54780d3
commit
524a493149
1 changed files with 12 additions and 14 deletions
|
|
@ -323,16 +323,15 @@ export class CreditNoteController extends Controller {
|
|||
(v) => v.workStatus === RequestWorkStatus.Completed,
|
||||
).length;
|
||||
|
||||
const price = c.request.quotation.agentPrice ? "price" : "agentPrice";
|
||||
const price =
|
||||
c.productService.pricePerUnit -
|
||||
c.productService.discount / c.productService.amount +
|
||||
c.productService.vat / c.productService.amount;
|
||||
|
||||
if (serviceChargeStepCount && successCount) {
|
||||
return (
|
||||
a +
|
||||
c.productService.product[price] -
|
||||
c.productService.product.serviceCharge * successCount
|
||||
);
|
||||
return a + price - c.productService.product.serviceCharge * successCount;
|
||||
}
|
||||
return a + c.productService.product.price;
|
||||
return a + price;
|
||||
}, 0);
|
||||
|
||||
this.setStatus(HttpStatus.CREATED);
|
||||
|
|
@ -457,16 +456,15 @@ export class CreditNoteController extends Controller {
|
|||
(v) => v.workStatus === RequestWorkStatus.Completed,
|
||||
).length;
|
||||
|
||||
const price = c.request.quotation.agentPrice ? "price" : "agentPrice";
|
||||
const price =
|
||||
c.productService.pricePerUnit -
|
||||
c.productService.discount / c.productService.amount +
|
||||
c.productService.vat / c.productService.amount;
|
||||
|
||||
if (serviceChargeStepCount && successCount) {
|
||||
return (
|
||||
a +
|
||||
c.productService.product[price] -
|
||||
c.productService.product.serviceCharge * successCount
|
||||
);
|
||||
return a + price - c.productService.product.serviceCharge * successCount;
|
||||
}
|
||||
return a + c.productService.product.price;
|
||||
return a + price;
|
||||
}, 0);
|
||||
|
||||
const record = await prisma.creditNote.update({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue