OP_aus_LOC_Belege_ohne_8520.iqd 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. COGNOS QUERY
  2. STRUCTURE,1,1
  3. DATABASE,GC_LOCOSOFT
  4. DATASOURCENAME,C:\GlobalCube\System\LOCOSOFT\IQD\op\OP_aus_LOC_Belege_ohne_8520.imr
  5. TITLE,OP_aus_LOC_Belege_ohne_8520.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. XSUM(c50 for c53) as c59,
  66. c60 as c60,
  67. c61 as c61,
  68. c62 as c62,
  69. c63 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. from
  87. (select c112 as c1,
  88. c154 as c2,
  89. c153 as c3,
  90. c152 as c4,
  91. c109 as c5,
  92. c151 as c6,
  93. c150 as c7,
  94. c149 as c8,
  95. c148 as c9,
  96. c147 as c10,
  97. c146 as c11,
  98. c145 as c12,
  99. c144 as c13,
  100. c143 as c14,
  101. c142 as c15,
  102. c141 as c16,
  103. c140 as c17,
  104. c139 as c18,
  105. c138 as c19,
  106. c137 as c20,
  107. c136 as c21,
  108. c135 as c22,
  109. c134 as c23,
  110. c133 as c24,
  111. c132 as c25,
  112. c131 as c26,
  113. c130 as c27,
  114. c129 as c28,
  115. c128 as c29,
  116. c127 as c30,
  117. c126 as c31,
  118. c125 as c32,
  119. c124 as c33,
  120. c123 as c34,
  121. c122 as c35,
  122. c121 as c36,
  123. c120 as c37,
  124. c119 as c38,
  125. c118 as c39,
  126. c117 as c40,
  127. c116 as c41,
  128. c115 as c42,
  129. c114 as c43,
  130. c113 as c44,
  131. c99 as c45,
  132. c84 as c46,
  133. c112 as c47,
  134. c111 as c48,
  135. '1' as c49,
  136. c96 as c50,
  137. c110 as c51,
  138. c109 as c52,
  139. c83 as c53,
  140. c108 as c54,
  141. c107 as c55,
  142. c106 as c56,
  143. c105 as c57,
  144. c104 as c58,
  145. c103 as c60,
  146. c102 as c61,
  147. c101 as c62,
  148. c100 as c63,
  149. c99 as c64,
  150. c98 as c65,
  151. c97 as c66,
  152. c96 as c67,
  153. c95 as c68,
  154. c94 as c69,
  155. c93 as c70,
  156. c92 as c71,
  157. c91 as c72,
  158. c90 as c73,
  159. c89 as c74,
  160. c88 as c75,
  161. c87 as c76,
  162. c86 as c77,
  163. c85 as c78,
  164. c84 as c79,
  165. XSUM(c96 for c83) as c80
  166. from
  167. (select T5."customer_number" as c83,
  168. ((cast_numberToString(cast_integer(T1."branch_number")))) as c84,
  169. CASE WHEN ((((char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END)))) = 7) and ((substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 2 for 1)) BETWEEN '1' AND '4')) THEN ((substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 2 for 1))) ELSE null END as c85,
  170. CASE WHEN ((CASE WHEN (T7."invoice_type" IN (2,4,6,3)) THEN ('3') WHEN (T7."invoice_type" IN (5)) THEN ('6') WHEN (T7."invoice_type" IN (7)) THEN ('1') WHEN (T7."invoice_type" IN (8)) THEN ('2') WHEN (T6."document_type_in_journal" = 'R') THEN ('7') ELSE null END) = '1') THEN ('Neuwagen') WHEN ((CASE WHEN (T7."invoice_type" IN (2,4,6,3)) THEN ('3') WHEN (T7."invoice_type" IN (5)) THEN ('6') WHEN (T7."invoice_type" IN (7)) THEN ('1') WHEN (T7."invoice_type" IN (8)) THEN ('2') WHEN (T6."document_type_in_journal" = 'R') THEN ('7') ELSE null END) = '2') THEN ('Gebrauchtwagen') WHEN ((CASE WHEN (T7."invoice_type" IN (2,4,6,3)) THEN ('3') WHEN (T7."invoice_type" IN (5)) THEN ('6') WHEN (T7."invoice_type" IN (7)) THEN ('1') WHEN (T7."invoice_type" IN (8)) THEN ('2') WHEN (T6."document_type_in_journal" = 'R') THEN ('7') ELSE null END) = '3') THEN ('Service') WHEN ((CASE WHEN (T7."invoice_type" IN (2,4,6,3)) THEN ('3') WHEN (T7."invoice_type" IN (5)) THEN ('6') WHEN (T7."invoice_type" IN (7)) THEN ('1') WHEN (T7."invoice_type" IN (8)) THEN ('2') WHEN (T6."document_type_in_journal" = 'R') THEN ('7') ELSE null END) = '6') THEN ('Teile') ELSE ('nicht zuzuordnen') END as c86,
  171. CASE WHEN ((((char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END)))) = 7) and ((substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 1 for 1)) IN ('2','3','4'))) THEN ('Service') WHEN ((((char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END)))) = 7) and ((substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 1 for 1)) IN ('5'))) THEN ('Teile') WHEN ((((char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END)))) = 7) and ((substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 1 for 1)) IN ('6'))) THEN ('Garantie') WHEN ((((char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END)))) = 7) and ((substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 1 for 1)) IN ('7'))) THEN ('Neuwagen') WHEN ((((char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END)))) = 7) and ((substring((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END) from 1 for 1)) IN ('8'))) THEN ('Gebrauchtwagen') WHEN (T1."document_type" = 'R') THEN ('Rent') ELSE ('nicht zuzuordnen') END as c87,
  172. (char_length((CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END))) as c88,
  173. T4."name" as c89,
  174. T4."employee_number" as c90,
  175. ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END)) as c91,
  176. CASE WHEN (T5."first_name" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T5."customer_number"))),7)) || ' - ' || T5."first_name" || ' ' || T5."family_name") ELSE ((od_left((cast_numberToString(cast_integer(T5."customer_number"))),7)) || ' - ' || T5."family_name") END as c92,
  177. CASE WHEN (((extract(DAY FROM (now()) - (cdatetime(T1."accounting_date"))))) BETWEEN 0 AND 14) THEN ('< 2 Wochen') WHEN (((extract(DAY FROM (now()) - (cdatetime(T1."accounting_date"))))) BETWEEN 15 AND 28) THEN ('2 - 4 Wochen') WHEN (((extract(DAY FROM (now()) - (cdatetime(T1."accounting_date"))))) BETWEEN 29 AND 42) THEN ('4 - 6 Wochen') WHEN (((extract(DAY FROM (now()) - (cdatetime(T1."accounting_date"))))) BETWEEN 43 AND 84) THEN ('6 - 12 Wochen') WHEN (((extract(DAY FROM (now()) - (cdatetime(T1."accounting_date"))))) > 84) THEN ('> 12 Wochen') ELSE null END as c93,
  178. (extract(DAY FROM (now()) - (cdatetime(T1."accounting_date")))) as c94,
  179. CASE WHEN (T7."invoice_type" IN (2,4,6,3)) THEN ('3') WHEN (T7."invoice_type" IN (5)) THEN ('6') WHEN (T7."invoice_type" IN (7)) THEN ('1') WHEN (T7."invoice_type" IN (8)) THEN ('2') WHEN (T6."document_type_in_journal" = 'R') THEN ('7') ELSE null END as c95,
  180. (CASE WHEN (T1."debit_or_credit" = 'H') THEN (T1."posted_value" / 100 * -1) ELSE (T1."posted_value" / 100) END) as c96,
  181. CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END as c97,
  182. CASE WHEN (T7."subsidiary" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T7."subsidiary"))),1))) ELSE ('nicht zuzuordnen') END as c98,
  183. T1."subsidiary_to_company_ref" as c99,
  184. T7."invoice_date" as c100,
  185. T7."subsidiary" as c101,
  186. T7."invoice_number" as c102,
  187. T7."invoice_type" as c103,
  188. T6."document_type_description" as c104,
  189. T6."document_type_in_journal" as c105,
  190. T5."family_name" as c106,
  191. T5."first_name" as c107,
  192. T5."is_supplier" as c108,
  193. T1."nominal_account_number" as c109,
  194. CASE WHEN (T1."debit_or_credit" = 'H') THEN (T1."posted_count" / 100 * -1) ELSE (T1."posted_count" / 100) END as c110,
  195. CASE WHEN ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) IS NOT NULL) THEN ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) ELSE ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) END as c111,
  196. T1."accounting_date" as c112,
  197. CASE WHEN ((((((CASE WHEN ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) IS NOT NULL) THEN ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) ELSE ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) END) LIKE '%RG-BONUS%') or ((CASE WHEN ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) IS NOT NULL) THEN ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) ELSE ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) END) LIKE '%GEBURTSTAGS%')) or ((CASE WHEN ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) IS NOT NULL) THEN ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) ELSE ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) END) LIKE '%STARTGUTHABEN%')) or ((CASE WHEN ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) IS NOT NULL) THEN ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) ELSE ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) END) LIKE '%BONUS F%')) or ((CASE WHEN ((CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) IS NOT NULL) THEN ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END) || '/' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) ELSE ((truncate((ascii(((intdiv(T1."document_number",1))))))) || ' - ' || (CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END) || ' - ' || (CASE WHEN (T2."salesman_number" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T3."employee_number"))),4)) || ' - ' || T3."name") ELSE ((od_left((cast_numberToString(cast_integer(T4."employee_number"))),4)) || ' - ' || T4."name") END) || ' - ' || (asciiz(extract(YEAR FROM T1."document_date"),4) || '-' || asciiz(extract(MONTH FROM T1."document_date"),2) || '-' || asciiz(extract(DAY FROM T1."document_date"),2))) END) LIKE '%RG-ABZUG%')) THEN ('Bonus/Startguthaben') ELSE ('ohne Bonus/Startguthaben') END as c113,
  198. T1."free_form_accounting_text" as c114,
  199. T1."previously_used_account_no" as c115,
  200. T1."skr51_cost_unit" as c116,
  201. T1."skr51_sales_channel" as c117,
  202. T1."skr51_cost_center" as c118,
  203. T1."skr51_make" as c119,
  204. T1."skr51_branch" as c120,
  205. T1."day_of_actual_accounting" as c121,
  206. (asciiz(extract(YEAR FROM T1."accounting_date"),4) || '-' || asciiz(extract(MONTH FROM T1."accounting_date"),2) || '-' || asciiz(extract(DAY FROM T1."accounting_date"),2)) as c122,
  207. T1."vat_key" as c123,
  208. T1."account_statement_page" as c124,
  209. T1."account_statement_number" as c125,
  210. T1."vat_id_number" as c126,
  211. CASE WHEN ((T1."vehicle_reference" IS NULL) or (T1."vehicle_reference" = ' ')) THEN (' - ') ELSE (T1."vehicle_reference") END as c127,
  212. CASE WHEN ((T1."posting_text" IS NULL) or (T1."posting_text" = ' ')) THEN (' - ') ELSE (T1."posting_text") END as c128,
  213. T1."term_of_payment" as c129,
  214. T1."cash_discount" as c130,
  215. T1."journal_line" as c131,
  216. T1."journal_page" as c132,
  217. T1."last_dunning_date" as c133,
  218. T1."dunning_level" as c134,
  219. CASE WHEN ((T1."invoice_number" IS NULL) or (T1."invoice_number" = ' ')) THEN (' - ') ELSE (T1."invoice_number") END as c135,
  220. T1."invoice_date" as c136,
  221. T1."employee_number" as c137,
  222. T1."serial_number_each_month" as c138,
  223. T1."account_form_page_line" as c139,
  224. T1."account_form_page_number" as c140,
  225. T1."contra_account_text" as c141,
  226. T1."nominal_contra_account" as c142,
  227. T1."customer_contra_account" as c143,
  228. T1."branch_number" as c144,
  229. T1."posted_count" as c145,
  230. T1."debit_or_credit" as c146,
  231. T1."posted_value" as c147,
  232. T1."document_date" as c148,
  233. T1."clearing_number" as c149,
  234. T1."is_balanced" as c150,
  235. T1."customer_number" as c151,
  236. T1."position_in_document" as c152,
  237. (intdiv(T1."document_number",1)) as c153,
  238. T1."document_type" as c154
  239. from (((((("journal_accountings" T1 left outer join "vehicles" T2 on (od_right(T1."vehicle_reference",17)) = T2."vin") left outer join "employees" T3 on (T2."salesman_number" <> 0) and (T2."salesman_number" = T3."salesman_number")) left outer join "LOCOSOFT"."dbo"."employees" T4 on T1."employee_number" = T4."employee_number") left outer join "LOCOSOFT"."dbo"."customers_suppliers" T5 on T5."customer_number" = T1."customer_number") left outer join "document_types" T6 on T6."document_type_in_journal" = T1."document_type") left outer join "invoices" T7 on T7."invtype_invnr" = T1."invoice_number")
  240. where (((((T1."nominal_account_number" IN (1400,1409,1451,1408,1525)) and (T1."clearing_number" = 0)) and (T1."customer_number" IS NOT NULL)) and (not T6."document_type_in_journal" IN ('A','E','U','V'))) and (T5."customer_number" IS NOT NULL))
  241. ) D2
  242. ) D1
  243. where (c80 <> 0)
  244. order by c6 asc,c22 asc,c57 asc,c5 asc
  245. END SQL
  246. COLUMN,0,Accounting Date
  247. COLUMN,1,Document Type
  248. COLUMN,2,Document Number
  249. COLUMN,3,Position In Document
  250. COLUMN,4,Nominal Account Number
  251. COLUMN,5,Customer Number
  252. COLUMN,6,Is Balanced
  253. COLUMN,7,Clearing Number
  254. COLUMN,8,Document Date
  255. COLUMN,9,Posted Value
  256. COLUMN,10,Debit Or Credit
  257. COLUMN,11,Posted Count
  258. COLUMN,12,Branch Number
  259. COLUMN,13,Customer Contra Account
  260. COLUMN,14,Nominal Contra Account
  261. COLUMN,15,Contra Account Text
  262. COLUMN,16,Account Form Page Number
  263. COLUMN,17,Account Form Page Line
  264. COLUMN,18,Serial Number Each Month
  265. COLUMN,19,Employee Number
  266. COLUMN,20,Invoice Date
  267. COLUMN,21,Invoice Number
  268. COLUMN,22,Dunning Level
  269. COLUMN,23,Last Dunning Date
  270. COLUMN,24,Journal Page
  271. COLUMN,25,Journal Line
  272. COLUMN,26,Cash Discount
  273. COLUMN,27,Term Of Payment
  274. COLUMN,28,Posting Text
  275. COLUMN,29,Vehicle Reference
  276. COLUMN,30,Vat Id Number
  277. COLUMN,31,Account Statement Number
  278. COLUMN,32,Account Statement Page
  279. COLUMN,33,Vat Key
  280. COLUMN,34,Days For Cash Discount
  281. COLUMN,35,Day Of Actual Accounting
  282. COLUMN,36,Skr51 Branch
  283. COLUMN,37,Skr51 Make
  284. COLUMN,38,Skr51 Cost Center
  285. COLUMN,39,Skr51 Sales Channel
  286. COLUMN,40,Skr51 Cost Unit
  287. COLUMN,41,Previously Used Account No
  288. COLUMN,42,Free Form Accounting Text
  289. COLUMN,43,Free Form Document Text
  290. COLUMN,44,Rechtseinheit
  291. COLUMN,45,Betrieb
  292. COLUMN,46,Bookkeep Date
  293. COLUMN,47,Text
  294. COLUMN,48,Mandant
  295. COLUMN,49,Betrag
  296. COLUMN,50,Menge
  297. COLUMN,51,Acct Nr
  298. COLUMN,52,Customer Number_suctomer_supplier
  299. COLUMN,53,Is Supplier
  300. COLUMN,54,First Name
  301. COLUMN,55,Family Name
  302. COLUMN,56,Document Type In Journal
  303. COLUMN,57,Document Type Description
  304. COLUMN,58,Debitorsaldo_
  305. COLUMN,59,Invoice Type_Invoices
  306. COLUMN,60,Invoice Number_Invoices
  307. COLUMN,61,Subsidiary_Invoices
  308. COLUMN,62,Invoice Date_Invoices
  309. COLUMN,63,Hauptbetrieb
  310. COLUMN,64,Standort_ori
  311. COLUMN,65,Sel Name
  312. COLUMN,66,OP-Saldo
  313. COLUMN,67,Kostenstelle
  314. COLUMN,68,Tage
  315. COLUMN,69,Staffel
  316. COLUMN,70,Kunde
  317. COLUMN,71,Beleg
  318. COLUMN,72,Employee Number_Employees_journal_accountings
  319. COLUMN,73,Name_Employees_journal_accountings
  320. COLUMN,74,Anzahl_Stellen_Invoice_Number
  321. COLUMN,75,Forderungsart_aus_erste_Stelle_Inv_Number
  322. COLUMN,76,Forderungsart
  323. COLUMN,77,Standort_aus_2_Stelle_Invoice_Number
  324. COLUMN,78,Standort