fixes: refs #7760 collection problems #2888
|
@ -147,6 +147,14 @@ BEGIN
|
||||||
JOIN state s ON s.id = pb.state
|
JOIN state s ON s.id = pb.state
|
||||||
JOIN agencyMode am ON am.id = pb.agencyModeFk
|
JOIN agencyMode am ON am.id = pb.agencyModeFk
|
||||||
JOIN agency a ON a.id = am.agencyFk
|
JOIN agency a ON a.id = am.agencyFk
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT pb.ticketFk, MAX(i.`size`) maxSize
|
||||||
|
FROM tmp.productionBuffer pb
|
||||||
|
JOIN ticket t ON t.id = pb.ticketfk
|
||||||
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
|
JOIN item i ON i.id = s.itemFk
|
||||||
|
GROUP BY pb.ticketFk
|
||||||
|
) sub ON sub.ticketFk = pb.ticketFk
|
||||||
JOIN productionConfig pc
|
JOIN productionConfig pc
|
||||||
WHERE pb.shipped <> util.VN_CURDATE()
|
WHERE pb.shipped <> util.VN_CURDATE()
|
||||||
OR (pb.ubicacion IS NULL AND a.isOwn)
|
OR (pb.ubicacion IS NULL AND a.isOwn)
|
||||||
|
|
Loading…
Reference in New Issue