Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (@P1 numeric(10),@P2 numeric(10),@P3 numeric(10),@P4 numeric(10),@P5 numeric(10),@P6 numeric(10),@P7 numeric(10),@P8 numeric(10),@P9 numeric(10),@P10 numeric(10),@P11 nvarchar(4000),@P12 numeric(10),@P13 varbinary(16),@P14 numeric(10),@P15 numeric(10),@P16 numeric(10),@P17 numeric(10),@P18 numeric(10),@P19 datetime2(3),@P20 datetime2(3),@P21 numeric(10),@P22 numeric(10),@P23 numeric(10),@P24 nvarchar(4000),@P25 numeric(10),@P26 varbinary(16),@P27 numeric(10),@P28 numeric(10),@P29 numeric(10),@P30 numeric(10),@P31 numeric(10),@P32 numeric(10),@P33 numeric(10),@P34 numeric(10),@P35 nvarchar(4000),@P36 numeric(10),@P37 varbinary(16),@P38 numeric(10),@P39 numeric(10),@P40 numeric(10),@P41 numeric(10),@P42 numeric(10),@P43 numeric(10),@P44 numeric(10),@P45 numeric(10),@P46 numeric(10),@P47 numeric(10),@P48 nvarchar(4000),@P49 numeric(10),@P50 varbinary(16),@P51 numeric(10),@P52 numeric(10),@P53 numeric(10),@P54 numeric(10),@P55 numeric(10),@P56 numeric(10),@P57 numeric(10),@P58 nvarchar(4000),@P59 numeric(10),@P60 varbinary(16),@P61 numeric(10),@P62 numeric(10),@P63 numeric(10),@P64 numeric(10),@P65 numeric(10),@P66 numeric(10),@P67 numeric(10),@P68 numeric(10),@P69 nvarchar(4000),@P70 numeric(10),@P71 varbinary(16),@P72 numeric(10),@P73 numeric(10),@P74 numeric(10),@P75 numeric(10),@P76 numeric(10),@P77 numeric(10),@P78 numeric(10),@P79 numeric(10),@P80 numeric(10),@P81 nvarchar(4000),@P82 numeric(10),@P83 varbinary(16),@P84 numeric(10),@P85 numeric(10),@P86 numeric(10),@P87 numeric(10),@P88 numeric(10),@P89 datetime2(3),@P90 datetime2(3),@P91 numeric(10),@P92 numeric(10),@P93 numeric(10),@P94 nvarchar(4000),@P95 numeric(10),@P96 varbinary(16),@P97 numeric(10),@P98 numeric(10),@P99 numeric(10),@P100 numeric(10),@P101 numeric(10),@P102 datetime2(3),@P103 datetime2(3),@P104 numeric(10),@P105 numeric(10),@P106 numeric(10),@P107 nvarchar(4000),@P108 numeric(10),@P109 varbinary(16),@P110 numeric(10),@P111 numeric(10),@P112 numeric(10),@P113 numeric(10),@P114 numeric(10),@P115 datetime2(3),@P116 datetime2(3),@P117 numeric(10))INSERT INTO #tt183 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
- T1.Fld11293_TYPE,
- T1.Fld11293_RTRef,
- T1.Fld11293_RRRef,
- T1.Fld11295RRef,
- (T1.Fld11302Turnover_ - T1.Fld11303Turnover_),
- T65.IDRRef,
- 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,
- 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,
- CAST(0.0 AS NUMERIC(21, 2)),
- CAST(NULL AS NUMERIC(21, 2))
- FROM (SELECT
- T2._Fld11295RRef AS Fld11295RRef,
- T2._Fld11290_TYPE AS Fld11290_TYPE,
- T2._Fld11290_RTRef AS Fld11290_RTRef,
- T2._Fld11290_RRRef AS Fld11290_RRRef,
- T2._Fld11293_TYPE AS Fld11293_TYPE,
- T2._Fld11293_RTRef AS Fld11293_RTRef,
- T2._Fld11293_RRRef AS Fld11293_RRRef,
- CAST(SUM(T2._Fld11303) AS NUMERIC(33, 8)) AS Fld11303Turnover_,
- CAST(SUM(T2._Fld11302) AS NUMERIC(33, 8)) AS Fld11302Turnover_
- FROM dbo._AccumRgTn11305 T2
- WHERE (((T2._Fld595 = @P1)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Document233 T3
- ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000E9 AND T2._Fld11293_RRRef = T3._IDRRef) AND (T3._Fld595 = @P2)
- LEFT OUTER JOIN dbo._Document212 T4
- ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D4 AND T2._Fld11293_RRRef = T4._IDRRef) AND (T4._Fld595 = @P3)
- LEFT OUTER JOIN dbo._Document234 T5
- ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000EA AND T2._Fld11293_RRRef = T5._IDRRef) AND (T5._Fld595 = @P4)
- LEFT OUTER JOIN dbo._Document263 T6
- ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x00000107 AND T2._Fld11293_RRRef = T6._IDRRef) AND (T6._Fld595 = @P5)
- LEFT OUTER JOIN dbo._Document216 T7
- ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D8 AND T2._Fld11293_RRRef = T7._IDRRef) AND (T7._Fld595 = @P6)
- LEFT OUTER JOIN dbo._Document215 T8
- ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D7 AND T2._Fld11293_RRRef = T8._IDRRef) AND (T8._Fld595 = @P7)
- LEFT OUTER JOIN dbo._Document213 T9
- ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D5 AND T2._Fld11293_RRRef = T9._IDRRef) AND (T9._Fld595 = @P8)
- LEFT OUTER JOIN dbo._Document199 T10
- ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000C7 AND T2._Fld11293_RRRef = T10._IDRRef) AND (T10._Fld595 = @P9)
- LEFT OUTER JOIN dbo._Reference42 T11
- 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 = @P10)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T12
- INNER JOIN dbo._Reference21 T13
- ON (((T12._Fld1685 = @P11) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T14
- WHERE ((T14._Fld595 = @P12)) AND ((T14._Fld12065RRef = T12._IDRRef) AND (T14._Fld12066RRef = T13._IDRRef)))) AND T13._IDRRef IN
- (SELECT
- T15._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T15
- INNER JOIN dbo._InfoRg9937 T16
- ON ((T16._Fld9939_TYPE = 0x08 AND T16._Fld9939_RTRef = 0x00000095 AND T16._Fld9939_RRRef = @P13) AND (T16._Fld9938_TYPE = T15._Fld784_TYPE AND T16._Fld9938_RTRef = T15._Fld784_RTRef AND T16._Fld9938_RRRef = T15._Fld784_RRRef))
- WHERE ((T15._Fld595 = @P14)) AND (T16._Fld595 = @P15)))
- WHERE ((T13._Fld595 = @P16)) 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T17
- WHERE ((T17._Fld595 = @P17)) 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T18
- WHERE ((T18._Fld595 = @P18)) 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 >= @P19 AND T2._Period < @P20 AND (T2._Fld11303 <> @P21 OR T2._Fld11302 <> @P22))
- GROUP BY T2._Fld11295RRef,
- T2._Fld11290_TYPE,
- T2._Fld11290_RTRef,
- T2._Fld11290_RRRef,
- T2._Fld11293_TYPE,
- T2._Fld11293_RTRef,
- T2._Fld11293_RRRef
- HAVING (CAST(SUM(T2._Fld11303) AS NUMERIC(33, 8))) <> 0.0 OR (CAST(SUM(T2._Fld11302) AS NUMERIC(33, 8))) <> 0.0) T1
- LEFT OUTER JOIN (SELECT
- T20._IDRRef AS IDRRef,
- T20._Fld4625RRef AS Fld4625RRef,
- T20._Fld595 AS Fld595_
- FROM dbo._Document233 T20
- WHERE ((EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T21
- ON ((T20._Fld4625RRef = T21._IDRRef)) AND (T21._Fld595 = @P23)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T22
- INNER JOIN dbo._Reference21 T23
- ON (((T22._Fld1685 = @P24) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T24
- WHERE ((T24._Fld595 = @P25)) AND ((T24._Fld12065RRef = T22._IDRRef) AND (T24._Fld12066RRef = T23._IDRRef)))) AND T23._IDRRef IN
- (SELECT
- T25._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T25
- INNER JOIN dbo._InfoRg9937 T26
- ON ((T26._Fld9939_TYPE = 0x08 AND T26._Fld9939_RTRef = 0x00000095 AND T26._Fld9939_RRRef = @P26) AND (T26._Fld9938_TYPE = T25._Fld784_TYPE AND T26._Fld9938_RTRef = T25._Fld784_RTRef AND T26._Fld9938_RRRef = T25._Fld784_RRRef))
- WHERE ((T25._Fld595 = @P27)) AND (T26._Fld595 = @P28)))
- WHERE ((T23._Fld595 = @P29)) 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T27
- WHERE ((T27._Fld595 = @P30)) 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T28
- WHERE ((T28._Fld595 = @P31)) 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 = @P32)) T19
- ON T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000E9 AND T1.Fld11293_RRRef = T19.IDRRef
- LEFT OUTER JOIN dbo._Document212 T29
- ON (T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D4 AND T1.Fld11293_RRRef = T29._IDRRef) AND (T29._Fld595 = @P33)
- LEFT OUTER JOIN (SELECT
- T31._IDRRef AS IDRRef,
- T31._Fld595 AS Fld595_,
- T31._Fld4774RRef AS Fld4774RRef,
- T31._Fld4779RRef AS Fld4779RRef
- FROM dbo._Document234 T31
- WHERE ((EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T32
- ON ((T31._Fld4774RRef = T32._IDRRef)) AND (T32._Fld595 = @P34)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T33
- INNER JOIN dbo._Reference21 T34
- ON (((T33._Fld1685 = @P35) AND EXISTS(SELECT
- 0x01 AS Q_006_F_000_
- FROM dbo._InfoRg11709 T35
- WHERE ((T35._Fld595 = @P36)) AND ((T35._Fld12065RRef = T33._IDRRef) AND (T35._Fld12066RRef = T34._IDRRef)))) AND T34._IDRRef IN
- (SELECT
- T36._Reference21_IDRRef AS Q_007_F_000RRef
- FROM dbo._Reference21_VT782 T36
- INNER JOIN dbo._InfoRg9937 T37
- ON ((T37._Fld9939_TYPE = 0x08 AND T37._Fld9939_RTRef = 0x00000095 AND T37._Fld9939_RRRef = @P37) AND (T37._Fld9938_TYPE = T36._Fld784_TYPE AND T37._Fld9938_RTRef = T36._Fld784_RTRef AND T37._Fld9938_RRRef = T36._Fld784_RRRef))
- WHERE ((T36._Fld595 = @P38)) AND (T37._Fld595 = @P39)))
- WHERE ((T34._Fld595 = @P40)) AND ((0x08 <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T38
- WHERE ((T38._Fld595 = @P41)) 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T39
- WHERE ((T39._Fld595 = @P42)) 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
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11710 T40
- WHERE ((T40._Fld595 = @P43)) 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
- 0x01 AS Q_005_F_000_
- FROM dbo._InfoRg11715 T41
- WHERE ((T41._Fld595 = @P44)) 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 = @P45)) T30
- ON T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000EA AND T1.Fld11293_RRRef = T30.IDRRef
- LEFT OUTER JOIN dbo._Document263 T42
- ON (T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x00000107 AND T1.Fld11293_RRRef = T42._IDRRef) AND (T42._Fld595 = @P46)
- LEFT OUTER JOIN (SELECT
- T44._Fld3845RRef AS Fld3845RRef,
- T44._IDRRef AS IDRRef,
- T44._Fld595 AS Fld595_
- FROM dbo._Document216 T44
- WHERE ((EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T45
- ON ((T44._Fld3845RRef = T45._IDRRef)) AND (T45._Fld595 = @P47)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T46
- INNER JOIN dbo._Reference21 T47
- ON (((T46._Fld1685 = @P48) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T48
- WHERE ((T48._Fld595 = @P49)) AND ((T48._Fld12065RRef = T46._IDRRef) AND (T48._Fld12066RRef = T47._IDRRef)))) AND T47._IDRRef IN
- (SELECT
- T49._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T49
- INNER JOIN dbo._InfoRg9937 T50
- ON ((T50._Fld9939_TYPE = 0x08 AND T50._Fld9939_RTRef = 0x00000095 AND T50._Fld9939_RRRef = @P50) AND (T50._Fld9938_TYPE = T49._Fld784_TYPE AND T50._Fld9938_RTRef = T49._Fld784_RTRef AND T50._Fld9938_RRRef = T49._Fld784_RRRef))
- WHERE ((T49._Fld595 = @P51)) AND (T50._Fld595 = @P52)))
- WHERE ((T47._Fld595 = @P53)) 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T51
- WHERE ((T51._Fld595 = @P54)) 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T52
- WHERE ((T52._Fld595 = @P55)) 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 = @P56)) T43
- ON T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D8 AND T1.Fld11293_RRRef = T43.IDRRef
- LEFT OUTER JOIN (SELECT
- T54._IDRRef AS IDRRef,
- T54._Fld595 AS Fld595_,
- T54._Fld3734RRef AS Fld3734RRef
- FROM dbo._Document215 T54
- WHERE ((EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T55
- ON ((T54._Fld3734RRef = T55._IDRRef)) AND (T55._Fld595 = @P57)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T56
- INNER JOIN dbo._Reference21 T57
- ON (((T56._Fld1685 = @P58) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T58
- WHERE ((T58._Fld595 = @P59)) AND ((T58._Fld12065RRef = T56._IDRRef) AND (T58._Fld12066RRef = T57._IDRRef)))) AND T57._IDRRef IN
- (SELECT
- T59._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T59
- INNER JOIN dbo._InfoRg9937 T60
- ON ((T60._Fld9939_TYPE = 0x08 AND T60._Fld9939_RTRef = 0x00000095 AND T60._Fld9939_RRRef = @P60) AND (T60._Fld9938_TYPE = T59._Fld784_TYPE AND T60._Fld9938_RTRef = T59._Fld784_RTRef AND T60._Fld9938_RRRef = T59._Fld784_RRRef))
- WHERE ((T59._Fld595 = @P61)) AND (T60._Fld595 = @P62)))
- WHERE ((T57._Fld595 = @P63)) 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T61
- WHERE ((T61._Fld595 = @P64)) 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T62
- WHERE ((T62._Fld595 = @P65)) 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 = @P66)) T53
- ON T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D7 AND T1.Fld11293_RRRef = T53.IDRRef
- LEFT OUTER JOIN dbo._Document213 T63
- ON (T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D5 AND T1.Fld11293_RRRef = T63._IDRRef) AND (T63._Fld595 = @P67)
- LEFT OUTER JOIN dbo._Document199 T64
- ON (T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000C7 AND T1.Fld11293_RRRef = T64._IDRRef) AND (T64._Fld595 = @P68)
- LEFT OUTER JOIN (SELECT
- T66._IDRRef AS IDRRef,
- T66._Folder AS Folder_,
- T66._Fld12836RRef AS Fld12836RRef,
- T66._Fld595 AS Fld595_
- FROM dbo._Reference42 T66
- WHERE ((((T66._Folder = 0x00) OR EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T67
- INNER JOIN dbo._Reference21 T68
- ON (((T67._Fld1685 = @P69) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T69
- WHERE ((T69._Fld595 = @P70)) AND ((T69._Fld12065RRef = T67._IDRRef) AND (T69._Fld12066RRef = T68._IDRRef)))) AND T68._IDRRef IN
- (SELECT
- T70._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T70
- INNER JOIN dbo._InfoRg9937 T71
- ON ((T71._Fld9939_TYPE = 0x08 AND T71._Fld9939_RTRef = 0x00000095 AND T71._Fld9939_RRRef = @P71) AND (T71._Fld9938_TYPE = T70._Fld784_TYPE AND T71._Fld9938_RTRef = T70._Fld784_RTRef AND T71._Fld9938_RRRef = T70._Fld784_RRRef))
- WHERE ((T70._Fld595 = @P72)) AND (T71._Fld595 = @P73)))
- WHERE ((T68._Fld595 = @P74)) 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T72
- WHERE ((T72._Fld595 = @P75)) 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T73
- WHERE ((T73._Fld595 = @P76)) 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 = @P77)) T65
- 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)
- LEFT OUTER JOIN dbo._Reference88 T74
- ON (T1.Fld11290_TYPE = 0x08 AND T1.Fld11290_RTRef = 0x00000058 AND T1.Fld11290_RRRef = T74._IDRRef) AND (T74._Fld595 = @P78)
- UNION ALL SELECT
- T75.Fld10332_TYPE,
- T75.Fld10332_RTRef,
- T75.Fld10332_RRRef,
- T75.Fld10328RRef,
- CAST(NULL AS NUMERIC(28, 2)),
- T75.Fld10330RRef,
- CAST(NULL AS NUMERIC(28, 2)),
- CAST(NULL AS NUMERIC(28, 2)),
- T75.Fld10334Expense_,
- CAST(NULL AS NUMERIC(21, 2))
- FROM (SELECT
- T76._RecorderTRef AS RecorderTRef,
- T76._RecorderRRef AS RecorderRRef,
- T76._Fld10328RRef AS Fld10328RRef,
- T76._Fld10330RRef AS Fld10330RRef,
- T76._Fld10332_TYPE AS Fld10332_TYPE,
- T76._Fld10332_RTRef AS Fld10332_RTRef,
- T76._Fld10332_RRRef AS Fld10332_RRRef,
- CAST(SUM(CASE WHEN T76._RecordKind = 0.0 THEN 0.0 ELSE T76._Fld10334 END) AS NUMERIC(27, 8)) AS Fld10334Expense_
- FROM dbo._AccumRg10327 T76
- WHERE (((T76._Fld595 = @P79)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T77
- ON ((T76._Fld10330RRef = T77._IDRRef)) AND (T77._Fld595 = @P80)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T78
- INNER JOIN dbo._Reference21 T79
- ON (((T78._Fld1685 = @P81) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T80
- WHERE ((T80._Fld595 = @P82)) AND ((T80._Fld12065RRef = T78._IDRRef) AND (T80._Fld12066RRef = T79._IDRRef)))) AND T79._IDRRef IN
- (SELECT
- T81._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T81
- INNER JOIN dbo._InfoRg9937 T82
- ON ((T82._Fld9939_TYPE = 0x08 AND T82._Fld9939_RTRef = 0x00000095 AND T82._Fld9939_RRRef = @P83) AND (T82._Fld9938_TYPE = T81._Fld784_TYPE AND T82._Fld9938_RTRef = T81._Fld784_RTRef AND T82._Fld9938_RRRef = T81._Fld784_RRRef))
- WHERE ((T81._Fld595 = @P84)) AND (T82._Fld595 = @P85)))
- WHERE ((T79._Fld595 = @P86)) 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T83
- WHERE ((T83._Fld595 = @P87)) 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T84
- WHERE ((T84._Fld595 = @P88)) 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 >= @P89 AND T76._Period <= @P90 AND T76._Active = 0x01 AND (0x00) = 0x01 AND T76._RecordKind = @P91)
- GROUP BY T76._RecorderTRef,
- T76._RecorderRRef,
- T76._Fld10328RRef,
- T76._Fld10330RRef,
- T76._Fld10332_TYPE,
- T76._Fld10332_RTRef,
- T76._Fld10332_RRRef
- HAVING (CAST(SUM(CASE WHEN T76._RecordKind = 0.0 THEN 0.0 ELSE T76._Fld10334 END) AS NUMERIC(27, 8))) <> 0.0) T75
- WHERE (T75.RecorderTRef = 0x000000D3)
- UNION ALL SELECT
- T85.Fld10540_TYPE,
- T85.Fld10540_RTRef,
- T85.Fld10540_RRRef,
- T85.Fld10536RRef,
- CAST(NULL AS NUMERIC(28, 2)),
- T85.Fld10538RRef,
- CAST(NULL AS NUMERIC(28, 2)),
- CAST(NULL AS NUMERIC(28, 2)),
- T85.Fld10544Expense_,
- CAST(NULL AS NUMERIC(21, 2))
- FROM (SELECT
- T86._RecorderTRef AS RecorderTRef,
- T86._RecorderRRef AS RecorderRRef,
- T86._Fld10536RRef AS Fld10536RRef,
- T86._Fld10538RRef AS Fld10538RRef,
- T86._Fld10540_TYPE AS Fld10540_TYPE,
- T86._Fld10540_RTRef AS Fld10540_RTRef,
- T86._Fld10540_RRRef AS Fld10540_RRRef,
- CAST(SUM(CASE WHEN T86._RecordKind = 0.0 THEN 0.0 ELSE T86._Fld10544 END) AS NUMERIC(27, 8)) AS Fld10544Expense_
- FROM dbo._AccumRg10535 T86
- WHERE (((T86._Fld595 = @P92)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T87
- ON ((T86._Fld10538RRef = T87._IDRRef)) AND (T87._Fld595 = @P93)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T88
- INNER JOIN dbo._Reference21 T89
- ON (((T88._Fld1685 = @P94) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T90
- WHERE ((T90._Fld595 = @P95)) AND ((T90._Fld12065RRef = T88._IDRRef) AND (T90._Fld12066RRef = T89._IDRRef)))) AND T89._IDRRef IN
- (SELECT
- T91._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T91
- INNER JOIN dbo._InfoRg9937 T92
- ON ((T92._Fld9939_TYPE = 0x08 AND T92._Fld9939_RTRef = 0x00000095 AND T92._Fld9939_RRRef = @P96) AND (T92._Fld9938_TYPE = T91._Fld784_TYPE AND T92._Fld9938_RTRef = T91._Fld784_RTRef AND T92._Fld9938_RRRef = T91._Fld784_RRRef))
- WHERE ((T91._Fld595 = @P97)) AND (T92._Fld595 = @P98)))
- WHERE ((T89._Fld595 = @P99)) 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T93
- WHERE ((T93._Fld595 = @P100)) 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T94
- WHERE ((T94._Fld595 = @P101)) 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 >= @P102 AND T86._Period <= @P103 AND T86._Active = 0x01 AND T86._RecordKind = @P104)
- GROUP BY T86._RecorderTRef,
- T86._RecorderRRef,
- T86._Fld10536RRef,
- T86._Fld10538RRef,
- T86._Fld10540_TYPE,
- T86._Fld10540_RTRef,
- T86._Fld10540_RRRef
- HAVING (CAST(SUM(CASE WHEN T86._RecordKind = 0.0 THEN 0.0 ELSE T86._Fld10544 END) AS NUMERIC(27, 8))) <> 0.0) T85
- WHERE ((T85.RecorderTRef = 0x00000103) OR (T85.RecorderTRef = 0x000000FF))
- UNION ALL SELECT
- T95.Fld10332_TYPE,
- T95.Fld10332_RTRef,
- T95.Fld10332_RRRef,
- T95.Fld10328RRef,
- CAST(NULL AS NUMERIC(28, 2)),
- T95.Fld10330RRef,
- CAST(NULL AS NUMERIC(28, 2)),
- CAST(NULL AS NUMERIC(28, 2)),
- CAST(NULL AS NUMERIC(21, 2)),
- T95.Fld10334Receipt_
- FROM (SELECT
- T96._RecorderTRef AS RecorderTRef,
- T96._RecorderRRef AS RecorderRRef,
- T96._Fld10328RRef AS Fld10328RRef,
- T96._Fld10330RRef AS Fld10330RRef,
- T96._Fld10332_TYPE AS Fld10332_TYPE,
- T96._Fld10332_RTRef AS Fld10332_RTRef,
- T96._Fld10332_RRRef AS Fld10332_RRRef,
- CAST(SUM(CASE WHEN T96._RecordKind = 0.0 THEN T96._Fld10334 ELSE 0.0 END) AS NUMERIC(27, 8)) AS Fld10334Receipt_
- FROM dbo._AccumRg10327 T96
- WHERE (((T96._Fld595 = @P105)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T97
- ON ((T96._Fld10330RRef = T97._IDRRef)) AND (T97._Fld595 = @P106)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T98
- INNER JOIN dbo._Reference21 T99
- ON (((T98._Fld1685 = @P107) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T100
- WHERE ((T100._Fld595 = @P108)) AND ((T100._Fld12065RRef = T98._IDRRef) AND (T100._Fld12066RRef = T99._IDRRef)))) AND T99._IDRRef IN
- (SELECT
- T101._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T101
- INNER JOIN dbo._InfoRg9937 T102
- ON ((T102._Fld9939_TYPE = 0x08 AND T102._Fld9939_RTRef = 0x00000095 AND T102._Fld9939_RRRef = @P109) AND (T102._Fld9938_TYPE = T101._Fld784_TYPE AND T102._Fld9938_RTRef = T101._Fld784_RTRef AND T102._Fld9938_RRRef = T101._Fld784_RRRef))
- WHERE ((T101._Fld595 = @P110)) AND (T102._Fld595 = @P111)))
- WHERE ((T99._Fld595 = @P112)) 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T103
- WHERE ((T103._Fld595 = @P113)) 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T104
- WHERE ((T104._Fld595 = @P114)) 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._Period >= @P115 AND T96._Period <= @P116 AND T96._Active = 0x01 AND (0x00) = 0x01 AND T96._RecordKind = @P117)
- GROUP BY T96._RecorderTRef,
- T96._RecorderRRef,
- T96._Fld10328RRef,
- T96._Fld10330RRef,
- T96._Fld10332_TYPE,
- T96._Fld10332_RTRef,
- T96._Fld10332_RRRef
- HAVING (CAST(SUM(CASE WHEN T96._RecordKind = 0.0 THEN T96._Fld10334 ELSE 0.0 END) AS NUMERIC(27, 8))) <> 0.0) T95
- WHERE (T95.RecorderTRef = 0x000000D1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement