refactor: change installments data

This commit is contained in:
Methapon Metanipat 2024-10-29 09:49:02 +07:00
parent e80e2f725b
commit f4efa45fdc
4 changed files with 24 additions and 5 deletions

View file

@ -137,7 +137,17 @@ export class InvoiceController extends Controller {
return await prisma.$transaction(async (tx) => {
await tx.quotation.update({
where: { id: body.quotationId },
data: { quotationStatus: "PaymentInProcess" },
data: {
quotationStatus: "PaymentInProcess",
paySplit: body.installmentNo
? {
updateMany: {
where: { no: { in: body.installmentNo } },
data: { invoice: true },
},
}
: undefined,
},
});
return await tx.invoice.create({
data: {

View file

@ -98,7 +98,7 @@ type QuotationUpdate = {
payCondition?: PayCondition;
paySplitCount?: number;
paySplit?: { date: Date; amount: number }[];
paySplit?: { amount: number }[];
payBillDate?: Date;