offene_Auftraege_Teile.iqd 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. COGNOS QUERY
  2. STRUCTURE,1,1
  3. DATABASE,Locosoft_GC
  4. DATASOURCENAME,C:\GlobalCube\System\LOCOSOFT\IQD\serv_teile\offene_Auftraege_Teile.imr
  5. TITLE,offene_Auftraege_Teile.imr
  6. BEGIN SQL
  7. select distinct c55 as c1,
  8. c97 as c2,
  9. '' as c3,
  10. c96 as c4,
  11. c95 as c5,
  12. c94 as c6,
  13. c93 as c7,
  14. c92 as c8,
  15. c91 as c9,
  16. c90 as c10,
  17. c89 as c11,
  18. c88 as c12,
  19. c87 as c13,
  20. c86 as c14,
  21. c85 as c15,
  22. c84 as c16,
  23. c83 as c17,
  24. c82 as c18,
  25. c81 as c19,
  26. c80 as c20,
  27. '' as c21,
  28. '' as c22,
  29. c79 as c23,
  30. c78 as c24,
  31. c77 as c25,
  32. c76 as c26,
  33. 'Teile' as c27,
  34. c75 as c28,
  35. c74 as c29,
  36. c73 as c30,
  37. c72 as c31,
  38. c71 as c32,
  39. c70 as c33,
  40. c69 as c34,
  41. c68 as c35,
  42. c67 as c36,
  43. 'Service' as c37,
  44. c66 as c38,
  45. c65 as c39,
  46. c65 as c40,
  47. c64 as c41,
  48. c63 as c42,
  49. 1 as c43,
  50. XCOUNT('' for c55) as c44,
  51. c62 as c45,
  52. c61 as c46,
  53. c60 as c47,
  54. c59 as c48,
  55. c56 as c49,
  56. c58 as c50,
  57. c57 as c51,
  58. c56 as c52
  59. from
  60. (select T1."order_number" as c55,
  61. T2."sum" as c56,
  62. T2."text_line" as c57,
  63. T2."parts_type" as c58,
  64. T2."amount" as c59,
  65. T2."stock_removal_date" as c60,
  66. T2."stock_no" as c61,
  67. T2."part_number" as c62,
  68. (od_left((ucase(T7."description")),3)) as c63,
  69. T7."description" as c64,
  70. T6."description" as c65,
  71. T6."make_number" as c66,
  72. T5."make_number" as c67,
  73. T5."license_plate" as c68,
  74. T5."vin" as c69,
  75. T5."internal_number" as c70,
  76. CASE WHEN (T5."license_plate" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T1."order_number"))),6)) || ' - ' || (CASE WHEN (T1."order_taking_employee_no" = 0) THEN ('SB fehlt') ELSE ((od_left((cast_numberToString(cast_integer(T1."order_taking_employee_no"))),4)) || ' - ' || T3."name") END) || ' - ' || T4."family_name" || ' - ' || (asciiz(extract(YEAR FROM T1."order_date"),4) || '-' || asciiz(extract(MONTH FROM T1."order_date"),2) || '-' || asciiz(extract(DAY FROM T1."order_date"),2)) || ' - ' || T5."license_plate") ELSE ((od_left((cast_numberToString(cast_integer(T1."order_number"))),6)) || ' - ' || (CASE WHEN (T1."order_taking_employee_no" = 0) THEN ('SB fehlt') ELSE ((od_left((cast_numberToString(cast_integer(T1."order_taking_employee_no"))),4)) || ' - ' || T3."name") END) || ' - ' || T4."family_name" || ' - ' || (asciiz(extract(YEAR FROM T1."order_date"),4) || '-' || asciiz(extract(MONTH FROM T1."order_date"),2) || '-' || asciiz(extract(DAY FROM T1."order_date"),2))) END as c71,
  77. (od_left((cast_numberToString(cast_integer(T4."customer_number"))),7)) || ' - ' || T4."first_name" || ' ' || T4."family_name" as c72,
  78. T4."family_name" as c73,
  79. T4."first_name" as c74,
  80. T4."customer_number" as c75,
  81. CASE WHEN (T1."order_taking_employee_no" = 0) THEN ('SB fehlt') ELSE ((od_left((cast_numberToString(cast_integer(T1."order_taking_employee_no"))),4)) || ' - ' || T3."name") END as c76,
  82. T3."name" as c77,
  83. '0' || (cast_numberToString(cast_integer(T1."subsidiary"))) as c78,
  84. CASE WHEN (('0' || (cast_numberToString(cast_integer(T1."subsidiary")))) IN ('015 ')) THEN ('15') ELSE ('1') END as c79,
  85. T1."clearing_delay_type" as c80,
  86. T1."parts_rebate_group_sell" as c81,
  87. T1."holder_number" as c82,
  88. T1."paying_customer" as c83,
  89. T1."order_customer" as c84,
  90. T1."order_mileage" as c85,
  91. T1."vehicle_number" as c86,
  92. T1."order_delivery_employee_no" as c87,
  93. T1."order_taking_employee_no" as c88,
  94. T1."order_print_date" as c89,
  95. T1."estimated_outbound_time" as c90,
  96. T1."estimated_inbound_time" as c91,
  97. T1."order_date" as c92,
  98. T2."invoice_number" as c93,
  99. T2."invoice_type" as c94,
  100. T2."is_invoiced" as c95,
  101. T1."subsidiary" as c96,
  102. T2."order_position" as c97
  103. from (((((("dbo"."order_positions" T1 left outer join "dbo"."parts" T2 on T1."order_number" = T2."order_number") left outer join "dbo"."employees" T3 on T1."order_taking_employee_no" = T3."employee_number") left outer join "dbo"."customers_suppliers" T4 on T1."order_customer" = T4."customer_number") left outer join "dbo"."vehicles" T5 on T1."vehicle_number" = T5."internal_number") left outer join "dbo"."makes" T6 on T5."make_number" = T6."make_number") left outer join "dbo"."models" T7 on (T5."make_number" = T7."make_number") and (T5."model_code" = T7."model_code"))
  104. where ((((T2."invoice_number" IS NULL) and (T1."order_date" >= TIMESTAMP '2017-01-01 00:00:00.000')) and (T2."sum" IS NOT NULL)) and ('' <> 'F'))
  105. ) D1
  106. order by c1 asc
  107. END SQL
  108. COLUMN,0,Order Number_ori
  109. COLUMN,1,Order Position
  110. COLUMN,2,Labour Type
  111. COLUMN,3,Subsidiary
  112. COLUMN,4,Is Invoiced
  113. COLUMN,5,Invoice Type
  114. COLUMN,6,Invoice Number
  115. COLUMN,7,Order Date
  116. COLUMN,8,Estimated Inbound Time
  117. COLUMN,9,Estimated Outbound Time
  118. COLUMN,10,Order Print Date
  119. COLUMN,11,Order Taking Employee No
  120. COLUMN,12,Order Delivery Employee No
  121. COLUMN,13,Vehicle Number
  122. COLUMN,14,Order Mileage
  123. COLUMN,15,Order Customer
  124. COLUMN,16,Paying Customer
  125. COLUMN,17,Holder Number
  126. COLUMN,18,Parts Rebate Group Sell
  127. COLUMN,19,Clearing Delay Type
  128. COLUMN,20,Code_Labour_Type
  129. COLUMN,21,Description_Labour_Type
  130. COLUMN,22,Hauptbetrieb
  131. COLUMN,23,Standort
  132. COLUMN,24,Name_Serviceberater
  133. COLUMN,25,Serviceberater
  134. COLUMN,26,Umsatzart
  135. COLUMN,27,Customer Number_Cust
  136. COLUMN,28,First Name_Cust
  137. COLUMN,29,Family Name_Cust
  138. COLUMN,30,Kunde
  139. COLUMN,31,Order Number
  140. COLUMN,32,Internal Number_Vehicle
  141. COLUMN,33,Vin_Vehicle
  142. COLUMN,34,License Plate_Vehicle
  143. COLUMN,35,Make Number_Vehicle
  144. COLUMN,36,Auftragsart
  145. COLUMN,37,Make Number_Makes
  146. COLUMN,38,Description_Makes
  147. COLUMN,39,Fabrikat
  148. COLUMN,40,Description_Models
  149. COLUMN,41,Model
  150. COLUMN,42,DG_1
  151. COLUMN,43,DG_2
  152. COLUMN,44,Part Number
  153. COLUMN,45,Stock No
  154. COLUMN,46,Stock Removal Date
  155. COLUMN,47,Amount
  156. COLUMN,48,Sum
  157. COLUMN,49,Parts Type
  158. COLUMN,50,Text Line
  159. COLUMN,51,Teile