offene_Auftraege_Teile.iqd 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. COGNOS QUERY
  2. STRUCTURE,1,1
  3. DATABASE,GC_LOCOSOFT
  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. c96 as c2,
  9. '' as c3,
  10. c95 as c4,
  11. c94 as c5,
  12. c93 as c6,
  13. c92 as c7,
  14. c91 as c8,
  15. c90 as c9,
  16. c89 as c10,
  17. c88 as c11,
  18. c87 as c12,
  19. c86 as c13,
  20. c85 as c14,
  21. c84 as c15,
  22. c83 as c16,
  23. c82 as c17,
  24. c81 as c18,
  25. c80 as c19,
  26. c79 as c20,
  27. '' as c21,
  28. '' as c22,
  29. '1' 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. (cast_numberToString(cast_integer(T1."subsidiary"))) as c78,
  84. T1."clearing_delay_type" as c79,
  85. T1."parts_rebate_group_sell" as c80,
  86. T1."holder_number" as c81,
  87. T1."paying_customer" as c82,
  88. T1."order_customer" as c83,
  89. T1."order_mileage" as c84,
  90. T1."vehicle_number" as c85,
  91. T1."order_delivery_employee_no" as c86,
  92. T1."order_taking_employee_no" as c87,
  93. T1."order_print_date" as c88,
  94. T1."estimated_outbound_time" as c89,
  95. T1."estimated_inbound_time" as c90,
  96. T1."order_date" as c91,
  97. T2."invoice_number" as c92,
  98. T2."invoice_type" as c93,
  99. T2."is_invoiced" as c94,
  100. T1."subsidiary" as c95,
  101. T2."order_position" as c96
  102. 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"))
  103. 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'))
  104. ) D1
  105. order by c1 asc
  106. END SQL
  107. COLUMN,0,Order Number_ori
  108. COLUMN,1,Order Position
  109. COLUMN,2,Labour Type
  110. COLUMN,3,Subsidiary
  111. COLUMN,4,Is Invoiced
  112. COLUMN,5,Invoice Type
  113. COLUMN,6,Invoice Number
  114. COLUMN,7,Order Date
  115. COLUMN,8,Estimated Inbound Time
  116. COLUMN,9,Estimated Outbound Time
  117. COLUMN,10,Order Print Date
  118. COLUMN,11,Order Taking Employee No
  119. COLUMN,12,Order Delivery Employee No
  120. COLUMN,13,Vehicle Number
  121. COLUMN,14,Order Mileage
  122. COLUMN,15,Order Customer
  123. COLUMN,16,Paying Customer
  124. COLUMN,17,Holder Number
  125. COLUMN,18,Parts Rebate Group Sell
  126. COLUMN,19,Clearing Delay Type
  127. COLUMN,20,Code_Labour_Type
  128. COLUMN,21,Description_Labour_Type
  129. COLUMN,22,Hauptbetrieb
  130. COLUMN,23,Standort
  131. COLUMN,24,Name_Serviceberater
  132. COLUMN,25,Serviceberater
  133. COLUMN,26,Umsatzart
  134. COLUMN,27,Customer Number_Cust
  135. COLUMN,28,First Name_Cust
  136. COLUMN,29,Family Name_Cust
  137. COLUMN,30,Kunde
  138. COLUMN,31,Order Number
  139. COLUMN,32,Internal Number_Vehicle
  140. COLUMN,33,Vin_Vehicle
  141. COLUMN,34,License Plate_Vehicle
  142. COLUMN,35,Make Number_Vehicle
  143. COLUMN,36,Auftragsart
  144. COLUMN,37,Make Number_Makes
  145. COLUMN,38,Description_Makes
  146. COLUMN,39,Fabrikat
  147. COLUMN,40,Description_Models
  148. COLUMN,41,Model
  149. COLUMN,42,DG_1
  150. COLUMN,43,DG_2
  151. COLUMN,44,Part Number
  152. COLUMN,45,Stock No
  153. COLUMN,46,Stock Removal Date
  154. COLUMN,47,Amount
  155. COLUMN,48,Sum
  156. COLUMN,49,Parts Type
  157. COLUMN,50,Text Line
  158. COLUMN,51,Teile