OP_AS.iqd 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. COGNOS QUERY
  2. STRUCTURE,1,1
  3. DATABASE,O21
  4. DATASOURCENAME,C:\GAPS\Portal\System\IQD\OP\OP_AS.imr
  5. TITLE,OP_AS.imr
  6. BEGIN SQL
  7. select c1 as c1,
  8. c2 as c2,
  9. c3 as c3,
  10. c4 as c4,
  11. c5 as c5,
  12. c6 as c6,
  13. c7 as c7,
  14. c8 as c8,
  15. c9 as c9,
  16. c10 as c10,
  17. c11 as c11,
  18. c12 as c12,
  19. c13 as c13,
  20. c14 as c14,
  21. c15 as c15,
  22. c16 as c16,
  23. c17 as c17,
  24. c18 as c18,
  25. c19 as c19,
  26. c20 as c20,
  27. c21 as c21,
  28. c22 as c22,
  29. c23 as c23,
  30. c24 as c24,
  31. c25 as c25,
  32. c26 as c26,
  33. c27 as c27,
  34. c28 as c28,
  35. c29 as c29,
  36. c30 as c30,
  37. c31 as c31,
  38. c32 as c32,
  39. c33 as c33,
  40. c34 as c34,
  41. c35 as c35,
  42. c36 as c36,
  43. c37 as c37,
  44. c38 as c38,
  45. c39 as c39,
  46. c40 as c40,
  47. c41 as c41,
  48. c42 as c42,
  49. c43 as c43,
  50. c44 as c44,
  51. c45 as c45,
  52. c46 as c46,
  53. c47 as c47,
  54. c48 as c48,
  55. c49 as c49,
  56. c50 as c50,
  57. c51 as c51,
  58. c52 as c52,
  59. c53 as c53,
  60. c54 as c54,
  61. c55 as c55,
  62. c56 as c56,
  63. c57 as c57,
  64. c58 as c58,
  65. c59 as c59,
  66. c60 as c60,
  67. c61 as c61,
  68. RSUM(c61) as c62,
  69. RSUM(c61) as c63,
  70. c64 as c64,
  71. c65 as c65,
  72. c66 as c66,
  73. c67 as c67,
  74. c68 as c68,
  75. c69 as c69,
  76. c70 as c70,
  77. c71 as c71,
  78. c72 as c72,
  79. c73 as c73,
  80. c74 as c74,
  81. c75 as c75,
  82. c76 as c76,
  83. c77 as c77,
  84. c78 as c78,
  85. c79 as c79,
  86. c80 as c80,
  87. c81 as c81,
  88. c82 as c82,
  89. c83 as c83,
  90. c84 as c84,
  91. c85 as c85,
  92. c86 as c86,
  93. c87 as c87,
  94. c88 as c88,
  95. c89 as c89,
  96. c90 as c90,
  97. c91 as c91
  98. from
  99. (select T1."CUSTOMER_NUMBER" as c1,
  100. T1."VOUCHER_NO" as c2,
  101. T1."LINE_NO_CU" as c3,
  102. T1."TRANSACTION_STATUS" as c4,
  103. T1."DUE_DATE" as c5,
  104. T1."BOOKKEEP_DATE" as c6,
  105. T1."STATE_CODE" as c7,
  106. T1."TRANSACT_DATE" as c8,
  107. T1."HANDLER" as c9,
  108. T1."CREATION_DATE" as c10,
  109. T1."CREATION_TIME_8" as c11,
  110. T1."STATUS" as c12,
  111. T1."MODUL" as c13,
  112. T1."BATCH_NUMBER" as c14,
  113. T1."JOURNAL_NO" as c15,
  114. T1."DOCUMENT_NO" as c16,
  115. T1."DOCUMENT_DATE" as c17,
  116. T1."DISCOUNT_DATE" as c18,
  117. T1."DUNNING_DATE" as c19,
  118. T1."START_INT_DATE" as c20,
  119. T1."LAST_INT_DATE" as c21,
  120. T1."PMT_TERM" as c22,
  121. T1."DUNTIMES" as c23,
  122. T1."TAX_CODE" as c24,
  123. T1."REMINDER_CODE" as c25,
  124. T1."SUM_C_U" as c26,
  125. T1."TAX_C_U" as c27,
  126. T1."CASH_DISCOUNT_C_U" as c28,
  127. T1."INTEREST_PERC" as c29,
  128. T1."PAID_C_U" as c30,
  129. T1."COMMENT_CU" as c31,
  130. T1."SETOFF_ACCT" as c32,
  131. T1."COLLECT_ACCT" as c33,
  132. T1."INTEREST_CALC" as c34,
  133. T1."INT_VOUCHER_NO" as c35,
  134. T2."CUSTOMER_NUMBER" as c36,
  135. T2."STATE_CODE_CUST" as c37,
  136. T2."TRANSACT_DATE" as c38,
  137. T2."HANDLER" as c39,
  138. T2."CUST_ALT_KEY" as c40,
  139. T2."NAME" as c41,
  140. T2."STREET_ADDR" as c42,
  141. T2."ZIPCODE" as c43,
  142. T2."DEBIT_CUSTOMER" as c44,
  143. T2."TITLE_CODE" as c45,
  144. T2."TITLE" as c46,
  145. T2."PMT_TERM" as c47,
  146. T2."WORKSHOP_PRICECODE" as c48,
  147. T2."VAT_REGNO" as c49,
  148. T2."SALESMAN" as c50,
  149. T2."GROSS_DISCOUNT" as c51,
  150. T2."DELIVERY_STOP_CODE" as c52,
  151. T2."CREDIT_LIMIT" as c53,
  152. T2."REMINDER_CODE" as c54,
  153. T2."CUSTOMER_GROUP" as c55,
  154. T2."COMMENT_1" as c56,
  155. T2."COMMENT_2" as c57,
  156. T2."SALDO_C_U_CUST" as c58,
  157. T2."REMINDER_GROUP" as c59,
  158. T2."REMINDER_DATE" as c60,
  159. T1."SUM_C_U" + T1."PAID_C_U" as c61,
  160. T3."ORDER_NUMBER" as c64,
  161. T3."STATUS" as c65,
  162. T3."DEBIT_ACCOUNT" as c66,
  163. T3."INVOICE_NUMBER" as c67,
  164. T3."DELIVERY_ACCOUNT" as c68,
  165. T3."DEPARTMENT" as c69,
  166. T3."INVOICE_DATE" as c70,
  167. T3."ORDERS_GROSSVALUE" as c71,
  168. T3."SALESMAN" as c72,
  169. T4."DEPARTMENT_TYPE_ID" as c73,
  170. T4."DESCRIPTION" as c74,
  171. T5."SELLER_CODE" as c75,
  172. T5."SEL_NAME" as c76,
  173. T5."SEL_DEPARTMENT" as c77,
  174. '1' as c78,
  175. (od_left(T4."DEPARTMENT_TYPE_ID",2)) as c79,
  176. (substring(T4."DEPARTMENT_TYPE_ID" from 4 for 1)) as c80,
  177. T6."CUSTOMER_NUMBER" as c81,
  178. T6."NAME" as c82,
  179. (now()) as c83,
  180. (extract(DAY FROM ((now())) - T1."BOOKKEEP_DATE")) as c84,
  181. CASE WHEN (((extract(DAY FROM ((now())) - T1."BOOKKEEP_DATE"))) BETWEEN 0 AND 14) THEN ('< 2 Wochen') WHEN (((extract(DAY FROM ((now())) - T1."BOOKKEEP_DATE"))) BETWEEN 15 AND 28) THEN ('2 - 4 Wochen') WHEN (((extract(DAY FROM ((now())) - T1."BOOKKEEP_DATE"))) BETWEEN 29 AND 42) THEN ('4 - 6 Wochen') WHEN (((extract(DAY FROM ((now())) - T1."BOOKKEEP_DATE"))) BETWEEN 43 AND 84) THEN ('6 - 12 Wochen') WHEN (((extract(DAY FROM ((now())) - T1."BOOKKEEP_DATE"))) > 84) THEN ('> 12 Wochen') ELSE null END as c85,
  182. T2."NAME" || ' - ' || T1."CUSTOMER_NUMBER" as c86,
  183. T6."NAME" || ' - ' || T6."CUSTOMER_NUMBER" as c87,
  184. (asciiz(extract(YEAR FROM T1."BOOKKEEP_DATE"),4) || '-' || asciiz(extract(MONTH FROM T1."BOOKKEEP_DATE"),2) || '-' || asciiz(extract(DAY FROM T1."BOOKKEEP_DATE"),2)) as c88,
  185. (cast_numberToString(cast_integer(T1."VOUCHER_NO"))) as c89,
  186. (od_left(((cast_numberToString(cast_integer(T1."VOUCHER_NO")))),7)) || ' - ' || T1."COMMENT_CU" || ' - ' || ((asciiz(extract(YEAR FROM T1."BOOKKEEP_DATE"),4) || '-' || asciiz(extract(MONTH FROM T1."BOOKKEEP_DATE"),2) || '-' || asciiz(extract(DAY FROM T1."BOOKKEEP_DATE"),2))) as c90,
  187. (database()) as c91
  188. from ((((("deop01"."dbo"."CUSTOMER_TRANSACT" T1 left outer join "deop01"."dbo"."CUSTOMER" T2 on T1."CUSTOMER_NUMBER" = T2."CUSTOMER_NUMBER") left outer join "deop01"."dbo"."ORDER_HEADER" T3 on T1."DOCUMENT_NO" = T3."ORDER_NUMBER") left outer join "deop01"."dbo"."DEPARTMENT_TYPE" T4 on T3."DEPARTMENT" = T4."DEPARTMENT_TYPE_ID") left outer join "deop01"."dbo"."vPP43" T5 on T3."SALESMAN" = T5."SELLER_CODE") left outer join "deop01"."dbo"."CUSTOMER" T6 on T3."DELIVERY_ACCOUNT" = T6."CUSTOMER_NUMBER")
  189. where (((T1."SUM_C_U" + T1."PAID_C_U") <> .00) and (T3."ORDER_NUMBER" IS NOT NULL))
  190. order by c6 asc
  191. ) D1
  192. END SQL
  193. COLUMN,0,Customer Number
  194. COLUMN,1,Voucher No
  195. COLUMN,2,Line No Cu
  196. COLUMN,3,Transaction Status
  197. COLUMN,4,Due Date
  198. COLUMN,5,Bookkeep Date
  199. COLUMN,6,State Code
  200. COLUMN,7,Transact Date
  201. COLUMN,8,Handler
  202. COLUMN,9,Creation Date
  203. COLUMN,10,Creation Time 8
  204. COLUMN,11,Status
  205. COLUMN,12,Modul
  206. COLUMN,13,Batch Number
  207. COLUMN,14,Journal No
  208. COLUMN,15,Document No
  209. COLUMN,16,Document Date
  210. COLUMN,17,Discount Date
  211. COLUMN,18,Dunning Date
  212. COLUMN,19,Start Int Date
  213. COLUMN,20,Last Int Date
  214. COLUMN,21,Pmt Term
  215. COLUMN,22,Duntimes
  216. COLUMN,23,Tax Code
  217. COLUMN,24,Reminder Code
  218. COLUMN,25,Sum C U
  219. COLUMN,26,Tax C U
  220. COLUMN,27,Cash Discount C U
  221. COLUMN,28,Interest Perc
  222. COLUMN,29,Paid C U
  223. COLUMN,30,Comment Cu
  224. COLUMN,31,Setoff Acct
  225. COLUMN,32,Collect Acct
  226. COLUMN,33,Interest Calc
  227. COLUMN,34,Int Voucher No
  228. COLUMN,35,Customer Number
  229. COLUMN,36,State Code Cust
  230. COLUMN,37,Transact Date
  231. COLUMN,38,Handler
  232. COLUMN,39,Cust Alt Key
  233. COLUMN,40,Name
  234. COLUMN,41,Street Addr
  235. COLUMN,42,Zipcode
  236. COLUMN,43,Debit Customer
  237. COLUMN,44,Title Code
  238. COLUMN,45,Title
  239. COLUMN,46,Pmt Term
  240. COLUMN,47,Workshop Pricecode
  241. COLUMN,48,Vat Regno
  242. COLUMN,49,Salesman
  243. COLUMN,50,Gross Discount
  244. COLUMN,51,Delivery Stop Code
  245. COLUMN,52,Credit Limit
  246. COLUMN,53,Reminder Code
  247. COLUMN,54,Customer Group
  248. COLUMN,55,Comment 1
  249. COLUMN,56,Comment 2
  250. COLUMN,57,Saldo C U Cust
  251. COLUMN,58,Reminder Group
  252. COLUMN,59,Reminder Date
  253. COLUMN,60,Saldo_Beleg
  254. COLUMN,61,Summe (Saldo_Beleg) Nr.2
  255. COLUMN,62,Summe (Saldo_Beleg) Nr.1
  256. COLUMN,63,Order Number
  257. COLUMN,64,Status
  258. COLUMN,65,Debit Account
  259. COLUMN,66,Invoice Number
  260. COLUMN,67,Delivery Account
  261. COLUMN,68,Department
  262. COLUMN,69,Invoice Date
  263. COLUMN,70,Orders Grossvalue
  264. COLUMN,71,Salesman
  265. COLUMN,72,Department Type Id
  266. COLUMN,73,Description
  267. COLUMN,74,Seller Code
  268. COLUMN,75,Sel Name
  269. COLUMN,76,Sel Department
  270. COLUMN,77,Hauptbetrieb
  271. COLUMN,78,Standort
  272. COLUMN,79,Kostenstelle
  273. COLUMN,80,Customer Number_Deliv
  274. COLUMN,81,Name_Deliv
  275. COLUMN,82,Heute
  276. COLUMN,83,Tage
  277. COLUMN,84,Staffel
  278. COLUMN,85,Kunde
  279. COLUMN,86,Lieferkunde
  280. COLUMN,87,Datum_Zeichen
  281. COLUMN,88,Voucher_Zeichen
  282. COLUMN,89,Beleg
  283. COLUMN,90,Mandant