老师,下面的收入金额和支出金额列合并成交易金额列了,交易金额列数据用正负数来显示的。
'Select Case e.DataCol.Name
' Case "方向","收入金额","支出金额"
' Dim drs As List(of DataRow)
' Dim Filter As String
'Filter = "[_Identify] >= " & e.DataRow("_Identify") & " And [方向] = '" & e.DataRow("方向") & "'"
'drs = e.DataTable.Select(Filter)
' For i As Integer = 0 To drs.Count - 1
' Dim dr = drs(i)
' If i = drs.Count - 1 Then
' Filter = "[_Identify] <= " & dr("_Identify") & " And [方向] = '" & dr("方向") & "'"
' Dim Val1 As Double = e.DataTable.Compute("Sum(收入金额)",Filter)
' Dim Val2 As Double = e.DataTable.Compute("Sum(支出金额)",Filter)
' dr("累计收入") = Val1
' dr("累计支出") = Val2
' Else
' dr("累计收入") = Nothing
' dr("累计支出") = Nothing
' End If
'Next
'If e.DataCol.Name = "方向" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
' Filter = "[_Identify] > " & e.DataRow("_Identify") & " And [方向] = '" & e.OldValue & "'"
' drs = e.DataTable.Select(Filter)
' For i As Integer = 0 To drs.Count - 1
' Dim dr = drs(i)
' If i = drs.Count - 1 Then
' Filter = "[_Identify] <= " & dr("_Identify") & " And [方向] = '" & dr("方向") & "'"
' Dim Val1 As Double = e.DataTable.Compute("Sum(收入金额)",Filter)
' Dim Val2 As Double = e.DataTable.Compute("Sum(支出金额)",Filter)
' dr("累计收入") = Val1
' dr("累计支出") = Val2
' Else
' dr("累计收入") = Nothing
' dr("累计支出") = Nothing
' End If
' Next
' End If
' Dim dr2 As DataRow = e.DataTable.Find("方向 is not null","[_Identify] desc")
' Dim V1 = e.DataTable.Compute("Sum(累计收入)","累计收入 > 0")
' Dim V2 = e.DataTable.Compute("Sum(累计支出)","累计支出 > 0")
' e.DataTable.ReplaceFor("余额", Nothing)
' dr2("余额") = V1 - V2
'End Select
[此贴子已经被作者于2017/4/16 12:31:06编辑过]