select ID, ordnumber
from POSRECEIPTS
where
DocQueue_ID = :DocQueue_ID and
Period_ID = :Period_ID and
VirtualPOS_ID = :VirtualPOS_ID and
ordnumber =
(select max(ordnumber)
from POSRECEIPTS
where DocQueue_ID = :DocQueue_ID and
Period_ID = :Period_ID and
VirtualPOS_ID = :VirtualPOS_ID and
Ended = 'A')Generated by ABRA Software a.s. 27.10.2021 16:34:30