From ad8f27ea810b39bbc087ff32ceaf6cbf8827ecf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Wed, 11 Sep 2024 10:15:37 +0200 Subject: [PATCH] fix: refs #7213 change rounding problems --- .../vn/procedures/sale_getProblems.sql | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/db/routines/vn/procedures/sale_getProblems.sql b/db/routines/vn/procedures/sale_getProblems.sql index 40b72a878..133f3995a 100644 --- a/db/routines/vn/procedures/sale_getProblems.sql +++ b/db/routines/vn/procedures/sale_getProblems.sql @@ -204,9 +204,10 @@ BEGIN ) sub ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk; + -- Redondeo: cantidad incorrecta con respecto al grouping CALL buyUltimate(vWarehouseFk, vDate); INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk) - SELECT ticketFk, problem ,saleFk + SELECT ticketFk, problem, saleFk FROM ( SELECT sgp.ticketFk, s.id saleFk, @@ -222,24 +223,11 @@ BEGIN GROUP BY sgp.ticketFk )sub ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk; + + DROP TEMPORARY TABLE tmp.buyUltimate; END LOOP; CLOSE vCursor; - INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk) - SELECT ticketFk, problem, saleFk - FROM ( - SELECT sgp.ticketFk, - s.id saleFk, - LEFT(GROUP_CONCAT('RE: ', i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem - FROM tmp.sale_getProblems sgp - JOIN ticket t ON t.id = sgp.ticketFk - JOIN sale s ON s.ticketFk = sgp.ticketFk - JOIN item i ON i.id = s.itemFk - WHERE FIND_IN_SET('hasRounding', s.problem) - GROUP BY sgp.ticketFk - ) sub - ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk; - DROP TEMPORARY TABLE tItemShelvingStock_byWarehouse; END$$ DELIMITER ;