Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- )SELECT TOP 45
- T7._IDRRef,
- T7._Marked,
- T7._Number,
- T7._Date_Time,
- T7._Posted,
- T7._Fld4621RRef,
- T7._Fld4622RRef,
- T7._Fld4625RRef,
- T7._Fld4633,
- T7._Fld4635RRef,
- T7._Fld4657RRef,
- CASE WHEN ((T7._Fld4657RRef = @P1) AND T7._Posted = 0x01) THEN CASE WHEN (ISNULL(CAST(T20.Fld10346Balance_ AS NUMERIC(33, 2)),0.0) > 0.0) THEN CASE WHEN (ISNULL(CAST(T8.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T10.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 4.0 WHEN ((ISNULL(CAST(T10.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T8.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T8.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T10.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 6.0 ELSE 5.0 END ELSE CASE WHEN (ISNULL(CAST(T8.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T10.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 0.0 WHEN ((ISNULL(CAST(T10.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T8.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T8.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T10.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 2.0 ELSE 1.0 END END ELSE 7.0 END,
- T25._Fld12313RRef,
- T7._Fld13369,
- CASE WHEN ((ISNULL(CAST(T26.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T10.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) > 0.0) THEN (ISNULL(CAST(T26.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T10.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) ELSE 0.0 END,
- T36._Fld1191
- FROM dbo._Document233 T7
- LEFT OUTER JOIN (SELECT
- T9._Fld11328RRef AS Fld11328RRef,
- CAST(SUM(T9._Fld11330) AS NUMERIC(33, 8)) AS Fld11330Turnover_
- FROM dbo._AccumRgTn11332 T9
- WHERE ((T9._Fld595 = @P2)) AND ((T9._Fld11330 <> @P3))
- GROUP BY T9._Fld11328RRef
- HAVING (CAST(SUM(T9._Fld11330) AS NUMERIC(33, 8))) <> 0.0) T8
- ON (T7._IDRRef = T8.Fld11328RRef)
- LEFT OUTER JOIN (SELECT
- T11._Fld10540_TYPE AS Fld10540_TYPE,
- T11._Fld10540_RTRef AS Fld10540_RTRef,
- T11._Fld10540_RRRef AS Fld10540_RRRef,
- CAST(SUM(T11._Fld10545) AS NUMERIC(33, 8)) AS Fld10545Balance_
- FROM dbo._AccumRgT10549 T11
- WHERE (((T11._Fld595 = @P4)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T12
- ON ((T11._Fld10538RRef = T12._IDRRef)) AND (T12._Fld595 = @P5)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T13
- INNER JOIN dbo._Reference21 T14
- ON (((T13._Fld1685 = @P6) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T15
- WHERE ((T15._Fld595 = @P7)) AND ((T15._Fld12065RRef = T13._IDRRef) AND (T15._Fld12066RRef = T14._IDRRef)))) AND T14._IDRRef IN
- (SELECT
- T16._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T16
- INNER JOIN dbo._InfoRg9937 T17
- ON ((T17._Fld9939_TYPE = 0x08 AND T17._Fld9939_RTRef = 0x00000095 AND T17._Fld9939_RRRef = @P8) AND (T17._Fld9938_TYPE = T16._Fld784_TYPE AND T17._Fld9938_RTRef = T16._Fld784_RTRef AND T17._Fld9938_RRRef = T16._Fld784_RRRef))
- WHERE ((T16._Fld595 = @P9)) AND (T17._Fld595 = @P10)))
- WHERE ((T14._Fld595 = @P11)) AND ((CASE WHEN T12._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T12._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T18
- WHERE ((T18._Fld595 = @P12)) AND ((T18._Fld12072RRef = T14._IDRRef) AND (T18._Fld12073_TYPE = CASE WHEN T12._Fld12836RRef IS NOT NULL THEN 0x08 END AND T18._Fld12073_RTRef = CASE WHEN T12._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T18._Fld12073_RRRef = T12._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T19
- WHERE ((T19._Fld595 = @P13)) AND ((T19._Fld12199RRef = T14._IDRRef) AND T19._Fld12200_TYPE = CASE WHEN T12._Fld12836RRef IS NOT NULL THEN 0x08 END AND T19._Fld12200_RTRef = CASE WHEN T12._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T19._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T11._Period = @P14 AND (
Add Comment
Please, Sign In to add comment