Advertisement
bytecoded

Top Query #4

Mar 12th, 2019
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 91.55 KB | None | 0 0
  1. INSERT INTO #tt WITH(TABLOCK) (_Q_000_F_000_TYPE, _Q_000_F_000_RTRef, _Q_000_F_000_RRRef, _Q_000_F_001RRef, _Q_000_F_002, _Q_000_F_003RRef, _Q_000_F_004, _Q_000_F_005, _Q_000_F_006, _Q_000_F_007) SELECT
  2. T1.Fld11293_TYPE,
  3. T1.Fld11293_RTRef,
  4. T1.Fld11293_RRRef,
  5. T1.Fld11295RRef,
  6. (T1.Fld11302Turnover_ - T1.Fld11303Turnover_),
  7. T65.IDRRef,
  8. CASE WHEN CASE WHEN T1.Fld11290_TYPE = 0x08 AND T1.Fld11290_RTRef = 0x00000058 THEN T74._Fld12837 ELSE CAST(NULL AS BINARY(1)) END = 0x01 THEN (T1.Fld11302Turnover_ - T1.Fld11303Turnover_) ELSE 0.0 END,
  9. CASE WHEN (NOT ((CASE WHEN T1.Fld11290_TYPE = 0x08 AND T1.Fld11290_RTRef = 0x00000058 THEN T74._Fld12837 ELSE CAST(NULL AS BINARY(1)) END) = 0x01)) THEN (T1.Fld11302Turnover_ - T1.Fld11303Turnover_) ELSE 0.0 END,
  10. CAST(0.0 AS NUMERIC(21, 2)),
  11. CAST(NULL AS NUMERIC(21, 2))
  12. FROM (SELECT
  13. T2._Fld11293_TYPE AS Fld11293_TYPE,
  14. T2._Fld11293_RTRef AS Fld11293_RTRef,
  15. T2._Fld11293_RRRef AS Fld11293_RRRef,
  16. T2._Fld11295RRef AS Fld11295RRef,
  17. T2._Fld11290_TYPE AS Fld11290_TYPE,
  18. T2._Fld11290_RTRef AS Fld11290_RTRef,
  19. T2._Fld11290_RRRef AS Fld11290_RRRef,
  20. CAST(SUM(T2._Fld11303) AS NUMERIC(33, 8)) AS Fld11303Turnover_,
  21. CAST(SUM(T2._Fld11302) AS NUMERIC(33, 8)) AS Fld11302Turnover_
  22. FROM dbo._AccumRgTn11305 T2
  23. WHERE (((T2._Fld595 = ?)) AND (EXISTS(SELECT
  24. 1
  25. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  26. LEFT OUTER JOIN dbo._Document233 T3
  27. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000E9 AND T2._Fld11293_RRRef = T3._IDRRef) AND (T3._Fld595 = ?)
  28. LEFT OUTER JOIN dbo._Document212 T4
  29. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D4 AND T2._Fld11293_RRRef = T4._IDRRef) AND (T4._Fld595 = ?)
  30. LEFT OUTER JOIN dbo._Document234 T5
  31. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000EA AND T2._Fld11293_RRRef = T5._IDRRef) AND (T5._Fld595 = ?)
  32. LEFT OUTER JOIN dbo._Document263 T6
  33. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x00000107 AND T2._Fld11293_RRRef = T6._IDRRef) AND (T6._Fld595 = ?)
  34. LEFT OUTER JOIN dbo._Document216 T7
  35. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D8 AND T2._Fld11293_RRRef = T7._IDRRef) AND (T7._Fld595 = ?)
  36. LEFT OUTER JOIN dbo._Document215 T8
  37. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D7 AND T2._Fld11293_RRRef = T8._IDRRef) AND (T8._Fld595 = ?)
  38. LEFT OUTER JOIN dbo._Document213 T9
  39. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D5 AND T2._Fld11293_RRRef = T9._IDRRef) AND (T9._Fld595 = ?)
  40. LEFT OUTER JOIN dbo._Document199 T10
  41. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000C7 AND T2._Fld11293_RRRef = T10._IDRRef) AND (T10._Fld595 = ?)
  42. LEFT OUTER JOIN dbo._Reference42 T11
  43. ON ((CASE WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000E9 THEN T3._Fld4625RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D4 THEN T4._Fld3516RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000EA THEN T5._Fld4774RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x00000107 THEN T6._Fld6287RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D8 THEN T7._Fld3845RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D7 THEN T8._Fld3734RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D5 THEN T9._Fld3600RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000C7 THEN T10._Fld2840RRef ELSE CAST(NULL AS BINARY(16)) END = T11._IDRRef)) AND (T11._Fld595 = ?)
  44. WHERE EXISTS(SELECT
  45. 0x01 AS Q_001_F_000_
  46. FROM dbo._Reference98 T12
  47. INNER JOIN dbo._Reference21 T13
  48. ON (((T12._Fld1685 = ?) AND EXISTS(SELECT
  49. 0x01 AS Q_004_F_000_
  50. FROM dbo._InfoRg11709 T14
  51. WHERE ((T14._Fld595 = ?)) AND ((T14._Fld12065RRef = T12._IDRRef) AND (T14._Fld12066RRef = T13._IDRRef)))) AND T13._IDRRef IN
  52. (SELECT
  53. T15._Reference21_IDRRef AS Q_005_F_000RRef
  54. FROM dbo._Reference21_VT782 T15
  55. INNER JOIN dbo._InfoRg9937 T16
  56. ON ((T16._Fld9939_TYPE = 0x08 AND T16._Fld9939_RTRef = 0x00000095 AND T16._Fld9939_RRRef = ?) AND (T16._Fld9938_TYPE = T15._Fld784_TYPE AND T16._Fld9938_RTRef = T15._Fld784_RTRef AND T16._Fld9938_RRRef = T15._Fld784_RRRef))
  57. WHERE ((T15._Fld595 = ?)) AND (T16._Fld595 = ?)))
  58. WHERE ((T13._Fld595 = ?)) AND ((CASE WHEN T11._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T11._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  59. 0x01 AS Q_002_F_000_
  60. FROM dbo._InfoRg11710 T17
  61. WHERE ((T17._Fld595 = ?)) AND ((T17._Fld12072RRef = T13._IDRRef) AND (T17._Fld12073_TYPE = CASE WHEN T11._Fld12836RRef IS NOT NULL THEN 0x08 END AND T17._Fld12073_RTRef = CASE WHEN T11._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T17._Fld12073_RRRef = T11._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  62. 0x01 AS Q_003_F_000_
  63. FROM dbo._InfoRg11715 T18
  64. WHERE ((T18._Fld595 = ?)) AND ((T18._Fld12199RRef = T13._IDRRef) AND T18._Fld12200_TYPE = CASE WHEN T11._Fld12836RRef IS NOT NULL THEN 0x08 END AND T18._Fld12200_RTRef = CASE WHEN T11._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T18._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T2._Period >= ? AND T2._Period < ? AND (T2._Fld11303 <> ? OR T2._Fld11302 <> ?))
  65. GROUP BY T2._Fld11293_TYPE,
  66. T2._Fld11293_RTRef,
  67. T2._Fld11293_RRRef,
  68. T2._Fld11295RRef,
  69. T2._Fld11290_TYPE,
  70. T2._Fld11290_RTRef,
  71. T2._Fld11290_RRRef
  72. HAVING (CAST(SUM(T2._Fld11303) AS NUMERIC(33, 8))) <> 0.0 OR (CAST(SUM(T2._Fld11302) AS NUMERIC(33, 8))) <> 0.0) T1
  73. LEFT OUTER JOIN (SELECT
  74. T20._IDRRef AS IDRRef,
  75. T20._Fld4625RRef AS Fld4625RRef,
  76. T20._Fld595 AS Fld595_
  77. FROM dbo._Document233 T20
  78. WHERE ((EXISTS(SELECT
  79. 1
  80. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  81. LEFT OUTER JOIN dbo._Reference42 T21
  82. ON ((T20._Fld4625RRef = T21._IDRRef)) AND (T21._Fld595 = ?)
  83. WHERE EXISTS(SELECT
  84. 0x01 AS Q_001_F_000_
  85. FROM dbo._Reference98 T22
  86. INNER JOIN dbo._Reference21 T23
  87. ON (((T22._Fld1685 = ?) AND EXISTS(SELECT
  88. 0x01 AS Q_004_F_000_
  89. FROM dbo._InfoRg11709 T24
  90. WHERE ((T24._Fld595 = ?)) AND ((T24._Fld12065RRef = T22._IDRRef) AND (T24._Fld12066RRef = T23._IDRRef)))) AND T23._IDRRef IN
  91. (SELECT
  92. T25._Reference21_IDRRef AS Q_005_F_000RRef
  93. FROM dbo._Reference21_VT782 T25
  94. INNER JOIN dbo._InfoRg9937 T26
  95. ON ((T26._Fld9939_TYPE = 0x08 AND T26._Fld9939_RTRef = 0x00000095 AND T26._Fld9939_RRRef = ?) AND (T26._Fld9938_TYPE = T25._Fld784_TYPE AND T26._Fld9938_RTRef = T25._Fld784_RTRef AND T26._Fld9938_RRRef = T25._Fld784_RRRef))
  96. WHERE ((T25._Fld595 = ?)) AND (T26._Fld595 = ?)))
  97. WHERE ((T23._Fld595 = ?)) AND ((CASE WHEN T21._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T21._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  98. 0x01 AS Q_002_F_000_
  99. FROM dbo._InfoRg11710 T27
  100. WHERE ((T27._Fld595 = ?)) AND ((T27._Fld12072RRef = T23._IDRRef) AND (T27._Fld12073_TYPE = CASE WHEN T21._Fld12836RRef IS NOT NULL THEN 0x08 END AND T27._Fld12073_RTRef = CASE WHEN T21._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T27._Fld12073_RRRef = T21._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  101. 0x01 AS Q_003_F_000_
  102. FROM dbo._InfoRg11715 T28
  103. WHERE ((T28._Fld595 = ?)) AND ((T28._Fld12199RRef = T23._IDRRef) AND T28._Fld12200_TYPE = CASE WHEN T21._Fld12836RRef IS NOT NULL THEN 0x08 END AND T28._Fld12200_RTRef = CASE WHEN T21._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T28._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T20._Fld595 = ?)) T19
  104. ON T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000E9 AND T1.Fld11293_RRRef = T19.IDRRef
  105. LEFT OUTER JOIN dbo._Document212 T29
  106. ON (T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D4 AND T1.Fld11293_RRRef = T29._IDRRef) AND (T29._Fld595 = ?)
  107. LEFT OUTER JOIN (SELECT
  108. T31._IDRRef AS IDRRef,
  109. T31._Fld4779RRef AS Fld4779RRef,
  110. T31._Fld595 AS Fld595_,
  111. T31._Fld4774RRef AS Fld4774RRef
  112. FROM dbo._Document234 T31
  113. WHERE ((EXISTS(SELECT
  114. 1
  115. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  116. LEFT OUTER JOIN dbo._Reference42 T32
  117. ON ((T31._Fld4774RRef = T32._IDRRef)) AND (T32._Fld595 = ?)
  118. WHERE EXISTS(SELECT
  119. 0x01 AS Q_001_F_000_
  120. FROM dbo._Reference98 T33
  121. INNER JOIN dbo._Reference21 T34
  122. ON (((T33._Fld1685 = ?) AND EXISTS(SELECT
  123. 0x01 AS Q_006_F_000_
  124. FROM dbo._InfoRg11709 T35
  125. WHERE ((T35._Fld595 = ?)) AND ((T35._Fld12065RRef = T33._IDRRef) AND (T35._Fld12066RRef = T34._IDRRef)))) AND T34._IDRRef IN
  126. (SELECT
  127. T36._Reference21_IDRRef AS Q_007_F_000RRef
  128. FROM dbo._Reference21_VT782 T36
  129. INNER JOIN dbo._InfoRg9937 T37
  130. ON ((T37._Fld9939_TYPE = 0x08 AND T37._Fld9939_RTRef = 0x00000095 AND T37._Fld9939_RRRef = ?) AND (T37._Fld9938_TYPE = T36._Fld784_TYPE AND T37._Fld9938_RTRef = T36._Fld784_RTRef AND T37._Fld9938_RRRef = T36._Fld784_RRRef))
  131. WHERE ((T36._Fld595 = ?)) AND (T37._Fld595 = ?)))
  132. WHERE ((T34._Fld595 = ?)) AND ((0x08 <> 0x01) AND (CASE WHEN EXISTS(SELECT
  133. 0x01 AS Q_002_F_000_
  134. FROM dbo._InfoRg11710 T38
  135. WHERE ((T38._Fld595 = ?)) AND ((T38._Fld12072RRef = T34._IDRRef) AND (T38._Fld12073_TYPE = 0x08 AND T38._Fld12073_RTRef = 0x0000001C AND T38._Fld12073_RRRef = T31._Fld4779RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  136. 0x01 AS Q_003_F_000_
  137. FROM dbo._InfoRg11715 T39
  138. WHERE ((T39._Fld595 = ?)) AND ((T39._Fld12199RRef = T34._IDRRef) AND T39._Fld12200_TYPE = 0x08 AND T39._Fld12200_RTRef = 0x0000001C AND (T39._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END) AND (CASE WHEN T32._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  139. 0x01 AS Q_004_F_000_
  140. FROM dbo._InfoRg11710 T40
  141. WHERE ((T40._Fld595 = ?)) AND ((T40._Fld12072RRef = T34._IDRRef) AND (T40._Fld12073_TYPE = CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x08 END AND T40._Fld12073_RTRef = CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T40._Fld12073_RRRef = T32._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  142. 0x01 AS Q_005_F_000_
  143. FROM dbo._InfoRg11715 T41
  144. WHERE ((T41._Fld595 = ?)) AND ((T41._Fld12199RRef = T34._IDRRef) AND T41._Fld12200_TYPE = CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x08 END AND T41._Fld12200_RTRef = CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T41._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T31._Fld595 = ?)) T30
  145. ON T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000EA AND T1.Fld11293_RRRef = T30.IDRRef
  146. LEFT OUTER JOIN dbo._Document263 T42
  147. ON (T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x00000107 AND T1.Fld11293_RRRef = T42._IDRRef) AND (T42._Fld595 = ?)
  148. LEFT OUTER JOIN (SELECT
  149. T44._IDRRef AS IDRRef,
  150. T44._Fld3845RRef AS Fld3845RRef,
  151. T44._Fld595 AS Fld595_
  152. FROM dbo._Document216 T44
  153. WHERE ((EXISTS(SELECT
  154. 1
  155. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  156. LEFT OUTER JOIN dbo._Reference42 T45
  157. ON ((T44._Fld3845RRef = T45._IDRRef)) AND (T45._Fld595 = ?)
  158. WHERE EXISTS(SELECT
  159. 0x01 AS Q_001_F_000_
  160. FROM dbo._Reference98 T46
  161. INNER JOIN dbo._Reference21 T47
  162. ON (((T46._Fld1685 = ?) AND EXISTS(SELECT
  163. 0x01 AS Q_004_F_000_
  164. FROM dbo._InfoRg11709 T48
  165. WHERE ((T48._Fld595 = ?)) AND ((T48._Fld12065RRef = T46._IDRRef) AND (T48._Fld12066RRef = T47._IDRRef)))) AND T47._IDRRef IN
  166. (SELECT
  167. T49._Reference21_IDRRef AS Q_005_F_000RRef
  168. FROM dbo._Reference21_VT782 T49
  169. INNER JOIN dbo._InfoRg9937 T50
  170. ON ((T50._Fld9939_TYPE = 0x08 AND T50._Fld9939_RTRef = 0x00000095 AND T50._Fld9939_RRRef = ?) AND (T50._Fld9938_TYPE = T49._Fld784_TYPE AND T50._Fld9938_RTRef = T49._Fld784_RTRef AND T50._Fld9938_RRRef = T49._Fld784_RRRef))
  171. WHERE ((T49._Fld595 = ?)) AND (T50._Fld595 = ?)))
  172. WHERE ((T47._Fld595 = ?)) AND ((CASE WHEN T45._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T45._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  173. 0x01 AS Q_002_F_000_
  174. FROM dbo._InfoRg11710 T51
  175. WHERE ((T51._Fld595 = ?)) AND ((T51._Fld12072RRef = T47._IDRRef) AND (T51._Fld12073_TYPE = CASE WHEN T45._Fld12836RRef IS NOT NULL THEN 0x08 END AND T51._Fld12073_RTRef = CASE WHEN T45._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T51._Fld12073_RRRef = T45._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  176. 0x01 AS Q_003_F_000_
  177. FROM dbo._InfoRg11715 T52
  178. WHERE ((T52._Fld595 = ?)) AND ((T52._Fld12199RRef = T47._IDRRef) AND T52._Fld12200_TYPE = CASE WHEN T45._Fld12836RRef IS NOT NULL THEN 0x08 END AND T52._Fld12200_RTRef = CASE WHEN T45._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T52._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T44._Fld595 = ?)) T43
  179. ON T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D8 AND T1.Fld11293_RRRef = T43.IDRRef
  180. LEFT OUTER JOIN (SELECT
  181. T54._Fld595 AS Fld595_,
  182. T54._IDRRef AS IDRRef,
  183. T54._Fld3734RRef AS Fld3734RRef
  184. FROM dbo._Document215 T54
  185. WHERE ((EXISTS(SELECT
  186. 1
  187. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  188. LEFT OUTER JOIN dbo._Reference42 T55
  189. ON ((T54._Fld3734RRef = T55._IDRRef)) AND (T55._Fld595 = ?)
  190. WHERE EXISTS(SELECT
  191. 0x01 AS Q_001_F_000_
  192. FROM dbo._Reference98 T56
  193. INNER JOIN dbo._Reference21 T57
  194. ON (((T56._Fld1685 = ?) AND EXISTS(SELECT
  195. 0x01 AS Q_004_F_000_
  196. FROM dbo._InfoRg11709 T58
  197. WHERE ((T58._Fld595 = ?)) AND ((T58._Fld12065RRef = T56._IDRRef) AND (T58._Fld12066RRef = T57._IDRRef)))) AND T57._IDRRef IN
  198. (SELECT
  199. T59._Reference21_IDRRef AS Q_005_F_000RRef
  200. FROM dbo._Reference21_VT782 T59
  201. INNER JOIN dbo._InfoRg9937 T60
  202. ON ((T60._Fld9939_TYPE = 0x08 AND T60._Fld9939_RTRef = 0x00000095 AND T60._Fld9939_RRRef = ?) AND (T60._Fld9938_TYPE = T59._Fld784_TYPE AND T60._Fld9938_RTRef = T59._Fld784_RTRef AND T60._Fld9938_RRRef = T59._Fld784_RRRef))
  203. WHERE ((T59._Fld595 = ?)) AND (T60._Fld595 = ?)))
  204. WHERE ((T57._Fld595 = ?)) AND ((CASE WHEN T55._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T55._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  205. 0x01 AS Q_002_F_000_
  206. FROM dbo._InfoRg11710 T61
  207. WHERE ((T61._Fld595 = ?)) AND ((T61._Fld12072RRef = T57._IDRRef) AND (T61._Fld12073_TYPE = CASE WHEN T55._Fld12836RRef IS NOT NULL THEN 0x08 END AND T61._Fld12073_RTRef = CASE WHEN T55._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T61._Fld12073_RRRef = T55._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  208. 0x01 AS Q_003_F_000_
  209. FROM dbo._InfoRg11715 T62
  210. WHERE ((T62._Fld595 = ?)) AND ((T62._Fld12199RRef = T57._IDRRef) AND T62._Fld12200_TYPE = CASE WHEN T55._Fld12836RRef IS NOT NULL THEN 0x08 END AND T62._Fld12200_RTRef = CASE WHEN T55._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T62._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T54._Fld595 = ?)) T53
  211. ON T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D7 AND T1.Fld11293_RRRef = T53.IDRRef
  212. LEFT OUTER JOIN dbo._Document213 T63
  213. ON (T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D5 AND T1.Fld11293_RRRef = T63._IDRRef) AND (T63._Fld595 = ?)
  214. LEFT OUTER JOIN dbo._Document199 T64
  215. ON (T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000C7 AND T1.Fld11293_RRRef = T64._IDRRef) AND (T64._Fld595 = ?)
  216. LEFT OUTER JOIN (SELECT
  217. T66._IDRRef AS IDRRef,
  218. T66._Fld12836RRef AS Fld12836RRef,
  219. T66._Fld595 AS Fld595_,
  220. T66._Folder AS Folder_
  221. FROM dbo._Reference42 T66
  222. WHERE ((((T66._Folder = 0x00) OR EXISTS(SELECT
  223. 0x01 AS Q_001_F_000_
  224. FROM dbo._Reference98 T67
  225. INNER JOIN dbo._Reference21 T68
  226. ON (((T67._Fld1685 = ?) AND EXISTS(SELECT
  227. 0x01 AS Q_004_F_000_
  228. FROM dbo._InfoRg11709 T69
  229. WHERE ((T69._Fld595 = ?)) AND ((T69._Fld12065RRef = T67._IDRRef) AND (T69._Fld12066RRef = T68._IDRRef)))) AND T68._IDRRef IN
  230. (SELECT
  231. T70._Reference21_IDRRef AS Q_005_F_000RRef
  232. FROM dbo._Reference21_VT782 T70
  233. INNER JOIN dbo._InfoRg9937 T71
  234. ON ((T71._Fld9939_TYPE = 0x08 AND T71._Fld9939_RTRef = 0x00000095 AND T71._Fld9939_RRRef = ?) AND (T71._Fld9938_TYPE = T70._Fld784_TYPE AND T71._Fld9938_RTRef = T70._Fld784_RTRef AND T71._Fld9938_RRRef = T70._Fld784_RRRef))
  235. WHERE ((T70._Fld595 = ?)) AND (T71._Fld595 = ?)))
  236. WHERE ((T68._Fld595 = ?)) AND ((CASE WHEN T66._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T66._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  237. 0x01 AS Q_002_F_000_
  238. FROM dbo._InfoRg11710 T72
  239. WHERE ((T72._Fld595 = ?)) AND ((T72._Fld12072RRef = T68._IDRRef) AND (T72._Fld12073_TYPE = CASE WHEN T66._Fld12836RRef IS NOT NULL THEN 0x08 END AND T72._Fld12073_RTRef = CASE WHEN T66._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T72._Fld12073_RRRef = T66._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  240. 0x01 AS Q_003_F_000_
  241. FROM dbo._InfoRg11715 T73
  242. WHERE ((T73._Fld595 = ?)) AND ((T73._Fld12199RRef = T68._IDRRef) AND T73._Fld12200_TYPE = CASE WHEN T66._Fld12836RRef IS NOT NULL THEN 0x08 END AND T73._Fld12200_RTRef = CASE WHEN T66._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T73._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T66._Fld595 = ?)) T65
  243. ON (CASE WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000E9 THEN T19.Fld4625RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D4 THEN T29._Fld3516RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000EA THEN T30.Fld4774RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x00000107 THEN T42._Fld6287RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D8 THEN T43.Fld3845RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D7 THEN T53.Fld3734RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D5 THEN T63._Fld3600RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000C7 THEN T64._Fld2840RRef ELSE CAST(NULL AS BINARY(16)) END = T65.IDRRef)
  244. LEFT OUTER JOIN dbo._Reference88 T74
  245. ON (T1.Fld11290_TYPE = 0x08 AND T1.Fld11290_RTRef = 0x00000058 AND T1.Fld11290_RRRef = T74._IDRRef) AND (T74._Fld595 = ?)
  246. UNION ALL SELECT
  247. T75.Fld10332_TYPE,
  248. T75.Fld10332_RTRef,
  249. T75.Fld10332_RRRef,
  250. T75.Fld10328RRef,
  251. CAST(NULL AS NUMERIC(28, 2)),
  252. T75.Fld10330RRef,
  253. CAST(NULL AS NUMERIC(28, 2)),
  254. CAST(NULL AS NUMERIC(28, 2)),
  255. T75.Fld10334Expense_,
  256. CAST(NULL AS NUMERIC(21, 2))
  257. FROM (SELECT
  258. T76._RecorderTRef AS RecorderTRef,
  259. T76._RecorderRRef AS RecorderRRef,
  260. T76._Fld10332_TYPE AS Fld10332_TYPE,
  261. T76._Fld10332_RTRef AS Fld10332_RTRef,
  262. T76._Fld10332_RRRef AS Fld10332_RRRef,
  263. T76._Fld10328RRef AS Fld10328RRef,
  264. T76._Fld10330RRef AS Fld10330RRef,
  265. CAST(SUM(CASE WHEN T76._RecordKind = 0.0 THEN 0.0 ELSE T76._Fld10334 END) AS NUMERIC(27, 8)) AS Fld10334Expense_
  266. FROM dbo._AccumRg10327 T76
  267. WHERE (((T76._Fld595 = ?)) AND (EXISTS(SELECT
  268. 1
  269. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  270. LEFT OUTER JOIN dbo._Reference42 T77
  271. ON ((T76._Fld10330RRef = T77._IDRRef)) AND (T77._Fld595 = ?)
  272. WHERE EXISTS(SELECT
  273. 0x01 AS Q_001_F_000_
  274. FROM dbo._Reference98 T78
  275. INNER JOIN dbo._Reference21 T79
  276. ON (((T78._Fld1685 = ?) AND EXISTS(SELECT
  277. 0x01 AS Q_004_F_000_
  278. FROM dbo._InfoRg11709 T80
  279. WHERE ((T80._Fld595 = ?)) AND ((T80._Fld12065RRef = T78._IDRRef) AND (T80._Fld12066RRef = T79._IDRRef)))) AND T79._IDRRef IN
  280. (SELECT
  281. T81._Reference21_IDRRef AS Q_005_F_000RRef
  282. FROM dbo._Reference21_VT782 T81
  283. INNER JOIN dbo._InfoRg9937 T82
  284. ON ((T82._Fld9939_TYPE = 0x08 AND T82._Fld9939_RTRef = 0x00000095 AND T82._Fld9939_RRRef = ?) AND (T82._Fld9938_TYPE = T81._Fld784_TYPE AND T82._Fld9938_RTRef = T81._Fld784_RTRef AND T82._Fld9938_RRRef = T81._Fld784_RRRef))
  285. WHERE ((T81._Fld595 = ?)) AND (T82._Fld595 = ?)))
  286. WHERE ((T79._Fld595 = ?)) AND ((CASE WHEN T77._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T77._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  287. 0x01 AS Q_002_F_000_
  288. FROM dbo._InfoRg11710 T83
  289. WHERE ((T83._Fld595 = ?)) AND ((T83._Fld12072RRef = T79._IDRRef) AND (T83._Fld12073_TYPE = CASE WHEN T77._Fld12836RRef IS NOT NULL THEN 0x08 END AND T83._Fld12073_RTRef = CASE WHEN T77._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T83._Fld12073_RRRef = T77._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  290. 0x01 AS Q_003_F_000_
  291. FROM dbo._InfoRg11715 T84
  292. WHERE ((T84._Fld595 = ?)) AND ((T84._Fld12199RRef = T79._IDRRef) AND T84._Fld12200_TYPE = CASE WHEN T77._Fld12836RRef IS NOT NULL THEN 0x08 END AND T84._Fld12200_RTRef = CASE WHEN T77._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T84._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T76._Period >= ? AND T76._Period <= ? AND T76._Active = 0x01 AND T76._RecordKind = ?)
  293. GROUP BY T76._RecorderTRef,
  294. T76._RecorderRRef,
  295. T76._Fld10332_TYPE,
  296. T76._Fld10332_RTRef,
  297. T76._Fld10332_RRRef,
  298. T76._Fld10328RRef,
  299. T76._Fld10330RRef
  300. HAVING (CAST(SUM(CASE WHEN T76._RecordKind = 0.0 THEN 0.0 ELSE T76._Fld10334 END) AS NUMERIC(27, 8))) <> 0.0) T75
  301. WHERE (T75.RecorderTRef = 0x000000D3)
  302. UNION ALL SELECT
  303. T85.Fld10540_TYPE,
  304. T85.Fld10540_RTRef,
  305. T85.Fld10540_RRRef,
  306. T85.Fld10536RRef,
  307. CAST(NULL AS NUMERIC(28, 2)),
  308. T85.Fld10538RRef,
  309. CAST(NULL AS NUMERIC(28, 2)),
  310. CAST(NULL AS NUMERIC(28, 2)),
  311. T85.Fld10544Expense_,
  312. CAST(NULL AS NUMERIC(21, 2))
  313. FROM (SELECT
  314. T86._RecorderTRef AS RecorderTRef,
  315. T86._RecorderRRef AS RecorderRRef,
  316. T86._Fld10540_TYPE AS Fld10540_TYPE,
  317. T86._Fld10540_RTRef AS Fld10540_RTRef,
  318. T86._Fld10540_RRRef AS Fld10540_RRRef,
  319. T86._Fld10538RRef AS Fld10538RRef,
  320. T86._Fld10536RRef AS Fld10536RRef,
  321. CAST(SUM(CASE WHEN T86._RecordKind = 0.0 THEN 0.0 ELSE T86._Fld10544 END) AS NUMERIC(27, 8)) AS Fld10544Expense_
  322. FROM dbo._AccumRg10535 T86
  323. WHERE (((T86._Fld595 = ?)) AND (EXISTS(SELECT
  324. 1
  325. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  326. LEFT OUTER JOIN dbo._Reference42 T87
  327. ON ((T86._Fld10538RRef = T87._IDRRef)) AND (T87._Fld595 = ?)
  328. WHERE EXISTS(SELECT
  329. 0x01 AS Q_001_F_000_
  330. FROM dbo._Reference98 T88
  331. INNER JOIN dbo._Reference21 T89
  332. ON (((T88._Fld1685 = ?) AND EXISTS(SELECT
  333. 0x01 AS Q_004_F_000_
  334. FROM dbo._InfoRg11709 T90
  335. WHERE ((T90._Fld595 = ?)) AND ((T90._Fld12065RRef = T88._IDRRef) AND (T90._Fld12066RRef = T89._IDRRef)))) AND T89._IDRRef IN
  336. (SELECT
  337. T91._Reference21_IDRRef AS Q_005_F_000RRef
  338. FROM dbo._Reference21_VT782 T91
  339. INNER JOIN dbo._InfoRg9937 T92
  340. ON ((T92._Fld9939_TYPE = 0x08 AND T92._Fld9939_RTRef = 0x00000095 AND T92._Fld9939_RRRef = ?) AND (T92._Fld9938_TYPE = T91._Fld784_TYPE AND T92._Fld9938_RTRef = T91._Fld784_RTRef AND T92._Fld9938_RRRef = T91._Fld784_RRRef))
  341. WHERE ((T91._Fld595 = ?)) AND (T92._Fld595 = ?)))
  342. WHERE ((T89._Fld595 = ?)) AND ((CASE WHEN T87._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T87._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  343. 0x01 AS Q_002_F_000_
  344. FROM dbo._InfoRg11710 T93
  345. WHERE ((T93._Fld595 = ?)) AND ((T93._Fld12072RRef = T89._IDRRef) AND (T93._Fld12073_TYPE = CASE WHEN T87._Fld12836RRef IS NOT NULL THEN 0x08 END AND T93._Fld12073_RTRef = CASE WHEN T87._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T93._Fld12073_RRRef = T87._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  346. 0x01 AS Q_003_F_000_
  347. FROM dbo._InfoRg11715 T94
  348. WHERE ((T94._Fld595 = ?)) AND ((T94._Fld12199RRef = T89._IDRRef) AND T94._Fld12200_TYPE = CASE WHEN T87._Fld12836RRef IS NOT NULL THEN 0x08 END AND T94._Fld12200_RTRef = CASE WHEN T87._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T94._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T86._Period >= ? AND T86._Period <= ? AND T86._Active = 0x01 AND T86._RecordKind = ?)
  349. GROUP BY T86._RecorderTRef,
  350. T86._RecorderRRef,
  351. T86._Fld10540_TYPE,
  352. T86._Fld10540_RTRef,
  353. T86._Fld10540_RRRef,
  354. T86._Fld10538RRef,
  355. T86._Fld10536RRef
  356. HAVING (CAST(SUM(CASE WHEN T86._RecordKind = 0.0 THEN 0.0 ELSE T86._Fld10544 END) AS NUMERIC(27, 8))) <> 0.0) T85
  357. LEFT OUTER JOIN (SELECT
  358. T96._IDRRef AS IDRRef,
  359. T96._Fld4634_TYPE AS Fld4634_TYPE,
  360. T96._Fld4634_RTRef AS Fld4634_RTRef,
  361. T96._Fld4634_RRRef AS Fld4634_RRRef,
  362. T96._Fld4625RRef AS Fld4625RRef,
  363. T96._Fld595 AS Fld595_
  364. FROM dbo._Document233 T96
  365. WHERE ((EXISTS(SELECT
  366. 1
  367. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  368. LEFT OUTER JOIN dbo._Reference42 T97
  369. ON ((T96._Fld4625RRef = T97._IDRRef)) AND (T97._Fld595 = ?)
  370. WHERE EXISTS(SELECT
  371. 0x01 AS Q_001_F_000_
  372. FROM dbo._Reference98 T98
  373. INNER JOIN dbo._Reference21 T99
  374. ON (((T98._Fld1685 = ?) AND EXISTS(SELECT
  375. 0x01 AS Q_004_F_000_
  376. FROM dbo._InfoRg11709 T100
  377. WHERE ((T100._Fld595 = ?)) AND ((T100._Fld12065RRef = T98._IDRRef) AND (T100._Fld12066RRef = T99._IDRRef)))) AND T99._IDRRef IN
  378. (SELECT
  379. T101._Reference21_IDRRef AS Q_005_F_000RRef
  380. FROM dbo._Reference21_VT782 T101
  381. INNER JOIN dbo._InfoRg9937 T102
  382. ON ((T102._Fld9939_TYPE = 0x08 AND T102._Fld9939_RTRef = 0x00000095 AND T102._Fld9939_RRRef = ?) AND (T102._Fld9938_TYPE = T101._Fld784_TYPE AND T102._Fld9938_RTRef = T101._Fld784_RTRef AND T102._Fld9938_RRRef = T101._Fld784_RRRef))
  383. WHERE ((T101._Fld595 = ?)) AND (T102._Fld595 = ?)))
  384. WHERE ((T99._Fld595 = ?)) AND ((CASE WHEN T97._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T97._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  385. 0x01 AS Q_002_F_000_
  386. FROM dbo._InfoRg11710 T103
  387. WHERE ((T103._Fld595 = ?)) AND ((T103._Fld12072RRef = T99._IDRRef) AND (T103._Fld12073_TYPE = CASE WHEN T97._Fld12836RRef IS NOT NULL THEN 0x08 END AND T103._Fld12073_RTRef = CASE WHEN T97._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T103._Fld12073_RRRef = T97._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  388. 0x01 AS Q_003_F_000_
  389. FROM dbo._InfoRg11715 T104
  390. WHERE ((T104._Fld595 = ?)) AND ((T104._Fld12199RRef = T99._IDRRef) AND T104._Fld12200_TYPE = CASE WHEN T97._Fld12836RRef IS NOT NULL THEN 0x08 END AND T104._Fld12200_RTRef = CASE WHEN T97._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T104._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T96._Fld595 = ?)) T95
  391. ON T85.RecorderTRef = 0x000000E9 AND T85.RecorderRRef = T95.IDRRef
  392. LEFT OUTER JOIN dbo._Document212 T105
  393. ON (T85.RecorderTRef = 0x000000D4 AND T85.RecorderRRef = T105._IDRRef) AND (T105._Fld595 = ?)
  394. LEFT OUTER JOIN (SELECT
  395. T107._IDRRef AS IDRRef,
  396. T107._Fld4779RRef AS Fld4779RRef,
  397. T107._Fld595 AS Fld595_,
  398. T107._Fld4782_TYPE AS Fld4782_TYPE,
  399. T107._Fld4782_RTRef AS Fld4782_RTRef,
  400. T107._Fld4782_RRRef AS Fld4782_RRRef,
  401. T107._Fld4774RRef AS Fld4774RRef
  402. FROM dbo._Document234 T107
  403. WHERE ((EXISTS(SELECT
  404. 1
  405. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  406. LEFT OUTER JOIN dbo._Reference42 T108
  407. ON ((T107._Fld4774RRef = T108._IDRRef)) AND (T108._Fld595 = ?)
  408. WHERE EXISTS(SELECT
  409. 0x01 AS Q_001_F_000_
  410. FROM dbo._Reference98 T109
  411. INNER JOIN dbo._Reference21 T110
  412. ON (((T109._Fld1685 = ?) AND EXISTS(SELECT
  413. 0x01 AS Q_006_F_000_
  414. FROM dbo._InfoRg11709 T111
  415. WHERE ((T111._Fld595 = ?)) AND ((T111._Fld12065RRef = T109._IDRRef) AND (T111._Fld12066RRef = T110._IDRRef)))) AND T110._IDRRef IN
  416. (SELECT
  417. T112._Reference21_IDRRef AS Q_007_F_000RRef
  418. FROM dbo._Reference21_VT782 T112
  419. INNER JOIN dbo._InfoRg9937 T113
  420. ON ((T113._Fld9939_TYPE = 0x08 AND T113._Fld9939_RTRef = 0x00000095 AND T113._Fld9939_RRRef = ?) AND (T113._Fld9938_TYPE = T112._Fld784_TYPE AND T113._Fld9938_RTRef = T112._Fld784_RTRef AND T113._Fld9938_RRRef = T112._Fld784_RRRef))
  421. WHERE ((T112._Fld595 = ?)) AND (T113._Fld595 = ?)))
  422. WHERE ((T110._Fld595 = ?)) AND ((0x08 <> 0x01) AND (CASE WHEN EXISTS(SELECT
  423. 0x01 AS Q_002_F_000_
  424. FROM dbo._InfoRg11710 T114
  425. WHERE ((T114._Fld595 = ?)) AND ((T114._Fld12072RRef = T110._IDRRef) AND (T114._Fld12073_TYPE = 0x08 AND T114._Fld12073_RTRef = 0x0000001C AND T114._Fld12073_RRRef = T107._Fld4779RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  426. 0x01 AS Q_003_F_000_
  427. FROM dbo._InfoRg11715 T115
  428. WHERE ((T115._Fld595 = ?)) AND ((T115._Fld12199RRef = T110._IDRRef) AND T115._Fld12200_TYPE = 0x08 AND T115._Fld12200_RTRef = 0x0000001C AND (T115._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END) AND (CASE WHEN T108._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T108._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  429. 0x01 AS Q_004_F_000_
  430. FROM dbo._InfoRg11710 T116
  431. WHERE ((T116._Fld595 = ?)) AND ((T116._Fld12072RRef = T110._IDRRef) AND (T116._Fld12073_TYPE = CASE WHEN T108._Fld12836RRef IS NOT NULL THEN 0x08 END AND T116._Fld12073_RTRef = CASE WHEN T108._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T116._Fld12073_RRRef = T108._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  432. 0x01 AS Q_005_F_000_
  433. FROM dbo._InfoRg11715 T117
  434. WHERE ((T117._Fld595 = ?)) AND ((T117._Fld12199RRef = T110._IDRRef) AND T117._Fld12200_TYPE = CASE WHEN T108._Fld12836RRef IS NOT NULL THEN 0x08 END AND T117._Fld12200_RTRef = CASE WHEN T108._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T117._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T107._Fld595 = ?)) T106
  435. ON T85.RecorderTRef = 0x000000EA AND T85.RecorderRRef = T106.IDRRef
  436. LEFT OUTER JOIN dbo._Document253 T118
  437. ON (T85.RecorderTRef = 0x000000FD AND T85.RecorderRRef = T118._IDRRef) AND (T118._Fld595 = ?)
  438. LEFT OUTER JOIN (SELECT
  439. T120._IDRRef AS IDRRef,
  440. T120._Fld595 AS Fld595_,
  441. T120._Fld6145_TYPE AS Fld6145_TYPE,
  442. T120._Fld6145_RTRef AS Fld6145_RTRef,
  443. T120._Fld6145_RRRef AS Fld6145_RRRef,
  444. T120._Fld6139RRef AS Fld6139RRef
  445. FROM dbo._Document259 T120
  446. WHERE ((EXISTS(SELECT
  447. 1
  448. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  449. LEFT OUTER JOIN dbo._Reference42 T121
  450. ON ((T120._Fld6139RRef = T121._IDRRef)) AND (T121._Fld595 = ?)
  451. WHERE EXISTS(SELECT
  452. 0x01 AS Q_001_F_000_
  453. FROM dbo._Reference98 T122
  454. INNER JOIN dbo._Reference21 T123
  455. ON (((T122._Fld1685 = ?) AND EXISTS(SELECT
  456. 0x01 AS Q_004_F_000_
  457. FROM dbo._InfoRg11709 T124
  458. WHERE ((T124._Fld595 = ?)) AND ((T124._Fld12065RRef = T122._IDRRef) AND (T124._Fld12066RRef = T123._IDRRef)))) AND T123._IDRRef IN
  459. (SELECT
  460. T125._Reference21_IDRRef AS Q_005_F_000RRef
  461. FROM dbo._Reference21_VT782 T125
  462. INNER JOIN dbo._InfoRg9937 T126
  463. ON ((T126._Fld9939_TYPE = 0x08 AND T126._Fld9939_RTRef = 0x00000095 AND T126._Fld9939_RRRef = ?) AND (T126._Fld9938_TYPE = T125._Fld784_TYPE AND T126._Fld9938_RTRef = T125._Fld784_RTRef AND T126._Fld9938_RRRef = T125._Fld784_RRRef))
  464. WHERE ((T125._Fld595 = ?)) AND (T126._Fld595 = ?)))
  465. WHERE ((T123._Fld595 = ?)) AND ((CASE WHEN T121._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T121._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  466. 0x01 AS Q_002_F_000_
  467. FROM dbo._InfoRg11710 T127
  468. WHERE ((T127._Fld595 = ?)) AND ((T127._Fld12072RRef = T123._IDRRef) AND (T127._Fld12073_TYPE = CASE WHEN T121._Fld12836RRef IS NOT NULL THEN 0x08 END AND T127._Fld12073_RTRef = CASE WHEN T121._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T127._Fld12073_RRRef = T121._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  469. 0x01 AS Q_003_F_000_
  470. FROM dbo._InfoRg11715 T128
  471. WHERE ((T128._Fld595 = ?)) AND ((T128._Fld12199RRef = T123._IDRRef) AND T128._Fld12200_TYPE = CASE WHEN T121._Fld12836RRef IS NOT NULL THEN 0x08 END AND T128._Fld12200_RTRef = CASE WHEN T121._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T128._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T120._Fld595 = ?)) T119
  472. ON T85.RecorderTRef = 0x00000103 AND T85.RecorderRRef = T119.IDRRef
  473. LEFT OUTER JOIN (SELECT
  474. T130._IDRRef AS IDRRef,
  475. T130._Fld3845RRef AS Fld3845RRef,
  476. T130._Fld3852_TYPE AS Fld3852_TYPE,
  477. T130._Fld3852_RTRef AS Fld3852_RTRef,
  478. T130._Fld3852_RRRef AS Fld3852_RRRef,
  479. T130._Fld595 AS Fld595_
  480. FROM dbo._Document216 T130
  481. WHERE ((EXISTS(SELECT
  482. 1
  483. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  484. LEFT OUTER JOIN dbo._Reference42 T131
  485. ON ((T130._Fld3845RRef = T131._IDRRef)) AND (T131._Fld595 = ?)
  486. WHERE EXISTS(SELECT
  487. 0x01 AS Q_001_F_000_
  488. FROM dbo._Reference98 T132
  489. INNER JOIN dbo._Reference21 T133
  490. ON (((T132._Fld1685 = ?) AND EXISTS(SELECT
  491. 0x01 AS Q_004_F_000_
  492. FROM dbo._InfoRg11709 T134
  493. WHERE ((T134._Fld595 = ?)) AND ((T134._Fld12065RRef = T132._IDRRef) AND (T134._Fld12066RRef = T133._IDRRef)))) AND T133._IDRRef IN
  494. (SELECT
  495. T135._Reference21_IDRRef AS Q_005_F_000RRef
  496. FROM dbo._Reference21_VT782 T135
  497. INNER JOIN dbo._InfoRg9937 T136
  498. ON ((T136._Fld9939_TYPE = 0x08 AND T136._Fld9939_RTRef = 0x00000095 AND T136._Fld9939_RRRef = ?) AND (T136._Fld9938_TYPE = T135._Fld784_TYPE AND T136._Fld9938_RTRef = T135._Fld784_RTRef AND T136._Fld9938_RRRef = T135._Fld784_RRRef))
  499. WHERE ((T135._Fld595 = ?)) AND (T136._Fld595 = ?)))
  500. WHERE ((T133._Fld595 = ?)) AND ((CASE WHEN T131._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T131._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  501. 0x01 AS Q_002_F_000_
  502. FROM dbo._InfoRg11710 T137
  503. WHERE ((T137._Fld595 = ?)) AND ((T137._Fld12072RRef = T133._IDRRef) AND (T137._Fld12073_TYPE = CASE WHEN T131._Fld12836RRef IS NOT NULL THEN 0x08 END AND T137._Fld12073_RTRef = CASE WHEN T131._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T137._Fld12073_RRRef = T131._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  504. 0x01 AS Q_003_F_000_
  505. FROM dbo._InfoRg11715 T138
  506. WHERE ((T138._Fld595 = ?)) AND ((T138._Fld12199RRef = T133._IDRRef) AND T138._Fld12200_TYPE = CASE WHEN T131._Fld12836RRef IS NOT NULL THEN 0x08 END AND T138._Fld12200_RTRef = CASE WHEN T131._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T138._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T130._Fld595 = ?)) T129
  507. ON T85.RecorderTRef = 0x000000D8 AND T85.RecorderRRef = T129.IDRRef
  508. LEFT OUTER JOIN (SELECT
  509. T140._IDRRef AS IDRRef,
  510. T140._Fld3325_TYPE AS Fld3325_TYPE,
  511. T140._Fld3325_RTRef AS Fld3325_RTRef,
  512. T140._Fld3325_RRRef AS Fld3325_RRRef,
  513. T140._Fld595 AS Fld595_
  514. FROM dbo._Document209 T140
  515. WHERE ((EXISTS(SELECT
  516. 1
  517. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  518. LEFT OUTER JOIN dbo._Document211 T141
  519. ON (T140._Fld3325_TYPE = 0x08 AND T140._Fld3325_RTRef = 0x000000D3 AND T140._Fld3325_RRRef = T141._IDRRef) AND (T141._Fld595 = ?)
  520. LEFT OUTER JOIN dbo._Document210 T142
  521. ON (T140._Fld3325_TYPE = 0x08 AND T140._Fld3325_RTRef = 0x000000D2 AND T140._Fld3325_RRRef = T142._IDRRef) AND (T142._Fld595 = ?)
  522. LEFT OUTER JOIN dbo._Reference42 T143
  523. ON ((CASE WHEN T140._Fld3325_TYPE = 0x08 AND T140._Fld3325_RTRef = 0x000000D3 THEN T141._Fld3438RRef WHEN T140._Fld3325_TYPE = 0x08 AND T140._Fld3325_RTRef = 0x000000D2 THEN T142._Fld3343RRef ELSE CAST(NULL AS BINARY(16)) END = T143._IDRRef)) AND (T143._Fld595 = ?)
  524. WHERE EXISTS(SELECT
  525. 0x01 AS Q_001_F_000_
  526. FROM dbo._Reference98 T144
  527. INNER JOIN dbo._Reference21 T145
  528. ON (((T144._Fld1685 = ?) AND EXISTS(SELECT
  529. 0x01 AS Q_004_F_000_
  530. FROM dbo._InfoRg11709 T146
  531. WHERE ((T146._Fld595 = ?)) AND ((T146._Fld12065RRef = T144._IDRRef) AND (T146._Fld12066RRef = T145._IDRRef)))) AND T145._IDRRef IN
  532. (SELECT
  533. T147._Reference21_IDRRef AS Q_005_F_000RRef
  534. FROM dbo._Reference21_VT782 T147
  535. INNER JOIN dbo._InfoRg9937 T148
  536. ON ((T148._Fld9939_TYPE = 0x08 AND T148._Fld9939_RTRef = 0x00000095 AND T148._Fld9939_RRRef = ?) AND (T148._Fld9938_TYPE = T147._Fld784_TYPE AND T148._Fld9938_RTRef = T147._Fld784_RTRef AND T148._Fld9938_RRRef = T147._Fld784_RRRef))
  537. WHERE ((T147._Fld595 = ?)) AND (T148._Fld595 = ?)))
  538. WHERE ((T145._Fld595 = ?)) AND ((CASE WHEN T143._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T143._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  539. 0x01 AS Q_002_F_000_
  540. FROM dbo._InfoRg11710 T149
  541. WHERE ((T149._Fld595 = ?)) AND ((T149._Fld12072RRef = T145._IDRRef) AND (T149._Fld12073_TYPE = CASE WHEN T143._Fld12836RRef IS NOT NULL THEN 0x08 END AND T149._Fld12073_RTRef = CASE WHEN T143._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T149._Fld12073_RRRef = T143._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  542. 0x01 AS Q_003_F_000_
  543. FROM dbo._InfoRg11715 T150
  544. WHERE ((T150._Fld595 = ?)) AND ((T150._Fld12199RRef = T145._IDRRef) AND T150._Fld12200_TYPE = CASE WHEN T143._Fld12836RRef IS NOT NULL THEN 0x08 END AND T150._Fld12200_RTRef = CASE WHEN T143._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T150._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T140._Fld595 = ?)) T139
  545. ON T85.RecorderTRef = 0x000000D1 AND T85.RecorderRRef = T139.IDRRef
  546. LEFT OUTER JOIN (SELECT
  547. T152._Fld595 AS Fld595_,
  548. T152._IDRRef AS IDRRef,
  549. T152._Fld3734RRef AS Fld3734RRef,
  550. T152._Fld3739RRef AS Fld3739RRef
  551. FROM dbo._Document215 T152
  552. WHERE ((EXISTS(SELECT
  553. 1
  554. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  555. LEFT OUTER JOIN dbo._Reference42 T153
  556. ON ((T152._Fld3734RRef = T153._IDRRef)) AND (T153._Fld595 = ?)
  557. WHERE EXISTS(SELECT
  558. 0x01 AS Q_001_F_000_
  559. FROM dbo._Reference98 T154
  560. INNER JOIN dbo._Reference21 T155
  561. ON (((T154._Fld1685 = ?) AND EXISTS(SELECT
  562. 0x01 AS Q_004_F_000_
  563. FROM dbo._InfoRg11709 T156
  564. WHERE ((T156._Fld595 = ?)) AND ((T156._Fld12065RRef = T154._IDRRef) AND (T156._Fld12066RRef = T155._IDRRef)))) AND T155._IDRRef IN
  565. (SELECT
  566. T157._Reference21_IDRRef AS Q_005_F_000RRef
  567. FROM dbo._Reference21_VT782 T157
  568. INNER JOIN dbo._InfoRg9937 T158
  569. ON ((T158._Fld9939_TYPE = 0x08 AND T158._Fld9939_RTRef = 0x00000095 AND T158._Fld9939_RRRef = ?) AND (T158._Fld9938_TYPE = T157._Fld784_TYPE AND T158._Fld9938_RTRef = T157._Fld784_RTRef AND T158._Fld9938_RRRef = T157._Fld784_RRRef))
  570. WHERE ((T157._Fld595 = ?)) AND (T158._Fld595 = ?)))
  571. WHERE ((T155._Fld595 = ?)) AND ((CASE WHEN T153._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T153._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  572. 0x01 AS Q_002_F_000_
  573. FROM dbo._InfoRg11710 T159
  574. WHERE ((T159._Fld595 = ?)) AND ((T159._Fld12072RRef = T155._IDRRef) AND (T159._Fld12073_TYPE = CASE WHEN T153._Fld12836RRef IS NOT NULL THEN 0x08 END AND T159._Fld12073_RTRef = CASE WHEN T153._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T159._Fld12073_RRRef = T153._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  575. 0x01 AS Q_003_F_000_
  576. FROM dbo._InfoRg11715 T160
  577. WHERE ((T160._Fld595 = ?)) AND ((T160._Fld12199RRef = T155._IDRRef) AND T160._Fld12200_TYPE = CASE WHEN T153._Fld12836RRef IS NOT NULL THEN 0x08 END AND T160._Fld12200_RTRef = CASE WHEN T153._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T160._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T152._Fld595 = ?)) T151
  578. ON T85.RecorderTRef = 0x000000D7 AND T85.RecorderRRef = T151.IDRRef
  579. LEFT OUTER JOIN (SELECT
  580. T162._Fld6057_TYPE AS Fld6057_TYPE,
  581. T162._Fld6057_RTRef AS Fld6057_RTRef,
  582. T162._Fld6057_RRRef AS Fld6057_RRRef,
  583. T162._IDRRef AS IDRRef,
  584. T162._Fld6064RRef AS Fld6064RRef,
  585. T162._Fld595 AS Fld595_
  586. FROM dbo._Document258 T162
  587. WHERE ((EXISTS(SELECT
  588. 0x01 AS Q_001_F_000_
  589. FROM dbo._Reference98 T163
  590. INNER JOIN dbo._Reference21 T164
  591. ON (((T163._Fld1685 = ?) AND EXISTS(SELECT
  592. 0x01 AS Q_004_F_000_
  593. FROM dbo._InfoRg11709 T165
  594. WHERE ((T165._Fld595 = ?)) AND ((T165._Fld12065RRef = T163._IDRRef) AND (T165._Fld12066RRef = T164._IDRRef)))) AND T164._IDRRef IN
  595. (SELECT
  596. T166._Reference21_IDRRef AS Q_005_F_000RRef
  597. FROM dbo._Reference21_VT782 T166
  598. INNER JOIN dbo._InfoRg9937 T167
  599. ON ((T167._Fld9939_TYPE = 0x08 AND T167._Fld9939_RTRef = 0x00000095 AND T167._Fld9939_RRRef = ?) AND (T167._Fld9938_TYPE = T166._Fld784_TYPE AND T167._Fld9938_RTRef = T166._Fld784_RTRef AND T167._Fld9938_RRRef = T166._Fld784_RRRef))
  600. WHERE ((T166._Fld595 = ?)) AND (T167._Fld595 = ?)))
  601. WHERE ((T164._Fld595 = ?)) AND ((0x08 <> 0x01) AND (CASE WHEN EXISTS(SELECT
  602. 0x01 AS Q_002_F_000_
  603. FROM dbo._InfoRg11710 T168
  604. WHERE ((T168._Fld595 = ?)) AND ((T168._Fld12072RRef = T164._IDRRef) AND (T168._Fld12073_TYPE = 0x08 AND T168._Fld12073_RTRef = 0x0000006E AND T168._Fld12073_RRRef = T162._Fld6064RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  605. 0x01 AS Q_003_F_000_
  606. FROM dbo._InfoRg11715 T169
  607. WHERE ((T169._Fld595 = ?)) AND ((T169._Fld12199RRef = T164._IDRRef) AND T169._Fld12200_TYPE = 0x08 AND T169._Fld12200_RTRef = 0x0000006E AND (T169._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))))) AND (T162._Fld595 = ?)) T161
  608. ON T85.RecorderTRef = 0x00000102 AND T85.RecorderRRef = T161.IDRRef
  609. LEFT OUTER JOIN (SELECT
  610. T171._IDRRef AS IDRRef,
  611. T171._Fld3438RRef AS Fld3438RRef,
  612. T171._Fld3444_TYPE AS Fld3444_TYPE,
  613. T171._Fld3444_RTRef AS Fld3444_RTRef,
  614. T171._Fld3444_RRRef AS Fld3444_RRRef,
  615. T171._Fld595 AS Fld595_
  616. FROM dbo._Document211 T171
  617. WHERE ((EXISTS(SELECT
  618. 1
  619. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  620. LEFT OUTER JOIN dbo._Reference42 T172
  621. ON ((T171._Fld3438RRef = T172._IDRRef)) AND (T172._Fld595 = ?)
  622. WHERE EXISTS(SELECT
  623. 0x01 AS Q_001_F_000_
  624. FROM dbo._Reference98 T173
  625. INNER JOIN dbo._Reference21 T174
  626. ON (((T173._Fld1685 = ?) AND EXISTS(SELECT
  627. 0x01 AS Q_004_F_000_
  628. FROM dbo._InfoRg11709 T175
  629. WHERE ((T175._Fld595 = ?)) AND ((T175._Fld12065RRef = T173._IDRRef) AND (T175._Fld12066RRef = T174._IDRRef)))) AND T174._IDRRef IN
  630. (SELECT
  631. T176._Reference21_IDRRef AS Q_005_F_000RRef
  632. FROM dbo._Reference21_VT782 T176
  633. INNER JOIN dbo._InfoRg9937 T177
  634. ON ((T177._Fld9939_TYPE = 0x08 AND T177._Fld9939_RTRef = 0x00000095 AND T177._Fld9939_RRRef = ?) AND (T177._Fld9938_TYPE = T176._Fld784_TYPE AND T177._Fld9938_RTRef = T176._Fld784_RTRef AND T177._Fld9938_RRRef = T176._Fld784_RRRef))
  635. WHERE ((T176._Fld595 = ?)) AND (T177._Fld595 = ?)))
  636. WHERE ((T174._Fld595 = ?)) AND ((CASE WHEN T172._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T172._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  637. 0x01 AS Q_002_F_000_
  638. FROM dbo._InfoRg11710 T178
  639. WHERE ((T178._Fld595 = ?)) AND ((T178._Fld12072RRef = T174._IDRRef) AND (T178._Fld12073_TYPE = CASE WHEN T172._Fld12836RRef IS NOT NULL THEN 0x08 END AND T178._Fld12073_RTRef = CASE WHEN T172._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T178._Fld12073_RRRef = T172._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  640. 0x01 AS Q_003_F_000_
  641. FROM dbo._InfoRg11715 T179
  642. WHERE ((T179._Fld595 = ?)) AND ((T179._Fld12199RRef = T174._IDRRef) AND T179._Fld12200_TYPE = CASE WHEN T172._Fld12836RRef IS NOT NULL THEN 0x08 END AND T179._Fld12200_RTRef = CASE WHEN T172._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T179._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T171._Fld595 = ?)) T170
  643. ON T85.RecorderTRef = 0x000000D3 AND T85.RecorderRRef = T170.IDRRef
  644. LEFT OUTER JOIN dbo._Document248 T180
  645. ON (T85.RecorderTRef = 0x000000F8 AND T85.RecorderRRef = T180._IDRRef) AND (T180._Fld595 = ?)
  646. LEFT OUTER JOIN (SELECT
  647. T182._Fld5855RRef AS Fld5855RRef,
  648. T182._IDRRef AS IDRRef,
  649. T182._Fld5860_TYPE AS Fld5860_TYPE,
  650. T182._Fld5860_RTRef AS Fld5860_RTRef,
  651. T182._Fld5860_RRRef AS Fld5860_RRRef,
  652. T182._Fld595 AS Fld595_
  653. FROM dbo._Document255 T182
  654. WHERE ((EXISTS(SELECT
  655. 1
  656. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  657. LEFT OUTER JOIN dbo._Reference42 T183
  658. ON ((T182._Fld5855RRef = T183._IDRRef)) AND (T183._Fld595 = ?)
  659. WHERE EXISTS(SELECT
  660. 0x01 AS Q_001_F_000_
  661. FROM dbo._Reference98 T184
  662. INNER JOIN dbo._Reference21 T185
  663. ON (((T184._Fld1685 = ?) AND EXISTS(SELECT
  664. 0x01 AS Q_004_F_000_
  665. FROM dbo._InfoRg11709 T186
  666. WHERE ((T186._Fld595 = ?)) AND ((T186._Fld12065RRef = T184._IDRRef) AND (T186._Fld12066RRef = T185._IDRRef)))) AND T185._IDRRef IN
  667. (SELECT
  668. T187._Reference21_IDRRef AS Q_005_F_000RRef
  669. FROM dbo._Reference21_VT782 T187
  670. INNER JOIN dbo._InfoRg9937 T188
  671. ON ((T188._Fld9939_TYPE = 0x08 AND T188._Fld9939_RTRef = 0x00000095 AND T188._Fld9939_RRRef = ?) AND (T188._Fld9938_TYPE = T187._Fld784_TYPE AND T188._Fld9938_RTRef = T187._Fld784_RTRef AND T188._Fld9938_RRRef = T187._Fld784_RRRef))
  672. WHERE ((T187._Fld595 = ?)) AND (T188._Fld595 = ?)))
  673. WHERE ((T185._Fld595 = ?)) AND ((CASE WHEN T183._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T183._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  674. 0x01 AS Q_002_F_000_
  675. FROM dbo._InfoRg11710 T189
  676. WHERE ((T189._Fld595 = ?)) AND ((T189._Fld12072RRef = T185._IDRRef) AND (T189._Fld12073_TYPE = CASE WHEN T183._Fld12836RRef IS NOT NULL THEN 0x08 END AND T189._Fld12073_RTRef = CASE WHEN T183._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T189._Fld12073_RRRef = T183._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  677. 0x01 AS Q_003_F_000_
  678. FROM dbo._InfoRg11715 T190
  679. WHERE ((T190._Fld595 = ?)) AND ((T190._Fld12199RRef = T185._IDRRef) AND T190._Fld12200_TYPE = CASE WHEN T183._Fld12836RRef IS NOT NULL THEN 0x08 END AND T190._Fld12200_RTRef = CASE WHEN T183._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T190._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T182._Fld595 = ?)) T181
  680. ON T85.RecorderTRef = 0x000000FF AND T85.RecorderRRef = T181.IDRRef
  681. LEFT OUTER JOIN dbo._Document210 T191
  682. ON (T85.RecorderTRef = 0x000000D2 AND T85.RecorderRRef = T191._IDRRef) AND (T191._Fld595 = ?)
  683. WHERE (NOT (((CASE WHEN T85.RecorderTRef = 0x000000E9 THEN T95.Fld4634_TYPE WHEN T85.RecorderTRef = 0x000000D4 THEN CASE WHEN T105._Fld3521RRef IS NOT NULL THEN 0x08 END WHEN T85.RecorderTRef = 0x000000EA THEN T106.Fld4782_TYPE WHEN T85.RecorderTRef = 0x000000FD THEN T118._Fld5727_TYPE WHEN T85.RecorderTRef = 0x00000103 THEN T119.Fld6145_TYPE WHEN T85.RecorderTRef = 0x000000D8 THEN T129.Fld3852_TYPE WHEN T85.RecorderTRef = 0x000000D1 THEN T139.Fld3325_TYPE WHEN T85.RecorderTRef = 0x000000D7 THEN CASE WHEN T151.Fld3739RRef IS NOT NULL THEN 0x08 END WHEN T85.RecorderTRef = 0x00000102 THEN T161.Fld6057_TYPE WHEN T85.RecorderTRef = 0x000000D3 THEN T170.Fld3444_TYPE WHEN T85.RecorderTRef = 0x000000F8 THEN CASE WHEN T180._Fld5366RRef IS NOT NULL THEN 0x08 END WHEN T85.RecorderTRef = 0x000000FF THEN T181.Fld5860_TYPE WHEN T85.RecorderTRef = 0x000000D2 THEN T191._Fld3350_TYPE ELSE CAST(NULL AS BINARY(1)) END = 0x08 AND CASE WHEN T85.RecorderTRef = 0x000000E9 THEN T95.Fld4634_RTRef WHEN T85.RecorderTRef = 0x000000D4 THEN CASE WHEN T105._Fld3521RRef IS NOT NULL THEN 0x000000E9 END WHEN T85.RecorderTRef = 0x000000EA THEN T106.Fld4782_RTRef WHEN T85.RecorderTRef = 0x000000FD THEN T118._Fld5727_RTRef WHEN T85.RecorderTRef = 0x00000103 THEN T119.Fld6145_RTRef WHEN T85.RecorderTRef = 0x000000D8 THEN T129.Fld3852_RTRef WHEN T85.RecorderTRef = 0x000000D1 THEN T139.Fld3325_RTRef WHEN T85.RecorderTRef = 0x000000D7 THEN CASE WHEN T151.Fld3739RRef IS NOT NULL THEN 0x000000E9 END WHEN T85.RecorderTRef = 0x00000102 THEN T161.Fld6057_RTRef WHEN T85.RecorderTRef = 0x000000D3 THEN T170.Fld3444_RTRef WHEN T85.RecorderTRef = 0x000000F8 THEN CASE WHEN T180._Fld5366RRef IS NOT NULL THEN 0x000000F9 END WHEN T85.RecorderTRef = 0x000000FF THEN T181.Fld5860_RTRef WHEN T85.RecorderTRef = 0x000000D2 THEN T191._Fld3350_RTRef ELSE CAST(NULL AS BINARY(4)) END = 0x000000D3)))) AND ((T85.RecorderTRef = 0x00000103) OR (T85.RecorderTRef = 0x000000FF))
  684. UNION ALL SELECT
  685. T192.Fld10332_TYPE,
  686. T192.Fld10332_RTRef,
  687. T192.Fld10332_RRRef,
  688. T192.Fld10328RRef,
  689. CAST(NULL AS NUMERIC(28, 2)),
  690. T192.Fld10330RRef,
  691. CAST(NULL AS NUMERIC(28, 2)),
  692. CAST(NULL AS NUMERIC(28, 2)),
  693. CAST(NULL AS NUMERIC(21, 2)),
  694. T192.Fld10334Receipt_
  695. FROM (SELECT
  696. T193._RecorderTRef AS RecorderTRef,
  697. T193._RecorderRRef AS RecorderRRef,
  698. T193._Fld10332_TYPE AS Fld10332_TYPE,
  699. T193._Fld10332_RTRef AS Fld10332_RTRef,
  700. T193._Fld10332_RRRef AS Fld10332_RRRef,
  701. T193._Fld10328RRef AS Fld10328RRef,
  702. T193._Fld10330RRef AS Fld10330RRef,
  703. CAST(SUM(CASE WHEN T193._RecordKind = 0.0 THEN T193._Fld10334 ELSE 0.0 END) AS NUMERIC(27, 8)) AS Fld10334Receipt_
  704. FROM dbo._AccumRg10327 T193
  705. WHERE (((T193._Fld595 = ?)) AND (EXISTS(SELECT
  706. 1
  707. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  708. LEFT OUTER JOIN dbo._Reference42 T194
  709. ON ((T193._Fld10330RRef = T194._IDRRef)) AND (T194._Fld595 = ?)
  710. WHERE EXISTS(SELECT
  711. 0x01 AS Q_001_F_000_
  712. FROM dbo._Reference98 T195
  713. INNER JOIN dbo._Reference21 T196
  714. ON (((T195._Fld1685 = ?) AND EXISTS(SELECT
  715. 0x01 AS Q_004_F_000_
  716. FROM dbo._InfoRg11709 T197
  717. WHERE ((T197._Fld595 = ?)) AND ((T197._Fld12065RRef = T195._IDRRef) AND (T197._Fld12066RRef = T196._IDRRef)))) AND T196._IDRRef IN
  718. (SELECT
  719. T198._Reference21_IDRRef AS Q_005_F_000RRef
  720. FROM dbo._Reference21_VT782 T198
  721. INNER JOIN dbo._InfoRg9937 T199
  722. ON ((T199._Fld9939_TYPE = 0x08 AND T199._Fld9939_RTRef = 0x00000095 AND T199._Fld9939_RRRef = ?) AND (T199._Fld9938_TYPE = T198._Fld784_TYPE AND T199._Fld9938_RTRef = T198._Fld784_RTRef AND T199._Fld9938_RRRef = T198._Fld784_RRRef))
  723. WHERE ((T198._Fld595 = ?)) AND (T199._Fld595 = ?)))
  724. WHERE ((T196._Fld595 = ?)) AND ((CASE WHEN T194._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T194._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  725. 0x01 AS Q_002_F_000_
  726. FROM dbo._InfoRg11710 T200
  727. WHERE ((T200._Fld595 = ?)) AND ((T200._Fld12072RRef = T196._IDRRef) AND (T200._Fld12073_TYPE = CASE WHEN T194._Fld12836RRef IS NOT NULL THEN 0x08 END AND T200._Fld12073_RTRef = CASE WHEN T194._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T200._Fld12073_RRRef = T194._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  728. 0x01 AS Q_003_F_000_
  729. FROM dbo._InfoRg11715 T201
  730. WHERE ((T201._Fld595 = ?)) AND ((T201._Fld12199RRef = T196._IDRRef) AND T201._Fld12200_TYPE = CASE WHEN T194._Fld12836RRef IS NOT NULL THEN 0x08 END AND T201._Fld12200_RTRef = CASE WHEN T194._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T201._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T193._Period >= ? AND T193._Period <= ? AND T193._Active = 0x01 AND T193._RecordKind = ?)
  731. GROUP BY T193._RecorderTRef,
  732. T193._RecorderRRef,
  733. T193._Fld10332_TYPE,
  734. T193._Fld10332_RTRef,
  735. T193._Fld10332_RRRef,
  736. T193._Fld10328RRef,
  737. T193._Fld10330RRef
  738. HAVING (CAST(SUM(CASE WHEN T193._RecordKind = 0.0 THEN T193._Fld10334 ELSE 0.0 END) AS NUMERIC(27, 8))) <> 0.0) T192
  739. WHERE (T192.RecorderTRef = 0x000000D1)
  740. ",Context='Form.Call : Report.SalesExecutivesInfoFromInvoices.Form.Module.GenerateDirectly
  741. CommonForm.ReportForm.Form : 4405 : ComposeResult(ResultCompositionMode.Auto);
  742. ShajiAutoPaints_BIT Report.SalesExecutivesInfoFromInvoices.ObjectModule : 26 : ResultItem = CompositionProcessor.Next();'
  743.  
  744. 19781089=Duration,7=Execs,Sql="SELECT
  745. CAST(SUM(T1._Q_000_F_002) AS NUMERIC(38, 8)),
  746. CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T2.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END,
  747. T1._Q_000_F_003RRef,
  748. CAST(SUM(T1._Q_000_F_004) AS NUMERIC(38, 8)),
  749. CAST(SUM(T1._Q_000_F_005) AS NUMERIC(38, 8)),
  750. CAST(SUM(T1._Q_000_F_006) AS NUMERIC(33, 8)),
  751. CAST(NULL AS NUMERIC(38, 8)),
  752. CAST(SUM(CASE WHEN (CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E4 THEN T12._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T2.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D4 THEN T13._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000EA THEN T14.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000FD THEN T26._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000114 THEN T27._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000107 THEN T28._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000C8 THEN T29._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000103 THEN T30.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D8 THEN T40.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D7 THEN T50.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000116 THEN T60._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D5 THEN T61._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D3 THEN T62.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000F8 THEN T72._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000FF THEN T73.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000C7 THEN T83._Date_Time ELSE CAST(NULL AS DATETIME) END < {ts '4018-01-01 00:00:00'}) THEN T1._Q_000_F_006 ELSE 0.0 END) AS NUMERIC(33, 8)),
  753. CAST(SUM(CASE WHEN ((CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E4 THEN T12._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T2.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D4 THEN T13._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000EA THEN T14.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000FD THEN T26._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000114 THEN T27._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000107 THEN T28._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000C8 THEN T29._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000103 THEN T30.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D8 THEN T40.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D7 THEN T50.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000116 THEN T60._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D5 THEN T61._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D3 THEN T62.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000F8 THEN T72._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000FF THEN T73.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000C7 THEN T83._Date_Time ELSE CAST(NULL AS DATETIME) END >= {ts '4018-01-01 00:00:00'}) OR CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E4 THEN T12._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T2.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D4 THEN T13._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000EA THEN T14.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000FD THEN T26._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000114 THEN T27._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000107 THEN T28._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000C8 THEN T29._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000103 THEN T30.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D8 THEN T40.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D7 THEN T50.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000116 THEN T60._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D5 THEN T61._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D3 THEN T62.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000F8 THEN T72._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000FF THEN T73.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000C7 THEN T83._Date_Time ELSE CAST(NULL AS DATETIME) END IS NULL) THEN T1._Q_000_F_006 ELSE 0.0 END) AS NUMERIC(33, 8)),
  754. T1._Q_000_F_007,
  755. CAST(SUM(CASE WHEN (CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E4 THEN T12._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T2.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D4 THEN T13._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000EA THEN T14.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000FD THEN T26._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000114 THEN T27._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000107 THEN T28._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000C8 THEN T29._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000103 THEN T30.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D8 THEN T40.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D7 THEN T50.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000116 THEN T60._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D5 THEN T61._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D3 THEN T62.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000F8 THEN T72._Date_Time WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000FF THEN T73.Date_Time_ WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000C7 THEN T83._Date_Time ELSE CAST(NULL AS DATETIME) END < {ts '4018-01-01 00:00:00'}) THEN T1._Q_000_F_006 ELSE (CAST(T1._Q_000_F_006 AS NUMERIC(27, 8)) / 1.05) END) AS NUMERIC(35, 8)),
  756. T1._Q_000_F_003RRef,
  757. T84.Description_,
  758. 3.0,
  759. T84.Description_,
  760. CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T2.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END,
  761. T93._Description,
  762. 4.0,
  763. CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T94._Description ELSE CAST(NULL AS NVARCHAR(100)) END
  764. FROM #tt T1 WITH(NOLOCK)
  765. LEFT OUTER JOIN (SELECT
  766. T3._IDRRef AS IDRRef,
  767. T3._Date_Time AS Date_Time_,
  768. T3._Fld12737RRef AS Fld12737RRef,
  769. T3._Fld4654RRef AS Fld4654RRef,
  770. T3._Fld4625RRef AS Fld4625RRef,
  771. T3._Fld595 AS Fld595_
  772. FROM dbo._Document233 T3
  773. WHERE ((EXISTS(SELECT
  774. 1
  775. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  776. LEFT OUTER JOIN dbo._Reference42 T4
  777. ON ((T3._Fld4625RRef = T4._IDRRef)) AND (T4._Fld595 = ?)
  778. WHERE EXISTS(SELECT
  779. 0x01 AS Q_001_F_000_
  780. FROM dbo._Reference98 T5
  781. INNER JOIN dbo._Reference21 T6
  782. ON (((T5._Fld1685 = ?) AND EXISTS(SELECT
  783. 0x01 AS Q_004_F_000_
  784. FROM dbo._InfoRg11709 T7
  785. WHERE ((T7._Fld595 = ?)) AND ((T7._Fld12065RRef = T5._IDRRef) AND (T7._Fld12066RRef = T6._IDRRef)))) AND T6._IDRRef IN
  786. (SELECT
  787. T8._Reference21_IDRRef AS Q_005_F_000RRef
  788. FROM dbo._Reference21_VT782 T8
  789. INNER JOIN dbo._InfoRg9937 T9
  790. ON ((T9._Fld9939_TYPE = 0x08 AND T9._Fld9939_RTRef = 0x00000095 AND T9._Fld9939_RRRef = ?) AND (T9._Fld9938_TYPE = T8._Fld784_TYPE AND T9._Fld9938_RTRef = T8._Fld784_RTRef AND T9._Fld9938_RRRef = T8._Fld784_RRRef))
  791. WHERE ((T8._Fld595 = ?)) AND (T9._Fld595 = ?)))
  792. WHERE ((T6._Fld595 = ?)) AND ((CASE WHEN T4._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T4._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  793. 0x01 AS Q_002_F_000_
  794. FROM dbo._InfoRg11710 T10
  795. WHERE ((T10._Fld595 = ?)) AND ((T10._Fld12072RRef = T6._IDRRef) AND (T10._Fld12073_TYPE = CASE WHEN T4._Fld12836RRef IS NOT NULL THEN 0x08 END AND T10._Fld12073_RTRef = CASE WHEN T4._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T10._Fld12073_RRRef = T4._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  796. 0x01 AS Q_003_F_000_
  797. FROM dbo._InfoRg11715 T11
  798. WHERE ((T11._Fld595 = ?)) AND ((T11._Fld12199RRef = T6._IDRRef) AND T11._Fld12200_TYPE = CASE WHEN T4._Fld12836RRef IS NOT NULL THEN 0x08 END AND T11._Fld12200_RTRef = CASE WHEN T4._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T11._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T3._Fld595 = ?)) T2
  799. ON T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 AND T1._Q_000_F_000_RRRef = T2.IDRRef
  800. LEFT OUTER JOIN dbo._Document228 T12
  801. ON (T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E4 AND T1._Q_000_F_000_RRRef = T12._IDRRef) AND (T12._Fld595 = ?)
  802. LEFT OUTER JOIN dbo._Document212 T13
  803. ON (T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D4 AND T1._Q_000_F_000_RRRef = T13._IDRRef) AND (T13._Fld595 = ?)
  804. LEFT OUTER JOIN (SELECT
  805. T15._Date_Time AS Date_Time_,
  806. T15._IDRRef AS IDRRef,
  807. T15._Fld4779RRef AS Fld4779RRef,
  808. T15._Fld595 AS Fld595_,
  809. T15._Fld4798RRef AS Fld4798RRef,
  810. T15._Fld4774RRef AS Fld4774RRef
  811. FROM dbo._Document234 T15
  812. WHERE ((EXISTS(SELECT
  813. 1
  814. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  815. LEFT OUTER JOIN dbo._Reference42 T16
  816. ON ((T15._Fld4774RRef = T16._IDRRef)) AND (T16._Fld595 = ?)
  817. WHERE EXISTS(SELECT
  818. 0x01 AS Q_001_F_000_
  819. FROM dbo._Reference98 T17
  820. INNER JOIN dbo._Reference21 T18
  821. ON (((T17._Fld1685 = ?) AND EXISTS(SELECT
  822. 0x01 AS Q_006_F_000_
  823. FROM dbo._InfoRg11709 T19
  824. WHERE ((T19._Fld595 = ?)) AND ((T19._Fld12065RRef = T17._IDRRef) AND (T19._Fld12066RRef = T18._IDRRef)))) AND T18._IDRRef IN
  825. (SELECT
  826. T20._Reference21_IDRRef AS Q_007_F_000RRef
  827. FROM dbo._Reference21_VT782 T20
  828. INNER JOIN dbo._InfoRg9937 T21
  829. ON ((T21._Fld9939_TYPE = 0x08 AND T21._Fld9939_RTRef = 0x00000095 AND T21._Fld9939_RRRef = ?) AND (T21._Fld9938_TYPE = T20._Fld784_TYPE AND T21._Fld9938_RTRef = T20._Fld784_RTRef AND T21._Fld9938_RRRef = T20._Fld784_RRRef))
  830. WHERE ((T20._Fld595 = ?)) AND (T21._Fld595 = ?)))
  831. WHERE ((T18._Fld595 = ?)) AND ((0x08 <> 0x01) AND (CASE WHEN EXISTS(SELECT
  832. 0x01 AS Q_002_F_000_
  833. FROM dbo._InfoRg11710 T22
  834. WHERE ((T22._Fld595 = ?)) AND ((T22._Fld12072RRef = T18._IDRRef) AND (T22._Fld12073_TYPE = 0x08 AND T22._Fld12073_RTRef = 0x0000001C AND T22._Fld12073_RRRef = T15._Fld4779RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  835. 0x01 AS Q_003_F_000_
  836. FROM dbo._InfoRg11715 T23
  837. WHERE ((T23._Fld595 = ?)) AND ((T23._Fld12199RRef = T18._IDRRef) AND T23._Fld12200_TYPE = 0x08 AND T23._Fld12200_RTRef = 0x0000001C AND (T23._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END) AND (CASE WHEN T16._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T16._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  838. 0x01 AS Q_004_F_000_
  839. FROM dbo._InfoRg11710 T24
  840. WHERE ((T24._Fld595 = ?)) AND ((T24._Fld12072RRef = T18._IDRRef) AND (T24._Fld12073_TYPE = CASE WHEN T16._Fld12836RRef IS NOT NULL THEN 0x08 END AND T24._Fld12073_RTRef = CASE WHEN T16._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T24._Fld12073_RRRef = T16._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  841. 0x01 AS Q_005_F_000_
  842. FROM dbo._InfoRg11715 T25
  843. WHERE ((T25._Fld595 = ?)) AND ((T25._Fld12199RRef = T18._IDRRef) AND T25._Fld12200_TYPE = CASE WHEN T16._Fld12836RRef IS NOT NULL THEN 0x08 END AND T25._Fld12200_RTRef = CASE WHEN T16._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T25._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T15._Fld595 = ?)) T14
  844. ON T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000EA AND T1._Q_000_F_000_RRRef = T14.IDRRef
  845. LEFT OUTER JOIN dbo._Document253 T26
  846. ON (T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000FD AND T1._Q_000_F_000_RRRef = T26._IDRRef) AND (T26._Fld595 = ?)
  847. LEFT OUTER JOIN dbo._Document276 T27
  848. ON (T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000114 AND T1._Q_000_F_000_RRRef = T27._IDRRef) AND (T27._Fld595 = ?)
  849. LEFT OUTER JOIN dbo._Document263 T28
  850. ON (T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000107 AND T1._Q_000_F_000_RRRef = T28._IDRRef) AND (T28._Fld595 = ?)
  851. LEFT OUTER JOIN dbo._Document200 T29
  852. ON (T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000C8 AND T1._Q_000_F_000_RRRef = T29._IDRRef) AND (T29._Fld595 = ?)
  853. LEFT OUTER JOIN (SELECT
  854. T31._IDRRef AS IDRRef,
  855. T31._Date_Time AS Date_Time_,
  856. T31._Fld595 AS Fld595_,
  857. T31._Fld6139RRef AS Fld6139RRef
  858. FROM dbo._Document259 T31
  859. WHERE ((EXISTS(SELECT
  860. 1
  861. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  862. LEFT OUTER JOIN dbo._Reference42 T32
  863. ON ((T31._Fld6139RRef = T32._IDRRef)) AND (T32._Fld595 = ?)
  864. WHERE EXISTS(SELECT
  865. 0x01 AS Q_001_F_000_
  866. FROM dbo._Reference98 T33
  867. INNER JOIN dbo._Reference21 T34
  868. ON (((T33._Fld1685 = ?) AND EXISTS(SELECT
  869. 0x01 AS Q_004_F_000_
  870. FROM dbo._InfoRg11709 T35
  871. WHERE ((T35._Fld595 = ?)) AND ((T35._Fld12065RRef = T33._IDRRef) AND (T35._Fld12066RRef = T34._IDRRef)))) AND T34._IDRRef IN
  872. (SELECT
  873. T36._Reference21_IDRRef AS Q_005_F_000RRef
  874. FROM dbo._Reference21_VT782 T36
  875. INNER JOIN dbo._InfoRg9937 T37
  876. ON ((T37._Fld9939_TYPE = 0x08 AND T37._Fld9939_RTRef = 0x00000095 AND T37._Fld9939_RRRef = ?) AND (T37._Fld9938_TYPE = T36._Fld784_TYPE AND T37._Fld9938_RTRef = T36._Fld784_RTRef AND T37._Fld9938_RRRef = T36._Fld784_RRRef))
  877. WHERE ((T36._Fld595 = ?)) AND (T37._Fld595 = ?)))
  878. WHERE ((T34._Fld595 = ?)) AND ((CASE WHEN T32._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  879. 0x01 AS Q_002_F_000_
  880. FROM dbo._InfoRg11710 T38
  881. WHERE ((T38._Fld595 = ?)) AND ((T38._Fld12072RRef = T34._IDRRef) AND (T38._Fld12073_TYPE = CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x08 END AND T38._Fld12073_RTRef = CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T38._Fld12073_RRRef = T32._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  882. 0x01 AS Q_003_F_000_
  883. FROM dbo._InfoRg11715 T39
  884. WHERE ((T39._Fld595 = ?)) AND ((T39._Fld12199RRef = T34._IDRRef) AND T39._Fld12200_TYPE = CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x08 END AND T39._Fld12200_RTRef = CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T39._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T31._Fld595 = ?)) T30
  885. ON T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000103 AND T1._Q_000_F_000_RRRef = T30.IDRRef
  886. LEFT OUTER JOIN (SELECT
  887. T41._IDRRef AS IDRRef,
  888. T41._Fld3845RRef AS Fld3845RRef,
  889. T41._Date_Time AS Date_Time_,
  890. T41._Fld3877RRef AS Fld3877RRef,
  891. T41._Fld595 AS Fld595_
  892. FROM dbo._Document216 T41
  893. WHERE ((EXISTS(SELECT
  894. 1
  895. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  896. LEFT OUTER JOIN dbo._Reference42 T42
  897. ON ((T41._Fld3845RRef = T42._IDRRef)) AND (T42._Fld595 = ?)
  898. WHERE EXISTS(SELECT
  899. 0x01 AS Q_001_F_000_
  900. FROM dbo._Reference98 T43
  901. INNER JOIN dbo._Reference21 T44
  902. ON (((T43._Fld1685 = ?) AND EXISTS(SELECT
  903. 0x01 AS Q_004_F_000_
  904. FROM dbo._InfoRg11709 T45
  905. WHERE ((T45._Fld595 = ?)) AND ((T45._Fld12065RRef = T43._IDRRef) AND (T45._Fld12066RRef = T44._IDRRef)))) AND T44._IDRRef IN
  906. (SELECT
  907. T46._Reference21_IDRRef AS Q_005_F_000RRef
  908. FROM dbo._Reference21_VT782 T46
  909. INNER JOIN dbo._InfoRg9937 T47
  910. ON ((T47._Fld9939_TYPE = 0x08 AND T47._Fld9939_RTRef = 0x00000095 AND T47._Fld9939_RRRef = ?) AND (T47._Fld9938_TYPE = T46._Fld784_TYPE AND T47._Fld9938_RTRef = T46._Fld784_RTRef AND T47._Fld9938_RRRef = T46._Fld784_RRRef))
  911. WHERE ((T46._Fld595 = ?)) AND (T47._Fld595 = ?)))
  912. WHERE ((T44._Fld595 = ?)) AND ((CASE WHEN T42._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T42._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  913. 0x01 AS Q_002_F_000_
  914. FROM dbo._InfoRg11710 T48
  915. WHERE ((T48._Fld595 = ?)) AND ((T48._Fld12072RRef = T44._IDRRef) AND (T48._Fld12073_TYPE = CASE WHEN T42._Fld12836RRef IS NOT NULL THEN 0x08 END AND T48._Fld12073_RTRef = CASE WHEN T42._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T48._Fld12073_RRRef = T42._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  916. 0x01 AS Q_003_F_000_
  917. FROM dbo._InfoRg11715 T49
  918. WHERE ((T49._Fld595 = ?)) AND ((T49._Fld12199RRef = T44._IDRRef) AND T49._Fld12200_TYPE = CASE WHEN T42._Fld12836RRef IS NOT NULL THEN 0x08 END AND T49._Fld12200_RTRef = CASE WHEN T42._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T49._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T41._Fld595 = ?)) T40
  919. ON T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D8 AND T1._Q_000_F_000_RRRef = T40.IDRRef
  920. LEFT OUTER JOIN (SELECT
  921. T51._Fld595 AS Fld595_,
  922. T51._Fld3752RRef AS Fld3752RRef,
  923. T51._IDRRef AS IDRRef,
  924. T51._Fld3734RRef AS Fld3734RRef,
  925. T51._Date_Time AS Date_Time_
  926. FROM dbo._Document215 T51
  927. WHERE ((EXISTS(SELECT
  928. 1
  929. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  930. LEFT OUTER JOIN dbo._Reference42 T52
  931. ON ((T51._Fld3734RRef = T52._IDRRef)) AND (T52._Fld595 = ?)
  932. WHERE EXISTS(SELECT
  933. 0x01 AS Q_001_F_000_
  934. FROM dbo._Reference98 T53
  935. INNER JOIN dbo._Reference21 T54
  936. ON (((T53._Fld1685 = ?) AND EXISTS(SELECT
  937. 0x01 AS Q_004_F_000_
  938. FROM dbo._InfoRg11709 T55
  939. WHERE ((T55._Fld595 = ?)) AND ((T55._Fld12065RRef = T53._IDRRef) AND (T55._Fld12066RRef = T54._IDRRef)))) AND T54._IDRRef IN
  940. (SELECT
  941. T56._Reference21_IDRRef AS Q_005_F_000RRef
  942. FROM dbo._Reference21_VT782 T56
  943. INNER JOIN dbo._InfoRg9937 T57
  944. ON ((T57._Fld9939_TYPE = 0x08 AND T57._Fld9939_RTRef = 0x00000095 AND T57._Fld9939_RRRef = ?) AND (T57._Fld9938_TYPE = T56._Fld784_TYPE AND T57._Fld9938_RTRef = T56._Fld784_RTRef AND T57._Fld9938_RRRef = T56._Fld784_RRRef))
  945. WHERE ((T56._Fld595 = ?)) AND (T57._Fld595 = ?)))
  946. WHERE ((T54._Fld595 = ?)) AND ((CASE WHEN T52._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T52._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  947. 0x01 AS Q_002_F_000_
  948. FROM dbo._InfoRg11710 T58
  949. WHERE ((T58._Fld595 = ?)) AND ((T58._Fld12072RRef = T54._IDRRef) AND (T58._Fld12073_TYPE = CASE WHEN T52._Fld12836RRef IS NOT NULL THEN 0x08 END AND T58._Fld12073_RTRef = CASE WHEN T52._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T58._Fld12073_RRRef = T52._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  950. 0x01 AS Q_003_F_000_
  951. FROM dbo._InfoRg11715 T59
  952. WHERE ((T59._Fld595 = ?)) AND ((T59._Fld12199RRef = T54._IDRRef) AND T59._Fld12200_TYPE = CASE WHEN T52._Fld12836RRef IS NOT NULL THEN 0x08 END AND T59._Fld12200_RTRef = CASE WHEN T52._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T59._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T51._Fld595 = ?)) T50
  953. ON T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D7 AND T1._Q_000_F_000_RRRef = T50.IDRRef
  954. LEFT OUTER JOIN dbo._Document278 T60
  955. ON (T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000116 AND T1._Q_000_F_000_RRRef = T60._IDRRef) AND (T60._Fld595 = ?)
  956. LEFT OUTER JOIN dbo._Document213 T61
  957. ON (T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D5 AND T1._Q_000_F_000_RRRef = T61._IDRRef) AND (T61._Fld595 = ?)
  958. LEFT OUTER JOIN (SELECT
  959. T63._Date_Time AS Date_Time_,
  960. T63._IDRRef AS IDRRef,
  961. T63._Fld3438RRef AS Fld3438RRef,
  962. T63._Fld595 AS Fld595_
  963. FROM dbo._Document211 T63
  964. WHERE ((EXISTS(SELECT
  965. 1
  966. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  967. LEFT OUTER JOIN dbo._Reference42 T64
  968. ON ((T63._Fld3438RRef = T64._IDRRef)) AND (T64._Fld595 = ?)
  969. WHERE EXISTS(SELECT
  970. 0x01 AS Q_001_F_000_
  971. FROM dbo._Reference98 T65
  972. INNER JOIN dbo._Reference21 T66
  973. ON (((T65._Fld1685 = ?) AND EXISTS(SELECT
  974. 0x01 AS Q_004_F_000_
  975. FROM dbo._InfoRg11709 T67
  976. WHERE ((T67._Fld595 = ?)) AND ((T67._Fld12065RRef = T65._IDRRef) AND (T67._Fld12066RRef = T66._IDRRef)))) AND T66._IDRRef IN
  977. (SELECT
  978. T68._Reference21_IDRRef AS Q_005_F_000RRef
  979. FROM dbo._Reference21_VT782 T68
  980. INNER JOIN dbo._InfoRg9937 T69
  981. ON ((T69._Fld9939_TYPE = 0x08 AND T69._Fld9939_RTRef = 0x00000095 AND T69._Fld9939_RRRef = ?) AND (T69._Fld9938_TYPE = T68._Fld784_TYPE AND T69._Fld9938_RTRef = T68._Fld784_RTRef AND T69._Fld9938_RRRef = T68._Fld784_RRRef))
  982. WHERE ((T68._Fld595 = ?)) AND (T69._Fld595 = ?)))
  983. WHERE ((T66._Fld595 = ?)) AND ((CASE WHEN T64._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T64._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  984. 0x01 AS Q_002_F_000_
  985. FROM dbo._InfoRg11710 T70
  986. WHERE ((T70._Fld595 = ?)) AND ((T70._Fld12072RRef = T66._IDRRef) AND (T70._Fld12073_TYPE = CASE WHEN T64._Fld12836RRef IS NOT NULL THEN 0x08 END AND T70._Fld12073_RTRef = CASE WHEN T64._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T70._Fld12073_RRRef = T64._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  987. 0x01 AS Q_003_F_000_
  988. FROM dbo._InfoRg11715 T71
  989. WHERE ((T71._Fld595 = ?)) AND ((T71._Fld12199RRef = T66._IDRRef) AND T71._Fld12200_TYPE = CASE WHEN T64._Fld12836RRef IS NOT NULL THEN 0x08 END AND T71._Fld12200_RTRef = CASE WHEN T64._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T71._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T63._Fld595 = ?)) T62
  990. ON T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D3 AND T1._Q_000_F_000_RRRef = T62.IDRRef
  991. LEFT OUTER JOIN dbo._Document248 T72
  992. ON (T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000F8 AND T1._Q_000_F_000_RRRef = T72._IDRRef) AND (T72._Fld595 = ?)
  993. LEFT OUTER JOIN (SELECT
  994. T74._Fld5855RRef AS Fld5855RRef,
  995. T74._IDRRef AS IDRRef,
  996. T74._Date_Time AS Date_Time_,
  997. T74._Fld595 AS Fld595_
  998. FROM dbo._Document255 T74
  999. WHERE ((EXISTS(SELECT
  1000. 1
  1001. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  1002. LEFT OUTER JOIN dbo._Reference42 T75
  1003. ON ((T74._Fld5855RRef = T75._IDRRef)) AND (T75._Fld595 = ?)
  1004. WHERE EXISTS(SELECT
  1005. 0x01 AS Q_001_F_000_
  1006. FROM dbo._Reference98 T76
  1007. INNER JOIN dbo._Reference21 T77
  1008. ON (((T76._Fld1685 = ?) AND EXISTS(SELECT
  1009. 0x01 AS Q_004_F_000_
  1010. FROM dbo._InfoRg11709 T78
  1011. WHERE ((T78._Fld595 = ?)) AND ((T78._Fld12065RRef = T76._IDRRef) AND (T78._Fld12066RRef = T77._IDRRef)))) AND T77._IDRRef IN
  1012. (SELECT
  1013. T79._Reference21_IDRRef AS Q_005_F_000RRef
  1014. FROM dbo._Reference21_VT782 T79
  1015. INNER JOIN dbo._InfoRg9937 T80
  1016. ON ((T80._Fld9939_TYPE = 0x08 AND T80._Fld9939_RTRef = 0x00000095 AND T80._Fld9939_RRRef = ?) AND (T80._Fld9938_TYPE = T79._Fld784_TYPE AND T80._Fld9938_RTRef = T79._Fld784_RTRef AND T80._Fld9938_RRRef = T79._Fld784_RRRef))
  1017. WHERE ((T79._Fld595 = ?)) AND (T80._Fld595 = ?)))
  1018. WHERE ((T77._Fld595 = ?)) AND ((CASE WHEN T75._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T75._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  1019. 0x01 AS Q_002_F_000_
  1020. FROM dbo._InfoRg11710 T81
  1021. WHERE ((T81._Fld595 = ?)) AND ((T81._Fld12072RRef = T77._IDRRef) AND (T81._Fld12073_TYPE = CASE WHEN T75._Fld12836RRef IS NOT NULL THEN 0x08 END AND T81._Fld12073_RTRef = CASE WHEN T75._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T81._Fld12073_RRRef = T75._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  1022. 0x01 AS Q_003_F_000_
  1023. FROM dbo._InfoRg11715 T82
  1024. WHERE ((T82._Fld595 = ?)) AND ((T82._Fld12199RRef = T77._IDRRef) AND T82._Fld12200_TYPE = CASE WHEN T75._Fld12836RRef IS NOT NULL THEN 0x08 END AND T82._Fld12200_RTRef = CASE WHEN T75._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T82._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T74._Fld595 = ?)) T73
  1025. ON T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000FF AND T1._Q_000_F_000_RRRef = T73.IDRRef
  1026. LEFT OUTER JOIN dbo._Document199 T83
  1027. ON (T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000C7 AND T1._Q_000_F_000_RRRef = T83._IDRRef) AND (T83._Fld595 = ?)
  1028. LEFT OUTER JOIN (SELECT
  1029. T85._IDRRef AS IDRRef,
  1030. T85._Fld12836RRef AS Fld12836RRef,
  1031. T85._Fld595 AS Fld595_,
  1032. T85._Folder AS Folder_,
  1033. T85._Description COLLATE Latin1_General_CI_AS AS Description_
  1034. FROM dbo._Reference42 T85
  1035. WHERE ((((T85._Folder = 0x00) OR EXISTS(SELECT
  1036. 0x01 AS Q_001_F_000_
  1037. FROM dbo._Reference98 T86
  1038. INNER JOIN dbo._Reference21 T87
  1039. ON (((T86._Fld1685 = ?) AND EXISTS(SELECT
  1040. 0x01 AS Q_004_F_000_
  1041. FROM dbo._InfoRg11709 T88
  1042. WHERE ((T88._Fld595 = ?)) AND ((T88._Fld12065RRef = T86._IDRRef) AND (T88._Fld12066RRef = T87._IDRRef)))) AND T87._IDRRef IN
  1043. (SELECT
  1044. T89._Reference21_IDRRef AS Q_005_F_000RRef
  1045. FROM dbo._Reference21_VT782 T89
  1046. INNER JOIN dbo._InfoRg9937 T90
  1047. ON ((T90._Fld9939_TYPE = 0x08 AND T90._Fld9939_RTRef = 0x00000095 AND T90._Fld9939_RRRef = ?) AND (T90._Fld9938_TYPE = T89._Fld784_TYPE AND T90._Fld9938_RTRef = T89._Fld784_RTRef AND T90._Fld9938_RRRef = T89._Fld784_RRRef))
  1048. WHERE ((T89._Fld595 = ?)) AND (T90._Fld595 = ?)))
  1049. WHERE ((T87._Fld595 = ?)) AND ((CASE WHEN T85._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T85._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  1050. 0x01 AS Q_002_F_000_
  1051. FROM dbo._InfoRg11710 T91
  1052. WHERE ((T91._Fld595 = ?)) AND ((T91._Fld12072RRef = T87._IDRRef) AND (T91._Fld12073_TYPE = CASE WHEN T85._Fld12836RRef IS NOT NULL THEN 0x08 END AND T91._Fld12073_RTRef = CASE WHEN T85._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T91._Fld12073_RRRef = T85._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  1053. 0x01 AS Q_003_F_000_
  1054. FROM dbo._InfoRg11715 T92
  1055. WHERE ((T92._Fld595 = ?)) AND ((T92._Fld12199RRef = T87._IDRRef) AND T92._Fld12200_TYPE = CASE WHEN T85._Fld12836RRef IS NOT NULL THEN 0x08 END AND T92._Fld12200_RTRef = CASE WHEN T85._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T92._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T85._Fld595 = ?)) T84
  1056. ON T1._Q_000_F_003RRef = T84.IDRRef
  1057. LEFT OUTER JOIN dbo._Reference64 T93
  1058. ON (CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T2.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END = T93._IDRRef) AND (T93._Fld595 = ?)
  1059. LEFT OUTER JOIN dbo._Reference64 T94
  1060. ON (T2.Fld12737RRef = T94._IDRRef) AND (T94._Fld595 = ?)
  1061. WHERE CASE WHEN (? = ?) THEN CASE WHEN ((CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T2.Fld4654RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D4 THEN T13._Fld3528RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000EA THEN T14.Fld4798RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000114 THEN T27._Fld6926RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000107 THEN T28._Fld6301RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D8 THEN T40.Fld3877RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D7 THEN T50.Fld3752RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000116 THEN T60._Fld7015RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D5 THEN T61._Fld3616RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000C7 THEN T83._Fld2852RRef ELSE CAST(NULL AS BINARY(16)) END = ?) OR (CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T2.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END = ?)) THEN 0x01 WHEN NOT ((CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T2.Fld4654RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D4 THEN T13._Fld3528RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000EA THEN T14.Fld4798RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000114 THEN T27._Fld6926RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000107 THEN T28._Fld6301RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D8 THEN T40.Fld3877RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D7 THEN T50.Fld3752RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x00000116 THEN T60._Fld7015RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000D5 THEN T61._Fld3616RRef WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000C7 THEN T83._Fld2852RRef ELSE CAST(NULL AS BINARY(16)) END = ?) OR (CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T2.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END = ?)) THEN 0x00 END END = 0x01
  1062. GROUP BY T1._Q_000_F_003RRef,
  1063. T1._Q_000_F_007,
  1064. CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T2.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END,
  1065. CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T94._Description ELSE CAST(NULL AS NVARCHAR(100)) END,
  1066. T1._Q_000_F_003RRef,
  1067. T84.Description_,
  1068. T84.Description_,
  1069. CASE WHEN T1._Q_000_F_000_TYPE = 0x08 AND T1._Q_000_F_000_RTRef = 0x000000E9 THEN T2.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END,
  1070. T93._Description
  1071. UNION ALL SELECT
  1072. CAST(NULL AS NUMERIC(34, 2)),
  1073. CASE WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000E9 THEN T96.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END,
  1074. T95._Q_001_F_000RRef,
  1075. CAST(NULL AS NUMERIC(34, 2)),
  1076. CAST(NULL AS NUMERIC(34, 2)),
  1077. CAST(NULL AS NUMERIC(27, 2)),
  1078. CAST(SUM(T95._Q_001_F_001) AS NUMERIC(38, 8)),
  1079. CAST(NULL AS NUMERIC(27, 2)),
  1080. CAST(NULL AS NUMERIC(27, 2)),
  1081. CAST(NULL AS NUMERIC(21, 2)),
  1082. CAST(NULL AS NUMERIC(35, 8)),
  1083. T95._Q_001_F_000RRef,
  1084. T106.Description_,
  1085. 2.0,
  1086. T106.Description_,
  1087. CASE WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000E9 THEN T96.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END,
  1088. T115._Description,
  1089. 5.0,
  1090. CASE WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000E9 THEN T116._Description ELSE CAST(NULL AS NVARCHAR(100)) END
  1091. FROM #tt T95 WITH(NOLOCK)
  1092. LEFT OUTER JOIN (SELECT
  1093. T97._IDRRef AS IDRRef,
  1094. T97._Fld12737RRef AS Fld12737RRef,
  1095. T97._Fld4654RRef AS Fld4654RRef,
  1096. T97._Fld4625RRef AS Fld4625RRef,
  1097. T97._Fld595 AS Fld595_
  1098. FROM dbo._Document233 T97
  1099. WHERE ((EXISTS(SELECT
  1100. 1
  1101. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  1102. LEFT OUTER JOIN dbo._Reference42 T98
  1103. ON ((T97._Fld4625RRef = T98._IDRRef)) AND (T98._Fld595 = ?)
  1104. WHERE EXISTS(SELECT
  1105. 0x01 AS Q_001_F_000_
  1106. FROM dbo._Reference98 T99
  1107. INNER JOIN dbo._Reference21 T100
  1108. ON (((T99._Fld1685 = ?) AND EXISTS(SELECT
  1109. 0x01 AS Q_004_F_000_
  1110. FROM dbo._InfoRg11709 T101
  1111. WHERE ((T101._Fld595 = ?)) AND ((T101._Fld12065RRef = T99._IDRRef) AND (T101._Fld12066RRef = T100._IDRRef)))) AND T100._IDRRef IN
  1112. (SELECT
  1113. T102._Reference21_IDRRef AS Q_005_F_000RRef
  1114. FROM dbo._Reference21_VT782 T102
  1115. INNER JOIN dbo._InfoRg9937 T103
  1116. ON ((T103._Fld9939_TYPE = 0x08 AND T103._Fld9939_RTRef = 0x00000095 AND T103._Fld9939_RRRef = ?) AND (T103._Fld9938_TYPE = T102._Fld784_TYPE AND T103._Fld9938_RTRef = T102._Fld784_RTRef AND T103._Fld9938_RRRef = T102._Fld784_RRRef))
  1117. WHERE ((T102._Fld595 = ?)) AND (T103._Fld595 = ?)))
  1118. WHERE ((T100._Fld595 = ?)) AND ((CASE WHEN T98._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T98._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  1119. 0x01 AS Q_002_F_000_
  1120. FROM dbo._InfoRg11710 T104
  1121. WHERE ((T104._Fld595 = ?)) AND ((T104._Fld12072RRef = T100._IDRRef) AND (T104._Fld12073_TYPE = CASE WHEN T98._Fld12836RRef IS NOT NULL THEN 0x08 END AND T104._Fld12073_RTRef = CASE WHEN T98._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T104._Fld12073_RRRef = T98._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  1122. 0x01 AS Q_003_F_000_
  1123. FROM dbo._InfoRg11715 T105
  1124. WHERE ((T105._Fld595 = ?)) AND ((T105._Fld12199RRef = T100._IDRRef) AND T105._Fld12200_TYPE = CASE WHEN T98._Fld12836RRef IS NOT NULL THEN 0x08 END AND T105._Fld12200_RTRef = CASE WHEN T98._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T105._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T97._Fld595 = ?)) T96
  1125. ON T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000E9 AND T95._Q_001_F_002_RRRef = T96.IDRRef
  1126. LEFT OUTER JOIN (SELECT
  1127. T107._IDRRef AS IDRRef,
  1128. T107._Fld12836RRef AS Fld12836RRef,
  1129. T107._Fld595 AS Fld595_,
  1130. T107._Folder AS Folder_,
  1131. T107._Description COLLATE Latin1_General_CI_AS AS Description_
  1132. FROM dbo._Reference42 T107
  1133. WHERE ((((T107._Folder = 0x00) OR EXISTS(SELECT
  1134. 0x01 AS Q_001_F_000_
  1135. FROM dbo._Reference98 T108
  1136. INNER JOIN dbo._Reference21 T109
  1137. ON (((T108._Fld1685 = ?) AND EXISTS(SELECT
  1138. 0x01 AS Q_004_F_000_
  1139. FROM dbo._InfoRg11709 T110
  1140. WHERE ((T110._Fld595 = ?)) AND ((T110._Fld12065RRef = T108._IDRRef) AND (T110._Fld12066RRef = T109._IDRRef)))) AND T109._IDRRef IN
  1141. (SELECT
  1142. T111._Reference21_IDRRef AS Q_005_F_000RRef
  1143. FROM dbo._Reference21_VT782 T111
  1144. INNER JOIN dbo._InfoRg9937 T112
  1145. ON ((T112._Fld9939_TYPE = 0x08 AND T112._Fld9939_RTRef = 0x00000095 AND T112._Fld9939_RRRef = ?) AND (T112._Fld9938_TYPE = T111._Fld784_TYPE AND T112._Fld9938_RTRef = T111._Fld784_RTRef AND T112._Fld9938_RRRef = T111._Fld784_RRRef))
  1146. WHERE ((T111._Fld595 = ?)) AND (T112._Fld595 = ?)))
  1147. WHERE ((T109._Fld595 = ?)) AND ((CASE WHEN T107._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T107._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  1148. 0x01 AS Q_002_F_000_
  1149. FROM dbo._InfoRg11710 T113
  1150. WHERE ((T113._Fld595 = ?)) AND ((T113._Fld12072RRef = T109._IDRRef) AND (T113._Fld12073_TYPE = CASE WHEN T107._Fld12836RRef IS NOT NULL THEN 0x08 END AND T113._Fld12073_RTRef = CASE WHEN T107._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T113._Fld12073_RRRef = T107._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  1151. 0x01 AS Q_003_F_000_
  1152. FROM dbo._InfoRg11715 T114
  1153. WHERE ((T114._Fld595 = ?)) AND ((T114._Fld12199RRef = T109._IDRRef) AND T114._Fld12200_TYPE = CASE WHEN T107._Fld12836RRef IS NOT NULL THEN 0x08 END AND T114._Fld12200_RTRef = CASE WHEN T107._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T114._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T107._Fld595 = ?)) T106
  1154. ON T95._Q_001_F_000RRef = T106.IDRRef
  1155. LEFT OUTER JOIN dbo._Reference64 T115
  1156. ON (CASE WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000E9 THEN T96.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END = T115._IDRRef) AND (T115._Fld595 = ?)
  1157. LEFT OUTER JOIN dbo._Reference64 T116
  1158. ON (T96.Fld12737RRef = T116._IDRRef) AND (T116._Fld595 = ?)
  1159. LEFT OUTER JOIN dbo._Document212 T117
  1160. ON (T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000D4 AND T95._Q_001_F_002_RRRef = T117._IDRRef) AND (T117._Fld595 = ?)
  1161. LEFT OUTER JOIN (SELECT
  1162. T119._IDRRef AS IDRRef,
  1163. T119._Fld4779RRef AS Fld4779RRef,
  1164. T119._Fld595 AS Fld595_,
  1165. T119._Fld4798RRef AS Fld4798RRef,
  1166. T119._Fld4774RRef AS Fld4774RRef
  1167. FROM dbo._Document234 T119
  1168. WHERE ((EXISTS(SELECT
  1169. 1
  1170. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  1171. LEFT OUTER JOIN dbo._Reference42 T120
  1172. ON ((T119._Fld4774RRef = T120._IDRRef)) AND (T120._Fld595 = ?)
  1173. WHERE EXISTS(SELECT
  1174. 0x01 AS Q_001_F_000_
  1175. FROM dbo._Reference98 T121
  1176. INNER JOIN dbo._Reference21 T122
  1177. ON (((T121._Fld1685 = ?) AND EXISTS(SELECT
  1178. 0x01 AS Q_006_F_000_
  1179. FROM dbo._InfoRg11709 T123
  1180. WHERE ((T123._Fld595 = ?)) AND ((T123._Fld12065RRef = T121._IDRRef) AND (T123._Fld12066RRef = T122._IDRRef)))) AND T122._IDRRef IN
  1181. (SELECT
  1182. T124._Reference21_IDRRef AS Q_007_F_000RRef
  1183. FROM dbo._Reference21_VT782 T124
  1184. INNER JOIN dbo._InfoRg9937 T125
  1185. ON ((T125._Fld9939_TYPE = 0x08 AND T125._Fld9939_RTRef = 0x00000095 AND T125._Fld9939_RRRef = ?) AND (T125._Fld9938_TYPE = T124._Fld784_TYPE AND T125._Fld9938_RTRef = T124._Fld784_RTRef AND T125._Fld9938_RRRef = T124._Fld784_RRRef))
  1186. WHERE ((T124._Fld595 = ?)) AND (T125._Fld595 = ?)))
  1187. WHERE ((T122._Fld595 = ?)) AND ((0x08 <> 0x01) AND (CASE WHEN EXISTS(SELECT
  1188. 0x01 AS Q_002_F_000_
  1189. FROM dbo._InfoRg11710 T126
  1190. WHERE ((T126._Fld595 = ?)) AND ((T126._Fld12072RRef = T122._IDRRef) AND (T126._Fld12073_TYPE = 0x08 AND T126._Fld12073_RTRef = 0x0000001C AND T126._Fld12073_RRRef = T119._Fld4779RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  1191. 0x01 AS Q_003_F_000_
  1192. FROM dbo._InfoRg11715 T127
  1193. WHERE ((T127._Fld595 = ?)) AND ((T127._Fld12199RRef = T122._IDRRef) AND T127._Fld12200_TYPE = 0x08 AND T127._Fld12200_RTRef = 0x0000001C AND (T127._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END) AND (CASE WHEN T120._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T120._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  1194. 0x01 AS Q_004_F_000_
  1195. FROM dbo._InfoRg11710 T128
  1196. WHERE ((T128._Fld595 = ?)) AND ((T128._Fld12072RRef = T122._IDRRef) AND (T128._Fld12073_TYPE = CASE WHEN T120._Fld12836RRef IS NOT NULL THEN 0x08 END AND T128._Fld12073_RTRef = CASE WHEN T120._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T128._Fld12073_RRRef = T120._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  1197. 0x01 AS Q_005_F_000_
  1198. FROM dbo._InfoRg11715 T129
  1199. WHERE ((T129._Fld595 = ?)) AND ((T129._Fld12199RRef = T122._IDRRef) AND T129._Fld12200_TYPE = CASE WHEN T120._Fld12836RRef IS NOT NULL THEN 0x08 END AND T129._Fld12200_RTRef = CASE WHEN T120._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T129._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T119._Fld595 = ?)) T118
  1200. ON T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000EA AND T95._Q_001_F_002_RRRef = T118.IDRRef
  1201. LEFT OUTER JOIN dbo._Document263 T130
  1202. ON (T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x00000107 AND T95._Q_001_F_002_RRRef = T130._IDRRef) AND (T130._Fld595 = ?)
  1203. LEFT OUTER JOIN (SELECT
  1204. T132._IDRRef AS IDRRef,
  1205. T132._Fld3845RRef AS Fld3845RRef,
  1206. T132._Fld3877RRef AS Fld3877RRef,
  1207. T132._Fld595 AS Fld595_
  1208. FROM dbo._Document216 T132
  1209. WHERE ((EXISTS(SELECT
  1210. 1
  1211. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  1212. LEFT OUTER JOIN dbo._Reference42 T133
  1213. ON ((T132._Fld3845RRef = T133._IDRRef)) AND (T133._Fld595 = ?)
  1214. WHERE EXISTS(SELECT
  1215. 0x01 AS Q_001_F_000_
  1216. FROM dbo._Reference98 T134
  1217. INNER JOIN dbo._Reference21 T135
  1218. ON (((T134._Fld1685 = ?) AND EXISTS(SELECT
  1219. 0x01 AS Q_004_F_000_
  1220. FROM dbo._InfoRg11709 T136
  1221. WHERE ((T136._Fld595 = ?)) AND ((T136._Fld12065RRef = T134._IDRRef) AND (T136._Fld12066RRef = T135._IDRRef)))) AND T135._IDRRef IN
  1222. (SELECT
  1223. T137._Reference21_IDRRef AS Q_005_F_000RRef
  1224. FROM dbo._Reference21_VT782 T137
  1225. INNER JOIN dbo._InfoRg9937 T138
  1226. ON ((T138._Fld9939_TYPE = 0x08 AND T138._Fld9939_RTRef = 0x00000095 AND T138._Fld9939_RRRef = ?) AND (T138._Fld9938_TYPE = T137._Fld784_TYPE AND T138._Fld9938_RTRef = T137._Fld784_RTRef AND T138._Fld9938_RRRef = T137._Fld784_RRRef))
  1227. WHERE ((T137._Fld595 = ?)) AND (T138._Fld595 = ?)))
  1228. WHERE ((T135._Fld595 = ?)) AND ((CASE WHEN T133._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T133._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  1229. 0x01 AS Q_002_F_000_
  1230. FROM dbo._InfoRg11710 T139
  1231. WHERE ((T139._Fld595 = ?)) AND ((T139._Fld12072RRef = T135._IDRRef) AND (T139._Fld12073_TYPE = CASE WHEN T133._Fld12836RRef IS NOT NULL THEN 0x08 END AND T139._Fld12073_RTRef = CASE WHEN T133._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T139._Fld12073_RRRef = T133._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  1232. 0x01 AS Q_003_F_000_
  1233. FROM dbo._InfoRg11715 T140
  1234. WHERE ((T140._Fld595 = ?)) AND ((T140._Fld12199RRef = T135._IDRRef) AND T140._Fld12200_TYPE = CASE WHEN T133._Fld12836RRef IS NOT NULL THEN 0x08 END AND T140._Fld12200_RTRef = CASE WHEN T133._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T140._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T132._Fld595 = ?)) T131
  1235. ON T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000D8 AND T95._Q_001_F_002_RRRef = T131.IDRRef
  1236. LEFT OUTER JOIN (SELECT
  1237. T142._Fld595 AS Fld595_,
  1238. T142._Fld3752RRef AS Fld3752RRef,
  1239. T142._IDRRef AS IDRRef,
  1240. T142._Fld3734RRef AS Fld3734RRef
  1241. FROM dbo._Document215 T142
  1242. WHERE ((EXISTS(SELECT
  1243. 1
  1244. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  1245. LEFT OUTER JOIN dbo._Reference42 T143
  1246. ON ((T142._Fld3734RRef = T143._IDRRef)) AND (T143._Fld595 = ?)
  1247. WHERE EXISTS(SELECT
  1248. 0x01 AS Q_001_F_000_
  1249. FROM dbo._Reference98 T144
  1250. INNER JOIN dbo._Reference21 T145
  1251. ON (((T144._Fld1685 = ?) AND EXISTS(SELECT
  1252. 0x01 AS Q_004_F_000_
  1253. FROM dbo._InfoRg11709 T146
  1254. WHERE ((T146._Fld595 = ?)) AND ((T146._Fld12065RRef = T144._IDRRef) AND (T146._Fld12066RRef = T145._IDRRef)))) AND T145._IDRRef IN
  1255. (SELECT
  1256. T147._Reference21_IDRRef AS Q_005_F_000RRef
  1257. FROM dbo._Reference21_VT782 T147
  1258. INNER JOIN dbo._InfoRg9937 T148
  1259. ON ((T148._Fld9939_TYPE = 0x08 AND T148._Fld9939_RTRef = 0x00000095 AND T148._Fld9939_RRRef = ?) AND (T148._Fld9938_TYPE = T147._Fld784_TYPE AND T148._Fld9938_RTRef = T147._Fld784_RTRef AND T148._Fld9938_RRRef = T147._Fld784_RRRef))
  1260. WHERE ((T147._Fld595 = ?)) AND (T148._Fld595 = ?)))
  1261. WHERE ((T145._Fld595 = ?)) AND ((CASE WHEN T143._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T143._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  1262. 0x01 AS Q_002_F_000_
  1263. FROM dbo._InfoRg11710 T149
  1264. WHERE ((T149._Fld595 = ?)) AND ((T149._Fld12072RRef = T145._IDRRef) AND (T149._Fld12073_TYPE = CASE WHEN T143._Fld12836RRef IS NOT NULL THEN 0x08 END AND T149._Fld12073_RTRef = CASE WHEN T143._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T149._Fld12073_RRRef = T143._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  1265. 0x01 AS Q_003_F_000_
  1266. FROM dbo._InfoRg11715 T150
  1267. WHERE ((T150._Fld595 = ?)) AND ((T150._Fld12199RRef = T145._IDRRef) AND T150._Fld12200_TYPE = CASE WHEN T143._Fld12836RRef IS NOT NULL THEN 0x08 END AND T150._Fld12200_RTRef = CASE WHEN T143._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T150._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T142._Fld595 = ?)) T141
  1268. ON T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000D7 AND T95._Q_001_F_002_RRRef = T141.IDRRef
  1269. WHERE CASE WHEN (? = ?) THEN CASE WHEN ((CASE WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000E9 THEN T96.Fld4654RRef WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000D4 THEN T117._Fld3528RRef WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000EA THEN T118.Fld4798RRef WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x00000107 THEN T130._Fld6301RRef WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000D8 THEN T131.Fld3877RRef WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000D7 THEN T141.Fld3752RRef ELSE CAST(NULL AS BINARY(16)) END = ?) OR (CASE WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000E9 THEN T96.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END = ?)) THEN 0x01 WHEN NOT ((CASE WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000E9 THEN T96.Fld4654RRef WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000D4 THEN T117._Fld3528RRef WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000EA THEN T118.Fld4798RRef WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x00000107 THEN T130._Fld6301RRef WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000D8 THEN T131.Fld3877RRef WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000D7 THEN T141.Fld3752RRef ELSE CAST(NULL AS BINARY(16)) END = ?) OR (CASE WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000E9 THEN T96.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END = ?)) THEN 0x00 END END = 0x01
  1270. GROUP BY T95._Q_001_F_000RRef,
  1271. CASE WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000E9 THEN T96.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END,
  1272. CASE WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000E9 THEN T116._Description ELSE CAST(NULL AS NVARCHAR(100)) END,
  1273. T95._Q_001_F_000RRef,
  1274. T106.Description_,
  1275. T106.Description_,
  1276. CASE WHEN T95._Q_001_F_002_TYPE = 0x08 AND T95._Q_001_F_002_RTRef = 0x000000E9 THEN T96.Fld12737RRef ELSE CAST(NULL AS BINARY(16)) END,
  1277. T115._Description
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement