NW_BE_Einsatz.iqd 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  1. COGNOS QUERY
  2. STRUCTURE,1,1
  3. DATABASE,O21
  4. DATASOURCENAME,C:\GAPS\Portal\System\IQD\NW\NW_BE_Einsatz.imr
  5. TITLE,NW_BE_Einsatz.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. 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. 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. c92 as c92,
  99. c93 as c93,
  100. c94 as c94,
  101. c95 as c95,
  102. c96 as c96,
  103. c97 as c97,
  104. c98 as c98,
  105. c99 as c99,
  106. c100 as c100,
  107. c101 as c101,
  108. c102 as c102,
  109. c103 as c103,
  110. c104 as c104,
  111. c105 as c105,
  112. c106 as c106,
  113. c107 as c107,
  114. c108 as c108,
  115. c109 as c109,
  116. c110 as c110,
  117. c111 as c111,
  118. c112 as c112,
  119. c113 as c113,
  120. c114 as c114,
  121. c115 as c115,
  122. c116 as c116,
  123. c117 as c117,
  124. c118 as c118,
  125. c119 as c119,
  126. c120 as c120,
  127. c121 as c121,
  128. c122 as c122,
  129. c123 as c123,
  130. c124 as c124,
  131. c125 as c125,
  132. c126 as c126,
  133. c127 as c127,
  134. c128 as c128,
  135. c129 as c129,
  136. c130 as c130,
  137. c131 as c131,
  138. c132 as c132,
  139. c133 as c133,
  140. c134 as c134,
  141. c135 as c135,
  142. c136 as c136,
  143. c137 as c137,
  144. c138 as c138,
  145. c139 as c139,
  146. c140 as c140,
  147. c141 as c141,
  148. c142 as c142,
  149. c143 as c143,
  150. c144 as c144,
  151. c145 as c145,
  152. c146 as c146,
  153. c147 as c147,
  154. c148 as c148,
  155. c149 as c149,
  156. c150 as c150,
  157. c151 as c151,
  158. c152 as c152,
  159. c153 as c153,
  160. c154 as c154,
  161. c155 as c155,
  162. c156 as c156,
  163. c157 as c157,
  164. c158 as c158,
  165. c159 as c159,
  166. c160 as c160,
  167. c161 as c161,
  168. c162 as c162,
  169. c163 as c163,
  170. c164 as c164,
  171. c165 as c165,
  172. c166 as c166,
  173. c167 as c167,
  174. c168 as c168,
  175. c169 as c169,
  176. c170 as c170,
  177. c171 as c171,
  178. c172 as c172,
  179. c173 as c173,
  180. c174 as c174,
  181. c175 as c175,
  182. c176 as c176,
  183. c177 as c177,
  184. c178 as c178,
  185. c179 as c179,
  186. c180 as c180,
  187. c181 as c181,
  188. c182 as c182,
  189. c183 as c183,
  190. c184 as c184,
  191. c185 as c185,
  192. c186 as c186,
  193. c187 as c187,
  194. c188 as c188,
  195. c189 as c189,
  196. c190 as c190,
  197. c191 as c191,
  198. c192 as c192,
  199. c193 as c193,
  200. c194 as c194,
  201. c195 as c195,
  202. c196 as c196,
  203. c197 as c197,
  204. c198 as c198,
  205. c199 as c199,
  206. c200 as c200,
  207. c201 as c201,
  208. c202 as c202,
  209. c203 as c203,
  210. c204 as c204,
  211. c205 as c205,
  212. c206 as c206,
  213. c207 as c207,
  214. c208 as c208,
  215. c209 as c209,
  216. c210 as c210,
  217. c211 as c211,
  218. c212 as c212,
  219. c213 as c213,
  220. c214 as c214,
  221. c215 as c215,
  222. c216 as c216,
  223. c217 as c217,
  224. c218 as c218,
  225. c219 as c219,
  226. c220 as c220,
  227. c221 as c221,
  228. c222 as c222,
  229. c223 as c223,
  230. c224 as c224,
  231. c225 as c225,
  232. c226 as c226,
  233. c227 as c227,
  234. c228 as c228,
  235. c229 as c229,
  236. c230 as c230,
  237. c231 as c231,
  238. c232 as c232,
  239. c233 as c233,
  240. c234 as c234,
  241. XMAX(c234 for c1) as c235,
  242. c236 as c236,
  243. c237 as c237,
  244. c238 as c238,
  245. c239 as c239,
  246. c240 as c240,
  247. c241 as c241
  248. from
  249. (select c245 as c1,
  250. c474 as c2,
  251. c473 as c3,
  252. c472 as c4,
  253. c471 as c5,
  254. c470 as c6,
  255. c469 as c7,
  256. c468 as c8,
  257. c467 as c9,
  258. c466 as c10,
  259. c465 as c11,
  260. c464 as c12,
  261. c463 as c13,
  262. c462 as c14,
  263. c461 as c15,
  264. c460 as c16,
  265. c459 as c17,
  266. c458 as c18,
  267. c457 as c19,
  268. c456 as c20,
  269. c455 as c21,
  270. c454 as c22,
  271. c453 as c23,
  272. c452 as c24,
  273. c451 as c25,
  274. c450 as c26,
  275. c449 as c27,
  276. c448 as c28,
  277. c447 as c29,
  278. c446 as c30,
  279. c445 as c31,
  280. c444 as c32,
  281. c443 as c33,
  282. c255 as c34,
  283. c442 as c35,
  284. c441 as c36,
  285. c440 as c37,
  286. c257 as c38,
  287. c439 as c39,
  288. c438 as c40,
  289. c437 as c41,
  290. c436 as c42,
  291. c435 as c43,
  292. c434 as c44,
  293. c433 as c45,
  294. c432 as c46,
  295. c431 as c47,
  296. c430 as c48,
  297. c429 as c49,
  298. c428 as c50,
  299. c427 as c51,
  300. c426 as c52,
  301. c425 as c53,
  302. c424 as c54,
  303. c423 as c55,
  304. c422 as c56,
  305. c421 as c57,
  306. c420 as c58,
  307. c419 as c59,
  308. c418 as c60,
  309. c417 as c61,
  310. c416 as c62,
  311. c415 as c63,
  312. c414 as c64,
  313. c413 as c65,
  314. c412 as c66,
  315. c411 as c67,
  316. c410 as c68,
  317. c260 as c69,
  318. c409 as c70,
  319. c408 as c71,
  320. c407 as c72,
  321. c406 as c73,
  322. c405 as c74,
  323. c404 as c75,
  324. c403 as c76,
  325. c402 as c77,
  326. c401 as c78,
  327. c400 as c79,
  328. c399 as c80,
  329. c398 as c81,
  330. c397 as c82,
  331. c396 as c83,
  332. c395 as c84,
  333. c394 as c85,
  334. c393 as c86,
  335. c392 as c87,
  336. c391 as c88,
  337. c390 as c89,
  338. c389 as c90,
  339. c388 as c91,
  340. c387 as c92,
  341. c386 as c93,
  342. c385 as c94,
  343. c384 as c95,
  344. c383 as c96,
  345. c382 as c97,
  346. c381 as c98,
  347. c380 as c99,
  348. c379 as c100,
  349. c378 as c101,
  350. c377 as c102,
  351. c376 as c103,
  352. c375 as c104,
  353. c374 as c105,
  354. c373 as c106,
  355. c372 as c107,
  356. c371 as c108,
  357. c370 as c109,
  358. c369 as c110,
  359. c368 as c111,
  360. c367 as c112,
  361. c366 as c113,
  362. c365 as c114,
  363. c364 as c115,
  364. c273 as c116,
  365. c363 as c117,
  366. c362 as c118,
  367. c361 as c119,
  368. c360 as c120,
  369. c359 as c121,
  370. c358 as c122,
  371. c357 as c123,
  372. c356 as c124,
  373. c355 as c125,
  374. c354 as c126,
  375. c274 as c127,
  376. c353 as c128,
  377. c352 as c129,
  378. c351 as c130,
  379. c350 as c131,
  380. c349 as c132,
  381. c348 as c133,
  382. c347 as c134,
  383. c346 as c135,
  384. c345 as c136,
  385. c344 as c137,
  386. c343 as c138,
  387. c342 as c139,
  388. c341 as c140,
  389. c340 as c141,
  390. c339 as c142,
  391. c338 as c143,
  392. c337 as c144,
  393. c336 as c145,
  394. c335 as c146,
  395. c334 as c147,
  396. c333 as c148,
  397. c332 as c149,
  398. c331 as c150,
  399. c330 as c151,
  400. c329 as c152,
  401. c328 as c153,
  402. c327 as c154,
  403. c326 as c155,
  404. c325 as c156,
  405. c324 as c157,
  406. c323 as c158,
  407. c322 as c159,
  408. c321 as c160,
  409. c320 as c161,
  410. c319 as c162,
  411. c318 as c163,
  412. c317 as c164,
  413. c316 as c165,
  414. c315 as c166,
  415. c314 as c167,
  416. c313 as c168,
  417. c312 as c169,
  418. c311 as c170,
  419. c310 as c171,
  420. c309 as c172,
  421. c308 as c173,
  422. c307 as c174,
  423. c306 as c175,
  424. c305 as c176,
  425. c304 as c177,
  426. c303 as c178,
  427. c302 as c179,
  428. c301 as c180,
  429. c300 as c181,
  430. c299 as c182,
  431. c298 as c183,
  432. c297 as c184,
  433. c296 as c185,
  434. c295 as c186,
  435. c294 as c187,
  436. c293 as c188,
  437. c292 as c189,
  438. c291 as c190,
  439. c290 as c191,
  440. c289 as c192,
  441. c288 as c193,
  442. c275 as c194,
  443. c287 as c195,
  444. c286 as c196,
  445. c285 as c197,
  446. c284 as c198,
  447. c283 as c199,
  448. c282 as c200,
  449. c281 as c201,
  450. c280 as c202,
  451. '1' as c203,
  452. c279 as c204,
  453. c278 as c205,
  454. c277 as c206,
  455. c276 as c207,
  456. c268 as c208,
  457. c275 as c209,
  458. c274 as c210,
  459. c273 as c211,
  460. c272 as c212,
  461. c271 as c213,
  462. c270 as c214,
  463. c269 as c215,
  464. c268 as c216,
  465. c267 as c217,
  466. 1 as c218,
  467. c266 as c219,
  468. c265 as c220,
  469. c264 as c221,
  470. c263 as c222,
  471. c262 as c223,
  472. c261 as c224,
  473. c260 as c225,
  474. c259 as c226,
  475. c258 as c227,
  476. c258 as c228,
  477. c257 as c229,
  478. c256 as c230,
  479. c255 as c231,
  480. c254 as c232,
  481. c253 as c233,
  482. c252 as c234,
  483. c251 as c236,
  484. c250 as c237,
  485. c249 as c238,
  486. c248 as c239,
  487. c247 as c240,
  488. c246 as c241,
  489. XMAX(c252 for c245) as c242
  490. from
  491. (select T1."UNIT_NUMBER" as c245,
  492. T9."REFERENCE" as c246,
  493. T9."ORDERS_GROSSVALUE" as c247,
  494. T9."COSTS" as c248,
  495. T9."TRANSACTION_CODE" as c249,
  496. (database()) as c250,
  497. CASE WHEN ((od_left(T7."DEPARTMENT_TYPE_ID",2)) = '01') THEN ('Brunsbüttel') WHEN ((od_left(T7."DEPARTMENT_TYPE_ID",2)) = '02') THEN ('Marne') WHEN ((od_left(T7."DEPARTMENT_TYPE_ID",2)) = '03') THEN ('Büsum') WHEN ((od_left(T7."DEPARTMENT_TYPE_ID",2)) = '04') THEN ('Meldorf') ELSE ('KST EK fehlt') END as c251,
  498. T6."UNIQUE_IDENT" as c252,
  499. T6."DEPARTMENT" as c253,
  500. CASE WHEN (T8."DESCRIPTION" IN ('Chevrolet','Chevrolet US Car','Opel')) THEN (T8."DESCRIPTION") ELSE ('Fremdfabrikat') END as c254,
  501. T1."BUD_SALE_DET" as c255,
  502. CASE WHEN (T9."TRANSACTION_CODE" IN ('47 ','40 ','41 ','49 ')) THEN (T9."ORDERS_GROSSVALUE") ELSE null END as c256,
  503. T1."BUD_COST" as c257,
  504. T10."SEL_NAME" as c258,
  505. T10."SELLER_CODE" as c259,
  506. (T1."LOCATION_CODE") as c260,
  507. (CASE WHEN (T1."ECC_STATUS" IN ('21','24')) THEN (0) WHEN (T1."RECEPTION_DATE" IS NULL) THEN ((extract(DAY FROM ((now())) - T1."PURCH_DATE"))) ELSE ((extract(DAY FROM ((now())) - T1."RECEPTION_DATE"))) END) * 15 as c261,
  508. CASE WHEN (T3."CAR_LETTER" = 'Konsi') THEN ('Konsi-FZG') ELSE ('Lagerfahrzeug') END as c262,
  509. T3."CAR_LETTER" as c263,
  510. CASE WHEN ((CASE WHEN (T1."ECC_STATUS" IN ('21','24')) THEN (0) WHEN (T1."RECEPTION_DATE" IS NULL) THEN ((extract(DAY FROM ((now())) - T1."PURCH_DATE"))) ELSE ((extract(DAY FROM ((now())) - T1."RECEPTION_DATE"))) END) BETWEEN 0 AND 30) THEN ('0 - 30 Tage') WHEN ((CASE WHEN (T1."ECC_STATUS" IN ('21','24')) THEN (0) WHEN (T1."RECEPTION_DATE" IS NULL) THEN ((extract(DAY FROM ((now())) - T1."PURCH_DATE"))) ELSE ((extract(DAY FROM ((now())) - T1."RECEPTION_DATE"))) END) BETWEEN 31 AND 60) THEN ('31 - 60 Tage') WHEN ((CASE WHEN (T1."ECC_STATUS" IN ('21','24')) THEN (0) WHEN (T1."RECEPTION_DATE" IS NULL) THEN ((extract(DAY FROM ((now())) - T1."PURCH_DATE"))) ELSE ((extract(DAY FROM ((now())) - T1."RECEPTION_DATE"))) END) BETWEEN 61 AND 90) THEN ('61 - 90 Tage') WHEN ((CASE WHEN (T1."ECC_STATUS" IN ('21','24')) THEN (0) WHEN (T1."RECEPTION_DATE" IS NULL) THEN ((extract(DAY FROM ((now())) - T1."PURCH_DATE"))) ELSE ((extract(DAY FROM ((now())) - T1."RECEPTION_DATE"))) END) BETWEEN 91 AND 180) THEN ('91 - 180 Tage') WHEN ((CASE WHEN (T1."ECC_STATUS" IN ('21','24')) THEN (0) WHEN (T1."RECEPTION_DATE" IS NULL) THEN ((extract(DAY FROM ((now())) - T1."PURCH_DATE"))) ELSE ((extract(DAY FROM ((now())) - T1."RECEPTION_DATE"))) END) > 180) THEN ('> 180 Tage') ELSE null END as c264,
  511. CASE WHEN (T1."ECC_STATUS" IN ('21','24')) THEN (0) WHEN (T1."RECEPTION_DATE" IS NULL) THEN ((extract(DAY FROM ((now())) - T1."PURCH_DATE"))) ELSE ((extract(DAY FROM ((now())) - T1."RECEPTION_DATE"))) END as c265,
  512. (now()) as c266,
  513. CASE WHEN (T9."TRANSACTION_CODE" IN ('25 ','40 ')) THEN (T9."ORDERS_GROSSVALUE") ELSE null END as c267,
  514. T8."DESCRIPTION" as c268,
  515. T8."GLOBAL_MAKE_CD" as c269,
  516. CASE WHEN (T2."VEHICLE_TYPE" IS NULL) THEN (T1."VEHICLE_TYPE") ELSE (T2."VEHICLE_TYPE" || ' - ' || T2."VEHICLE_TYPE_TEXT") END as c270,
  517. T1."UNIT_NUMBER" || ' - ' || T3."CHASSIS_NUMBER" as c271,
  518. T3."COLOUR_CODE" || ' - ' || T3."COLOUR_CF" as c272,
  519. T3."CHASSIS_NUMBER" as c273,
  520. T3."MODEL_TEXT" as c274,
  521. T4."MOD_LIN_SPECIFY" as c275,
  522. CASE WHEN (T2."VEHICLE_TYPE" IN ('K','M','N','T','V')) THEN ('Neuwagen') WHEN (T2."VEHICLE_TYPE" IN ('R','D')) THEN ('Gebrauchtwagen') WHEN (T2."VEHICLE_TYPE" IN ('G')) THEN ('Geschäftswagen') ELSE null END as c276,
  523. T7."DESCRIPTION" as c277,
  524. T7."DEPARTMENT_TYPE_ID" as c278,
  525. CASE WHEN (T6."DEPARTMENT" IS NULL) THEN ((od_left(T7."DEPARTMENT_TYPE_ID",2))) ELSE ((od_left(T6."DEPARTMENT",2))) END as c279,
  526. T5."MAKE_CODE" as c280,
  527. T5."MODEL_GROUP" as c281,
  528. T5."MODEL_TYPE" as c282,
  529. T5."ORIG_MODEL_CODE" as c283,
  530. T5."MODEL_TEXT" as c284,
  531. T5."MAKE_CD" as c285,
  532. T5."WORKSHOP_MODEL" as c286,
  533. T4."MAKE_CD" as c287,
  534. T4."MODEL_LINE" as c288,
  535. T3."MAKE_CD" as c289,
  536. T3."SOLDMARK_DATE" as c290,
  537. T3."DISCOUNT_PERC_WORK" as c291,
  538. T3."WORKSHOP_PRICECODE" as c292,
  539. T3."HOURLY_REPAIR_RATE" as c293,
  540. T3."SERVICE_DAYS" as c294,
  541. T3."FUELTYPE" as c295,
  542. T3."DEALER_MARKING" as c296,
  543. T3."DEALER_NUMBER" as c297,
  544. T3."PURCH_AMOUNT" as c298,
  545. T3."LATEST_INV_DATE" as c299,
  546. T3."PAID_DATE" as c300,
  547. T3."HOUR_RATE_TABLE" as c301,
  548. T3."MAKE" as c302,
  549. T3."MODEL_TYPE_2" as c303,
  550. T3."MODEL_LINE_GROUP" as c304,
  551. T3."PURCH_CAL_DATE" as c305,
  552. T3."STOCK_DATE" as c306,
  553. T3."CAL_COST_DATE" as c307,
  554. T3."CAL_COST" as c308,
  555. T3."AVAILABLE" as c309,
  556. T3."TYPE_YEAR" as c310,
  557. T3."ASU_INSP" as c311,
  558. T3."ASU_DATE" as c312,
  559. T3."ASU_TYPE" as c313,
  560. T3."TUV_INSP" as c314,
  561. T3."TUV_DATE" as c315,
  562. T3."TUV_TYPE" as c316,
  563. T3."NO_OF_OWNERS" as c317,
  564. T3."TRIM_CODE" as c318,
  565. T3."COLOUR_CODE" as c319,
  566. T3."DRIVE_CODE" as c320,
  567. T3."GEAR_CODE" as c321,
  568. T3."MOTOR_CODE" as c322,
  569. T3."MISC_10_CF" as c323,
  570. T3."MISC_9_CF" as c324,
  571. T3."MISC_8_CF" as c325,
  572. T3."MISC_7_CF" as c326,
  573. T3."MISC_6_CF" as c327,
  574. T3."MISC_5_CF" as c328,
  575. T3."MISC_4_CF" as c329,
  576. T3."MISC_3_CF" as c330,
  577. T3."MISC_2_CF" as c331,
  578. T3."MISC_1_CF" as c332,
  579. T3."MILEAGE" as c333,
  580. T3."EQUIPMENT_4" as c334,
  581. T3."EQUIPMENT_3" as c335,
  582. T3."EQUIPMENT_2" as c336,
  583. T3."EQUIPMENT_1" as c337,
  584. T3."DECLARATION_NUMBER" as c338,
  585. T3."DECLARATION_PLACE" as c339,
  586. T3."DECLARATION_DATE" as c340,
  587. T3."SEATS" as c341,
  588. T3."CYLINDER_VOLUME" as c342,
  589. T3."YEAR_MODEL_CF" as c343,
  590. T3."KEY_CODE" as c344,
  591. T3."MOTOR_NUMBER" as c345,
  592. T3."CLASSIFICATION" as c346,
  593. T3."FAC_MODEL_CODE_S" as c347,
  594. T3."WORKSHOP_MODEL" as c348,
  595. T3."MODEL_LINE" as c349,
  596. T3."TRIM_TXT" as c350,
  597. T3."COLOUR_CF" as c351,
  598. T3."ORIG_MODEL_CODE2" as c352,
  599. T3."ORIG_MODEL_CODE1" as c353,
  600. T3."SALESMAN_SALE" as c354,
  601. T3."SALESMAN_BUY" as c355,
  602. T3."ARRIVAL_DATE" as c356,
  603. T3."EXPECTED_ARR_DATE" as c357,
  604. T3."FIRST_OCCUR_DATE" as c358,
  605. T3."LATEST_REG_DATE" as c359,
  606. T3."FIRST_REG_DATE" as c360,
  607. T3."FAC_MODEL_CODE_L" as c361,
  608. T3."CAR_STATUS" as c362,
  609. T3."CAR_GROUP" as c363,
  610. T3."REGISTER_NUMBER" as c364,
  611. T3."HANDLER" as c365,
  612. T3."TRANSACT_DATE" as c366,
  613. T3."BASIS_NUMBER" as c367,
  614. CASE WHEN (T1."ECC_STATUS" = '21') THEN ('21 - Lagerauftrag') WHEN (T1."ECC_STATUS" = '24') THEN ('24 - Kundenauftrag') WHEN (T1."ECC_STATUS" = '41') THEN ('41 - Bestand') WHEN (T1."ECC_STATUS" = '44') THEN ('44 - auf Lager verkauft') WHEN (T1."ECC_STATUS" = '64') THEN ('64 - verkauft') WHEN (T1."ECC_STATUS" = '42') THEN ('42') ELSE null END as c368,
  615. T2."VEHICLE_TYPE_TEXT" as c369,
  616. T2."VEHICLE_TYPE" as c370,
  617. T1."UNIQUE_IDENT" as c371,
  618. T1."PRICE_LIST_DATE" as c372,
  619. T1."PRICE_LIST_VERSION" as c373,
  620. T1."PURCH_ORIGIN_CODE" as c374,
  621. T1."SALE_PRICE_DATE" as c375,
  622. T1."BUD_OPT_PRICE" as c376,
  623. T1."RECEPTION_DATE" as c377,
  624. T1."EST_REFERENCE_NO" as c378,
  625. T1."EST_SALES_PRICE" as c379,
  626. T1."FORD_INT_DATE" as c380,
  627. T1."VALUATION_DATE" as c381,
  628. T1."DESIRED_DELIV_DATE" as c382,
  629. T1."BOOKING_DEALER_NR" as c383,
  630. T1."DEALER_MARKING" as c384,
  631. T1."EXP_ARRIVAL_TIME" as c385,
  632. T1."CONTRACT_DATE" as c386,
  633. T1."CNTRACT_DUE_DATE" as c387,
  634. T1."TRANSFER_VAT_RC" as c388,
  635. T1."VAT_RATE_CODE" as c389,
  636. T1."VAT_TABLE_NORMAL" as c390,
  637. T1."VAT_TABLE_WORK" as c391,
  638. T1."PRICE_LABEL_DATE" as c392,
  639. T1."ORDER_CONFIRM_DATE" as c393,
  640. T1."ORDER_ARRIVAL_DATE" as c394,
  641. T1."TRF_DEPARTMENT" as c395,
  642. T1."UNIT_SOLD" as c396,
  643. T1."SALE_ORDER_NO" as c397,
  644. T1."TRF_TAXBASIS_PURCH" as c398,
  645. T1."TRF_TAXBASIS_SALES" as c399,
  646. T1."FREIGHT_BALANCE" as c400,
  647. T1."RESERVATION_TEXT" as c401,
  648. T1."RESERVATION_PERSON" as c402,
  649. T1."RESERVATION_DATE" as c403,
  650. T1."DELIVERY_DATE_VEH" as c404,
  651. T1."COMMISION_NO" as c405,
  652. T1."RECALC_CODE" as c406,
  653. T1."BUDG_PRICE_VAT" as c407,
  654. T1."ACCOUNT_SALES" as c408,
  655. T1."ACCOUNT_PURCHASE" as c409,
  656. T1."INVOICE_PERMISSION" as c410,
  657. T1."LATEST_UPDATE" as c411,
  658. T1."VEHICLE_UPDATE" as c412,
  659. T1."PA_NUMBER" as c413,
  660. T1."BUYING_ORDER_DATE" as c414,
  661. T1."BUYING_ORDER_NO" as c415,
  662. T1."CONDITION_UNIT" as c416,
  663. T1."TRANSFER_BBDB" as c417,
  664. T1."DELETE_PROPOSAL" as c418,
  665. T1."STOCK_DAYS" as c419,
  666. T1."TRANSFER_DATE" as c420,
  667. T1."OR_MARK" as c421,
  668. T1."COST_TAX" as c422,
  669. T1."PURCH_TAX" as c423,
  670. T1."TRANSFER_SOLD" as c424,
  671. T1."TRANSFER_TAX_PCT" as c425,
  672. T1."TRANSFER_TAX_BASIS" as c426,
  673. T1."TRANSFER_ACC_CODE" as c427,
  674. T1."TRANSFER_TAX_HAND" as c428,
  675. T1."TRANSFER_LINE" as c429,
  676. T1."NEXT_LINE_1" as c430,
  677. T1."NEXT_LINE_UNIT" as c431,
  678. T1."INTEREST_2" as c432,
  679. T1."INTEREST_1" as c433,
  680. T1."REG_FEE" as c434,
  681. T1."SALES_PRICE_UNIT" as c435,
  682. T1."COST_UNIT" as c436,
  683. T1."PURCH_PRICE_UNIT" as c437,
  684. T1."OWNER" as c438,
  685. T1."PREV_OWNER" as c439,
  686. T1."BUD_DEDUCT_FEE" as c440,
  687. T1."BUD_REG_FEE" as c441,
  688. T1."BUD_PURCH_PRICE" as c442,
  689. T1."UNIT_IN_CHANGE" as c443,
  690. T1."SCRAP_CODE" as c444,
  691. T1."SALE_DATE" as c445,
  692. T1."SALE_INV_NUMBER" as c446,
  693. T1."SALE_SALESMAN" as c447,
  694. T1."SALES_DEPARTMENT" as c448,
  695. T1."PURCH_DATE" as c449,
  696. T1."PURCH_INVNO" as c450,
  697. T1."PURCH_SALSMAN_CODE" as c451,
  698. T1."PURCH_DEPARTMENT" as c452,
  699. T1."MILEAGE" as c453,
  700. T1."INTEREST_CODE" as c454,
  701. T1."TAX_HANDLING" as c455,
  702. T1."BOOK_KEEPING_CODE" as c456,
  703. T1."TRANSFER_TAX" as c457,
  704. T1."DEPRECIATION" as c458,
  705. T1."UNIT_LAST_UPD_DTE" as c459,
  706. T1."TAX_CODE" as c460,
  707. T1."INTERNAL_CODE" as c461,
  708. T1."DISCOUNT_LIMIT" as c462,
  709. T1."DISCOUNT_PERC_WORK" as c463,
  710. T1."PRICE_CODE" as c464,
  711. T1."DELIVERY_STOP_CODE" as c465,
  712. T1."SMALL_INV_CHARGE" as c466,
  713. T1."SMALL_ACCESSORIES" as c467,
  714. T1."PMT_TERM" as c468,
  715. T1."CAR_CREATION_DATE" as c469,
  716. T1."HANDLER" as c470,
  717. T1."TRANSACT_DATE" as c471,
  718. T1."VEHICLE_TYPE" as c472,
  719. T1."ECC_STATUS" as c473,
  720. T1."BASIS_NUMBER" as c474
  721. from ((((((((("deop01"."dbo"."UNIT_FILE" T1 left outer join "deop01"."dbo"."vPP5R" T2 on T1."VEHICLE_TYPE" = T2."VEHICLE_TYPE") left outer join "deop01"."dbo"."VEHICLE" T3 on T1."BASIS_NUMBER" = T3."BASIS_NUMBER") left outer join "deop01"."dbo"."vPP5Q" T4 on (T3."MODEL_LINE" = T4."MODEL_LINE") and (T3."MAKE_CD" = T4."MAKE_CD")) left outer join "deop01"."dbo"."vPP74" T5 on (T3."WORKSHOP_MODEL" = T5."WORKSHOP_MODEL") and (T3."MAKE_CD" = T5."MAKE_CD")) left outer join "deop01"."dbo"."UNIT_CHANGE_HIST" T6 on (T6."UNIT_NUMBER" = T1."UNIT_NUMBER") and (T6."DEPARTMENT" <> ' ')) left outer join "deop01"."dbo"."DEPARTMENT_TYPE" T7 on T1."PURCH_DEPARTMENT" = T7."DEPARTMENT_TYPE_ID") left outer join "deop01"."dbo"."GLOBAL_MAKE" T8 on T3."MAKE_CD" = T8."GLOBAL_MAKE_CD") left outer join "deop01"."dbo"."UNIT_HISTORY" T9 on T1."UNIT_NUMBER" = T9."UNIT_NUMBER") left outer join "deop01"."dbo"."vPP43" T10 on T1."PURCH_SALSMAN_CODE" = T10."SELLER_CODE")
  722. where (T1."ECC_STATUS" IN ('21','24','25','41','42','44'))
  723. ) D2
  724. ) D1
  725. where (c234 = c242)
  726. order by c1 asc,c220 desc
  727. END SQL
  728. COLUMN,0,Unit Number
  729. COLUMN,1,Basis Number
  730. COLUMN,2,Ecc Status
  731. COLUMN,3,Vehicle Type
  732. COLUMN,4,Transact Date
  733. COLUMN,5,Handler
  734. COLUMN,6,Car Creation Date
  735. COLUMN,7,Pmt Term
  736. COLUMN,8,Small Accessories
  737. COLUMN,9,Small Inv Charge
  738. COLUMN,10,Delivery Stop Code
  739. COLUMN,11,Price Code
  740. COLUMN,12,Discount Perc Work
  741. COLUMN,13,Discount Limit
  742. COLUMN,14,Internal Code
  743. COLUMN,15,Tax Code
  744. COLUMN,16,Unit Last Upd Dte
  745. COLUMN,17,Depreciation
  746. COLUMN,18,Transfer Tax
  747. COLUMN,19,Book Keeping Code
  748. COLUMN,20,Tax Handling
  749. COLUMN,21,Interest Code
  750. COLUMN,22,Mileage
  751. COLUMN,23,Purch Department
  752. COLUMN,24,Purch Salsman Code
  753. COLUMN,25,Purch Invno
  754. COLUMN,26,Purch Date
  755. COLUMN,27,Sales Department
  756. COLUMN,28,Sale Salesman
  757. COLUMN,29,Sale Inv Number
  758. COLUMN,30,Sale Date
  759. COLUMN,31,Scrap Code
  760. COLUMN,32,Unit In Change
  761. COLUMN,33,Bud Sale Det
  762. COLUMN,34,Bud Purch Price
  763. COLUMN,35,Bud Reg Fee
  764. COLUMN,36,Bud Deduct Fee
  765. COLUMN,37,Bud Cost
  766. COLUMN,38,Prev Owner
  767. COLUMN,39,Owner
  768. COLUMN,40,Purch Price Unit
  769. COLUMN,41,Cost Unit
  770. COLUMN,42,Sales Price Unit
  771. COLUMN,43,Reg Fee
  772. COLUMN,44,Interest 1
  773. COLUMN,45,Interest 2
  774. COLUMN,46,Next Line Unit
  775. COLUMN,47,Next Line 1
  776. COLUMN,48,Transfer Line
  777. COLUMN,49,Transfer Tax Hand
  778. COLUMN,50,Transfer Acc Code
  779. COLUMN,51,Transfer Tax Basis
  780. COLUMN,52,Transfer Tax Pct
  781. COLUMN,53,Transfer Sold
  782. COLUMN,54,Purch Tax
  783. COLUMN,55,Cost Tax
  784. COLUMN,56,Or Mark
  785. COLUMN,57,Transfer Date
  786. COLUMN,58,Stock Days
  787. COLUMN,59,Delete Proposal
  788. COLUMN,60,Transfer Bbdb
  789. COLUMN,61,Condition Unit
  790. COLUMN,62,Buying Order No
  791. COLUMN,63,Buying Order Date
  792. COLUMN,64,Pa Number
  793. COLUMN,65,Vehicle Update
  794. COLUMN,66,Latest Update
  795. COLUMN,67,Invoice Permission
  796. COLUMN,68,Location Code
  797. COLUMN,69,Account Purchase
  798. COLUMN,70,Account Sales
  799. COLUMN,71,Budg Price Vat
  800. COLUMN,72,Recalc Code
  801. COLUMN,73,Commision No
  802. COLUMN,74,Delivery Date Veh
  803. COLUMN,75,Reservation Date
  804. COLUMN,76,Reservation Person
  805. COLUMN,77,Reservation Text
  806. COLUMN,78,Freight Balance
  807. COLUMN,79,Trf Taxbasis Sales
  808. COLUMN,80,Trf Taxbasis Purch
  809. COLUMN,81,Sale Order No
  810. COLUMN,82,Unit Sold
  811. COLUMN,83,Trf Department
  812. COLUMN,84,Order Arrival Date
  813. COLUMN,85,Order Confirm Date
  814. COLUMN,86,Price Label Date
  815. COLUMN,87,Vat Table Work
  816. COLUMN,88,Vat Table Normal
  817. COLUMN,89,Vat Rate Code
  818. COLUMN,90,Transfer Vat Rc
  819. COLUMN,91,Cntract Due Date
  820. COLUMN,92,Contract Date
  821. COLUMN,93,Exp Arrival Time
  822. COLUMN,94,Dealer Marking
  823. COLUMN,95,Booking Dealer Nr
  824. COLUMN,96,Desired Deliv Date
  825. COLUMN,97,Valuation Date
  826. COLUMN,98,Ford Int Date
  827. COLUMN,99,Est Sales Price
  828. COLUMN,100,Est Reference No
  829. COLUMN,101,Reception Date
  830. COLUMN,102,Bud Opt Price
  831. COLUMN,103,Sale Price Date
  832. COLUMN,104,Purch Origin Code
  833. COLUMN,105,Price List Version
  834. COLUMN,106,Price List Date
  835. COLUMN,107,Unique Ident
  836. COLUMN,108,Vehicle Type
  837. COLUMN,109,Vehicle Type Text
  838. COLUMN,110,ECC_Status_Text
  839. COLUMN,111,Basis Number
  840. COLUMN,112,Transact Date
  841. COLUMN,113,Handler
  842. COLUMN,114,Register Number
  843. COLUMN,115,Chassis Number
  844. COLUMN,116,Car Group
  845. COLUMN,117,Car Status
  846. COLUMN,118,Fac Model Code L
  847. COLUMN,119,First Reg Date
  848. COLUMN,120,Latest Reg Date
  849. COLUMN,121,First Occur Date
  850. COLUMN,122,Expected Arr Date
  851. COLUMN,123,Arrival Date
  852. COLUMN,124,Salesman Buy
  853. COLUMN,125,Salesman Sale
  854. COLUMN,126,Model Text
  855. COLUMN,127,Orig Model Code1
  856. COLUMN,128,Orig Model Code2
  857. COLUMN,129,Colour Cf
  858. COLUMN,130,Trim Txt
  859. COLUMN,131,Model Line
  860. COLUMN,132,Workshop Model
  861. COLUMN,133,Fac Model Code S
  862. COLUMN,134,Classification
  863. COLUMN,135,Motor Number
  864. COLUMN,136,Key Code
  865. COLUMN,137,Year Model Cf
  866. COLUMN,138,Cylinder Volume
  867. COLUMN,139,Seats
  868. COLUMN,140,Declaration Date
  869. COLUMN,141,Declaration Place
  870. COLUMN,142,Declaration Number
  871. COLUMN,143,Equipment 1
  872. COLUMN,144,Equipment 2
  873. COLUMN,145,Equipment 3
  874. COLUMN,146,Equipment 4
  875. COLUMN,147,Mileage
  876. COLUMN,148,Misc 1 Cf
  877. COLUMN,149,Misc 2 Cf
  878. COLUMN,150,Misc 3 Cf
  879. COLUMN,151,Misc 4 Cf
  880. COLUMN,152,Misc 5 Cf
  881. COLUMN,153,Misc 6 Cf
  882. COLUMN,154,Misc 7 Cf
  883. COLUMN,155,Misc 8 Cf
  884. COLUMN,156,Misc 9 Cf
  885. COLUMN,157,Misc 10 Cf
  886. COLUMN,158,Motor Code
  887. COLUMN,159,Gear Code
  888. COLUMN,160,Drive Code
  889. COLUMN,161,Colour Code
  890. COLUMN,162,Trim Code
  891. COLUMN,163,No Of Owners
  892. COLUMN,164,Tuv Type
  893. COLUMN,165,Tuv Date
  894. COLUMN,166,Tuv Insp
  895. COLUMN,167,Asu Type
  896. COLUMN,168,Asu Date
  897. COLUMN,169,Asu Insp
  898. COLUMN,170,Type Year
  899. COLUMN,171,Available
  900. COLUMN,172,Cal Cost
  901. COLUMN,173,Cal Cost Date
  902. COLUMN,174,Stock Date
  903. COLUMN,175,Purch Cal Date
  904. COLUMN,176,Model Line Group
  905. COLUMN,177,Model Type 2
  906. COLUMN,178,Make
  907. COLUMN,179,Hour Rate Table
  908. COLUMN,180,Paid Date
  909. COLUMN,181,Latest Inv Date
  910. COLUMN,182,Purch Amount
  911. COLUMN,183,Dealer Number
  912. COLUMN,184,Dealer Marking
  913. COLUMN,185,Fueltype
  914. COLUMN,186,Service Days
  915. COLUMN,187,Hourly Repair Rate
  916. COLUMN,188,Workshop Pricecode
  917. COLUMN,189,Discount Perc Work
  918. COLUMN,190,Soldmark Date
  919. COLUMN,191,Make Cd
  920. COLUMN,192,Model Line
  921. COLUMN,193,Mod Lin Specify
  922. COLUMN,194,Make Cd
  923. COLUMN,195,Workshop Model
  924. COLUMN,196,Make Cd
  925. COLUMN,197,Model Text
  926. COLUMN,198,Orig Model Code
  927. COLUMN,199,Model Type
  928. COLUMN,200,Model Group
  929. COLUMN,201,Make Code
  930. COLUMN,202,Hauptbetrieb
  931. COLUMN,203,Standort
  932. COLUMN,204,Department Type Id
  933. COLUMN,205,Description
  934. COLUMN,206,Fahrzeugart
  935. COLUMN,207,Fabrikat_ori
  936. COLUMN,208,Model
  937. COLUMN,209,Modellbez
  938. COLUMN,210,Fahrgestellnr
  939. COLUMN,211,Farbe
  940. COLUMN,212,FZG
  941. COLUMN,213,Fahrzeugtyp
  942. COLUMN,214,Global Make Cd
  943. COLUMN,215,Description
  944. COLUMN,216,Einsatz
  945. COLUMN,217,Menge
  946. COLUMN,218,Heute
  947. COLUMN,219,Standtage
  948. COLUMN,220,Standtagestaffel
  949. COLUMN,221,Car Letter
  950. COLUMN,222,Fahrzeugart_Konsi
  951. COLUMN,223,kalk_Kosten
  952. COLUMN,224,Betrieb
  953. COLUMN,225,Seller Code
  954. COLUMN,226,Sel Name
  955. COLUMN,227,VB_Einkauf
  956. COLUMN,228,geplante Kosten
  957. COLUMN,229,tatsächl. Kosten
  958. COLUMN,230,geplanter VK
  959. COLUMN,231,Fabrikat
  960. COLUMN,232,Department_unique_change_history
  961. COLUMN,233,Unique Ident_unique_change_history
  962. COLUMN,234,MAXIMUM ( Unique Ident_unique_change_history )
  963. COLUMN,235,KST EK
  964. COLUMN,236,Mandant
  965. COLUMN,237,Transaction Code
  966. COLUMN,238,Costs
  967. COLUMN,239,Orders Grossvalue
  968. COLUMN,240,Reference