From d852d16ae4d19e97aafa562a8c9686b0e78c8742 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 2 Aug 2024 08:11:38 +0200 Subject: [PATCH] feat: refs #7382 Changes --- db/routines/vn/procedures/invoiceIn_booking.sql | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/procedures/invoiceIn_booking.sql b/db/routines/vn/procedures/invoiceIn_booking.sql index c728085b8..a5dd3a5f1 100644 --- a/db/routines/vn/procedures/invoiceIn_booking.sql +++ b/db/routines/vn/procedures/invoiceIn_booking.sql @@ -16,9 +16,11 @@ BEGIN DECLARE vHasRepeatedTransactions BOOL; SELECT TRUE INTO vHasRepeatedTransactions - FROM invoiceInTax - WHERE invoiceInFk = vSelf - HAVING COUNT(DISTINCT transactionTypeSageFk) > 1 + FROM invoiceInTax iit + JOIN invoiceIn ii ON ii.id = iit.invoiceInFk + WHERE ii.id = vSelf + AND ii.serial = 'E' + HAVING COUNT(DISTINCT iit.transactionTypeSageFk) > 1 LIMIT 1; IF vHasRepeatedTransactions THEN