Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- )SELECT TOP 25
- T39._IDRRef,
- T39._Marked,
- T39._Number,
- T39._Date_Time,
- T39._Posted,
- T39._Fld4621RRef,
- T39._Fld4622RRef,
- T39._Fld4625RRef,
- T39._Fld4633,
- T39._Fld4635RRef,
- T39._Fld4657RRef,
- CASE WHEN ((T39._Fld4657RRef = @P1) 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,
- T57._Fld12313RRef,
- T39._Fld13369,
- 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,
- T68._Fld1191
- FROM dbo._Document233 T39
- LEFT OUTER JOIN (SELECT
- T41._Fld11328RRef AS Fld11328RRef,
- CAST(SUM(T41._Fld11330) AS NUMERIC(33, 8)) AS Fld11330Turnover_
- FROM dbo._AccumRgTn11332 T41
- WHERE ((T41._Fld595 = @P2)) AND ((T41._Fld11330 <> @P3))
- GROUP BY T41._Fld11328RRef
- HAVING (CAST(SUM(T41._Fld11330) AS NUMERIC(33, 8))) <> 0.0) T40
- ON (T39._IDRRef = T40.Fld11328RRef)
- LEFT OUTER JOIN (SELECT
- T43._Fld10540_TYPE AS Fld10540_TYPE,
- T43._Fld10540_RTRef AS Fld10540_RTRef,
- T43._Fld10540_RRRef AS Fld10540_RRRef,
- CAST(SUM(T43._Fld10545) AS NUMERIC(33, 8)) AS Fld10545Balance_
- FROM dbo._AccumRgT10549 T43
- WHERE (((T43._Fld595 = @P4)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T44
- ON ((T43._Fld10538RRef = T44._IDRRef)) AND (T44._Fld595 = @P5)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T45
- INNER JOIN dbo._Reference21 T46
- ON (((T45._Fld1685 = @P6) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T47
- WHERE ((T47._Fld595 = @P7)) AND ((T47._Fld12065RRef = T45._IDRRef) AND (T47._Fld12066RRef = T46._IDRRef)))) AND T46._IDRRef IN
- (SELECT
- T48._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T48
- INNER JOIN dbo._InfoRg9937 T49
- ON ((T49._Fld9939_TYPE = 0x08 AND T49._Fld9939_RTRef = 0x00000095 AND T49._Fld9939_RRRef = @P8) AND (T49._Fld9938_TYPE = T48._Fld784_TYPE AND T49._Fld9938_RTRef = T48._Fld784_RTRef AND T49._Fld9938_RRRef = T48._Fld784_RRRef))
- WHERE ((T48._Fld595 = @P9)) AND (T49._Fld595 = @P10)))
- WHERE ((T46._Fld595 = @P11)) 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T50
- WHERE ((T50._Fld595 = @P12)) 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T51
- WHERE ((T51._Fld595 = @P13)) 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)))))
Add Comment
Please, Sign In to add comment