fix: only sum from payment success status

This commit is contained in:
Methapon Metanipat 2024-11-01 10:27:51 +07:00
parent 1ae40f5114
commit c8146ae8f1

View file

@ -137,7 +137,12 @@ export class QuotationPayment extends Controller {
const paymentSum = await prisma.payment.aggregate({
_sum: { amount: true },
where: { invoice: { quotationId: quotation.id } },
where: {
invoice: {
quotationId: quotation.id,
payment: { paymentStatus: "PaymentSuccess" },
},
},
});
await tx.quotation.update({