diff --git a/src/controllers/04-invoice-controller.ts b/src/controllers/04-invoice-controller.ts index f3fc50e..28864cf 100644 --- a/src/controllers/04-invoice-controller.ts +++ b/src/controllers/04-invoice-controller.ts @@ -137,7 +137,7 @@ export class InvoiceController extends Controller { return await tx.invoice.create({ data: { quotationId: body.quotationId, - code: `IV${year}${month}${last.toString().padStart(6, "0")}`, + code: `IV${year}${month}${last.value.toString().padStart(6, "0")}`, amount: body.amount, installments: { connect: record.paySplit.map((v) => ({ id: v.id })), diff --git a/src/controllers/05-payment-controller.ts b/src/controllers/05-payment-controller.ts index 36ff19f..f10cfb7 100644 --- a/src/controllers/05-payment-controller.ts +++ b/src/controllers/05-payment-controller.ts @@ -170,7 +170,7 @@ export class QuotationPayment extends Controller { await tx.quotation.update({ where: { id: quotation.id }, data: { - code: last ? `RE${year}${month}${last.toString().padStart(6, "0")}` : undefined, + code: last ? `RE${year}${month}${last.value.toString().padStart(6, "0")}` : undefined, quotationStatus: paymentSum._sum.amount || 0 >= quotation.finalPrice ? "PaymentSuccess"