Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 28609334.000 "SELECT TOP 25
- T80._IDRRef,
- T80._Marked,
- T80._Number,
- T80._Date_Time,
- T80._Posted,
- T80._Fld4621RRef,
- T80._Fld4622RRef,
- T80._Fld4625RRef,
- T80._Fld4633,
- T80._Fld4635RRef,
- T80._Fld4657RRef,
- CASE WHEN ((T80._Fld4657RRef = ?) AND T80._Posted = 0x01) THEN CASE WHEN (ISNULL(CAST(T97.Fld10346Balance_ AS NUMERIC(33, 2)),0.0) > 0.0) THEN CASE WHEN (ISNULL(CAST(T81.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T83.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 4.0 WHEN ((ISNULL(CAST(T83.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T81.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T81.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T83.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 6.0 ELSE 5.0 END ELSE CASE WHEN (ISNULL(CAST(T81.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) = ISNULL(CAST(T83.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 0.0 WHEN ((ISNULL(CAST(T83.Fld10545Balance_ AS NUMERIC(27, 2)),0.0) = 0.0) AND (ISNULL(CAST(T81.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) > 0.0)) THEN 3.0 WHEN ((CAST(ISNULL(CAST(T81.Fld11330Turnover_ AS NUMERIC(27, 2)),0.0) AS NUMERIC(33, 8)) / 2.0) > ISNULL(CAST(T83.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) THEN 2.0 ELSE 1.0 END END ELSE 7.0 END,
- T102._Fld12313RRef,
- T80._Fld13369,
- CASE WHEN ((ISNULL(CAST(T103.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T83.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) > 0.0) THEN (ISNULL(CAST(T103.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T83.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) ELSE 0.0 END,
- T117._Fld1191
- FROM dbo._Document233 T80
- LEFT OUTER JOIN (SELECT
- T82._Fld11328RRef AS Fld11328RRef,
- CAST(SUM(T82._Fld11330) AS NUMERIC(33, 8)) AS Fld11330Turnover_
- FROM dbo._AccumRgTn11332 T82
- WHERE ((T82._Fld595 = ?)) AND ((T82._Fld11330 <> ?))
- GROUP BY T82._Fld11328RRef
- HAVING (CAST(SUM(T82._Fld11330) AS NUMERIC(33, 8))) <> 0.0) T81
- ON (T80._IDRRef = T81.Fld11328RRef)
- LEFT OUTER JOIN (SELECT
- T84._Fld10540_TYPE AS Fld10540_TYPE,
- T84._Fld10540_RTRef AS Fld10540_RTRef,
- T84._Fld10540_RRRef AS Fld10540_RRRef,
- CAST(SUM(T84._Fld10545) AS NUMERIC(33, 8)) AS Fld10545Balance_
- FROM dbo._AccumRgT10549 T84
- WHERE (((T84._Fld595 = ?)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T85
- ON ((T84._Fld10538RRef = T85._IDRRef)) AND (T85._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T86
- INNER JOIN dbo._Reference21 T87
- ON (((T86._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_008_F_000_
- FROM dbo._InfoRg11709 T88
- WHERE ((T88._Fld595 = ?)) AND ((T88._Fld12065RRef = T86._IDRRef) AND (T88._Fld12066RRef = T87._IDRRef)))) AND T87._IDRRef IN
- (SELECT
- T89._Reference21_IDRRef AS Q_009_F_000RRef
- FROM dbo._Reference21_VT782 T89
- INNER JOIN dbo._InfoRg9937 T90
- ON ((T90._Fld9939_TYPE = 0x08 AND T90._Fld9939_RTRef = 0x00000095 AND T90._Fld9939_RRRef = ?) AND (T90._Fld9938_TYPE = T89._Fld784_TYPE AND T90._Fld9938_RTRef = T89._Fld784_RTRef AND T90._Fld9938_RRRef = T89._Fld784_RRRef))
- WHERE ((T89._Fld595 = ?)) AND (T90._Fld595 = ?)))
- WHERE ((T87._Fld595 = ?)) AND (((((CASE WHEN T85._Fld1040RRef IS NULL THEN 0x01 ELSE CASE WHEN T85._Fld1040RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T91
- WHERE ((T91._Fld595 = ?)) AND ((T91._Fld12072RRef = T87._IDRRef) AND (T91._Fld12073_TYPE = CASE WHEN T85._Fld1040RRef IS NOT NULL THEN 0x08 END AND T91._Fld12073_RTRef = CASE WHEN T85._Fld1040RRef IS NOT NULL THEN 0x00000040 END AND T91._Fld12073_RRRef = T85._Fld1040RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T92
- WHERE ((T92._Fld595 = ?)) AND ((T92._Fld12199RRef = T87._IDRRef) AND T92._Fld12200_TYPE = CASE WHEN T85._Fld1040RRef IS NOT NULL THEN 0x08 END AND T92._Fld12200_RTRef = CASE WHEN T85._Fld1040RRef IS NOT NULL THEN 0x00000040 END AND (T92._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)) OR ((CASE WHEN T85._Fld12739RRef IS NULL THEN 0x01 ELSE CASE WHEN T85._Fld12739RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11710 T93
- WHERE ((T93._Fld595 = ?)) AND ((T93._Fld12072RRef = T87._IDRRef) AND (T93._Fld12073_TYPE = CASE WHEN T85._Fld12739RRef IS NOT NULL THEN 0x08 END AND T93._Fld12073_RTRef = CASE WHEN T85._Fld12739RRef IS NOT NULL THEN 0x00000040 END AND T93._Fld12073_RRRef = T85._Fld12739RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_005_F_000_
- FROM dbo._InfoRg11715 T94
- WHERE ((T94._Fld595 = ?)) AND ((T94._Fld12199RRef = T87._IDRRef) AND T94._Fld12200_TYPE = CASE WHEN T85._Fld12739RRef IS NOT NULL THEN 0x08 END AND T94._Fld12200_RTRef = CASE WHEN T85._Fld12739RRef IS NOT NULL THEN 0x00000040 END AND (T94._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))) OR ((CASE WHEN T85._Fld12740RRef IS NULL THEN 0x01 ELSE CASE WHEN T85._Fld12740RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_006_F_000_
- FROM dbo._InfoRg11710 T95
- WHERE ((T95._Fld595 = ?)) AND ((T95._Fld12072RRef = T87._IDRRef) AND (T95._Fld12073_TYPE = CASE WHEN T85._Fld12740RRef IS NOT NULL THEN 0x08 END AND T95._Fld12073_RTRef = CASE WHEN T85._Fld12740RRef IS NOT NULL THEN 0x00000040 END AND T95._Fld12073_RRRef = T85._Fld12740RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_007_F_000_
- FROM dbo._InfoRg11715 T96
- WHERE ((T96._Fld595 = ?)) AND ((T96._Fld12199RRef = T87._IDRRef) AND T96._Fld12200_TYPE = CASE WHEN T85._Fld12740RRef IS NOT NULL THEN 0x08 END AND T96._Fld12200_RTRef = CASE WHEN T85._Fld12740RRef IS NOT NULL THEN 0x00000040 END AND (T96._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))))) AND (T84._Period = ? AND (T84._Fld10545 <> ?) AND (T84._Fld10545 <> ?))
- GROUP BY T84._Fld10540_TYPE,
- T84._Fld10540_RTRef,
- T84._Fld10540_RRRef
- HAVING (CAST(SUM(T84._Fld10545) AS NUMERIC(33, 8))) <> 0.0) T83
- ON (0x08 = T83.Fld10540_TYPE AND 0x000000E9 = T83.Fld10540_RTRef AND T80._IDRRef = T83.Fld10540_RRRef)
- LEFT OUTER JOIN (SELECT
- T98.Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T98.Fld10346Balance_) AS NUMERIC(38, 8)) AS Fld10346Balance_
- FROM (SELECT
- T99._Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T99._Fld10346) AS NUMERIC(33, 8)) AS Fld10346Balance_
- FROM dbo._AccumRgT10349 T99
- WHERE ((T99._Fld595 = ?)) AND (T99._Period = ? AND (T99._Fld10346 <> ?) AND (T99._Fld10346 <> ?))
- GROUP BY T99._Fld10344RRef
- HAVING (CAST(SUM(T99._Fld10346) AS NUMERIC(33, 8))) <> 0.0
- UNION ALL SELECT
- T100._Fld10344RRef AS Fld10344RRef,
- CAST(CAST(SUM(CASE WHEN T100._RecordKind = 0.0 THEN -T100._Fld10346 ELSE T100._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2)) AS Fld10346Balance_
- FROM dbo._AccumRg10339 T100
- WHERE ((T100._Fld595 = ?)) AND (T100._Period >= ? AND T100._Period < ? AND T100._Active = 0x01)
- GROUP BY T100._Fld10344RRef
- HAVING (CAST(CAST(SUM(CASE WHEN T100._RecordKind = 0.0 THEN -T100._Fld10346 ELSE T100._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2))) <> 0.0) T98
- GROUP BY T98.Fld10344RRef
- HAVING (CAST(SUM(T98.Fld10346Balance_) AS NUMERIC(38, 8))) <> 0.0) T97
- ON (T80._IDRRef = T97.Fld10344RRef)
- LEFT OUTER JOIN dbo._InfoRg9134 T101
- ON ((0x08 = T101._Fld9136_TYPE AND 0x000000E9 = T101._Fld9136_RTRef AND T80._IDRRef = T101._Fld9136_RRRef)) AND (T101._Fld595 = ?)
- LEFT OUTER JOIN dbo._InfoRg11720 T102
- ON ((0x08 = T102._Fld12312_TYPE AND 0x000000E9 = T102._Fld12312_RTRef AND T80._IDRRef = T102._Fld12312_RRRef)) AND (T102._Fld595 = ?)
- LEFT OUTER JOIN (SELECT
- T104._Fld10332_TYPE AS Fld10332_TYPE,
- T104._Fld10332_RTRef AS Fld10332_RTRef,
- T104._Fld10332_RRRef AS Fld10332_RRRef,
- CAST(SUM(T104._Fld10335) AS NUMERIC(33, 8)) AS Fld10335Balance_
- FROM dbo._AccumRgT10337 T104
- WHERE (((T104._Fld595 = ?)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T105
- ON ((T104._Fld10330RRef = T105._IDRRef)) AND (T105._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T106
- INNER JOIN dbo._Reference21 T107
- ON (((T106._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_008_F_000_
- FROM dbo._InfoRg11709 T108
- WHERE ((T108._Fld595 = ?)) AND ((T108._Fld12065RRef = T106._IDRRef) AND (T108._Fld12066RRef = T107._IDRRef)))) AND T107._IDRRef IN
- (SELECT
- T109._Reference21_IDRRef AS Q_009_F_000RRef
- FROM dbo._Reference21_VT782 T109
- INNER JOIN dbo._InfoRg9937 T110
- ON ((T110._Fld9939_TYPE = 0x08 AND T110._Fld9939_RTRef = 0x00000095 AND T110._Fld9939_RRRef = ?) AND (T110._Fld9938_TYPE = T109._Fld784_TYPE AND T110._Fld9938_RTRef = T109._Fld784_RTRef AND T110._Fld9938_RRRef = T109._Fld784_RRRef))
- WHERE ((T109._Fld595 = ?)) AND (T110._Fld595 = ?)))
- WHERE ((T107._Fld595 = ?)) AND (((((CASE WHEN T105._Fld1040RRef IS NULL THEN 0x01 ELSE CASE WHEN T105._Fld1040RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T111
- WHERE ((T111._Fld595 = ?)) AND ((T111._Fld12072RRef = T107._IDRRef) AND (T111._Fld12073_TYPE = CASE WHEN T105._Fld1040RRef IS NOT NULL THEN 0x08 END AND T111._Fld12073_RTRef = CASE WHEN T105._Fld1040RRef IS NOT NULL THEN 0x00000040 END AND T111._Fld12073_RRRef = T105._Fld1040RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T112
- WHERE ((T112._Fld595 = ?)) AND ((T112._Fld12199RRef = T107._IDRRef) AND T112._Fld12200_TYPE = CASE WHEN T105._Fld1040RRef IS NOT NULL THEN 0x08 END AND T112._Fld12200_RTRef = CASE WHEN T105._Fld1040RRef IS NOT NULL THEN 0x00000040 END AND (T112._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)) OR ((CASE WHEN T105._Fld12739RRef IS NULL THEN 0x01 ELSE CASE WHEN T105._Fld12739RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11710 T113
- WHERE ((T113._Fld595 = ?)) AND ((T113._Fld12072RRef = T107._IDRRef) AND (T113._Fld12073_TYPE = CASE WHEN T105._Fld12739RRef IS NOT NULL THEN 0x08 END AND T113._Fld12073_RTRef = CASE WHEN T105._Fld12739RRef IS NOT NULL THEN 0x00000040 END AND T113._Fld12073_RRRef = T105._Fld12739RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_005_F_000_
- FROM dbo._InfoRg11715 T114
- WHERE ((T114._Fld595 = ?)) AND ((T114._Fld12199RRef = T107._IDRRef) AND T114._Fld12200_TYPE = CASE WHEN T105._Fld12739RRef IS NOT NULL THEN 0x08 END AND T114._Fld12200_RTRef = CASE WHEN T105._Fld12739RRef IS NOT NULL THEN 0x00000040 END AND (T114._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))) OR ((CASE WHEN T105._Fld12740RRef IS NULL THEN 0x01 ELSE CASE WHEN T105._Fld12740RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_006_F_000_
- FROM dbo._InfoRg11710 T115
- WHERE ((T115._Fld595 = ?)) AND ((T115._Fld12072RRef = T107._IDRRef) AND (T115._Fld12073_TYPE = CASE WHEN T105._Fld12740RRef IS NOT NULL THEN 0x08 END AND T115._Fld12073_RTRef = CASE WHEN T105._Fld12740RRef IS NOT NULL THEN 0x00000040 END AND T115._Fld12073_RRRef = T105._Fld12740RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_007_F_000_
- FROM dbo._InfoRg11715 T116
- WHERE ((T116._Fld595 = ?)) AND ((T116._Fld12199RRef = T107._IDRRef) AND T116._Fld12200_TYPE = CASE WHEN T105._Fld12740RRef IS NOT NULL THEN 0x08 END AND T116._Fld12200_RTRef = CASE WHEN T105._Fld12740RRef IS NOT NULL THEN 0x00000040 END AND (T116._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))))) AND (T104._Period = ? AND (T104._Fld10335 <> ?) AND (T104._Fld10335 <> ?))
- GROUP BY T104._Fld10332_TYPE,
- T104._Fld10332_RTRef,
- T104._Fld10332_RRRef
- HAVING (CAST(SUM(T104._Fld10335) AS NUMERIC(33, 8))) <> 0.0) T103
- ON (0x08 = T103.Fld10332_TYPE AND 0x000000E9 = T103.Fld10332_RTRef AND T80._IDRRef = T103.Fld10332_RRRef)
- LEFT OUTER JOIN dbo._Reference51 T117
- ON (T80._Fld4635RRef = T117._IDRRef) AND (T117._Fld595 = ?)
- LEFT OUTER JOIN dbo._Reference28 T118
- ON (T80._Fld4621RRef = T118._IDRRef) AND (T118._Fld595 = ?)
- LEFT OUTER JOIN (SELECT
- T120._Folder AS Folder_,
- T120._Fld1040RRef AS Fld1040RRef,
- T120._Fld12739RRef AS Fld12739RRef,
- T120._IDRRef AS IDRRef,
- T120._Description COLLATE Latin1_General_CI_AS AS Description_,
- T120._Fld12740RRef AS Fld12740RRef,
- T120._Fld595 AS Fld595_
- FROM dbo._Reference42 T120
- WHERE ((((T120._Folder = 0x00) OR EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T121
- INNER JOIN dbo._Reference21 T122
- ON (((T121._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_008_F_000_
- FROM dbo._InfoRg11709 T123
- WHERE ((T123._Fld595 = ?)) AND ((T123._Fld12065RRef = T121._IDRRef) AND (T123._Fld12066RRef = T122._IDRRef)))) AND T122._IDRRef IN
- (SELECT
- T124._Reference21_IDRRef AS Q_009_F_000RRef
- FROM dbo._Reference21_VT782 T124
- INNER JOIN dbo._InfoRg9937 T125
- ON ((T125._Fld9939_TYPE = 0x08 AND T125._Fld9939_RTRef = 0x00000095 AND T125._Fld9939_RRRef = ?) AND (T125._Fld9938_TYPE = T124._Fld784_TYPE AND T125._Fld9938_RTRef = T124._Fld784_RTRef AND T125._Fld9938_RRRef = T124._Fld784_RRRef))
- WHERE ((T124._Fld595 = ?)) AND (T125._Fld595 = ?)))
- WHERE ((T122._Fld595 = ?)) AND (((((CASE WHEN T120._Fld1040RRef IS NULL THEN 0x01 ELSE CASE WHEN T120._Fld1040RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T126
- WHERE ((T126._Fld595 = ?)) AND ((T126._Fld12072RRef = T122._IDRRef) AND (T126._Fld12073_TYPE = CASE WHEN T120._Fld1040RRef IS NOT NULL THEN 0x08 END AND T126._Fld12073_RTRef = CASE WHEN T120._Fld1040RRef IS NOT NULL THEN 0x00000040 END AND T126._Fld12073_RRRef = T120._Fld1040RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T127
- WHERE ((T127._Fld595 = ?)) AND ((T127._Fld12199RRef = T122._IDRRef) AND T127._Fld12200_TYPE = CASE WHEN T120._Fld1040RRef IS NOT NULL THEN 0x08 END AND T127._Fld12200_RTRef = CASE WHEN T120._Fld1040RRef IS NOT NULL THEN 0x00000040 END AND (T127._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)) OR ((CASE WHEN T120._Fld12739RRef IS NULL THEN 0x01 ELSE CASE WHEN T120._Fld12739RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11710 T128
- WHERE ((T128._Fld595 = ?)) AND ((T128._Fld12072RRef = T122._IDRRef) AND (T128._Fld12073_TYPE = CASE WHEN T120._Fld12739RRef IS NOT NULL THEN 0x08 END AND T128._Fld12073_RTRef = CASE WHEN T120._Fld12739RRef IS NOT NULL THEN 0x00000040 END AND T128._Fld12073_RRRef = T120._Fld12739RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_005_F_000_
- FROM dbo._InfoRg11715 T129
- WHERE ((T129._Fld595 = ?)) AND ((T129._Fld12199RRef = T122._IDRRef) AND T129._Fld12200_TYPE = CASE WHEN T120._Fld12739RRef IS NOT NULL THEN 0x08 END AND T129._Fld12200_RTRef = CASE WHEN T120._Fld12739RRef IS NOT NULL THEN 0x00000040 END AND (T129._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))) OR ((CASE WHEN T120._Fld12740RRef IS NULL THEN 0x01 ELSE CASE WHEN T120._Fld12740RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_006_F_000_
- FROM dbo._InfoRg11710 T130
- WHERE ((T130._Fld595 = ?)) AND ((T130._Fld12072RRef = T122._IDRRef) AND (T130._Fld12073_TYPE = CASE WHEN T120._Fld12740RRef IS NOT NULL THEN 0x08 END AND T130._Fld12073_RTRef = CASE WHEN T120._Fld12740RRef IS NOT NULL THEN 0x00000040 END AND T130._Fld12073_RRRef = T120._Fld12740RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_007_F_000_
- FROM dbo._InfoRg11715 T131
- WHERE ((T131._Fld595 = ?)) AND ((T131._Fld12199RRef = T122._IDRRef) AND T131._Fld12200_TYPE = CASE WHEN T120._Fld12740RRef IS NOT NULL THEN 0x08 END AND T131._Fld12200_RTRef = CASE WHEN T120._Fld12740RRef IS NOT NULL THEN 0x00000040 END AND (T131._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))))) AND (T120._Fld595 = ?)) T119
- ON T80._Fld4625RRef = T119.IDRRef
- LEFT OUTER JOIN (SELECT
- T133._Fld5085RRef AS Fld5085RRef,
- T133._IDRRef AS IDRRef,
- T133._Number COLLATE Latin1_General_CI_AS AS Number_,
- T133._Fld595 AS Fld595_
- FROM dbo._Document240 T133
- WHERE ((EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T134
- ON ((T133._Fld5085RRef = T134._IDRRef)) AND (T134._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T135
- INNER JOIN dbo._Reference21 T136
- ON (((T135._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_008_F_000_
- FROM dbo._InfoRg11709 T137
- WHERE ((T137._Fld595 = ?)) AND ((T137._Fld12065RRef = T135._IDRRef) AND (T137._Fld12066RRef = T136._IDRRef)))) AND T136._IDRRef IN
- (SELECT
- T138._Reference21_IDRRef AS Q_009_F_000RRef
- FROM dbo._Reference21_VT782 T138
- INNER JOIN dbo._InfoRg9937 T139
- ON ((T139._Fld9939_TYPE = 0x08 AND T139._Fld9939_RTRef = 0x00000095 AND T139._Fld9939_RRRef = ?) AND (T139._Fld9938_TYPE = T138._Fld784_TYPE AND T139._Fld9938_RTRef = T138._Fld784_RTRef AND T139._Fld9938_RRRef = T138._Fld784_RRRef))
- WHERE ((T138._Fld595 = ?)) AND (T139._Fld595 = ?)))
- WHERE ((T136._Fld595 = ?)) AND (((((CASE WHEN T134._Fld1040RRef IS NULL THEN 0x01 ELSE CASE WHEN T134._Fld1040RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T140
- WHERE ((T140._Fld595 = ?)) AND ((T140._Fld12072RRef = T136._IDRRef) AND (T140._Fld12073_TYPE = CASE WHEN T134._Fld1040RRef IS NOT NULL THEN 0x08 END AND T140._Fld12073_RTRef = CASE WHEN T134._Fld1040RRef IS NOT NULL THEN 0x00000040 END AND T140._Fld12073_RRRef = T134._Fld1040RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T141
- WHERE ((T141._Fld595 = ?)) AND ((T141._Fld12199RRef = T136._IDRRef) AND T141._Fld12200_TYPE = CASE WHEN T134._Fld1040RRef IS NOT NULL THEN 0x08 END AND T141._Fld12200_RTRef = CASE WHEN T134._Fld1040RRef IS NOT NULL THEN 0x00000040 END AND (T141._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)) OR ((CASE WHEN T134._Fld12739RRef IS NULL THEN 0x01 ELSE CASE WHEN T134._Fld12739RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11710 T142
- WHERE ((T142._Fld595 = ?)) AND ((T142._Fld12072RRef = T136._IDRRef) AND (T142._Fld12073_TYPE = CASE WHEN T134._Fld12739RRef IS NOT NULL THEN 0x08 END AND T142._Fld12073_RTRef = CASE WHEN T134._Fld12739RRef IS NOT NULL THEN 0x00000040 END AND T142._Fld12073_RRRef = T134._Fld12739RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_005_F_000_
- FROM dbo._InfoRg11715 T143
- WHERE ((T143._Fld595 = ?)) AND ((T143._Fld12199RRef = T136._IDRRef) AND T143._Fld12200_TYPE = CASE WHEN T134._Fld12739RRef IS NOT NULL THEN 0x08 END AND T143._Fld12200_RTRef = CASE WHEN T134._Fld12739RRef IS NOT NULL THEN 0x00000040 END AND (T143._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))) OR ((CASE WHEN T134._Fld12740RRef IS NULL THEN 0x01 ELSE CASE WHEN T134._Fld12740RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_006_F_000_
- FROM dbo._InfoRg11710 T144
- WHERE ((T144._Fld595 = ?)) AND ((T144._Fld12072RRef = T136._IDRRef) AND (T144._Fld12073_TYPE = CASE WHEN T134._Fld12740RRef IS NOT NULL THEN 0x08 END AND T144._Fld12073_RTRef = CASE WHEN T134._Fld12740RRef IS NOT NULL THEN 0x00000040 END AND T144._Fld12073_RRRef = T134._Fld12740RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_007_F_000_
- FROM dbo._InfoRg11715 T145
- WHERE ((T145._Fld595 = ?)) AND ((T145._Fld12199RRef = T136._IDRRef) AND T145._Fld12200_TYPE = CASE WHEN T134._Fld12740RRef IS NOT NULL THEN 0x08 END AND T145._Fld12200_RTRef = CASE WHEN T134._Fld12740RRef IS NOT NULL THEN 0x00000040 END AND (T145._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))))) AND (T133._Fld595 = ?)) T132
- ON T102._Fld12313RRef = T132.IDRRef
- WHERE (((T80._Fld595 = ?) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T146
- ON ((T80._Fld4625RRef = T146._IDRRef)) AND (T146._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T147
- INNER JOIN dbo._Reference21 T148
- ON (((T147._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_008_F_000_
- FROM dbo._InfoRg11709 T149
- WHERE ((T149._Fld595 = ?)) AND ((T149._Fld12065RRef = T147._IDRRef) AND (T149._Fld12066RRef = T148._IDRRef)))) AND T148._IDRRef IN
- (SELECT
- T150._Reference21_IDRRef AS Q_009_F_000RRef
- FROM dbo._Reference21_VT782 T150
- INNER JOIN dbo._InfoRg9937 T151
- ON ((T151._Fld9939_TYPE = 0x08 AND T151._Fld9939_RTRef = 0x00000095 AND T151._Fld9939_RRRef = ?) AND (T151._Fld9938_TYPE = T150._Fld784_TYPE AND T151._Fld9938_RTRef = T150._Fld784_RTRef AND T151._Fld9938_RRRef = T150._Fld784_RRRef))
- WHERE ((T150._Fld595 = ?)) AND (T151._Fld595 = ?)))
- WHERE ((T148._Fld595 = ?)) AND (((((CASE WHEN T146._Fld1040RRef IS NULL THEN 0x01 ELSE CASE WHEN T146._Fld1040RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T152
- WHERE ((T152._Fld595 = ?)) AND ((T152._Fld12072RRef = T148._IDRRef) AND (T152._Fld12073_TYPE = CASE WHEN T146._Fld1040RRef IS NOT NULL THEN 0x08 END AND T152._Fld12073_RTRef = CASE WHEN T146._Fld1040RRef IS NOT NULL THEN 0x00000040 END AND T152._Fld12073_RRRef = T146._Fld1040RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T153
- WHERE ((T153._Fld595 = ?)) AND ((T153._Fld12199RRef = T148._IDRRef) AND T153._Fld12200_TYPE = CASE WHEN T146._Fld1040RRef IS NOT NULL THEN 0x08 END AND T153._Fld12200_RTRef = CASE WHEN T146._Fld1040RRef IS NOT NULL THEN 0x00000040 END AND (T153._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)) OR ((CASE WHEN T146._Fld12739RRef IS NULL THEN 0x01 ELSE CASE WHEN T146._Fld12739RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11710 T154
- WHERE ((T154._Fld595 = ?)) AND ((T154._Fld12072RRef = T148._IDRRef) AND (T154._Fld12073_TYPE = CASE WHEN T146._Fld12739RRef IS NOT NULL THEN 0x08 END AND T154._Fld12073_RTRef = CASE WHEN T146._Fld12739RRef IS NOT NULL THEN 0x00000040 END AND T154._Fld12073_RRRef = T146._Fld12739RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_005_F_000_
- FROM dbo._InfoRg11715 T155
- WHERE ((T155._Fld595 = ?)) AND ((T155._Fld12199RRef = T148._IDRRef) AND T155._Fld12200_TYPE = CASE WHEN T146._Fld12739RRef IS NOT NULL THEN 0x08 END AND T155._Fld12200_RTRef = CASE WHEN T146._Fld12739RRef IS NOT NULL THEN 0x00000040 END AND (T155._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END))) OR ((CASE WHEN T146._Fld12740RRef IS NULL THEN 0x01 ELSE CASE WHEN T146._Fld12740RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_006_F_000_
- FROM dbo._InfoRg11710 T156
- WHERE ((T156._Fld595 = ?)) AND ((T156._Fld12072RRef = T148._IDRRef) AND (T156._Fld12073_TYPE = CASE WHEN T146._Fld12740RRef IS NOT NULL THEN 0x08 END AND T156._Fld12073_RTRef = CASE WHEN T146._Fld12740RRef IS NOT NULL THEN 0x00000040 END AND T156._Fld12073_RRRef = T146._Fld12740RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_007_F_000_
- FROM dbo._InfoRg11715 T157
- WHERE ((T157._Fld595 = ?)) AND ((T157._Fld12199RRef = T148._IDRRef) AND T157._Fld12200_TYPE = CASE WHEN T146._Fld12740RRef IS NOT NULL THEN 0x08 END AND T157._Fld12200_RTRef = CASE WHEN T146._Fld12740RRef IS NOT NULL THEN 0x00000040 END AND (T157._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))))) AND ((T80._IDRRef IN
- (SELECT
- T158._Q_000_F_000RRef AS INVALUELISTRRef
- FROM #tt T158 WITH(NOLOCK)
- WHERE T158._Q_000_F_000RRef IS NOT NULL) AND ((((T118._Description LIKE ? ESCAPE '/') OR (T119.Description_ LIKE ? ESCAPE '/')) OR (T117._Description LIKE ? ESCAPE '/')) OR (T80._Number LIKE ? ESCAPE '/'))) OR (T132.Number_ LIKE ? ESCAPE '/'))) AND T80._Date_Time < ?
- ORDER BY (T80._Date_Time) DESC, (T80._IDRRef) DESC
- OPTION (FAST 1)
- ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
- 13203005.500 "SELECT TOP 25
- T1._IDRRef,
- T1._Marked,
- T1._Number,
- T1._Date_Time,
- T1._Posted,
- T1._Fld4621RRef,
- T1._Fld4622RRef,
- T1._Fld4625RRef,
- T1._Fld4633,
- T1._Fld4635RRef,
- T1._Fld4654RRef,
- T1._Fld4657RRef,
- CASE WHEN ((T1._Fld4657RRef = ?) 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,
- 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._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._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._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)
- 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._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 = ?)
- LEFT OUTER JOIN dbo._Reference28 T31
- ON (T1._Fld4621RRef = T31._IDRRef) AND (T31._Fld595 = ?)
- LEFT OUTER JOIN (SELECT
- T33._Folder AS Folder_,
- T33._IDRRef AS IDRRef,
- T33._Description COLLATE Latin1_General_CI_AS AS Description_,
- T33._Fld12836RRef AS Fld12836RRef,
- T33._Fld595 AS Fld595_
- FROM dbo._Reference42 T33
- WHERE ((((T33._Folder = 0x00) OR EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T34
- INNER JOIN dbo._Reference21 T35
- ON (((T34._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T36
- WHERE ((T36._Fld595 = ?)) AND ((T36._Fld12065RRef = T34._IDRRef) AND (T36._Fld12066RRef = T35._IDRRef)))) AND T35._IDRRef IN
- (SELECT
- T37._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T37
- INNER JOIN dbo._InfoRg9937 T38
- ON ((T38._Fld9939_TYPE = 0x08 AND T38._Fld9939_RTRef = 0x00000095 AND T38._Fld9939_RRRef = ?) AND (T38._Fld9938_TYPE = T37._Fld784_TYPE AND T38._Fld9938_RTRef = T37._Fld784_RTRef AND T38._Fld9938_RRRef = T37._Fld784_RRRef))
- WHERE ((T37._Fld595 = ?)) AND (T38._Fld595 = ?)))
- WHERE ((T35._Fld595 = ?)) AND ((CASE WHEN T33._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T33._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T39
- WHERE ((T39._Fld595 = ?)) AND ((T39._Fld12072RRef = T35._IDRRef) AND (T39._Fld12073_TYPE = CASE WHEN T33._Fld12836RRef IS NOT NULL THEN 0x08 END AND T39._Fld12073_RTRef = CASE WHEN T33._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T39._Fld12073_RRRef = T33._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T40
- WHERE ((T40._Fld595 = ?)) AND ((T40._Fld12199RRef = T35._IDRRef) AND T40._Fld12200_TYPE = CASE WHEN T33._Fld12836RRef IS NOT NULL THEN 0x08 END AND T40._Fld12200_RTRef = CASE WHEN T33._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T40._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T33._Fld595 = ?)) T32
- ON T1._Fld4625RRef = T32.IDRRef
- LEFT OUTER JOIN dbo._Reference64 T41
- ON (T1._Fld4654RRef = T41._IDRRef) AND (T41._Fld595 = ?)
- LEFT OUTER JOIN (SELECT
- T43._Fld5085RRef AS Fld5085RRef,
- T43._IDRRef AS IDRRef,
- T43._Number COLLATE Latin1_General_CI_AS AS Number_,
- T43._Fld595 AS Fld595_
- FROM dbo._Document240 T43
- WHERE ((EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T44
- ON ((T43._Fld5085RRef = 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._Fld595 = ?)) T42
- ON T19._Fld12313RRef = T42.IDRRef
- WHERE (((T1._Fld595 = ?)) AND (EXISTS(SELECT
- 1
- FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
- LEFT OUTER JOIN dbo._Reference42 T52
- ON ((T1._Fld4625RRef = T52._IDRRef)) AND (T52._Fld595 = ?)
- WHERE EXISTS(SELECT
- 0x01 AS Q_001_F_000_
- FROM dbo._Reference98 T53
- INNER JOIN dbo._Reference21 T54
- ON (((T53._Fld1685 = ?) AND EXISTS(SELECT
- 0x01 AS Q_004_F_000_
- FROM dbo._InfoRg11709 T55
- WHERE ((T55._Fld595 = ?)) AND ((T55._Fld12065RRef = T53._IDRRef) AND (T55._Fld12066RRef = T54._IDRRef)))) AND T54._IDRRef IN
- (SELECT
- T56._Reference21_IDRRef AS Q_005_F_000RRef
- FROM dbo._Reference21_VT782 T56
- INNER JOIN dbo._InfoRg9937 T57
- ON ((T57._Fld9939_TYPE = 0x08 AND T57._Fld9939_RTRef = 0x00000095 AND T57._Fld9939_RRRef = ?) AND (T57._Fld9938_TYPE = T56._Fld784_TYPE AND T57._Fld9938_RTRef = T56._Fld784_RTRef AND T57._Fld9938_RRRef = T56._Fld784_RRRef))
- WHERE ((T56._Fld595 = ?)) AND (T57._Fld595 = ?)))
- WHERE ((T54._Fld595 = ?)) AND ((CASE WHEN T52._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T52._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
- 0x01 AS Q_002_F_000_
- FROM dbo._InfoRg11710 T58
- WHERE ((T58._Fld595 = ?)) AND ((T58._Fld12072RRef = T54._IDRRef) AND (T58._Fld12073_TYPE = CASE WHEN T52._Fld12836RRef IS NOT NULL THEN 0x08 END AND T58._Fld12073_RTRef = CASE WHEN T52._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T58._Fld12073_RRRef = T52._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
- 0x01 AS Q_003_F_000_
- FROM dbo._InfoRg11715 T59
- WHERE ((T59._Fld595 = ?)) AND ((T59._Fld12199RRef = T54._IDRRef) AND T59._Fld12200_TYPE = CASE WHEN T52._Fld12836RRef IS NOT NULL THEN 0x08 END AND T59._Fld12200_RTRef = CASE WHEN T52._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T59._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND ((T1._Fld4621RRef = ?) AND (T1._Marked = 0x00) AND ((((((((T31._Description LIKE ? ESCAPE '/') OR (T32.Description_ LIKE ? ESCAPE '/')) OR ((T1._Fld4633 >= ?) AND (T1._Fld4633 < ?))) OR (T30._Description LIKE ? ESCAPE '/')) OR (T1._Number LIKE ? ESCAPE '/')) OR ((CASE WHEN ((ISNULL(CAST(T20.Fld10335Balance_ AS NUMERIC(27, 2)),?) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) > ?) THEN (ISNULL(CAST(T20.Fld10335Balance_ AS NUMERIC(27, 2)),?) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) ELSE ? END >= ?) AND (CASE WHEN ((ISNULL(CAST(T20.Fld10335Balance_ AS NUMERIC(27, 2)),?) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) > ?) THEN (ISNULL(CAST(T20.Fld10335Balance_ AS NUMERIC(27, 2)),?) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),?)) ELSE ? END < ?))) OR (T41._Description LIKE ? ESCAPE '/')) OR (T42.Number_ LIKE ? ESCAPE '/')))
- ORDER BY (T1._Date_Time) DESC, (T1._IDRRef) DESC
- ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
- 2156008.000 "SELECT TOP 25
- T1._IDRRef,
- T1._Marked,
- T1._Number,
- T1._Date_Time,
- T1._Posted,
- T1._Fld4621RRef,
- T1._Fld4622RRef,
- T1._Fld4625RRef,
- T1._Fld4633,
- T1._Fld4635RRef,
- T1._Fld4657RRef,
- CASE WHEN ((T1._Fld4657RRef = 0xAEB7F7D9237C245A447AADE98F164CDF) AND T1._Posted = 0x01) THEN CASE WHEN (ISNULL(CAST(T6.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,
- T11._Fld12313RRef,
- CASE WHEN ((ISNULL(CAST(T12.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) > 0.0) THEN (ISNULL(CAST(T12.Fld10335Balance_ AS NUMERIC(27, 2)),0.0) + ISNULL(CAST(T4.Fld10545Balance_ AS NUMERIC(27, 2)),0.0)) ELSE 0.0 END,
- T14._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._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 (T5._Period = ? 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
- T7.Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T7.Fld10346Balance_) AS NUMERIC(38, 8)) AS Fld10346Balance_
- FROM (SELECT
- T8._Fld10344RRef AS Fld10344RRef,
- CAST(SUM(T8._Fld10346) AS NUMERIC(33, 8)) AS Fld10346Balance_
- FROM dbo._AccumRgT10349 T8
- WHERE ((T8._Fld595 = ?)) AND (T8._Period = ? AND (T8._Fld10346 <> ?) AND (T8._Fld10346 <> ?))
- GROUP BY T8._Fld10344RRef
- HAVING (CAST(SUM(T8._Fld10346) AS NUMERIC(33, 8))) <> 0.0
- UNION ALL SELECT
- T9._Fld10344RRef AS Fld10344RRef,
- CAST(CAST(SUM(CASE WHEN T9._RecordKind = 0.0 THEN -T9._Fld10346 ELSE T9._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2)) AS Fld10346Balance_
- FROM dbo._AccumRg10339 T9
- WHERE ((T9._Fld595 = ?)) AND (T9._Period >= ? AND T9._Period < ? AND T9._Active = 0x01)
- GROUP BY T9._Fld10344RRef
- HAVING (CAST(CAST(SUM(CASE WHEN T9._RecordKind = 0.0 THEN -T9._Fld10346 ELSE T9._Fld10346 END) AS NUMERIC(27, 8)) AS NUMERIC(27, 2))) <> 0.0) T7
- GROUP BY T7.Fld10344RRef
- HAVING (CAST(SUM(T7.Fld10346Balance_) AS NUMERIC(38, 8))) <> 0.0) T6
- ON (T1._IDRRef = T6.Fld10344RRef)
- LEFT OUTER JOIN dbo._InfoRg9134 T10
- ON ((0x08 = T10._Fld9136_TYPE AND 0x000000E9 = T10._Fld9136_RTRef AND T1._IDRRef = T10._Fld9136_RRRef)) AND (T10._Fld595 = ?)
- LEFT OUTER JOIN dbo._InfoRg11720 T11
- ON ((0x08 = T11._Fld12312_TYPE AND 0x000000E9 = T11._Fld12312_RTRef AND T1._IDRRef = T11._Fld12312_RRRef)) AND (T11._Fld595 = ?)
- LEFT OUTER JOIN (SELECT
- T13._Fld10332_TYPE AS Fld10332_TYPE,
- T13._Fld10332_RTRef AS Fld10332_RTRef,
- T13._Fld10332_RRRef AS Fld10332_RRRef,
- CAST(SUM(T13._Fld10335) AS NUMERIC(33, 8)) AS Fld10335Balance_
- FROM dbo._AccumRgT10337 T13
- WHERE ((T13._Fld595 = ?)) AND (T13._Period = ? AND (T13._Fld10335 <> ?) AND (T13._Fld10335 <> ?))
- GROUP BY T13._Fld10332_TYPE,
- T13._Fld10332_RTRef,
- T13._Fld10332_RRRef
- HAVING (CAST(SUM(T13._Fld10335) AS NUMERIC(33, 8))) <> 0.0) T12
- ON (0x08 = T12.Fld10332_TYPE AND 0x000000E9 = T12.Fld10332_RTRef AND T1._IDRRef = T12.Fld10332_RRRef)
- LEFT OUTER JOIN dbo._Reference51 T14
- ON (T1._Fld4635RRef = T14._IDRRef) AND (T14._Fld595 = ?)
- LEFT OUTER JOIN dbo._Reference28 T15
- ON (T1._Fld4621RRef = T15._IDRRef) AND (T15._Fld595 = ?)
- LEFT OUTER JOIN dbo._Reference42 T16
- ON (T1._Fld4625RRef = T16._IDRRef) AND (T16._Fld595 = ?)
- LEFT OUTER JOIN dbo._Document240 T17
- ON (T11._Fld12313RRef = T17._IDRRef) AND (T17._Fld595 = ?)
- WHERE ((T1._Fld595 = ?)) AND ((T1._Fld4621RRef = ?) AND (((((T15._Description LIKE ? ESCAPE '/') OR (T16._Description LIKE ? ESCAPE '/')) OR (T14._Description LIKE ? ESCAPE '/')) OR (T1._Number LIKE ? ESCAPE '/')) OR (T17._Number LIKE ? ESCAPE '/')) AND ((CASE WHEN ((T1._Fld4657RRef = ?) AND T1._Posted = 0x01) THEN CASE WHEN (ISNULL(CAST(T6.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(T6.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(T6.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), (T1._IDRRef)
- ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
- 1859000.000 "SELECT TOP 30
- T1._IDRRef,
- T1._Marked,
- T1._Number,
- T1._Date_Time,
- T1._Posted,
- T1._Fld4621RRef,
- T1._Fld4622RRef,
- T1._Fld4625RRef,
- T1._Fld4633,
- T1._Fld4635RRef,
- T1._Fld4657RRef,
- CASE WHEN ((T1._Fld4657RRef = ?) 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,
- 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,
- T1._Fld4642,
- T1._Posted
- 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._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._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._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)
- 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._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._Posted = 0x00) AND (T1._Marked = 0x00))
- ORDER BY (T1._Date_Time), (T1._IDRRef)
- ",Context=DynamicList.GetData : Document.InventoryExpense.Form.ListForm.Attribute.List
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement