SELECT id, proforma_reference, status, deleted_at FROM proformas WHERE deleted_at IS NOT NULL AND status <> 'draft'; SELECT id, proforma_reference, deleted_at FROM proformas WHERE deleted_at IS NOT NULL ORDER BY deleted_at DESC LIMIT 20; SELECT ds.document_type, ds.code, ds.next_number FROM document_series ds WHERE ds.document_type = 'proforma';