fix: refs #7213 change rounding problems #2943
|
@ -208,18 +208,18 @@ BEGIN
|
|||
INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
|
||||
SELECT ticketFk, problem ,saleFk
|
||||
guillermo marked this conversation as resolved
|
||||
FROM (
|
||||
SELECT tl.ticketFk,
|
||||
SELECT sgp.ticketFk,
|
||||
s.id saleFk,
|
||||
LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN ticket t ON t.id = tl.ticketFk
|
||||
FROM tmp.sale_getProblems sgp
|
||||
JOIN ticket t ON t.id = sgp.ticketFk
|
||||
AND t.warehouseFk = vWarehouseFk
|
||||
JOIN sale s ON s.ticketFk = tl.ticketFk
|
||||
JOIN sale s ON s.ticketFk = sgp.ticketFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
||||
JOIN buy b ON b.id = bu.buyFk
|
||||
WHERE MOD(s.quantity, b.`grouping`)
|
||||
GROUP BY tl.ticketFk
|
||||
GROUP BY sgp.ticketFk
|
||||
)sub
|
||||
ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
|
||||
END LOOP;
|
||||
|
|
Loading…
Reference in New Issue
SELECT ticketFk, problem, saleFk