Select Case e.DataCol.Name
Case "客户id","商品名称","摘要","付款金额"
Dim drs As List(of DataRow)
Dim Filter As String
Filter = "[_Identify] >= " & e.DataRow("_Identify") & " And [客户id] = '" & e.DataRow("客户id") & "' and [商品名称] = '" & e.DataRow("商品名称") & "' and .........."
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 [客户id] = '" & dr("客户id") & "' and [商品名称] = '" & e.DataRow("商品名称") & "' and .........."
Dim Val1 As Double = e.DataTable.Compute("Sum(付款金额)",Filter)
dr("累计付款") = Val1
Else
dr("累计付款") = Nothing
End If
Next
If e.DataCol.Name = "客户id" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
Filter = "[_Identify] > " & e.DataRow("_Identify") & " And [客户id] = '" & e.OldValue & "' and [商品名称] = '" & e.DataRow("商品名称") & "' and .........."
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 [客户id] = '" & dr("客户id") & "' and [商品名称] = '" & e.DataRow("商品名称") & "' and .........."
Dim Val1 As Double = e.DataTable.Compute("Sum(付款金额)",Filter)
dr("累计付款") = Val1
Else
dr("累计付款") = Nothing
End If
Next
End If
If e.DataCol.Name = "商品名称" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
Filter = "[_Identify] > " & e.DataRow("_Identify") & " And [商品名称] = '" & e.OldValue & "' and [客户id] = '" & e.DataRow("客户id") & "' and .........."
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 [商品名称] = '" & e.OldValue & "' and [客户id] = '" & e.DataRow("客户id") & "' and .........."
Dim Val1 As Double = e.DataTable.Compute("Sum(付款金额)",Filter)
……
If e.DataCol.Name = "摘要" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
Filter = "[_Identify] > " & e.DataRow("_Identify") & " And [摘要] = '" & e.OldValue & "' and [商品名称] = '" & e.DataRow("商品名称") & "' and .........."
……
End Select