SELECT SD.DocDate$date, SD2.ID FROM StoreDocuments SD
JOIN StoreDocuments2 SD2 ON SD2.parent_id = SD.id
JOIN sys$storedocuments3 syssd3 ON syssd3.storedocument_id = SD.id
WHERE (SD.DocumentType = '27' OR SD.DocumentType = '21' OR SD.DocumentType = '22' OR SD.DocumentType = '26' OR SD.DocumentType = '30')
/* VMV or Dodaci list or PRV - Prevodky vydej or INM - Inventarni manka or VPR - Vratka prijemek */
AND syssd3.closed = 'A' AND sd2.storecard_id = :SC_ID
ORDER BY SD.DocDate$date DESCGenerated by ABRA Software a.s. 27.10.2021 16:34:49