fix: refs #7213 Hotfix-ticket_isTooLittle-group-by-addressFk #2895
|
@ -20,13 +20,12 @@ BEGIN
|
||||||
)
|
)
|
||||||
SELECT (SUM(IFNULL(sv.litros, 0)) < vc.minTicketVolume
|
SELECT (SUM(IFNULL(sv.litros, 0)) < vc.minTicketVolume
|
||||||
AND SUM(IFNULL(t.totalWithoutVat, 0)) < vc.minTicketValue) INTO vIsTooLittle
|
AND SUM(IFNULL(t.totalWithoutVat, 0)) < vc.minTicketValue) INTO vIsTooLittle
|
||||||
FROM vn.ticket t
|
FROM tickets ts
|
||||||
JOIN tickets ts ON ts.addressFk = t.addressFk
|
JOIN vn.ticket t ON t.addressFk = ts.addressFk
|
||||||
JOIN vn.volumeConfig vc
|
|
||||||
LEFT JOIN vn.saleVolume sv ON sv.ticketFk = t.id
|
LEFT JOIN vn.saleVolume sv ON sv.ticketFk = t.id
|
||||||
|
JOIN vn.volumeConfig vc
|
||||||
WHERE t.shipped BETWEEN ts.dated AND util.dayEnd(ts.dated)
|
WHERE t.shipped BETWEEN ts.dated AND util.dayEnd(ts.dated)
|
||||||
AND sv.litros > 0
|
AND ticket_isProblemCalcNeeded(t.id);
|
||||||
AND t.totalWithoutVat > 0;
|
|
||||||
|
|
||||||
RETURN vIsTooLittle;
|
RETURN vIsTooLittle;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -17,9 +17,9 @@ BEGIN
|
||||||
FROM vn.ticket
|
FROM vn.ticket
|
||||||
WHERE id = vSelf
|
WHERE id = vSelf
|
||||||
)
|
)
|
||||||
SELECT vSelf ticketFk,
|
SELECT t.id ticketFk,
|
||||||
ticket_isTooLittle(vSelf) hasProblem,
|
ticket_isTooLittle(t.id) hasProblem,
|
||||||
ticket_isProblemCalcNeeded(vSelf) isProblemCalcNeeded
|
ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
|
||||||
FROM vn.ticket t
|
FROM vn.ticket t
|
||||||
JOIN tickets ts ON ts.addressFk = t.addressFk
|
JOIN tickets ts ON ts.addressFk = t.addressFk
|
||||||
WHERE t.shipped BETWEEN ts.dated AND util.dayEnd(ts.dated);
|
WHERE t.shipped BETWEEN ts.dated AND util.dayEnd(ts.dated);
|
||||||
|
|
Loading…
Reference in New Issue