Offene_Posten_Autoline.iqd 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. COGNOS QUERY
  2. STRUCTURE,1,1
  3. DATABASE,GC_AUTOLINE
  4. DATASOURCENAME,C:\GlobalCube\System\Autoline\IQD\op\Offene_Posten_Autoline.imr
  5. TITLE,Offene_Posten_Autoline.imr
  6. BEGIN SQL
  7. select c92 as c1,
  8. c171 as c2,
  9. c170 as c3,
  10. c169 as c4,
  11. c168 as c5,
  12. c106 as c6,
  13. c96 as c7,
  14. c167 as c8,
  15. c166 as c9,
  16. c165 as c10,
  17. c164 as c11,
  18. c163 as c12,
  19. c162 as c13,
  20. c161 as c14,
  21. c160 as c15,
  22. c159 as c16,
  23. c158 as c17,
  24. c157 as c18,
  25. c156 as c19,
  26. c155 as c20,
  27. c154 as c21,
  28. c153 as c22,
  29. c152 as c23,
  30. c151 as c24,
  31. c150 as c25,
  32. c149 as c26,
  33. c148 as c27,
  34. c147 as c28,
  35. c146 as c29,
  36. c145 as c30,
  37. c144 as c31,
  38. c143 as c32,
  39. c142 as c33,
  40. c141 as c34,
  41. c140 as c35,
  42. c139 as c36,
  43. c138 as c37,
  44. c137 as c38,
  45. c136 as c39,
  46. c135 as c40,
  47. c134 as c41,
  48. c133 as c42,
  49. c132 as c43,
  50. c131 as c44,
  51. c130 as c45,
  52. c129 as c46,
  53. c112 as c47,
  54. c128 as c48,
  55. c127 as c49,
  56. c107 as c50,
  57. c126 as c51,
  58. c125 as c52,
  59. c124 as c53,
  60. c123 as c54,
  61. c122 as c55,
  62. c113 as c56,
  63. c121 as c57,
  64. c120 as c58,
  65. c119 as c59,
  66. c118 as c60,
  67. c117 as c61,
  68. c116 as c62,
  69. c115 as c63,
  70. c114 as c64,
  71. c113 as c65,
  72. '' as c66,
  73. c112 as c67,
  74. c111 as c68,
  75. c110 as c69,
  76. c109 as c70,
  77. c108 as c71,
  78. c107 as c72,
  79. c106 as c73,
  80. c105 as c74,
  81. c104 as c75,
  82. c103 as c76,
  83. c103 as c77,
  84. c102 as c78,
  85. c101 as c79,
  86. c100 as c80,
  87. c99 as c81,
  88. c93 as c82,
  89. c98 as c83,
  90. c97 as c84,
  91. c96 as c85,
  92. XSUM(c97 for c92) as c86,
  93. c95 as c87,
  94. c94 as c88,
  95. c93 as c89
  96. from
  97. (select T1."AccountCode" as c92,
  98. T4."CategoryCode" as c93,
  99. CASE WHEN (((extract(DAY FROM (now()) - T1."DueDate"))) BETWEEN 0 AND 14) THEN ('< 2 Wochen') WHEN (((extract(DAY FROM (now()) - T1."DueDate"))) BETWEEN 15 AND 28) THEN ('2 - 4 Wochen') WHEN (((extract(DAY FROM (now()) - T1."DueDate"))) BETWEEN 29 AND 42) THEN ('4 - 6 Wochen') WHEN (((extract(DAY FROM (now()) - T1."DueDate"))) BETWEEN 43 AND 84) THEN ('6 - 12 Wochen') WHEN (((extract(DAY FROM (now()) - T1."DueDate"))) > 84) THEN ('> 12 Wochen') WHEN (((extract(DAY FROM (now()) - T1."DueDate"))) < 0) THEN ('noch nicht fällig') ELSE null END as c94,
  100. (extract(DAY FROM (now()) - T1."DueDate")) as c95,
  101. T1."DocumentBaseTotal" as c96,
  102. T1."DocumentBaseTotal" - T1."AmountPaidBase" as c97,
  103. CASE WHEN (T2."SalesExecutive001" IS NOT NULL) THEN ('Neuwagen') WHEN (T3."SalesExecutive001" IS NOT NULL) THEN ('Gebrauchtwagen') WHEN (T6."WIPNumber" IS NOT NULL) THEN ('Aftersales') ELSE ('nicht zuzuordnen') END as c98,
  104. CASE WHEN (T7."UserName" IS NOT NULL) THEN (T7."UserName") WHEN (T8."UserName" IS NOT NULL) THEN (T8."UserName") WHEN (T9."UserName" IS NOT NULL) THEN (T9."UserName") ELSE ('n.N.') END as c99,
  105. T9."UserName" as c100,
  106. T8."UserName" as c101,
  107. T6."CreatingOperator" as c102,
  108. T7."UserName" as c103,
  109. T6."InvoicingOperator" as c104,
  110. T6."WIPNumber" as c105,
  111. T1."DueDate" as c106,
  112. T1."LastLetterType" as c107,
  113. (rtrim((cast_numberToString(cast_integer(T1."DocumentNumber"))))) || ' - ' || (asciiz(extract(YEAR FROM T1."DocumentDate"),4) || '-' || asciiz(extract(MONTH FROM T1."DocumentDate"),2) || '-' || asciiz(extract(DAY FROM T1."DocumentDate"),2)) || ' - ' || T1."CustomerReference" || ' - ' || T1."MiscellaneousRef" || ' - MS: ' || T1."LastLetterType" as c108,
  114. T5."LocationCode" || ' - ' || T5."Description" as c109,
  115. T5."Description" as c110,
  116. T5."LocationCode" as c111,
  117. T1."TruePostingOrigin" as c112,
  118. T1."Client_DB" as c113,
  119. T1."AccountCode" || ' - ' || T4."CustomerSName" as c114,
  120. T4."Postcode" as c115,
  121. T4."CustomerSName" as c116,
  122. T4."AccountCode" as c117,
  123. T3."SalesInvoiceNumber" as c118,
  124. T2."SalesInvoiceNumber" as c119,
  125. T3."SalesExecutive001" as c120,
  126. T2."SalesExecutive001" as c121,
  127. T1."OriginalInvoice" as c122,
  128. T1."SocialIDVatReg" as c123,
  129. T1."PaymentReference" as c124,
  130. T1."PaymentTypeCode" as c125,
  131. T1."ControlAccountType" as c126,
  132. T1."LastLetterDate" as c127,
  133. T1."TRUEMOD" as c128,
  134. T1."TaxBillPending" as c129,
  135. T1."TaxBillNumber" as c130,
  136. T1."TaxBillDate" as c131,
  137. T1."BOEMagicNumber" as c132,
  138. T1."USTaxCodes002" as c133,
  139. T1."USTaxCodes001" as c134,
  140. T1."DocumentArchiveID" as c135,
  141. T1."SourceBranch" as c136,
  142. T1."SourceModule" as c137,
  143. T1."AllowanceCurrency" as c138,
  144. T1."AllowanceBase" as c139,
  145. T1."SystemMatchNumber" as c140,
  146. T1."PRFollowUpDate" as c141,
  147. T1."PRSentTo" as c142,
  148. T1."PRComment" as c143,
  149. T1."PRDateRaised" as c144,
  150. T1."PRReference" as c145,
  151. T1."PRCode" as c146,
  152. T1."MiscellaneousRef" as c147,
  153. T1."SettledFlag" as c148,
  154. T1."StatementPrintedYN" as c149,
  155. T1."DebtFlag" as c150,
  156. T1."SDiscountDate002" as c151,
  157. T1."SDiscountDate001" as c152,
  158. T1."SDiscountOffered002" as c153,
  159. T1."SDiscountOffered001" as c154,
  160. T1."Status" as c155,
  161. T1."LastPmtDaybookItm" as c156,
  162. T1."LastPmtDaybookNo" as c157,
  163. T1."LastPaymentRef" as c158,
  164. T1."LastPaymentDate" as c159,
  165. T1."AmountPaidCurr" as c160,
  166. T1."AmountPaidBase" as c161,
  167. T1."PostingDaybkDate" as c162,
  168. T1."DaybookItemNumber" as c163,
  169. T1."DaybookNumber" as c164,
  170. T1."VatAmountCurr" as c165,
  171. T1."VATAmountBase" as c166,
  172. T1."DocumentCurrTotal" as c167,
  173. T1."DocumentType" as c168,
  174. T1."DocumentDate" as c169,
  175. T1."DocumentNumber" as c170,
  176. T1."CustomerReference" as c171
  177. from (((((((("AUTOLINE"."import"."SL_SLTransactions" T1 left outer join "AUTOLINE"."import"."VS_NewVehicleStock" T2 on (T2."SalesInvoiceNumber" = T1."DocumentNumber") and (T2."Client_DB" = T1."Client_DB")) left outer join "AUTOLINE"."import"."VS_UsedVehicleStock" T3 on (T1."DocumentNumber" = T3."SalesInvoiceNumber") and (T1."Client_DB" = T3."Client_DB")) left outer join "AUTOLINE"."import"."SL_SalesLedgerAccounts" T4 on (T1."AccountCode" = T4."AccountCode") and (T1."Client_DB" = T4."Client_DB")) left outer join "AUTOLINE"."import"."GB_CompanyLocations" T5 on T5."LocationCode" = T1."TruePostingOrigin") left outer join "AUTOLINE"."import"."SO_HeaderRecords" T6 on (T1."TruePostingOrigin" = T6."Client_DB") and ((substring(T1."MiscellaneousRef" from 6 for 5)) = (cast_numberToString(cast_integer(T6."WIPNumber"))))) left outer join "AUTOLINE"."import"."GB_UserDetails" T7 on ((cast_float(T6."CreatingOperator")) = T7."POSOperator") and ((T6."Department" = T7."CRMDepartment") or (T7."POSOperator" = 888))) left outer join "AUTOLINE"."import"."GB_UserDetails" T8 on T8."UserID" = T2."SalesExecutive001") left outer join "AUTOLINE"."import"."GB_UserDetails" T9 on T9."UserID" = T3."SalesExecutive001")
  178. where (((T1."AmountPaidBase" <> T1."DocumentBaseTotal") and (T1."DocumentBaseTotal" <> 0)) and (not T1."AccountCode" IN ('000999')))
  179. order by c92 asc
  180. ) D1
  181. END SQL
  182. COLUMN,0,Accountcode
  183. COLUMN,1,Customerreference
  184. COLUMN,2,Documentnumber
  185. COLUMN,3,Documentdate
  186. COLUMN,4,Documenttype
  187. COLUMN,5,Duedate
  188. COLUMN,6,Documentbasetotal
  189. COLUMN,7,Documentcurrtotal
  190. COLUMN,8,Vatamountbase
  191. COLUMN,9,Vatamountcurr
  192. COLUMN,10,Daybooknumber
  193. COLUMN,11,Daybookitemnumber
  194. COLUMN,12,Postingdaybkdate
  195. COLUMN,13,Amountpaidbase
  196. COLUMN,14,Amountpaidcurr
  197. COLUMN,15,Lastpaymentdate
  198. COLUMN,16,Lastpaymentref
  199. COLUMN,17,Lastpmtdaybookno
  200. COLUMN,18,Lastpmtdaybookitm
  201. COLUMN,19,Status
  202. COLUMN,20,Sdiscountoffered001
  203. COLUMN,21,Sdiscountoffered002
  204. COLUMN,22,Sdiscountdate001
  205. COLUMN,23,Sdiscountdate002
  206. COLUMN,24,Debtflag
  207. COLUMN,25,Statementprintedyn
  208. COLUMN,26,Settledflag
  209. COLUMN,27,Miscellaneousref
  210. COLUMN,28,Prcode
  211. COLUMN,29,Prreference
  212. COLUMN,30,Prdateraised
  213. COLUMN,31,Prcomment
  214. COLUMN,32,Prsentto
  215. COLUMN,33,Prfollowupdate
  216. COLUMN,34,Systemmatchnumber
  217. COLUMN,35,Allowancebase
  218. COLUMN,36,Allowancecurrency
  219. COLUMN,37,Sourcemodule
  220. COLUMN,38,Sourcebranch
  221. COLUMN,39,Documentarchiveid
  222. COLUMN,40,Ustaxcodes001
  223. COLUMN,41,Ustaxcodes002
  224. COLUMN,42,Boemagicnumber
  225. COLUMN,43,Taxbilldate
  226. COLUMN,44,Taxbillnumber
  227. COLUMN,45,Taxbillpending
  228. COLUMN,46,Truepostingorigin
  229. COLUMN,47,Truemod
  230. COLUMN,48,Lastletterdate
  231. COLUMN,49,Lastlettertype
  232. COLUMN,50,Controlaccounttype
  233. COLUMN,51,Paymenttypecode
  234. COLUMN,52,Paymentreference
  235. COLUMN,53,Socialidvatreg
  236. COLUMN,54,Originalinvoice
  237. COLUMN,55,Client Db
  238. COLUMN,56,Salesexecutive001_VS_NewVehicle
  239. COLUMN,57,Salesexecutive001_VS_UsedVehicle
  240. COLUMN,58,Salesinvoicenumber_VS_NewVehicle
  241. COLUMN,59,Salesinvoicenumber_VS_UsedVehicle
  242. COLUMN,60,Accountcode
  243. COLUMN,61,Customersname
  244. COLUMN,62,Postcode
  245. COLUMN,63,Kunde
  246. COLUMN,64,Hauptbetrieb_ID
  247. COLUMN,65,Hauptbetrieb_Name
  248. COLUMN,66,Standort_ID
  249. COLUMN,67,Locationcode_GB_Company
  250. COLUMN,68,Description_GB_Company
  251. COLUMN,69,Standort_Name
  252. COLUMN,70,Beleg
  253. COLUMN,71,Mahnstufe
  254. COLUMN,72,Bookkeep Date
  255. COLUMN,73,Wipnumber
  256. COLUMN,74,Invoicingoperator
  257. COLUMN,75,Username_GB_User_Service
  258. COLUMN,76,Serviceberater
  259. COLUMN,77,Creatingoperator
  260. COLUMN,78,Username_GB_User_NewVehicle
  261. COLUMN,79,Username_GB_User_Usedvehicle
  262. COLUMN,80,Sel Name
  263. COLUMN,81,Forderungsart
  264. COLUMN,82,Bereich
  265. COLUMN,83,offen
  266. COLUMN,84,Rechnungsbetrag
  267. COLUMN,85,Gesamt offen KD (Info)
  268. COLUMN,86,Tage
  269. COLUMN,87,Staffel
  270. COLUMN,88,Categorycode_SL_SalesledgerAccount