From d10db686e536df72cb982b8d811702f5425c4b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 6 Sep 2024 12:52:24 +0200 Subject: [PATCH] fix: refs #7346 ticket_close serial --- db/routines/vn/procedures/ticket_close.sql | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/procedures/ticket_close.sql b/db/routines/vn/procedures/ticket_close.sql index 97da5057c..f8bbe239b 100644 --- a/db/routines/vn/procedures/ticket_close.sql +++ b/db/routines/vn/procedures/ticket_close.sql @@ -17,6 +17,7 @@ BEGIN DECLARE vHasDailyInvoice BOOL; DECLARE vWithPackage BOOL; DECLARE vHasToInvoice BOOL; + DECLARE vSerial VARCHAR(2); DECLARE cur CURSOR FOR SELECT ticketFk FROM tmp.ticket_close; @@ -83,14 +84,17 @@ BEGIN GROUP BY e.freightItemFk); IF(vHasDailyInvoice) AND vHasToInvoice THEN + SELECT invoiceSerial(vClientFk, vCompanyFk, 'quick') INTO vSerial; + IF NOT vSerial THEN + CALL util.throw('Cannot booking without a serial'); + END IF; - -- Facturacion rapida CALL ticket_setState(vCurTicketFk, 'DELIVERED'); - -- Facturar si está contabilizado + IF vIsTaxDataChecked THEN CALL invoiceOut_newFromClient( vClientFk, - (SELECT invoiceSerial(vClientFk, vCompanyFk, 'multiple')), + vSerial, vShipped, vCompanyFk, NULL,