Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 661643688=Duration,206=Execs,Usr=55QUS,Sql="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 = ?) 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,
- 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 = ?)) AND ((T41._Fld11330 <> ?))
- 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 = ?)) 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 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T45
- INNER JOIN dbo._Reference21 T46
- ON (((T45._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T47
- WHERE ((T47._Fld595 = ?)) 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 = ?) AND (T49._Fld9938_TYPE = T48._Fld784_TYPE AND T49._Fld9938_RTRef = T48._Fld784_RTRef AND T49._Fld9938_RRRef = T48._Fld784_RRRef))
- WHERE ((T48._Fld595 = ?)) AND (T49._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T50
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T51
- 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 <> ?))
- GROUP BY T43._Fld10540_TYPE,
- T43._Fld10540_RTRef,
- T43._Fld10540_RRRef
- HAVING (CAST(SUM(T43._Fld10545) AS NUMERIC(33, 8))) <> 0.0) T42
- ON (0x08 = T42.Fld10540_TYPE AND 0x000000E9 = T42.Fld10540_RTRef AND T39._IDRRef = T42.Fld10540_RRRef)
- LEFT OUTER JOIN (SELECT
- T53.Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8)) AS Fld10346Balance_
- FROM (SELECT
- T54._Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8)) AS Fld10346Balance_
- FROM dbo._AccumRgT10349 T54
- WHERE ((T54._Fld595 = ?)) AND (T54._Period = ? AND (T54._Fld10346 <> ?) AND (T54._Fld10346 <> ?))
- GROUP BY T54._Fld10344RRef
- HAVING (CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8))) <> 0.0
- UNION ALL SELECT
- T55._Fld10344RRef AS Fld10344RRef,
- 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_
- FROM dbo._AccumRg10339 T55
- WHERE ((T55._Fld595 = ?)) AND (T55._Period >= ? AND T55._Period < ? AND T55._Active = 0x01)
- GROUP BY T55._Fld10344RRef
- 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
- GROUP BY T53.Fld10344RRef
- HAVING (CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8))) <> 0.0) T52
- ON (T39._IDRRef = T52.Fld10344RRef)
- LEFT OUTER JOIN dbo._InfoRg9134 T56
- ON ((0x08 = T56._Fld9136_TYPE AND 0x000000E9 = T56._Fld9136_RTRef AND T39._IDRRef = T56._Fld9136_RRRef)) AND (T56._Fld595 = ?)
- LEFT OUTER JOIN dbo._InfoRg11720 T57
- ON ((0x08 = T57._Fld12312_TYPE AND 0x000000E9 = T57._Fld12312_RTRef AND T39._IDRRef = T57._Fld12312_RRRef)) AND (T57._Fld595 = ?)
- LEFT OUTER JOIN (SELECT
- T59._Fld10332_TYPE AS Fld10332_TYPE,
- T59._Fld10332_RTRef AS Fld10332_RTRef,
- T59._Fld10332_RRRef AS Fld10332_RRRef,
- CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8)) AS Fld10335Balance_
- FROM dbo._AccumRgT10337 T59
- WHERE (((T59._Fld595 = ?)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T60
- ON ((T59._Fld10330RRef = T60._IDRRef)) AND (T60._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T61
- INNER JOIN dbo._Reference21 T62
- ON (((T61._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T63
- WHERE ((T63._Fld595 = ?)) AND ((T63._Fld12065RRef = T61._IDRRef) AND (T63._Fld12066RRef = T62._IDRRef)))) AND T62._IDRRef IN
- (SELECT
- T64._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T64
- INNER JOIN dbo._InfoRg9937 T65
- 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))
- WHERE ((T64._Fld595 = ?)) AND (T65._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T66
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T67
- 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 <> ?))
- GROUP BY T59._Fld10332_TYPE,
- T59._Fld10332_RTRef,
- T59._Fld10332_RRRef
- HAVING (CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8))) <> 0.0) T58
- ON (0x08 = T58.Fld10332_TYPE AND 0x000000E9 = T58.Fld10332_RTRef AND T39._IDRRef = T58.Fld10332_RRRef)
- LEFT OUTER JOIN dbo._Reference51 T68
- ON (T39._Fld4635RRef = T68._IDRRef) AND (T68._Fld595 = ?)
- WHERE (((((T39._Fld595 = ?) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T69
- ON ((T39._Fld4625RRef = T69._IDRRef)) AND (T69._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T70
- INNER JOIN dbo._Reference21 T71
- ON (((T70._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T72
- WHERE ((T72._Fld595 = ?)) AND ((T72._Fld12065RRef = T70._IDRRef) AND (T72._Fld12066RRef = T71._IDRRef)))) AND T71._IDRRef IN
- (SELECT
- T73._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T73
- INNER JOIN dbo._InfoRg9937 T74
- 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))
- WHERE ((T73._Fld595 = ?)) AND (T74._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T75
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T76
- 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 < ?
- ORDER BY (T39._Number) DESC, (T39._IDRRef) DESC
- OPTION (FAST 1)
- ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
- 284154441=Duration,422=Execs,Usr=44ABD,Sql="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._Fld4654RRef,
- T39._Fld4657RRef,
- 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,
- T57._Fld12313RRef,
- 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 = ?)) AND ((T41._Fld11330 <> ?))
- 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 = ?)) 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 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T45
- INNER JOIN dbo._Reference21 T46
- ON (((T45._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T47
- WHERE ((T47._Fld595 = ?)) 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 = ?) AND (T49._Fld9938_TYPE = T48._Fld784_TYPE AND T49._Fld9938_RTRef = T48._Fld784_RTRef AND T49._Fld9938_RRRef = T48._Fld784_RRRef))
- WHERE ((T48._Fld595 = ?)) AND (T49._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T50
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T51
- 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 <> ?))
- GROUP BY T43._Fld10540_TYPE,
- T43._Fld10540_RTRef,
- T43._Fld10540_RRRef
- HAVING (CAST(SUM(T43._Fld10545) AS NUMERIC(33, 8))) <> 0.0) T42
- ON (0x08 = T42.Fld10540_TYPE AND 0x000000E9 = T42.Fld10540_RTRef AND T39._IDRRef = T42.Fld10540_RRRef)
- LEFT OUTER JOIN (SELECT
- T53.Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8)) AS Fld10346Balance_
- FROM (SELECT
- T54._Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8)) AS Fld10346Balance_
- FROM dbo._AccumRgT10349 T54
- WHERE ((T54._Fld595 = ?)) AND (T54._Period = ? AND (T54._Fld10346 <> ?) AND (T54._Fld10346 <> ?))
- GROUP BY T54._Fld10344RRef
- HAVING (CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8))) <> 0.0
- UNION ALL SELECT
- T55._Fld10344RRef AS Fld10344RRef,
- 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_
- FROM dbo._AccumRg10339 T55
- WHERE ((T55._Fld595 = ?)) AND (T55._Period >= ? AND T55._Period < ? AND T55._Active = 0x01)
- GROUP BY T55._Fld10344RRef
- 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
- GROUP BY T53.Fld10344RRef
- HAVING (CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8))) <> 0.0) T52
- ON (T39._IDRRef = T52.Fld10344RRef)
- LEFT OUTER JOIN dbo._InfoRg9134 T56
- ON ((0x08 = T56._Fld9136_TYPE AND 0x000000E9 = T56._Fld9136_RTRef AND T39._IDRRef = T56._Fld9136_RRRef)) AND (T56._Fld595 = ?)
- LEFT OUTER JOIN dbo._InfoRg11720 T57
- ON ((0x08 = T57._Fld12312_TYPE AND 0x000000E9 = T57._Fld12312_RTRef AND T39._IDRRef = T57._Fld12312_RRRef)) AND (T57._Fld595 = ?)
- LEFT OUTER JOIN (SELECT
- T59._Fld10332_TYPE AS Fld10332_TYPE,
- T59._Fld10332_RTRef AS Fld10332_RTRef,
- T59._Fld10332_RRRef AS Fld10332_RRRef,
- CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8)) AS Fld10335Balance_
- FROM dbo._AccumRgT10337 T59
- WHERE (((T59._Fld595 = ?)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T60
- ON ((T59._Fld10330RRef = T60._IDRRef)) AND (T60._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T61
- INNER JOIN dbo._Reference21 T62
- ON (((T61._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T63
- WHERE ((T63._Fld595 = ?)) AND ((T63._Fld12065RRef = T61._IDRRef) AND (T63._Fld12066RRef = T62._IDRRef)))) AND T62._IDRRef IN
- (SELECT
- T64._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T64
- INNER JOIN dbo._InfoRg9937 T65
- 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))
- WHERE ((T64._Fld595 = ?)) AND (T65._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T66
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T67
- 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 <> ?))
- GROUP BY T59._Fld10332_TYPE,
- T59._Fld10332_RTRef,
- T59._Fld10332_RRRef
- HAVING (CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8))) <> 0.0) T58
- ON (0x08 = T58.Fld10332_TYPE AND 0x000000E9 = T58.Fld10332_RTRef AND T39._IDRRef = T58.Fld10332_RRRef)
- LEFT OUTER JOIN dbo._Reference51 T68
- ON (T39._Fld4635RRef = T68._IDRRef) AND (T68._Fld595 = ?)
- WHERE ((((T39._Fld595 = ?) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T69
- ON ((T39._Fld4625RRef = T69._IDRRef)) AND (T69._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T70
- INNER JOIN dbo._Reference21 T71
- ON (((T70._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T72
- WHERE ((T72._Fld595 = ?)) AND ((T72._Fld12065RRef = T70._IDRRef) AND (T72._Fld12066RRef = T71._IDRRef)))) AND T71._IDRRef IN
- (SELECT
- T73._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T73
- INNER JOIN dbo._InfoRg9937 T74
- 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))
- WHERE ((T73._Fld595 = ?)) AND (T74._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T75
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T76
- 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 < ?
- ORDER BY (T39._Date_Time) DESC, (T39._IDRRef) DESC
- OPTION (FAST 1)
- ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
- 159787884=Duration,293=Execs,Usr=22RAK,Sql="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 = ?) 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,
- 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 = ?)) AND ((T41._Fld11330 <> ?))
- 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 = ?)) 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 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T45
- INNER JOIN dbo._Reference21 T46
- ON (((T45._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T47
- WHERE ((T47._Fld595 = ?)) 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 = ?) AND (T49._Fld9938_TYPE = T48._Fld784_TYPE AND T49._Fld9938_RTRef = T48._Fld784_RTRef AND T49._Fld9938_RRRef = T48._Fld784_RRRef))
- WHERE ((T48._Fld595 = ?)) AND (T49._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T50
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T51
- 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 <> ?))
- GROUP BY T43._Fld10540_TYPE,
- T43._Fld10540_RTRef,
- T43._Fld10540_RRRef
- HAVING (CAST(SUM(T43._Fld10545) AS NUMERIC(33, 8))) <> 0.0) T42
- ON (0x08 = T42.Fld10540_TYPE AND 0x000000E9 = T42.Fld10540_RTRef AND T39._IDRRef = T42.Fld10540_RRRef)
- LEFT OUTER JOIN (SELECT
- T53.Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8)) AS Fld10346Balance_
- FROM (SELECT
- T54._Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8)) AS Fld10346Balance_
- FROM dbo._AccumRgT10349 T54
- WHERE ((T54._Fld595 = ?)) AND (T54._Period = ? AND (T54._Fld10346 <> ?) AND (T54._Fld10346 <> ?))
- GROUP BY T54._Fld10344RRef
- HAVING (CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8))) <> 0.0
- UNION ALL SELECT
- T55._Fld10344RRef AS Fld10344RRef,
- 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_
- FROM dbo._AccumRg10339 T55
- WHERE ((T55._Fld595 = ?)) AND (T55._Period >= ? AND T55._Period < ? AND T55._Active = 0x01)
- GROUP BY T55._Fld10344RRef
- 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
- GROUP BY T53.Fld10344RRef
- HAVING (CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8))) <> 0.0) T52
- ON (T39._IDRRef = T52.Fld10344RRef)
- LEFT OUTER JOIN dbo._InfoRg9134 T56
- ON ((0x08 = T56._Fld9136_TYPE AND 0x000000E9 = T56._Fld9136_RTRef AND T39._IDRRef = T56._Fld9136_RRRef)) AND (T56._Fld595 = ?)
- LEFT OUTER JOIN dbo._InfoRg11720 T57
- ON ((0x08 = T57._Fld12312_TYPE AND 0x000000E9 = T57._Fld12312_RTRef AND T39._IDRRef = T57._Fld12312_RRRef)) AND (T57._Fld595 = ?)
- LEFT OUTER JOIN (SELECT
- T59._Fld10332_TYPE AS Fld10332_TYPE,
- T59._Fld10332_RTRef AS Fld10332_RTRef,
- T59._Fld10332_RRRef AS Fld10332_RRRef,
- CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8)) AS Fld10335Balance_
- FROM dbo._AccumRgT10337 T59
- WHERE (((T59._Fld595 = ?)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T60
- ON ((T59._Fld10330RRef = T60._IDRRef)) AND (T60._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T61
- INNER JOIN dbo._Reference21 T62
- ON (((T61._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T63
- WHERE ((T63._Fld595 = ?)) AND ((T63._Fld12065RRef = T61._IDRRef) AND (T63._Fld12066RRef = T62._IDRRef)))) AND T62._IDRRef IN
- (SELECT
- T64._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T64
- INNER JOIN dbo._InfoRg9937 T65
- 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))
- WHERE ((T64._Fld595 = ?)) AND (T65._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T66
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T67
- 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 <> ?))
- GROUP BY T59._Fld10332_TYPE,
- T59._Fld10332_RTRef,
- T59._Fld10332_RRRef
- HAVING (CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8))) <> 0.0) T58
- ON (0x08 = T58.Fld10332_TYPE AND 0x000000E9 = T58.Fld10332_RTRef AND T39._IDRRef = T58.Fld10332_RRRef)
- LEFT OUTER JOIN dbo._Reference51 T68
- ON (T39._Fld4635RRef = T68._IDRRef) AND (T68._Fld595 = ?)
- WHERE (((((T39._Fld595 = ?) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T69
- ON ((T39._Fld4625RRef = T69._IDRRef)) AND (T69._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T70
- INNER JOIN dbo._Reference21 T71
- ON (((T70._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T72
- WHERE ((T72._Fld595 = ?)) AND ((T72._Fld12065RRef = T70._IDRRef) AND (T72._Fld12066RRef = T71._IDRRef)))) AND T71._IDRRef IN
- (SELECT
- T73._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T73
- INNER JOIN dbo._InfoRg9937 T74
- 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))
- WHERE ((T73._Fld595 = ?)) AND (T74._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T75
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T76
- 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 < ?
- ORDER BY (T39._Number) DESC, (T39._IDRRef) DESC
- OPTION (FAST 1)
- ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
- 155044730=Duration,420=Execs,Usr=44ABD,Sql="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._Fld4654RRef,
- T39._Fld4657RRef,
- 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,
- T57._Fld12313RRef,
- 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 = ?)) AND ((T41._Fld11330 <> ?))
- 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 = ?)) 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 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T45
- INNER JOIN dbo._Reference21 T46
- ON (((T45._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T47
- WHERE ((T47._Fld595 = ?)) 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 = ?) AND (T49._Fld9938_TYPE = T48._Fld784_TYPE AND T49._Fld9938_RTRef = T48._Fld784_RTRef AND T49._Fld9938_RRRef = T48._Fld784_RRRef))
- WHERE ((T48._Fld595 = ?)) AND (T49._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T50
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T51
- 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 <> ?))
- GROUP BY T43._Fld10540_TYPE,
- T43._Fld10540_RTRef,
- T43._Fld10540_RRRef
- HAVING (CAST(SUM(T43._Fld10545) AS NUMERIC(33, 8))) <> 0.0) T42
- ON (0x08 = T42.Fld10540_TYPE AND 0x000000E9 = T42.Fld10540_RTRef AND T39._IDRRef = T42.Fld10540_RRRef)
- LEFT OUTER JOIN (SELECT
- T53.Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8)) AS Fld10346Balance_
- FROM (SELECT
- T54._Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8)) AS Fld10346Balance_
- FROM dbo._AccumRgT10349 T54
- WHERE ((T54._Fld595 = ?)) AND (T54._Period = ? AND (T54._Fld10346 <> ?) AND (T54._Fld10346 <> ?))
- GROUP BY T54._Fld10344RRef
- HAVING (CAST(SUM(T54._Fld10346) AS NUMERIC(33, 8))) <> 0.0
- UNION ALL SELECT
- T55._Fld10344RRef AS Fld10344RRef,
- 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_
- FROM dbo._AccumRg10339 T55
- WHERE ((T55._Fld595 = ?)) AND (T55._Period >= ? AND T55._Period < ? AND T55._Active = 0x01)
- GROUP BY T55._Fld10344RRef
- 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
- GROUP BY T53.Fld10344RRef
- HAVING (CAST(SUM(T53.Fld10346Balance_) AS NUMERIC(38, 8))) <> 0.0) T52
- ON (T39._IDRRef = T52.Fld10344RRef)
- LEFT OUTER JOIN dbo._InfoRg9134 T56
- ON ((0x08 = T56._Fld9136_TYPE AND 0x000000E9 = T56._Fld9136_RTRef AND T39._IDRRef = T56._Fld9136_RRRef)) AND (T56._Fld595 = ?)
- LEFT OUTER JOIN dbo._InfoRg11720 T57
- ON ((0x08 = T57._Fld12312_TYPE AND 0x000000E9 = T57._Fld12312_RTRef AND T39._IDRRef = T57._Fld12312_RRRef)) AND (T57._Fld595 = ?)
- LEFT OUTER JOIN (SELECT
- T59._Fld10332_TYPE AS Fld10332_TYPE,
- T59._Fld10332_RTRef AS Fld10332_RTRef,
- T59._Fld10332_RRRef AS Fld10332_RRRef,
- CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8)) AS Fld10335Balance_
- FROM dbo._AccumRgT10337 T59
- WHERE (((T59._Fld595 = ?)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T60
- ON ((T59._Fld10330RRef = T60._IDRRef)) AND (T60._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T61
- INNER JOIN dbo._Reference21 T62
- ON (((T61._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T63
- WHERE ((T63._Fld595 = ?)) AND ((T63._Fld12065RRef = T61._IDRRef) AND (T63._Fld12066RRef = T62._IDRRef)))) AND T62._IDRRef IN
- (SELECT
- T64._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T64
- INNER JOIN dbo._InfoRg9937 T65
- 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))
- WHERE ((T64._Fld595 = ?)) AND (T65._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T66
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T67
- 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 <> ?))
- GROUP BY T59._Fld10332_TYPE,
- T59._Fld10332_RTRef,
- T59._Fld10332_RRRef
- HAVING (CAST(SUM(T59._Fld10335) AS NUMERIC(33, 8))) <> 0.0) T58
- ON (0x08 = T58.Fld10332_TYPE AND 0x000000E9 = T58.Fld10332_RTRef AND T39._IDRRef = T58.Fld10332_RRRef)
- LEFT OUTER JOIN dbo._Reference51 T68
- ON (T39._Fld4635RRef = T68._IDRRef) AND (T68._Fld595 = ?)
- WHERE ((((T39._Fld595 = ?) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T69
- ON ((T39._Fld4625RRef = T69._IDRRef)) AND (T69._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T70
- INNER JOIN dbo._Reference21 T71
- ON (((T70._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T72
- WHERE ((T72._Fld595 = ?)) AND ((T72._Fld12065RRef = T70._IDRRef) AND (T72._Fld12066RRef = T71._IDRRef)))) AND T71._IDRRef IN
- (SELECT
- T73._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T73
- INNER JOIN dbo._InfoRg9937 T74
- 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))
- WHERE ((T73._Fld595 = ?)) AND (T74._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T75
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T76
- 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 > ?
- ORDER BY (T39._Date_Time), (T39._IDRRef)
- OPTION (FAST 1)
- ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
- 109594766=Duration,581=Execs,Usr=00SHJ1,Sql="SELECT TOP 25
- T1._IDRRef,
- T1._Marked,
- T1._Number,
- T1._Date_Time,
- T1._Posted,
- T1._Fld4621RRef,
- T1._Fld4622RRef,
- T1._Fld4625RRef,
- T1._Fld4627RRef,
- T1._Fld4633,
- T1._Fld4635RRef,
- T1._Fld4657RRef,
- 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,
- T19._Fld12313RRef,
- T1._Fld13369,
- 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,
- T30._Fld1191
- FROM dbo._Document233 T1
- LEFT OUTER JOIN (SELECT
- T3._Fld11328RRef AS Fld11328RRef,
- CAST(SUM(T3._Fld11330) AS NUMERIC(33, 8)) AS Fld11330Turnover_
- FROM dbo._AccumRgTn11332 T3
- WHERE ((T3._Fld595 = ?)) AND (((T3._Fld11324RRef = ?)) AND (T3._Fld11330 <> ?))
- GROUP BY T3._Fld11328RRef
- HAVING (CAST(SUM(T3._Fld11330) AS NUMERIC(33, 8))) <> 0.0) T2
- ON (T1._IDRRef = T2.Fld11328RRef)
- LEFT OUTER JOIN (SELECT
- T5._Fld10540_TYPE AS Fld10540_TYPE,
- T5._Fld10540_RTRef AS Fld10540_RTRef,
- T5._Fld10540_RRRef AS Fld10540_RRRef,
- CAST(SUM(T5._Fld10545) AS NUMERIC(33, 8)) AS Fld10545Balance_
- FROM dbo._AccumRgT10549 T5
- WHERE (((T5._Fld595 = ?)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T6
- ON ((T5._Fld10538RRef = T6._IDRRef)) AND (T6._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T7
- INNER JOIN dbo._Reference21 T8
- ON (((T7._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T9
- WHERE ((T9._Fld595 = ?)) AND ((T9._Fld12065RRef = T7._IDRRef) AND (T9._Fld12066RRef = T8._IDRRef)))) AND T8._IDRRef IN
- (SELECT
- T10._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T10
- INNER JOIN dbo._InfoRg9937 T11
- 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))
- WHERE ((T10._Fld595 = ?)) AND (T11._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T12
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T13
- 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 <> ?))
- GROUP BY T5._Fld10540_TYPE,
- T5._Fld10540_RTRef,
- T5._Fld10540_RRRef
- HAVING (CAST(SUM(T5._Fld10545) AS NUMERIC(33, 8))) <> 0.0) T4
- ON (0x08 = T4.Fld10540_TYPE AND 0x000000E9 = T4.Fld10540_RTRef AND T1._IDRRef = T4.Fld10540_RRRef)
- LEFT OUTER JOIN (SELECT
- T15.Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T15.Fld10346Balance_) AS NUMERIC(38, 8)) AS Fld10346Balance_
- FROM (SELECT
- T16._Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T16._Fld10346) AS NUMERIC(33, 8)) AS Fld10346Balance_
- FROM dbo._AccumRgT10349 T16
- WHERE ((T16._Fld595 = ?)) AND (T16._Period = ? AND ((T16._Fld10340RRef = ?)) AND (T16._Fld10346 <> ?) AND (T16._Fld10346 <> ?))
- GROUP BY T16._Fld10344RRef
- HAVING (CAST(SUM(T16._Fld10346) AS NUMERIC(33, 8))) <> 0.0
- UNION ALL SELECT
- T17._Fld10344RRef AS Fld10344RRef,
- 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_
- FROM dbo._AccumRg10339 T17
- WHERE ((T17._Fld595 = ?)) AND (T17._Period >= ? AND T17._Period < ? AND T17._Active = 0x01 AND ((T17._Fld10340RRef = ?)))
- GROUP BY T17._Fld10344RRef
- 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
- GROUP BY T15.Fld10344RRef
- HAVING (CAST(SUM(T15.Fld10346Balance_) AS NUMERIC(38, 8))) <> 0.0) T14
- ON (T1._IDRRef = T14.Fld10344RRef)
- LEFT OUTER JOIN dbo._InfoRg9134 T18
- ON ((0x08 = T18._Fld9136_TYPE AND 0x000000E9 = T18._Fld9136_RTRef AND T1._IDRRef = T18._Fld9136_RRRef)) AND (T18._Fld595 = ?)
- LEFT OUTER JOIN dbo._InfoRg11720 T19
- ON ((0x08 = T19._Fld12312_TYPE AND 0x000000E9 = T19._Fld12312_RTRef AND T1._IDRRef = T19._Fld12312_RRRef)) AND (T19._Fld595 = ?)
- LEFT OUTER JOIN (SELECT
- T21._Fld10332_TYPE AS Fld10332_TYPE,
- T21._Fld10332_RTRef AS Fld10332_RTRef,
- T21._Fld10332_RRRef AS Fld10332_RRRef,
- CAST(SUM(T21._Fld10335) AS NUMERIC(33, 8)) AS Fld10335Balance_
- FROM dbo._AccumRgT10337 T21
- WHERE (((T21._Fld595 = ?)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T22
- ON ((T21._Fld10330RRef = T22._IDRRef)) AND (T22._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T23
- INNER JOIN dbo._Reference21 T24
- ON (((T23._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T25
- WHERE ((T25._Fld595 = ?)) AND ((T25._Fld12065RRef = T23._IDRRef) AND (T25._Fld12066RRef = T24._IDRRef)))) AND T24._IDRRef IN
- (SELECT
- T26._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T26
- INNER JOIN dbo._InfoRg9937 T27
- 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))
- WHERE ((T26._Fld595 = ?)) AND (T27._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T28
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T29
- 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 <> ?))
- GROUP BY T21._Fld10332_TYPE,
- T21._Fld10332_RTRef,
- T21._Fld10332_RRRef
- HAVING (CAST(SUM(T21._Fld10335) AS NUMERIC(33, 8))) <> 0.0) T20
- ON (0x08 = T20.Fld10332_TYPE AND 0x000000E9 = T20.Fld10332_RTRef AND T1._IDRRef = T20.Fld10332_RRRef)
- LEFT OUTER JOIN dbo._Reference51 T30
- ON (T1._Fld4635RRef = T30._IDRRef) AND (T30._Fld595 = ?)
- WHERE (((T1._Fld595 = ?)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T31
- ON ((T1._Fld4625RRef = T31._IDRRef)) AND (T31._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T32
- INNER JOIN dbo._Reference21 T33
- ON (((T32._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T34
- WHERE ((T34._Fld595 = ?)) AND ((T34._Fld12065RRef = T32._IDRRef) AND (T34._Fld12066RRef = T33._IDRRef)))) AND T33._IDRRef IN
- (SELECT
- T35._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T35
- INNER JOIN dbo._InfoRg9937 T36
- 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))
- WHERE ((T35._Fld595 = ?)) AND (T36._Fld595 = ?)))
- 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
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T37
- 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
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T38
- 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 < ?))))
- 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
- ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement