NW_BE_STK.iqd 24 KB

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