feat: detect if agent price
This commit is contained in:
parent
d5e0c56da3
commit
77dbdac012
1 changed files with 16 additions and 4 deletions
|
|
@ -273,11 +273,17 @@ export class CreditNoteController extends Controller {
|
|||
(v) => v.productId === c.productService.productId,
|
||||
)?.stepCount;
|
||||
|
||||
const successCount = c.stepStatus.filter((v) => v.workStatus === "Completed").length;
|
||||
const successCount = c.stepStatus.filter(
|
||||
(v) => v.workStatus === RequestWorkStatus.Completed,
|
||||
).length;
|
||||
|
||||
const price = c.request.quotation.agentPrice ? "price" : "agentPrice";
|
||||
|
||||
if (serviceChargeStepCount && successCount) {
|
||||
return (
|
||||
a + c.productService.product.price - c.productService.product.serviceCharge * successCount
|
||||
a +
|
||||
c.productService.product[price] -
|
||||
c.productService.product.serviceCharge * successCount
|
||||
);
|
||||
}
|
||||
return a + c.productService.product.price;
|
||||
|
|
@ -400,11 +406,17 @@ export class CreditNoteController extends Controller {
|
|||
(v) => v.productId === c.productService.productId,
|
||||
)?.stepCount;
|
||||
|
||||
const successCount = c.stepStatus.filter((v) => v.workStatus === "Completed").length;
|
||||
const successCount = c.stepStatus.filter(
|
||||
(v) => v.workStatus === RequestWorkStatus.Completed,
|
||||
).length;
|
||||
|
||||
const price = c.request.quotation.agentPrice ? "price" : "agentPrice";
|
||||
|
||||
if (serviceChargeStepCount && successCount) {
|
||||
return (
|
||||
a + c.productService.product.price - c.productService.product.serviceCharge * successCount
|
||||
a +
|
||||
c.productService.product[price] -
|
||||
c.productService.product.serviceCharge * successCount
|
||||
);
|
||||
}
|
||||
return a + c.productService.product.price;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue