fix: refs #7213 change rounding problems #2943

Merged
guillermo merged 4 commits from 7213-changeRoundingProblem into master 2024-09-11 10:33:01 +00:00
1 changed files with 4 additions and 16 deletions
Showing only changes of commit ad8f27ea81 - Show all commits

View File

@ -204,9 +204,10 @@ BEGIN
) sub ) sub
ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk; ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk;
-- Redondeo: cantidad incorrecta con respecto al grouping
CALL buyUltimate(vWarehouseFk, vDate); CALL buyUltimate(vWarehouseFk, vDate);
INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk) INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
guillermo marked this conversation as resolved
Review

SELECT ticketFk, problem, saleFk

SELECT ticketFk, problem, saleFk
SELECT ticketFk, problem ,saleFk SELECT ticketFk, problem, saleFk
FROM ( FROM (
SELECT sgp.ticketFk, SELECT sgp.ticketFk,
s.id saleFk, s.id saleFk,
@ -222,24 +223,11 @@ BEGIN
GROUP BY sgp.ticketFk GROUP BY sgp.ticketFk
)sub )sub
ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk; ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
DROP TEMPORARY TABLE tmp.buyUltimate;
END LOOP; END LOOP;
CLOSE vCursor; 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; DROP TEMPORARY TABLE tItemShelvingStock_byWarehouse;
END$$ END$$
DELIMITER ; DELIMITER ;