select ID
from POSDocuments
where
DocQueue_ID = :DocQueue_ID and
Shop_ID = :Shop_ID and
(
(Opened = 'A') or
(IsPayChange = 'A')
) and
ID like :SiteMask
order by
IsPayChange, DocDate$DATEGenerated by ABRA Software a.s. 27.10.2021 16:34:30