Advertisement
bytecoded

Top Queries by Duration (Result)

Mar 20th, 2019
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 53.56 KB | None | 0 0
  1. 661643688=Duration,206=Execs,Usr=55QUS,Sql="SELECT TOP 25
  2. T39._IDRRef,
  3. T39._Marked,
  4. T39._Number,
  5. T39._Date_Time,
  6. T39._Posted,
  7. T39._Fld4621RRef,
  8. T39._Fld4622RRef,
  9. T39._Fld4625RRef,
  10. T39._Fld4633,
  11. T39._Fld4635RRef,
  12. T39._Fld4657RRef,
  13. CASE WHEN ((T39._Fld4657RRef = ?) AND T39._Posted = 0x01) THEN CASE WHEN (ISNULL(CAST(T52.Fld10346Balance_ AS NUMERIC(33, 2)),0.0) > 0.0) THEN CASE WHEN (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 4.0 WHEN ((ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 6.0 ELSE 5.0 END ELSE CASE WHEN (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 0.0 WHEN ((ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 2.0 ELSE 1.0 END END ELSE 7.0 END,
  14. T57._Fld12313RRef,
  15. CASE WHEN ((ISNULL(CAST(T58.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) > 0.0) THEN (ISNULL(CAST(T58.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) ELSE 0.0 END,
  16. T68._Fld1191
  17. FROM dbo._Document233 T39
  18. LEFT OUTER JOIN (SELECT
  19. T41._Fld11328RRef AS Fld11328RRef,
  20. CAST(SUM(T41._Fld11330) AS NUMERIC(33, 8)) AS Fld11330Turnover_
  21. FROM dbo._AccumRgTn11332 T41
  22. WHERE ((T41._Fld595 = ?)) AND ((T41._Fld11330 <> ?))
  23. GROUP BY T41._Fld11328RRef
  24. HAVING (CAST(SUM(T41._Fld11330) AS NUMERIC(33, 8))) <> 0.0) T40
  25. ON (T39._IDRRef = T40.Fld11328RRef)
  26. LEFT OUTER JOIN (SELECT
  27. T43._Fld10540_TYPE AS Fld10540_TYPE,
  28. T43._Fld10540_RTRef AS Fld10540_RTRef,
  29. T43._Fld10540_RRRef AS Fld10540_RRRef,
  30. CAST(SUM(T43._Fld10545) AS NUMERIC(33, 8)) AS Fld10545Balance_
  31. FROM dbo._AccumRgT10549 T43
  32. WHERE (((T43._Fld595 = ?)) AND (EXISTS(SELECT
  33. 1
  34. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  35. LEFT OUTER JOIN dbo._Reference42 T44
  36. ON ((T43._Fld10538RRef = T44._IDRRef)) AND (T44._Fld595 = ?)
  37. WHERE EXISTS(SELECT
  38. 0x01 AS Q_001_F_000_
  39. FROM dbo._Reference98 T45
  40. INNER JOIN dbo._Reference21 T46
  41. ON (((T45._Fld1685 = ?) AND EXISTS(SELECT
  42. 0x01 AS Q_004_F_000_
  43. FROM dbo._InfoRg11709 T47
  44. WHERE ((T47._Fld595 = ?)) AND ((T47._Fld12065RRef = T45._IDRRef) AND (T47._Fld12066RRef = T46._IDRRef)))) AND T46._IDRRef IN
  45. (SELECT
  46. T48._Reference21_IDRRef AS Q_005_F_000RRef
  47. FROM dbo._Reference21_VT782 T48
  48. INNER JOIN dbo._InfoRg9937 T49
  49. ON ((T49._Fld9939_TYPE = 0x08 AND T49._Fld9939_RTRef = 0x00000095 AND T49._Fld9939_RRRef = ?) AND (T49._Fld9938_TYPE = T48._Fld784_TYPE AND T49._Fld9938_RTRef = T48._Fld784_RTRef AND T49._Fld9938_RRRef = T48._Fld784_RRRef))
  50. WHERE ((T48._Fld595 = ?)) AND (T49._Fld595 = ?)))
  51. WHERE ((T46._Fld595 = ?)) AND ((CASE WHEN T44._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  52. 0x01 AS Q_002_F_000_
  53. FROM dbo._InfoRg11710 T50
  54. WHERE ((T50._Fld595 = ?)) AND ((T50._Fld12072RRef = T46._IDRRef) AND (T50._Fld12073_TYPE = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END AND T50._Fld12073_RTRef = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T50._Fld12073_RRRef = T44._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  55. 0x01 AS Q_003_F_000_
  56. FROM dbo._InfoRg11715 T51
  57. WHERE ((T51._Fld595 = ?)) AND ((T51._Fld12199RRef = T46._IDRRef) AND T51._Fld12200_TYPE = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END AND T51._Fld12200_RTRef = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T51._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T43._Period = ? AND (T43._Fld10545 <> ?) AND (T43._Fld10545 <> ?))
  58. GROUP BY T43._Fld10540_TYPE,
  59. T43._Fld10540_RTRef,
  60. T43._Fld10540_RRRef
  61. HAVING (CAST(SUM(T43._Fld10545) AS NUMERIC(33, 8))) <> 0.0) T42
  62. ON (0x08 = T42.Fld10540_TYPE AND 0x000000E9 = T42.Fld10540_RTRef AND T39._IDRRef = T42.Fld10540_RRRef)
  63. LEFT OUTER JOIN (SELECT
  64. T53.Fld10344RRef AS Fld10344RRef,
  65. CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8)) AS Fld10346Balance_
  66. FROM (SELECT
  67. T54._Fld10344RRef AS Fld10344RRef,
  68. CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8)) AS Fld10346Balance_
  69. FROM dbo._AccumRgT10349 T54
  70. WHERE ((T54._Fld595 = ?)) AND (T54._Period = ? AND (T54._Fld10346 <> ?) AND (T54._Fld10346 <> ?))
  71. GROUP BY T54._Fld10344RRef
  72. HAVING (CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8))) <> 0.0
  73. UNION ALL SELECT
  74. T55._Fld10344RRef AS Fld10344RRef,
  75. CAST(CAST(SUM(CASE WHEN T55._RecordKind = 0.0 THEN -T55._Fld10346 ELSE T55._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2)) AS Fld10346Balance_
  76. FROM dbo._AccumRg10339 T55
  77. WHERE ((T55._Fld595 = ?)) AND (T55._Period >= ? AND T55._Period < ? AND T55._Active = 0x01)
  78. GROUP BY T55._Fld10344RRef
  79. HAVING (CAST(CAST(SUM(CASE WHEN T55._RecordKind = 0.0 THEN -T55._Fld10346 ELSE T55._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2))) <> 0.0) T53
  80. GROUP BY T53.Fld10344RRef
  81. HAVING (CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8))) <> 0.0) T52
  82. ON (T39._IDRRef = T52.Fld10344RRef)
  83. LEFT OUTER JOIN dbo._InfoRg9134 T56
  84. ON ((0x08 = T56._Fld9136_TYPE AND 0x000000E9 = T56._Fld9136_RTRef AND T39._IDRRef = T56._Fld9136_RRRef)) AND (T56._Fld595 = ?)
  85. LEFT OUTER JOIN dbo._InfoRg11720 T57
  86. ON ((0x08 = T57._Fld12312_TYPE AND 0x000000E9 = T57._Fld12312_RTRef AND T39._IDRRef = T57._Fld12312_RRRef)) AND (T57._Fld595 = ?)
  87. LEFT OUTER JOIN (SELECT
  88. T59._Fld10332_TYPE AS Fld10332_TYPE,
  89. T59._Fld10332_RTRef AS Fld10332_RTRef,
  90. T59._Fld10332_RRRef AS Fld10332_RRRef,
  91. CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8)) AS Fld10335Balance_
  92. FROM dbo._AccumRgT10337 T59
  93. WHERE (((T59._Fld595 = ?)) AND (EXISTS(SELECT
  94. 1
  95. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  96. LEFT OUTER JOIN dbo._Reference42 T60
  97. ON ((T59._Fld10330RRef = T60._IDRRef)) AND (T60._Fld595 = ?)
  98. WHERE EXISTS(SELECT
  99. 0x01 AS Q_001_F_000_
  100. FROM dbo._Reference98 T61
  101. INNER JOIN dbo._Reference21 T62
  102. ON (((T61._Fld1685 = ?) AND EXISTS(SELECT
  103. 0x01 AS Q_004_F_000_
  104. FROM dbo._InfoRg11709 T63
  105. WHERE ((T63._Fld595 = ?)) AND ((T63._Fld12065RRef = T61._IDRRef) AND (T63._Fld12066RRef = T62._IDRRef)))) AND T62._IDRRef IN
  106. (SELECT
  107. T64._Reference21_IDRRef AS Q_005_F_000RRef
  108. FROM dbo._Reference21_VT782 T64
  109. INNER JOIN dbo._InfoRg9937 T65
  110. ON ((T65._Fld9939_TYPE = 0x08 AND T65._Fld9939_RTRef = 0x00000095 AND T65._Fld9939_RRRef = ?) AND (T65._Fld9938_TYPE = T64._Fld784_TYPE AND T65._Fld9938_RTRef = T64._Fld784_RTRef AND T65._Fld9938_RRRef = T64._Fld784_RRRef))
  111. WHERE ((T64._Fld595 = ?)) AND (T65._Fld595 = ?)))
  112. WHERE ((T62._Fld595 = ?)) AND ((CASE WHEN T60._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  113. 0x01 AS Q_002_F_000_
  114. FROM dbo._InfoRg11710 T66
  115. WHERE ((T66._Fld595 = ?)) AND ((T66._Fld12072RRef = T62._IDRRef) AND (T66._Fld12073_TYPE = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x08 END AND T66._Fld12073_RTRef = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T66._Fld12073_RRRef = T60._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  116. 0x01 AS Q_003_F_000_
  117. FROM dbo._InfoRg11715 T67
  118. WHERE ((T67._Fld595 = ?)) AND ((T67._Fld12199RRef = T62._IDRRef) AND T67._Fld12200_TYPE = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x08 END AND T67._Fld12200_RTRef = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T67._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T59._Period = ? AND (T59._Fld10335 <> ?) AND (T59._Fld10335 <> ?))
  119. GROUP BY T59._Fld10332_TYPE,
  120. T59._Fld10332_RTRef,
  121. T59._Fld10332_RRRef
  122. HAVING (CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8))) <> 0.0) T58
  123. ON (0x08 = T58.Fld10332_TYPE AND 0x000000E9 = T58.Fld10332_RTRef AND T39._IDRRef = T58.Fld10332_RRRef)
  124. LEFT OUTER JOIN dbo._Reference51 T68
  125. ON (T39._Fld4635RRef = T68._IDRRef) AND (T68._Fld595 = ?)
  126. WHERE (((((T39._Fld595 = ?) AND (EXISTS(SELECT
  127. 1
  128. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  129. LEFT OUTER JOIN dbo._Reference42 T69
  130. ON ((T39._Fld4625RRef = T69._IDRRef)) AND (T69._Fld595 = ?)
  131. WHERE EXISTS(SELECT
  132. 0x01 AS Q_001_F_000_
  133. FROM dbo._Reference98 T70
  134. INNER JOIN dbo._Reference21 T71
  135. ON (((T70._Fld1685 = ?) AND EXISTS(SELECT
  136. 0x01 AS Q_004_F_000_
  137. FROM dbo._InfoRg11709 T72
  138. WHERE ((T72._Fld595 = ?)) AND ((T72._Fld12065RRef = T70._IDRRef) AND (T72._Fld12066RRef = T71._IDRRef)))) AND T71._IDRRef IN
  139. (SELECT
  140. T73._Reference21_IDRRef AS Q_005_F_000RRef
  141. FROM dbo._Reference21_VT782 T73
  142. INNER JOIN dbo._InfoRg9937 T74
  143. ON ((T74._Fld9939_TYPE = 0x08 AND T74._Fld9939_RTRef = 0x00000095 AND T74._Fld9939_RRRef = ?) AND (T74._Fld9938_TYPE = T73._Fld784_TYPE AND T74._Fld9938_RTRef = T73._Fld784_RTRef AND T74._Fld9938_RRRef = T73._Fld784_RRRef))
  144. WHERE ((T73._Fld595 = ?)) AND (T74._Fld595 = ?)))
  145. WHERE ((T71._Fld595 = ?)) AND ((CASE WHEN T69._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  146. 0x01 AS Q_002_F_000_
  147. FROM dbo._InfoRg11710 T75
  148. WHERE ((T75._Fld595 = ?)) AND ((T75._Fld12072RRef = T71._IDRRef) AND (T75._Fld12073_TYPE = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x08 END AND T75._Fld12073_RTRef = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T75._Fld12073_RRRef = T69._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  149. 0x01 AS Q_003_F_000_
  150. FROM dbo._InfoRg11715 T76
  151. WHERE ((T76._Fld595 = ?)) AND ((T76._Fld12199RRef = T71._IDRRef) AND T76._Fld12200_TYPE = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x08 END AND T76._Fld12200_RTRef = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T76._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T39._Fld4621RRef = ?)) AND (T39._Date_Time >= ?)) AND (T39._Date_Time <= ?)) AND T39._Number < ?
  152. ORDER BY (T39._Number) DESC, (T39._IDRRef) DESC
  153. OPTION (FAST 1)
  154. ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
  155.  
  156. 284154441=Duration,422=Execs,Usr=44ABD,Sql="SELECT TOP 25
  157. T39._IDRRef,
  158. T39._Marked,
  159. T39._Number,
  160. T39._Date_Time,
  161. T39._Posted,
  162. T39._Fld4621RRef,
  163. T39._Fld4622RRef,
  164. T39._Fld4625RRef,
  165. T39._Fld4633,
  166. T39._Fld4635RRef,
  167. T39._Fld4654RRef,
  168. T39._Fld4657RRef,
  169. CASE WHEN ((T39._Fld4657RRef = ?) AND T39._Posted = 0x01) THEN CASE WHEN (ISNULL(CAST(T52.Fld10346Balance_ AS NUMERIC(33, 2)),0.0) > 0.0) THEN CASE WHEN (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 4.0 WHEN ((ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 6.0 ELSE 5.0 END ELSE CASE WHEN (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 0.0 WHEN ((ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 2.0 ELSE 1.0 END END ELSE 7.0 END,
  170. T57._Fld12313RRef,
  171. CASE WHEN ((ISNULL(CAST(T58.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) > 0.0) THEN (ISNULL(CAST(T58.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) ELSE 0.0 END,
  172. T68._Fld1191
  173. FROM dbo._Document233 T39
  174. LEFT OUTER JOIN (SELECT
  175. T41._Fld11328RRef AS Fld11328RRef,
  176. CAST(SUM(T41._Fld11330) AS NUMERIC(33, 8)) AS Fld11330Turnover_
  177. FROM dbo._AccumRgTn11332 T41
  178. WHERE ((T41._Fld595 = ?)) AND ((T41._Fld11330 <> ?))
  179. GROUP BY T41._Fld11328RRef
  180. HAVING (CAST(SUM(T41._Fld11330) AS NUMERIC(33, 8))) <> 0.0) T40
  181. ON (T39._IDRRef = T40.Fld11328RRef)
  182. LEFT OUTER JOIN (SELECT
  183. T43._Fld10540_TYPE AS Fld10540_TYPE,
  184. T43._Fld10540_RTRef AS Fld10540_RTRef,
  185. T43._Fld10540_RRRef AS Fld10540_RRRef,
  186. CAST(SUM(T43._Fld10545) AS NUMERIC(33, 8)) AS Fld10545Balance_
  187. FROM dbo._AccumRgT10549 T43
  188. WHERE (((T43._Fld595 = ?)) AND (EXISTS(SELECT
  189. 1
  190. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  191. LEFT OUTER JOIN dbo._Reference42 T44
  192. ON ((T43._Fld10538RRef = T44._IDRRef)) AND (T44._Fld595 = ?)
  193. WHERE EXISTS(SELECT
  194. 0x01 AS Q_001_F_000_
  195. FROM dbo._Reference98 T45
  196. INNER JOIN dbo._Reference21 T46
  197. ON (((T45._Fld1685 = ?) AND EXISTS(SELECT
  198. 0x01 AS Q_004_F_000_
  199. FROM dbo._InfoRg11709 T47
  200. WHERE ((T47._Fld595 = ?)) AND ((T47._Fld12065RRef = T45._IDRRef) AND (T47._Fld12066RRef = T46._IDRRef)))) AND T46._IDRRef IN
  201. (SELECT
  202. T48._Reference21_IDRRef AS Q_005_F_000RRef
  203. FROM dbo._Reference21_VT782 T48
  204. INNER JOIN dbo._InfoRg9937 T49
  205. ON ((T49._Fld9939_TYPE = 0x08 AND T49._Fld9939_RTRef = 0x00000095 AND T49._Fld9939_RRRef = ?) AND (T49._Fld9938_TYPE = T48._Fld784_TYPE AND T49._Fld9938_RTRef = T48._Fld784_RTRef AND T49._Fld9938_RRRef = T48._Fld784_RRRef))
  206. WHERE ((T48._Fld595 = ?)) AND (T49._Fld595 = ?)))
  207. WHERE ((T46._Fld595 = ?)) AND ((CASE WHEN T44._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  208. 0x01 AS Q_002_F_000_
  209. FROM dbo._InfoRg11710 T50
  210. WHERE ((T50._Fld595 = ?)) AND ((T50._Fld12072RRef = T46._IDRRef) AND (T50._Fld12073_TYPE = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END AND T50._Fld12073_RTRef = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T50._Fld12073_RRRef = T44._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  211. 0x01 AS Q_003_F_000_
  212. FROM dbo._InfoRg11715 T51
  213. WHERE ((T51._Fld595 = ?)) AND ((T51._Fld12199RRef = T46._IDRRef) AND T51._Fld12200_TYPE = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END AND T51._Fld12200_RTRef = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T51._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T43._Period = ? AND (T43._Fld10545 <> ?) AND (T43._Fld10545 <> ?))
  214. GROUP BY T43._Fld10540_TYPE,
  215. T43._Fld10540_RTRef,
  216. T43._Fld10540_RRRef
  217. HAVING (CAST(SUM(T43._Fld10545) AS NUMERIC(33, 8))) <> 0.0) T42
  218. ON (0x08 = T42.Fld10540_TYPE AND 0x000000E9 = T42.Fld10540_RTRef AND T39._IDRRef = T42.Fld10540_RRRef)
  219. LEFT OUTER JOIN (SELECT
  220. T53.Fld10344RRef AS Fld10344RRef,
  221. CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8)) AS Fld10346Balance_
  222. FROM (SELECT
  223. T54._Fld10344RRef AS Fld10344RRef,
  224. CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8)) AS Fld10346Balance_
  225. FROM dbo._AccumRgT10349 T54
  226. WHERE ((T54._Fld595 = ?)) AND (T54._Period = ? AND (T54._Fld10346 <> ?) AND (T54._Fld10346 <> ?))
  227. GROUP BY T54._Fld10344RRef
  228. HAVING (CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8))) <> 0.0
  229. UNION ALL SELECT
  230. T55._Fld10344RRef AS Fld10344RRef,
  231. CAST(CAST(SUM(CASE WHEN T55._RecordKind = 0.0 THEN -T55._Fld10346 ELSE T55._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2)) AS Fld10346Balance_
  232. FROM dbo._AccumRg10339 T55
  233. WHERE ((T55._Fld595 = ?)) AND (T55._Period >= ? AND T55._Period < ? AND T55._Active = 0x01)
  234. GROUP BY T55._Fld10344RRef
  235. HAVING (CAST(CAST(SUM(CASE WHEN T55._RecordKind = 0.0 THEN -T55._Fld10346 ELSE T55._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2))) <> 0.0) T53
  236. GROUP BY T53.Fld10344RRef
  237. HAVING (CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8))) <> 0.0) T52
  238. ON (T39._IDRRef = T52.Fld10344RRef)
  239. LEFT OUTER JOIN dbo._InfoRg9134 T56
  240. ON ((0x08 = T56._Fld9136_TYPE AND 0x000000E9 = T56._Fld9136_RTRef AND T39._IDRRef = T56._Fld9136_RRRef)) AND (T56._Fld595 = ?)
  241. LEFT OUTER JOIN dbo._InfoRg11720 T57
  242. ON ((0x08 = T57._Fld12312_TYPE AND 0x000000E9 = T57._Fld12312_RTRef AND T39._IDRRef = T57._Fld12312_RRRef)) AND (T57._Fld595 = ?)
  243. LEFT OUTER JOIN (SELECT
  244. T59._Fld10332_TYPE AS Fld10332_TYPE,
  245. T59._Fld10332_RTRef AS Fld10332_RTRef,
  246. T59._Fld10332_RRRef AS Fld10332_RRRef,
  247. CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8)) AS Fld10335Balance_
  248. FROM dbo._AccumRgT10337 T59
  249. WHERE (((T59._Fld595 = ?)) AND (EXISTS(SELECT
  250. 1
  251. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  252. LEFT OUTER JOIN dbo._Reference42 T60
  253. ON ((T59._Fld10330RRef = T60._IDRRef)) AND (T60._Fld595 = ?)
  254. WHERE EXISTS(SELECT
  255. 0x01 AS Q_001_F_000_
  256. FROM dbo._Reference98 T61
  257. INNER JOIN dbo._Reference21 T62
  258. ON (((T61._Fld1685 = ?) AND EXISTS(SELECT
  259. 0x01 AS Q_004_F_000_
  260. FROM dbo._InfoRg11709 T63
  261. WHERE ((T63._Fld595 = ?)) AND ((T63._Fld12065RRef = T61._IDRRef) AND (T63._Fld12066RRef = T62._IDRRef)))) AND T62._IDRRef IN
  262. (SELECT
  263. T64._Reference21_IDRRef AS Q_005_F_000RRef
  264. FROM dbo._Reference21_VT782 T64
  265. INNER JOIN dbo._InfoRg9937 T65
  266. ON ((T65._Fld9939_TYPE = 0x08 AND T65._Fld9939_RTRef = 0x00000095 AND T65._Fld9939_RRRef = ?) AND (T65._Fld9938_TYPE = T64._Fld784_TYPE AND T65._Fld9938_RTRef = T64._Fld784_RTRef AND T65._Fld9938_RRRef = T64._Fld784_RRRef))
  267. WHERE ((T64._Fld595 = ?)) AND (T65._Fld595 = ?)))
  268. WHERE ((T62._Fld595 = ?)) AND ((CASE WHEN T60._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  269. 0x01 AS Q_002_F_000_
  270. FROM dbo._InfoRg11710 T66
  271. WHERE ((T66._Fld595 = ?)) AND ((T66._Fld12072RRef = T62._IDRRef) AND (T66._Fld12073_TYPE = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x08 END AND T66._Fld12073_RTRef = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T66._Fld12073_RRRef = T60._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  272. 0x01 AS Q_003_F_000_
  273. FROM dbo._InfoRg11715 T67
  274. WHERE ((T67._Fld595 = ?)) AND ((T67._Fld12199RRef = T62._IDRRef) AND T67._Fld12200_TYPE = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x08 END AND T67._Fld12200_RTRef = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T67._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T59._Period = ? AND (T59._Fld10335 <> ?) AND (T59._Fld10335 <> ?))
  275. GROUP BY T59._Fld10332_TYPE,
  276. T59._Fld10332_RTRef,
  277. T59._Fld10332_RRRef
  278. HAVING (CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8))) <> 0.0) T58
  279. ON (0x08 = T58.Fld10332_TYPE AND 0x000000E9 = T58.Fld10332_RTRef AND T39._IDRRef = T58.Fld10332_RRRef)
  280. LEFT OUTER JOIN dbo._Reference51 T68
  281. ON (T39._Fld4635RRef = T68._IDRRef) AND (T68._Fld595 = ?)
  282. WHERE ((((T39._Fld595 = ?) AND (EXISTS(SELECT
  283. 1
  284. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  285. LEFT OUTER JOIN dbo._Reference42 T69
  286. ON ((T39._Fld4625RRef = T69._IDRRef)) AND (T69._Fld595 = ?)
  287. WHERE EXISTS(SELECT
  288. 0x01 AS Q_001_F_000_
  289. FROM dbo._Reference98 T70
  290. INNER JOIN dbo._Reference21 T71
  291. ON (((T70._Fld1685 = ?) AND EXISTS(SELECT
  292. 0x01 AS Q_004_F_000_
  293. FROM dbo._InfoRg11709 T72
  294. WHERE ((T72._Fld595 = ?)) AND ((T72._Fld12065RRef = T70._IDRRef) AND (T72._Fld12066RRef = T71._IDRRef)))) AND T71._IDRRef IN
  295. (SELECT
  296. T73._Reference21_IDRRef AS Q_005_F_000RRef
  297. FROM dbo._Reference21_VT782 T73
  298. INNER JOIN dbo._InfoRg9937 T74
  299. ON ((T74._Fld9939_TYPE = 0x08 AND T74._Fld9939_RTRef = 0x00000095 AND T74._Fld9939_RRRef = ?) AND (T74._Fld9938_TYPE = T73._Fld784_TYPE AND T74._Fld9938_RTRef = T73._Fld784_RTRef AND T74._Fld9938_RRRef = T73._Fld784_RRRef))
  300. WHERE ((T73._Fld595 = ?)) AND (T74._Fld595 = ?)))
  301. WHERE ((T71._Fld595 = ?)) AND ((CASE WHEN T69._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  302. 0x01 AS Q_002_F_000_
  303. FROM dbo._InfoRg11710 T75
  304. WHERE ((T75._Fld595 = ?)) AND ((T75._Fld12072RRef = T71._IDRRef) AND (T75._Fld12073_TYPE = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x08 END AND T75._Fld12073_RTRef = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T75._Fld12073_RRRef = T69._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  305. 0x01 AS Q_003_F_000_
  306. FROM dbo._InfoRg11715 T76
  307. WHERE ((T76._Fld595 = ?)) AND ((T76._Fld12199RRef = T71._IDRRef) AND T76._Fld12200_TYPE = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x08 END AND T76._Fld12200_RTRef = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T76._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T39._Fld4621RRef = ?)) AND (T39._Marked = 0x00)) AND T39._Date_Time < ?
  308. ORDER BY (T39._Date_Time) DESC, (T39._IDRRef) DESC
  309. OPTION (FAST 1)
  310. ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
  311.  
  312. 159787884=Duration,293=Execs,Usr=22RAK,Sql="SELECT TOP 25
  313. T39._IDRRef,
  314. T39._Marked,
  315. T39._Number,
  316. T39._Date_Time,
  317. T39._Posted,
  318. T39._Fld4621RRef,
  319. T39._Fld4622RRef,
  320. T39._Fld4625RRef,
  321. T39._Fld4633,
  322. T39._Fld4635RRef,
  323. T39._Fld4657RRef,
  324. CASE WHEN ((T39._Fld4657RRef = ?) AND T39._Posted = 0x01) THEN CASE WHEN (ISNULL(CAST(T52.Fld10346Balance_ AS NUMERIC(33, 2)),0.0) > 0.0) THEN CASE WHEN (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 4.0 WHEN ((ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 6.0 ELSE 5.0 END ELSE CASE WHEN (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 0.0 WHEN ((ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 2.0 ELSE 1.0 END END ELSE 7.0 END,
  325. T57._Fld12313RRef,
  326. CASE WHEN ((ISNULL(CAST(T58.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) > 0.0) THEN (ISNULL(CAST(T58.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) ELSE 0.0 END,
  327. T68._Fld1191
  328. FROM dbo._Document233 T39
  329. LEFT OUTER JOIN (SELECT
  330. T41._Fld11328RRef AS Fld11328RRef,
  331. CAST(SUM(T41._Fld11330) AS NUMERIC(33, 8)) AS Fld11330Turnover_
  332. FROM dbo._AccumRgTn11332 T41
  333. WHERE ((T41._Fld595 = ?)) AND ((T41._Fld11330 <> ?))
  334. GROUP BY T41._Fld11328RRef
  335. HAVING (CAST(SUM(T41._Fld11330) AS NUMERIC(33, 8))) <> 0.0) T40
  336. ON (T39._IDRRef = T40.Fld11328RRef)
  337. LEFT OUTER JOIN (SELECT
  338. T43._Fld10540_TYPE AS Fld10540_TYPE,
  339. T43._Fld10540_RTRef AS Fld10540_RTRef,
  340. T43._Fld10540_RRRef AS Fld10540_RRRef,
  341. CAST(SUM(T43._Fld10545) AS NUMERIC(33, 8)) AS Fld10545Balance_
  342. FROM dbo._AccumRgT10549 T43
  343. WHERE (((T43._Fld595 = ?)) AND (EXISTS(SELECT
  344. 1
  345. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  346. LEFT OUTER JOIN dbo._Reference42 T44
  347. ON ((T43._Fld10538RRef = T44._IDRRef)) AND (T44._Fld595 = ?)
  348. WHERE EXISTS(SELECT
  349. 0x01 AS Q_001_F_000_
  350. FROM dbo._Reference98 T45
  351. INNER JOIN dbo._Reference21 T46
  352. ON (((T45._Fld1685 = ?) AND EXISTS(SELECT
  353. 0x01 AS Q_004_F_000_
  354. FROM dbo._InfoRg11709 T47
  355. WHERE ((T47._Fld595 = ?)) AND ((T47._Fld12065RRef = T45._IDRRef) AND (T47._Fld12066RRef = T46._IDRRef)))) AND T46._IDRRef IN
  356. (SELECT
  357. T48._Reference21_IDRRef AS Q_005_F_000RRef
  358. FROM dbo._Reference21_VT782 T48
  359. INNER JOIN dbo._InfoRg9937 T49
  360. ON ((T49._Fld9939_TYPE = 0x08 AND T49._Fld9939_RTRef = 0x00000095 AND T49._Fld9939_RRRef = ?) AND (T49._Fld9938_TYPE = T48._Fld784_TYPE AND T49._Fld9938_RTRef = T48._Fld784_RTRef AND T49._Fld9938_RRRef = T48._Fld784_RRRef))
  361. WHERE ((T48._Fld595 = ?)) AND (T49._Fld595 = ?)))
  362. WHERE ((T46._Fld595 = ?)) AND ((CASE WHEN T44._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  363. 0x01 AS Q_002_F_000_
  364. FROM dbo._InfoRg11710 T50
  365. WHERE ((T50._Fld595 = ?)) AND ((T50._Fld12072RRef = T46._IDRRef) AND (T50._Fld12073_TYPE = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END AND T50._Fld12073_RTRef = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T50._Fld12073_RRRef = T44._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  366. 0x01 AS Q_003_F_000_
  367. FROM dbo._InfoRg11715 T51
  368. WHERE ((T51._Fld595 = ?)) AND ((T51._Fld12199RRef = T46._IDRRef) AND T51._Fld12200_TYPE = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END AND T51._Fld12200_RTRef = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T51._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T43._Period = ? AND (T43._Fld10545 <> ?) AND (T43._Fld10545 <> ?))
  369. GROUP BY T43._Fld10540_TYPE,
  370. T43._Fld10540_RTRef,
  371. T43._Fld10540_RRRef
  372. HAVING (CAST(SUM(T43._Fld10545) AS NUMERIC(33, 8))) <> 0.0) T42
  373. ON (0x08 = T42.Fld10540_TYPE AND 0x000000E9 = T42.Fld10540_RTRef AND T39._IDRRef = T42.Fld10540_RRRef)
  374. LEFT OUTER JOIN (SELECT
  375. T53.Fld10344RRef AS Fld10344RRef,
  376. CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8)) AS Fld10346Balance_
  377. FROM (SELECT
  378. T54._Fld10344RRef AS Fld10344RRef,
  379. CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8)) AS Fld10346Balance_
  380. FROM dbo._AccumRgT10349 T54
  381. WHERE ((T54._Fld595 = ?)) AND (T54._Period = ? AND (T54._Fld10346 <> ?) AND (T54._Fld10346 <> ?))
  382. GROUP BY T54._Fld10344RRef
  383. HAVING (CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8))) <> 0.0
  384. UNION ALL SELECT
  385. T55._Fld10344RRef AS Fld10344RRef,
  386. CAST(CAST(SUM(CASE WHEN T55._RecordKind = 0.0 THEN -T55._Fld10346 ELSE T55._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2)) AS Fld10346Balance_
  387. FROM dbo._AccumRg10339 T55
  388. WHERE ((T55._Fld595 = ?)) AND (T55._Period >= ? AND T55._Period < ? AND T55._Active = 0x01)
  389. GROUP BY T55._Fld10344RRef
  390. HAVING (CAST(CAST(SUM(CASE WHEN T55._RecordKind = 0.0 THEN -T55._Fld10346 ELSE T55._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2))) <> 0.0) T53
  391. GROUP BY T53.Fld10344RRef
  392. HAVING (CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8))) <> 0.0) T52
  393. ON (T39._IDRRef = T52.Fld10344RRef)
  394. LEFT OUTER JOIN dbo._InfoRg9134 T56
  395. ON ((0x08 = T56._Fld9136_TYPE AND 0x000000E9 = T56._Fld9136_RTRef AND T39._IDRRef = T56._Fld9136_RRRef)) AND (T56._Fld595 = ?)
  396. LEFT OUTER JOIN dbo._InfoRg11720 T57
  397. ON ((0x08 = T57._Fld12312_TYPE AND 0x000000E9 = T57._Fld12312_RTRef AND T39._IDRRef = T57._Fld12312_RRRef)) AND (T57._Fld595 = ?)
  398. LEFT OUTER JOIN (SELECT
  399. T59._Fld10332_TYPE AS Fld10332_TYPE,
  400. T59._Fld10332_RTRef AS Fld10332_RTRef,
  401. T59._Fld10332_RRRef AS Fld10332_RRRef,
  402. CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8)) AS Fld10335Balance_
  403. FROM dbo._AccumRgT10337 T59
  404. WHERE (((T59._Fld595 = ?)) AND (EXISTS(SELECT
  405. 1
  406. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  407. LEFT OUTER JOIN dbo._Reference42 T60
  408. ON ((T59._Fld10330RRef = T60._IDRRef)) AND (T60._Fld595 = ?)
  409. WHERE EXISTS(SELECT
  410. 0x01 AS Q_001_F_000_
  411. FROM dbo._Reference98 T61
  412. INNER JOIN dbo._Reference21 T62
  413. ON (((T61._Fld1685 = ?) AND EXISTS(SELECT
  414. 0x01 AS Q_004_F_000_
  415. FROM dbo._InfoRg11709 T63
  416. WHERE ((T63._Fld595 = ?)) AND ((T63._Fld12065RRef = T61._IDRRef) AND (T63._Fld12066RRef = T62._IDRRef)))) AND T62._IDRRef IN
  417. (SELECT
  418. T64._Reference21_IDRRef AS Q_005_F_000RRef
  419. FROM dbo._Reference21_VT782 T64
  420. INNER JOIN dbo._InfoRg9937 T65
  421. ON ((T65._Fld9939_TYPE = 0x08 AND T65._Fld9939_RTRef = 0x00000095 AND T65._Fld9939_RRRef = ?) AND (T65._Fld9938_TYPE = T64._Fld784_TYPE AND T65._Fld9938_RTRef = T64._Fld784_RTRef AND T65._Fld9938_RRRef = T64._Fld784_RRRef))
  422. WHERE ((T64._Fld595 = ?)) AND (T65._Fld595 = ?)))
  423. WHERE ((T62._Fld595 = ?)) AND ((CASE WHEN T60._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  424. 0x01 AS Q_002_F_000_
  425. FROM dbo._InfoRg11710 T66
  426. WHERE ((T66._Fld595 = ?)) AND ((T66._Fld12072RRef = T62._IDRRef) AND (T66._Fld12073_TYPE = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x08 END AND T66._Fld12073_RTRef = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T66._Fld12073_RRRef = T60._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  427. 0x01 AS Q_003_F_000_
  428. FROM dbo._InfoRg11715 T67
  429. WHERE ((T67._Fld595 = ?)) AND ((T67._Fld12199RRef = T62._IDRRef) AND T67._Fld12200_TYPE = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x08 END AND T67._Fld12200_RTRef = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T67._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T59._Period = ? AND (T59._Fld10335 <> ?) AND (T59._Fld10335 <> ?))
  430. GROUP BY T59._Fld10332_TYPE,
  431. T59._Fld10332_RTRef,
  432. T59._Fld10332_RRRef
  433. HAVING (CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8))) <> 0.0) T58
  434. ON (0x08 = T58.Fld10332_TYPE AND 0x000000E9 = T58.Fld10332_RTRef AND T39._IDRRef = T58.Fld10332_RRRef)
  435. LEFT OUTER JOIN dbo._Reference51 T68
  436. ON (T39._Fld4635RRef = T68._IDRRef) AND (T68._Fld595 = ?)
  437. WHERE (((((T39._Fld595 = ?) AND (EXISTS(SELECT
  438. 1
  439. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  440. LEFT OUTER JOIN dbo._Reference42 T69
  441. ON ((T39._Fld4625RRef = T69._IDRRef)) AND (T69._Fld595 = ?)
  442. WHERE EXISTS(SELECT
  443. 0x01 AS Q_001_F_000_
  444. FROM dbo._Reference98 T70
  445. INNER JOIN dbo._Reference21 T71
  446. ON (((T70._Fld1685 = ?) AND EXISTS(SELECT
  447. 0x01 AS Q_004_F_000_
  448. FROM dbo._InfoRg11709 T72
  449. WHERE ((T72._Fld595 = ?)) AND ((T72._Fld12065RRef = T70._IDRRef) AND (T72._Fld12066RRef = T71._IDRRef)))) AND T71._IDRRef IN
  450. (SELECT
  451. T73._Reference21_IDRRef AS Q_005_F_000RRef
  452. FROM dbo._Reference21_VT782 T73
  453. INNER JOIN dbo._InfoRg9937 T74
  454. ON ((T74._Fld9939_TYPE = 0x08 AND T74._Fld9939_RTRef = 0x00000095 AND T74._Fld9939_RRRef = ?) AND (T74._Fld9938_TYPE = T73._Fld784_TYPE AND T74._Fld9938_RTRef = T73._Fld784_RTRef AND T74._Fld9938_RRRef = T73._Fld784_RRRef))
  455. WHERE ((T73._Fld595 = ?)) AND (T74._Fld595 = ?)))
  456. WHERE ((T71._Fld595 = ?)) AND ((CASE WHEN T69._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  457. 0x01 AS Q_002_F_000_
  458. FROM dbo._InfoRg11710 T75
  459. WHERE ((T75._Fld595 = ?)) AND ((T75._Fld12072RRef = T71._IDRRef) AND (T75._Fld12073_TYPE = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x08 END AND T75._Fld12073_RTRef = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T75._Fld12073_RRRef = T69._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  460. 0x01 AS Q_003_F_000_
  461. FROM dbo._InfoRg11715 T76
  462. WHERE ((T76._Fld595 = ?)) AND ((T76._Fld12199RRef = T71._IDRRef) AND T76._Fld12200_TYPE = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x08 END AND T76._Fld12200_RTRef = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T76._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T39._Fld4621RRef = ?)) AND (T39._Date_Time >= ?)) AND (T39._Date_Time <= ?)) AND T39._Number < ?
  463. ORDER BY (T39._Number) DESC, (T39._IDRRef) DESC
  464. OPTION (FAST 1)
  465. ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
  466.  
  467. 155044730=Duration,420=Execs,Usr=44ABD,Sql="SELECT TOP 25
  468. T39._IDRRef,
  469. T39._Marked,
  470. T39._Number,
  471. T39._Date_Time,
  472. T39._Posted,
  473. T39._Fld4621RRef,
  474. T39._Fld4622RRef,
  475. T39._Fld4625RRef,
  476. T39._Fld4633,
  477. T39._Fld4635RRef,
  478. T39._Fld4654RRef,
  479. T39._Fld4657RRef,
  480. CASE WHEN ((T39._Fld4657RRef = ?) AND T39._Posted = 0x01) THEN CASE WHEN (ISNULL(CAST(T52.Fld10346Balance_ AS NUMERIC(33, 2)),0.0) > 0.0) THEN CASE WHEN (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 4.0 WHEN ((ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 6.0 ELSE 5.0 END ELSE CASE WHEN (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 0.0 WHEN ((ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T40.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 2.0 ELSE 1.0 END END ELSE 7.0 END,
  481. T57._Fld12313RRef,
  482. CASE WHEN ((ISNULL(CAST(T58.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) > 0.0) THEN (ISNULL(CAST(T58.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T42.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) ELSE 0.0 END,
  483. T68._Fld1191
  484. FROM dbo._Document233 T39
  485. LEFT OUTER JOIN (SELECT
  486. T41._Fld11328RRef AS Fld11328RRef,
  487. CAST(SUM(T41._Fld11330) AS NUMERIC(33, 8)) AS Fld11330Turnover_
  488. FROM dbo._AccumRgTn11332 T41
  489. WHERE ((T41._Fld595 = ?)) AND ((T41._Fld11330 <> ?))
  490. GROUP BY T41._Fld11328RRef
  491. HAVING (CAST(SUM(T41._Fld11330) AS NUMERIC(33, 8))) <> 0.0) T40
  492. ON (T39._IDRRef = T40.Fld11328RRef)
  493. LEFT OUTER JOIN (SELECT
  494. T43._Fld10540_TYPE AS Fld10540_TYPE,
  495. T43._Fld10540_RTRef AS Fld10540_RTRef,
  496. T43._Fld10540_RRRef AS Fld10540_RRRef,
  497. CAST(SUM(T43._Fld10545) AS NUMERIC(33, 8)) AS Fld10545Balance_
  498. FROM dbo._AccumRgT10549 T43
  499. WHERE (((T43._Fld595 = ?)) AND (EXISTS(SELECT
  500. 1
  501. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  502. LEFT OUTER JOIN dbo._Reference42 T44
  503. ON ((T43._Fld10538RRef = T44._IDRRef)) AND (T44._Fld595 = ?)
  504. WHERE EXISTS(SELECT
  505. 0x01 AS Q_001_F_000_
  506. FROM dbo._Reference98 T45
  507. INNER JOIN dbo._Reference21 T46
  508. ON (((T45._Fld1685 = ?) AND EXISTS(SELECT
  509. 0x01 AS Q_004_F_000_
  510. FROM dbo._InfoRg11709 T47
  511. WHERE ((T47._Fld595 = ?)) AND ((T47._Fld12065RRef = T45._IDRRef) AND (T47._Fld12066RRef = T46._IDRRef)))) AND T46._IDRRef IN
  512. (SELECT
  513. T48._Reference21_IDRRef AS Q_005_F_000RRef
  514. FROM dbo._Reference21_VT782 T48
  515. INNER JOIN dbo._InfoRg9937 T49
  516. ON ((T49._Fld9939_TYPE = 0x08 AND T49._Fld9939_RTRef = 0x00000095 AND T49._Fld9939_RRRef = ?) AND (T49._Fld9938_TYPE = T48._Fld784_TYPE AND T49._Fld9938_RTRef = T48._Fld784_RTRef AND T49._Fld9938_RRRef = T48._Fld784_RRRef))
  517. WHERE ((T48._Fld595 = ?)) AND (T49._Fld595 = ?)))
  518. WHERE ((T46._Fld595 = ?)) AND ((CASE WHEN T44._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  519. 0x01 AS Q_002_F_000_
  520. FROM dbo._InfoRg11710 T50
  521. WHERE ((T50._Fld595 = ?)) AND ((T50._Fld12072RRef = T46._IDRRef) AND (T50._Fld12073_TYPE = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END AND T50._Fld12073_RTRef = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T50._Fld12073_RRRef = T44._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  522. 0x01 AS Q_003_F_000_
  523. FROM dbo._InfoRg11715 T51
  524. WHERE ((T51._Fld595 = ?)) AND ((T51._Fld12199RRef = T46._IDRRef) AND T51._Fld12200_TYPE = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x08 END AND T51._Fld12200_RTRef = CASE WHEN T44._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T51._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T43._Period = ? AND (T43._Fld10545 <> ?) AND (T43._Fld10545 <> ?))
  525. GROUP BY T43._Fld10540_TYPE,
  526. T43._Fld10540_RTRef,
  527. T43._Fld10540_RRRef
  528. HAVING (CAST(SUM(T43._Fld10545) AS NUMERIC(33, 8))) <> 0.0) T42
  529. ON (0x08 = T42.Fld10540_TYPE AND 0x000000E9 = T42.Fld10540_RTRef AND T39._IDRRef = T42.Fld10540_RRRef)
  530. LEFT OUTER JOIN (SELECT
  531. T53.Fld10344RRef AS Fld10344RRef,
  532. CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8)) AS Fld10346Balance_
  533. FROM (SELECT
  534. T54._Fld10344RRef AS Fld10344RRef,
  535. CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8)) AS Fld10346Balance_
  536. FROM dbo._AccumRgT10349 T54
  537. WHERE ((T54._Fld595 = ?)) AND (T54._Period = ? AND (T54._Fld10346 <> ?) AND (T54._Fld10346 <> ?))
  538. GROUP BY T54._Fld10344RRef
  539. HAVING (CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8))) <> 0.0
  540. UNION ALL SELECT
  541. T55._Fld10344RRef AS Fld10344RRef,
  542. CAST(CAST(SUM(CASE WHEN T55._RecordKind = 0.0 THEN -T55._Fld10346 ELSE T55._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2)) AS Fld10346Balance_
  543. FROM dbo._AccumRg10339 T55
  544. WHERE ((T55._Fld595 = ?)) AND (T55._Period >= ? AND T55._Period < ? AND T55._Active = 0x01)
  545. GROUP BY T55._Fld10344RRef
  546. HAVING (CAST(CAST(SUM(CASE WHEN T55._RecordKind = 0.0 THEN -T55._Fld10346 ELSE T55._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2))) <> 0.0) T53
  547. GROUP BY T53.Fld10344RRef
  548. HAVING (CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8))) <> 0.0) T52
  549. ON (T39._IDRRef = T52.Fld10344RRef)
  550. LEFT OUTER JOIN dbo._InfoRg9134 T56
  551. ON ((0x08 = T56._Fld9136_TYPE AND 0x000000E9 = T56._Fld9136_RTRef AND T39._IDRRef = T56._Fld9136_RRRef)) AND (T56._Fld595 = ?)
  552. LEFT OUTER JOIN dbo._InfoRg11720 T57
  553. ON ((0x08 = T57._Fld12312_TYPE AND 0x000000E9 = T57._Fld12312_RTRef AND T39._IDRRef = T57._Fld12312_RRRef)) AND (T57._Fld595 = ?)
  554. LEFT OUTER JOIN (SELECT
  555. T59._Fld10332_TYPE AS Fld10332_TYPE,
  556. T59._Fld10332_RTRef AS Fld10332_RTRef,
  557. T59._Fld10332_RRRef AS Fld10332_RRRef,
  558. CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8)) AS Fld10335Balance_
  559. FROM dbo._AccumRgT10337 T59
  560. WHERE (((T59._Fld595 = ?)) AND (EXISTS(SELECT
  561. 1
  562. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  563. LEFT OUTER JOIN dbo._Reference42 T60
  564. ON ((T59._Fld10330RRef = T60._IDRRef)) AND (T60._Fld595 = ?)
  565. WHERE EXISTS(SELECT
  566. 0x01 AS Q_001_F_000_
  567. FROM dbo._Reference98 T61
  568. INNER JOIN dbo._Reference21 T62
  569. ON (((T61._Fld1685 = ?) AND EXISTS(SELECT
  570. 0x01 AS Q_004_F_000_
  571. FROM dbo._InfoRg11709 T63
  572. WHERE ((T63._Fld595 = ?)) AND ((T63._Fld12065RRef = T61._IDRRef) AND (T63._Fld12066RRef = T62._IDRRef)))) AND T62._IDRRef IN
  573. (SELECT
  574. T64._Reference21_IDRRef AS Q_005_F_000RRef
  575. FROM dbo._Reference21_VT782 T64
  576. INNER JOIN dbo._InfoRg9937 T65
  577. ON ((T65._Fld9939_TYPE = 0x08 AND T65._Fld9939_RTRef = 0x00000095 AND T65._Fld9939_RRRef = ?) AND (T65._Fld9938_TYPE = T64._Fld784_TYPE AND T65._Fld9938_RTRef = T64._Fld784_RTRef AND T65._Fld9938_RRRef = T64._Fld784_RRRef))
  578. WHERE ((T64._Fld595 = ?)) AND (T65._Fld595 = ?)))
  579. WHERE ((T62._Fld595 = ?)) AND ((CASE WHEN T60._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  580. 0x01 AS Q_002_F_000_
  581. FROM dbo._InfoRg11710 T66
  582. WHERE ((T66._Fld595 = ?)) AND ((T66._Fld12072RRef = T62._IDRRef) AND (T66._Fld12073_TYPE = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x08 END AND T66._Fld12073_RTRef = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T66._Fld12073_RRRef = T60._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  583. 0x01 AS Q_003_F_000_
  584. FROM dbo._InfoRg11715 T67
  585. WHERE ((T67._Fld595 = ?)) AND ((T67._Fld12199RRef = T62._IDRRef) AND T67._Fld12200_TYPE = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x08 END AND T67._Fld12200_RTRef = CASE WHEN T60._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T67._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T59._Period = ? AND (T59._Fld10335 <> ?) AND (T59._Fld10335 <> ?))
  586. GROUP BY T59._Fld10332_TYPE,
  587. T59._Fld10332_RTRef,
  588. T59._Fld10332_RRRef
  589. HAVING (CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8))) <> 0.0) T58
  590. ON (0x08 = T58.Fld10332_TYPE AND 0x000000E9 = T58.Fld10332_RTRef AND T39._IDRRef = T58.Fld10332_RRRef)
  591. LEFT OUTER JOIN dbo._Reference51 T68
  592. ON (T39._Fld4635RRef = T68._IDRRef) AND (T68._Fld595 = ?)
  593. WHERE ((((T39._Fld595 = ?) AND (EXISTS(SELECT
  594. 1
  595. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  596. LEFT OUTER JOIN dbo._Reference42 T69
  597. ON ((T39._Fld4625RRef = T69._IDRRef)) AND (T69._Fld595 = ?)
  598. WHERE EXISTS(SELECT
  599. 0x01 AS Q_001_F_000_
  600. FROM dbo._Reference98 T70
  601. INNER JOIN dbo._Reference21 T71
  602. ON (((T70._Fld1685 = ?) AND EXISTS(SELECT
  603. 0x01 AS Q_004_F_000_
  604. FROM dbo._InfoRg11709 T72
  605. WHERE ((T72._Fld595 = ?)) AND ((T72._Fld12065RRef = T70._IDRRef) AND (T72._Fld12066RRef = T71._IDRRef)))) AND T71._IDRRef IN
  606. (SELECT
  607. T73._Reference21_IDRRef AS Q_005_F_000RRef
  608. FROM dbo._Reference21_VT782 T73
  609. INNER JOIN dbo._InfoRg9937 T74
  610. ON ((T74._Fld9939_TYPE = 0x08 AND T74._Fld9939_RTRef = 0x00000095 AND T74._Fld9939_RRRef = ?) AND (T74._Fld9938_TYPE = T73._Fld784_TYPE AND T74._Fld9938_RTRef = T73._Fld784_RTRef AND T74._Fld9938_RRRef = T73._Fld784_RRRef))
  611. WHERE ((T73._Fld595 = ?)) AND (T74._Fld595 = ?)))
  612. WHERE ((T71._Fld595 = ?)) AND ((CASE WHEN T69._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  613. 0x01 AS Q_002_F_000_
  614. FROM dbo._InfoRg11710 T75
  615. WHERE ((T75._Fld595 = ?)) AND ((T75._Fld12072RRef = T71._IDRRef) AND (T75._Fld12073_TYPE = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x08 END AND T75._Fld12073_RTRef = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T75._Fld12073_RRRef = T69._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  616. 0x01 AS Q_003_F_000_
  617. FROM dbo._InfoRg11715 T76
  618. WHERE ((T76._Fld595 = ?)) AND ((T76._Fld12199RRef = T71._IDRRef) AND T76._Fld12200_TYPE = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x08 END AND T76._Fld12200_RTRef = CASE WHEN T69._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T76._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T39._Fld4621RRef = ?)) AND (T39._Marked = 0x00)) AND T39._Date_Time > ?
  619. ORDER BY (T39._Date_Time), (T39._IDRRef)
  620. OPTION (FAST 1)
  621. ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
  622.  
  623. 109594766=Duration,581=Execs,Usr=00SHJ1,Sql="SELECT TOP 25
  624. T1._IDRRef,
  625. T1._Marked,
  626. T1._Number,
  627. T1._Date_Time,
  628. T1._Posted,
  629. T1._Fld4621RRef,
  630. T1._Fld4622RRef,
  631. T1._Fld4625RRef,
  632. T1._Fld4627RRef,
  633. T1._Fld4633,
  634. T1._Fld4635RRef,
  635. T1._Fld4657RRef,
  636. CASE WHEN ((T1._Fld4657RRef = 0xAEB7F7D9237C245A447AADE98F164CDF) AND T1._Posted = 0x01) THEN CASE WHEN (ISNULL(CAST(T14.Fld10346Balance_ AS NUMERIC(33, 2)),0.0) > 0.0) THEN CASE WHEN (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 4.0 WHEN ((ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 6.0 ELSE 5.0 END ELSE CASE WHEN (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 0.0 WHEN ((ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 2.0 ELSE 1.0 END END ELSE 7.0 END,
  637. T19._Fld12313RRef,
  638. T1._Fld13369,
  639. CASE WHEN ((ISNULL(CAST(T20.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) > 0.0) THEN (ISNULL(CAST(T20.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) ELSE 0.0 END,
  640. T30._Fld1191
  641. FROM dbo._Document233 T1
  642. LEFT OUTER JOIN (SELECT
  643. T3._Fld11328RRef AS Fld11328RRef,
  644. CAST(SUM(T3._Fld11330) AS NUMERIC(33, 8)) AS Fld11330Turnover_
  645. FROM dbo._AccumRgTn11332 T3
  646. WHERE ((T3._Fld595 = ?)) AND (((T3._Fld11324RRef = ?)) AND (T3._Fld11330 <> ?))
  647. GROUP BY T3._Fld11328RRef
  648. HAVING (CAST(SUM(T3._Fld11330) AS NUMERIC(33, 8))) <> 0.0) T2
  649. ON (T1._IDRRef = T2.Fld11328RRef)
  650. LEFT OUTER JOIN (SELECT
  651. T5._Fld10540_TYPE AS Fld10540_TYPE,
  652. T5._Fld10540_RTRef AS Fld10540_RTRef,
  653. T5._Fld10540_RRRef AS Fld10540_RRRef,
  654. CAST(SUM(T5._Fld10545) AS NUMERIC(33, 8)) AS Fld10545Balance_
  655. FROM dbo._AccumRgT10549 T5
  656. WHERE (((T5._Fld595 = ?)) AND (EXISTS(SELECT
  657. 1
  658. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  659. LEFT OUTER JOIN dbo._Reference42 T6
  660. ON ((T5._Fld10538RRef = T6._IDRRef)) AND (T6._Fld595 = ?)
  661. WHERE EXISTS(SELECT
  662. 0x01 AS Q_001_F_000_
  663. FROM dbo._Reference98 T7
  664. INNER JOIN dbo._Reference21 T8
  665. ON (((T7._Fld1685 = ?) AND EXISTS(SELECT
  666. 0x01 AS Q_004_F_000_
  667. FROM dbo._InfoRg11709 T9
  668. WHERE ((T9._Fld595 = ?)) AND ((T9._Fld12065RRef = T7._IDRRef) AND (T9._Fld12066RRef = T8._IDRRef)))) AND T8._IDRRef IN
  669. (SELECT
  670. T10._Reference21_IDRRef AS Q_005_F_000RRef
  671. FROM dbo._Reference21_VT782 T10
  672. INNER JOIN dbo._InfoRg9937 T11
  673. ON ((T11._Fld9939_TYPE = 0x08 AND T11._Fld9939_RTRef = 0x00000095 AND T11._Fld9939_RRRef = ?) AND (T11._Fld9938_TYPE = T10._Fld784_TYPE AND T11._Fld9938_RTRef = T10._Fld784_RTRef AND T11._Fld9938_RRRef = T10._Fld784_RRRef))
  674. WHERE ((T10._Fld595 = ?)) AND (T11._Fld595 = ?)))
  675. WHERE ((T8._Fld595 = ?)) AND ((CASE WHEN T6._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T6._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  676. 0x01 AS Q_002_F_000_
  677. FROM dbo._InfoRg11710 T12
  678. WHERE ((T12._Fld595 = ?)) AND ((T12._Fld12072RRef = T8._IDRRef) AND (T12._Fld12073_TYPE = CASE WHEN T6._Fld12836RRef IS NOT NULL THEN 0x08 END AND T12._Fld12073_RTRef = CASE WHEN T6._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T12._Fld12073_RRRef = T6._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  679. 0x01 AS Q_003_F_000_
  680. FROM dbo._InfoRg11715 T13
  681. WHERE ((T13._Fld595 = ?)) AND ((T13._Fld12199RRef = T8._IDRRef) AND T13._Fld12200_TYPE = CASE WHEN T6._Fld12836RRef IS NOT NULL THEN 0x08 END AND T13._Fld12200_RTRef = CASE WHEN T6._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T13._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T5._Period = ? AND ((T5._Fld10536RRef = ?)) AND (T5._Fld10545 <> ?) AND (T5._Fld10545 <> ?))
  682. GROUP BY T5._Fld10540_TYPE,
  683. T5._Fld10540_RTRef,
  684. T5._Fld10540_RRRef
  685. HAVING (CAST(SUM(T5._Fld10545) AS NUMERIC(33, 8))) <> 0.0) T4
  686. ON (0x08 = T4.Fld10540_TYPE AND 0x000000E9 = T4.Fld10540_RTRef AND T1._IDRRef = T4.Fld10540_RRRef)
  687. LEFT OUTER JOIN (SELECT
  688. T15.Fld10344RRef AS Fld10344RRef,
  689. CAST(SUM(T15.Fld10346Balance_) AS NUMERIC(38, 8)) AS Fld10346Balance_
  690. FROM (SELECT
  691. T16._Fld10344RRef AS Fld10344RRef,
  692. CAST(SUM(T16._Fld10346) AS NUMERIC(33, 8)) AS Fld10346Balance_
  693. FROM dbo._AccumRgT10349 T16
  694. WHERE ((T16._Fld595 = ?)) AND (T16._Period = ? AND ((T16._Fld10340RRef = ?)) AND (T16._Fld10346 <> ?) AND (T16._Fld10346 <> ?))
  695. GROUP BY T16._Fld10344RRef
  696. HAVING (CAST(SUM(T16._Fld10346) AS NUMERIC(33, 8))) <> 0.0
  697. UNION ALL SELECT
  698. T17._Fld10344RRef AS Fld10344RRef,
  699. CAST(CAST(SUM(CASE WHEN T17._RecordKind = 0.0 THEN -T17._Fld10346 ELSE T17._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2)) AS Fld10346Balance_
  700. FROM dbo._AccumRg10339 T17
  701. WHERE ((T17._Fld595 = ?)) AND (T17._Period >= ? AND T17._Period < ? AND T17._Active = 0x01 AND ((T17._Fld10340RRef = ?)))
  702. GROUP BY T17._Fld10344RRef
  703. HAVING (CAST(CAST(SUM(CASE WHEN T17._RecordKind = 0.0 THEN -T17._Fld10346 ELSE T17._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2))) <> 0.0) T15
  704. GROUP BY T15.Fld10344RRef
  705. HAVING (CAST(SUM(T15.Fld10346Balance_) AS NUMERIC(38, 8))) <> 0.0) T14
  706. ON (T1._IDRRef = T14.Fld10344RRef)
  707. LEFT OUTER JOIN dbo._InfoRg9134 T18
  708. ON ((0x08 = T18._Fld9136_TYPE AND 0x000000E9 = T18._Fld9136_RTRef AND T1._IDRRef = T18._Fld9136_RRRef)) AND (T18._Fld595 = ?)
  709. LEFT OUTER JOIN dbo._InfoRg11720 T19
  710. ON ((0x08 = T19._Fld12312_TYPE AND 0x000000E9 = T19._Fld12312_RTRef AND T1._IDRRef = T19._Fld12312_RRRef)) AND (T19._Fld595 = ?)
  711. LEFT OUTER JOIN (SELECT
  712. T21._Fld10332_TYPE AS Fld10332_TYPE,
  713. T21._Fld10332_RTRef AS Fld10332_RTRef,
  714. T21._Fld10332_RRRef AS Fld10332_RRRef,
  715. CAST(SUM(T21._Fld10335) AS NUMERIC(33, 8)) AS Fld10335Balance_
  716. FROM dbo._AccumRgT10337 T21
  717. WHERE (((T21._Fld595 = ?)) AND (EXISTS(SELECT
  718. 1
  719. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  720. LEFT OUTER JOIN dbo._Reference42 T22
  721. ON ((T21._Fld10330RRef = T22._IDRRef)) AND (T22._Fld595 = ?)
  722. WHERE EXISTS(SELECT
  723. 0x01 AS Q_001_F_000_
  724. FROM dbo._Reference98 T23
  725. INNER JOIN dbo._Reference21 T24
  726. ON (((T23._Fld1685 = ?) AND EXISTS(SELECT
  727. 0x01 AS Q_004_F_000_
  728. FROM dbo._InfoRg11709 T25
  729. WHERE ((T25._Fld595 = ?)) AND ((T25._Fld12065RRef = T23._IDRRef) AND (T25._Fld12066RRef = T24._IDRRef)))) AND T24._IDRRef IN
  730. (SELECT
  731. T26._Reference21_IDRRef AS Q_005_F_000RRef
  732. FROM dbo._Reference21_VT782 T26
  733. INNER JOIN dbo._InfoRg9937 T27
  734. ON ((T27._Fld9939_TYPE = 0x08 AND T27._Fld9939_RTRef = 0x00000095 AND T27._Fld9939_RRRef = ?) AND (T27._Fld9938_TYPE = T26._Fld784_TYPE AND T27._Fld9938_RTRef = T26._Fld784_RTRef AND T27._Fld9938_RRRef = T26._Fld784_RRRef))
  735. WHERE ((T26._Fld595 = ?)) AND (T27._Fld595 = ?)))
  736. WHERE ((T24._Fld595 = ?)) AND ((CASE WHEN T22._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T22._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  737. 0x01 AS Q_002_F_000_
  738. FROM dbo._InfoRg11710 T28
  739. WHERE ((T28._Fld595 = ?)) AND ((T28._Fld12072RRef = T24._IDRRef) AND (T28._Fld12073_TYPE = CASE WHEN T22._Fld12836RRef IS NOT NULL THEN 0x08 END AND T28._Fld12073_RTRef = CASE WHEN T22._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T28._Fld12073_RRRef = T22._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  740. 0x01 AS Q_003_F_000_
  741. FROM dbo._InfoRg11715 T29
  742. WHERE ((T29._Fld595 = ?)) AND ((T29._Fld12199RRef = T24._IDRRef) AND T29._Fld12200_TYPE = CASE WHEN T22._Fld12836RRef IS NOT NULL THEN 0x08 END AND T29._Fld12200_RTRef = CASE WHEN T22._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T29._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T21._Period = ? AND ((T21._Fld10328RRef = ?)) AND (T21._Fld10335 <> ?) AND (T21._Fld10335 <> ?))
  743. GROUP BY T21._Fld10332_TYPE,
  744. T21._Fld10332_RTRef,
  745. T21._Fld10332_RRRef
  746. HAVING (CAST(SUM(T21._Fld10335) AS NUMERIC(33, 8))) <> 0.0) T20
  747. ON (0x08 = T20.Fld10332_TYPE AND 0x000000E9 = T20.Fld10332_RTRef AND T1._IDRRef = T20.Fld10332_RRRef)
  748. LEFT OUTER JOIN dbo._Reference51 T30
  749. ON (T1._Fld4635RRef = T30._IDRRef) AND (T30._Fld595 = ?)
  750. WHERE (((T1._Fld595 = ?)) AND (EXISTS(SELECT
  751. 1
  752. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  753. LEFT OUTER JOIN dbo._Reference42 T31
  754. ON ((T1._Fld4625RRef = T31._IDRRef)) AND (T31._Fld595 = ?)
  755. WHERE EXISTS(SELECT
  756. 0x01 AS Q_001_F_000_
  757. FROM dbo._Reference98 T32
  758. INNER JOIN dbo._Reference21 T33
  759. ON (((T32._Fld1685 = ?) AND EXISTS(SELECT
  760. 0x01 AS Q_004_F_000_
  761. FROM dbo._InfoRg11709 T34
  762. WHERE ((T34._Fld595 = ?)) AND ((T34._Fld12065RRef = T32._IDRRef) AND (T34._Fld12066RRef = T33._IDRRef)))) AND T33._IDRRef IN
  763. (SELECT
  764. T35._Reference21_IDRRef AS Q_005_F_000RRef
  765. FROM dbo._Reference21_VT782 T35
  766. INNER JOIN dbo._InfoRg9937 T36
  767. ON ((T36._Fld9939_TYPE = 0x08 AND T36._Fld9939_RTRef = 0x00000095 AND T36._Fld9939_RRRef = ?) AND (T36._Fld9938_TYPE = T35._Fld784_TYPE AND T36._Fld9938_RTRef = T35._Fld784_RTRef AND T36._Fld9938_RRRef = T35._Fld784_RRRef))
  768. WHERE ((T35._Fld595 = ?)) AND (T36._Fld595 = ?)))
  769. WHERE ((T33._Fld595 = ?)) AND ((CASE WHEN T31._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T31._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  770. 0x01 AS Q_002_F_000_
  771. FROM dbo._InfoRg11710 T37
  772. WHERE ((T37._Fld595 = ?)) AND ((T37._Fld12072RRef = T33._IDRRef) AND (T37._Fld12073_TYPE = CASE WHEN T31._Fld12836RRef IS NOT NULL THEN 0x08 END AND T37._Fld12073_RTRef = CASE WHEN T31._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T37._Fld12073_RRRef = T31._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  773. 0x01 AS Q_003_F_000_
  774. FROM dbo._InfoRg11715 T38
  775. WHERE ((T38._Fld595 = ?)) AND ((T38._Fld12199RRef = T33._IDRRef) AND T38._Fld12200_TYPE = CASE WHEN T31._Fld12836RRef IS NOT NULL THEN 0x08 END AND T38._Fld12200_RTRef = CASE WHEN T31._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T38._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND ((T1._Fld4636RRef = ?) AND (T1._Fld4621RRef = ?) AND (T1._Date_Time >= ?) AND ((CASE WHEN ((T1._Fld4657RRef = ?) AND T1._Posted = 0x01) THEN CASE WHEN (ISNULL(CAST(T14.Fld10346Balance_ AS NUMERIC(33, 2)),?) > ?) THEN CASE WHEN (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),?) = ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) THEN ? WHEN ((ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?) = ?) AND (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),?) > ?)) THEN ? WHEN ((CAST(ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),?) AS NUMERIC(33, 8)) / ?) > ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) THEN ? ELSE ? END ELSE CASE WHEN (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),?) = ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) THEN ? WHEN ((ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?) = ?) AND (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),?) > ?)) THEN ? WHEN ((CAST(ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),?) AS NUMERIC(33, 8)) / ?) > ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) THEN ? ELSE ? END END ELSE ? END < ?) OR ((CASE WHEN ((T1._Fld4657RRef = ?) AND T1._Posted = 0x01) THEN CASE WHEN (ISNULL(CAST(T14.Fld10346Balance_ AS NUMERIC(33, 2)),?) > ?) THEN CASE WHEN (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),?) = ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) THEN ? WHEN ((ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?) = ?) AND (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),?) > ?)) THEN ? WHEN ((CAST(ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),?) AS NUMERIC(33, 8)) / ?) > ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) THEN ? ELSE ? END ELSE CASE WHEN (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),?) = ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) THEN ? WHEN ((ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?) = ?) AND (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),?) > ?)) THEN ? WHEN ((CAST(ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),?) AS NUMERIC(33, 8)) / ?) > ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) THEN ? ELSE ? END END ELSE ? END = ?) AND (T1._IDRRef < ?))))
  776. ORDER BY (CASE WHEN ((T1._Fld4657RRef = 0xAEB7F7D9237C245A447AADE98F164CDF) AND T1._Posted = 0x01) THEN CASE WHEN (ISNULL(CAST(T14.Fld10346Balance_ AS NUMERIC(33, 2)),0.0) > 0.0) THEN CASE WHEN (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 4.0 WHEN ((ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 6.0 ELSE 5.0 END ELSE CASE WHEN (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 0.0 WHEN ((ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T2.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 2.0 ELSE 1.0 END END ELSE 7.0 END) DESC, (T1._IDRRef) DESC
  777. ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement