Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType,
- case
- ObjType
- when 13 then 'Uitgaande factuur'
- when 14 then 'Uitgaande creditnota'
- when 15 then 'Levering'
- when 16 then 'Inkomende retour'
- when 17 then 'Order'
- when 18 then 'Inkomende factuur'
- when 19 then 'Inkomende creditnota'
- when 20 then 'Goederenontvangst bestelling'
- when 21 then 'Uitgaande retour'
- when 22 then 'Aankoopbestelling'
- when 23 then 'Verkoop offerte'
- when 59 then 'Goederenontvangst'
- when 60 then 'Goederenafgifte'
- when 67 then 'Voorraadtransport'
- when 112
- then
- case
- ExtType
- when 13 then 'Concept Uitgaande factuur'
- when 14 then 'Concept Uitgaande creditnota'
- when 15 then 'Concept Levering'
- when 16 then 'Concept Inkomende retour'
- when 17 then 'Concept Order'
- when 18 then 'Concept Inkomende factuur'
- when 19 then 'Concept Inkomende creditnota'
- when 20 then 'Concept Goederenontvangst bestelling'
- when 21 then 'Concept Uitgaande retour'
- when 22 then 'Concept Aankoopbestelling'
- when 23 then 'Concept Verkoop offerte'
- when 59 then 'Concept Goederenontvangst'
- when 60 then 'Concept Goederenafgifte'
- when 67 then 'Concept Voorraadtransport'
- when 132 then 'Concept Verkoop correctie factuur'
- when 163 then 'Concept Aankoop correctie factuur'
- when 164 then 'Concept Aankoop correctie factuur storno'
- when 165 then 'Concept Verkoop correctie factuur'
- when 166 then 'Concept Verkoop correctie factuur storno'
- when 203 then 'Concept Vooruitbetaling'
- when 204 then 'Concept Vooruitbetaling'
- when 540000006 then 'Concept Aankoop offerte'
- when 1250000001 then 'Concept Aanvraag voorraadtransport'
- when 1470000113 then 'Concept Aanvraag tot bestellen'
- else '???' end
- when 132 then 'Verkoop correctie factuur'
- when 163 then 'Aankoop correctie factuur'
- when 164 then 'Aankoop correctie factuur storno'
- when 165 then 'Verkoop correctie factuur'
- when 166 then 'Verkoop correctie factuur storno'
- when 203 then 'Vooruitbetaling'
- when 204 then 'Vooruitbetaling'
- when 540000006 then 'Aankoop offerte'
- when 1250000001 then 'Aanvraag voorraadtransport'
- when 1470000113 then 'Aanvraag tot bestellen'
- else '???' end as DocumentKind,
- U_ICD_SERVICENR
- from
- (
- SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OCIN WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OCPI WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OCPV WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OCSI WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OCSV WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM ODLN WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM ODPI WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM ODPO WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, 112, ObjType as ExtType, U_ICD_SERVICENR FROM ODRF WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OIEI WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OIGE WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OIGN WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OINV WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OOEI WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OPCH WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OPDN WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OPOR WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OPQT WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OPRQ WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OQUT WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM ORDN WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM ORDR WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM ORIN WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM ORPC WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM ORPD WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OWTQ WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- union all SELECT DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType, ObjType as ExtType, U_ICD_SERVICENR FROM OWTR WHERE ISNULL(U_ICD_SERVICENR, '') like '{0}%'
- ) AS T001
- order by
- U_ICD_SERVICENR,
- DocDate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement