Advertisement
Guest User

ServiceCallQuery

a guest
Aug 22nd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.94 KB | None | 0 0
  1. select
  2.                                 DocEntry, DocType, DocNum, DocDate, CardCode, CardName, DocTotal, Comments, ObjType,
  3.                                 case
  4.                                     ObjType
  5.                                         when 13 then 'Uitgaande factuur'
  6.                                         when 14 then 'Uitgaande creditnota'
  7.                                         when 15 then 'Levering'
  8.                                         when 16 then 'Inkomende retour'
  9.                                         when 17 then 'Order'
  10.                                         when 18 then 'Inkomende factuur'
  11.                                         when 19 then 'Inkomende creditnota'
  12.                                         when 20 then 'Goederenontvangst bestelling'
  13.                                         when 21 then 'Uitgaande retour'
  14.                                         when 22 then 'Aankoopbestelling'
  15.                                         when 23 then 'Verkoop offerte'
  16.                                         when 59 then 'Goederenontvangst'
  17.                                         when 60 then 'Goederenafgifte'
  18.                                         when 67 then 'Voorraadtransport'
  19.                                         when 112
  20.                                             then
  21.                                                 case
  22.                                                     ExtType
  23.                                                         when 13  then 'Concept Uitgaande factuur'
  24.                                                         when 14  then 'Concept Uitgaande creditnota'
  25.                                                         when 15  then 'Concept Levering'
  26.                                                         when 16  then 'Concept Inkomende retour'
  27.                                                         when 17  then 'Concept Order'
  28.                                                         when 18  then 'Concept Inkomende factuur'
  29.                                                         when 19  then 'Concept Inkomende creditnota'
  30.                                                         when 20  then 'Concept Goederenontvangst bestelling'
  31.                                                         when 21  then 'Concept Uitgaande retour'
  32.                                                         when 22  then 'Concept Aankoopbestelling'
  33.                                                         when 23  then 'Concept Verkoop offerte'
  34.                                                         when 59  then 'Concept Goederenontvangst'
  35.                                                         when 60  then 'Concept Goederenafgifte'
  36.                                                         when 67  then 'Concept Voorraadtransport'
  37.                                                         when 132 then 'Concept Verkoop correctie factuur'
  38.                                                         when 163 then 'Concept Aankoop correctie factuur'
  39.                                                         when 164 then 'Concept Aankoop correctie factuur storno'
  40.                                                         when 165 then 'Concept Verkoop correctie factuur'
  41.                                                         when 166 then 'Concept Verkoop correctie factuur storno'
  42.                                                         when 203 then 'Concept Vooruitbetaling'
  43.                                                         when 204 then 'Concept Vooruitbetaling'
  44.                                                         when 540000006 then 'Concept Aankoop offerte'
  45.                                                         when 1250000001 then 'Concept Aanvraag voorraadtransport'
  46.                                                         when 1470000113 then 'Concept Aanvraag tot bestellen'
  47.                                                         else '???' end
  48.                                         when 132 then 'Verkoop correctie factuur'
  49.                                         when 163 then 'Aankoop correctie factuur'
  50.                                         when 164 then 'Aankoop correctie factuur storno'
  51.                                         when 165 then 'Verkoop correctie factuur'
  52.                                         when 166 then 'Verkoop correctie factuur storno'
  53.                                         when 203 then 'Vooruitbetaling'
  54.                                         when 204 then 'Vooruitbetaling'
  55.                                         when 540000006 then 'Aankoop offerte'
  56.                                         when 1250000001 then 'Aanvraag voorraadtransport'
  57.                                         when 1470000113 then 'Aanvraag tot bestellen'
  58.                                         else '???' end as DocumentKind,
  59.                                 U_ICD_SERVICENR
  60.                             from
  61.                                 (
  62.                                               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}%'
  63.                                     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}%'
  64.                                     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}%'
  65.                                     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}%'
  66.                                     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}%'
  67.                                     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}%'
  68.                                     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}%'
  69.                                     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}%'
  70.                                     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}%'
  71.                                     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}%'
  72.                                     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}%'
  73.                                     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}%'
  74.                                     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}%'
  75.                                     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}%'
  76.                                     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}%'
  77.                                     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}%'
  78.                                     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}%'
  79.                                     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}%'
  80.                                     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}%'
  81.                                     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}%'
  82.                                     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}%'
  83.                                     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}%'
  84.                                     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}%'
  85.                                     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}%'
  86.                                     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}%'
  87.                                     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}%'
  88.                                     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}%'
  89.                                 ) AS T001
  90.                             order by
  91.                                 U_ICD_SERVICENR,
  92.                                 DocDate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement