红色的有问题:
Select Case e.DataCol.Name
Case "客户名称","扎差","余额"
Dim dr As DataRow
Dim mr As DataRow = e.DataRow
Dim drs As List(of DataRow)
dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [客户名称] = '" & mr("客户名称") & "'", "[_SortKey] Desc")
If dr Is Nothing Then
mr("扎差") = mr("余额")
dr = mr
End If
drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And [客户名称] = '" & dr("客户名称") & "'", "[日期]")
For i As Integer = 1 To drs.Count - 1
drs(i)("扎差") = drs(i)("余额") - drs(i-1)("余额")
Next
End Select
应该是:
Select Case e.DataCol.Name
Case "客户名称","扎差","余额"
Dim dr As DataRow
Dim mr As DataRow = e.DataRow
Dim drs As List(of DataRow)
dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [客户名称] = '" & mr("客户名称") & "'", "[_SortKey] Desc")
If dr Is Nothing Then
mr("扎差") = mr("余额")
dr = mr
End If
drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And [客户名称] = '" & dr("客户名称") & "'", "[_SortKey]")
For i As Integer = 1 To drs.Count - 1
drs(i)("扎差") = drs(i)("余额") - drs(i-1)("余额")
Next
End Select