From dfde2f684650e045bde67d6617a94a071f901bd9 Mon Sep 17 00:00:00 2001 From: Pako Date: Tue, 21 May 2024 13:28:05 +0200 Subject: [PATCH] evita facturacion proveedores --- db/routines/vn/procedures/ticketPackaging_add.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/ticketPackaging_add.sql b/db/routines/vn/procedures/ticketPackaging_add.sql index d669b95f5..f96068b56 100644 --- a/db/routines/vn/procedures/ticketPackaging_add.sql +++ b/db/routines/vn/procedures/ticketPackaging_add.sql @@ -27,7 +27,10 @@ BEGIN SELECT DISTINCT clientFk FROM ( SELECT clientFk, SUM(quantity) totalQuantity - FROM tmp.packagingToInvoice + FROM tmp.packagingToInvoice tpi + JOIN client c ON c.id = tpi.clientFk + LEFT JOIN supplier s ON s.nif = c.fi + WHERE s.id IS NULL GROUP BY itemFk, clientFk HAVING totalQuantity > 0)sub; -- 2.40.1