Select Case e.DataCol.name
Case "项目名称","名称或规格", "数量"
Dim drs As List(of DataRow)
Dim Filter As String
filter = "[项目名称] = '" & e.DataRow("项目名称") & "' and 名称或规格 = '" & e.DataRow("名称或规格") & "'"
Dim qc As Double = 0
Dim fdr As DataRow = DataTables("湿地项目统计").Find(filter)
If fdr IsNot Nothing Then
qc = fdr("数量")
End If
Filter = "[_SortKey] >= " & e.DataRow("_SortKey") & " And [项目名称] = '" & e.DataRow("项目名称") & "' and 名称或规格 = '" & e.DataRow("名称或规格") & "'"
drs = e.DataTable.Select(Filter)
For Each dr As DataRow In drs
Filter = "[_SortKey] <= " & dr("_SortKey") & " And [项目名称] = '" & e.DataRow("项目名称") & "' and 名称或规格 = '" & e.DataRow("名称或规格") & "'"
Dim Val1 As Double = e.DataTable.Compute("Sum(数量)",Filter)
dr("分类统计") = Val1
Next
If (e.DataCol.name = "项目名称" OrElse e.DataCol.name = "名称或规格") And e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
If e.DataCol.Name = "项目名称" Then
Filter = "[项目名称] = '" & e.oldvalue & "' and 名称或规格 = '" & e.DataRow("名称或规格") & "'"
ElseIf e.DataCol.name = "名称或规格" Then
Filter = "[项目名称] = '" & e.DataRow("项目名称") & "' and 名称或规格 = '" & e.oldvalue & "'"
End If
drs = e.DataTable.Select("[_SortKey] > " & e.DataRow("_SortKey") & " and " & Filter)
For Each dr As DataRow In drs
Filter = "[_SortKey] <= " & dr("_SortKey") & " And " & filter
Dim Val1 As Double = e.DataTable.Compute("Sum(数量)",Filter)
dr("分类统计") = Val1
Next
End If
End Select
老师,我对我们10个项目使用的材料和工程量做按项目和材料信息流水统计,但是删除项目名称和名称规格列,分类统计的数字不会自动清楚。麻烦帮我修改下