If e.DataCol.Name = "工时" Then
If e.DataRow("姓名") <> "部门" Then
Dim dr As DataRow = e.DataTable.Find("姓名='部门'")
If dr IsNot Nothing Then
dr("工时") = e.DataTable.Compute ("Sum(工时)", "姓名<>'部门' and 姓名 is not null")
End If
End If
End If
If e.DataCol.Name = "奖金" AndAlso e.DataRow("姓名") = "部门" Then
Dim dr As DataRow = e.DataTable.Find("姓名='部门'")
If dr.IsNull ("奖金") = False AndAlso dr.IsNull ("工时") = False Then
Dim 工时奖金 As Decimal = dr("奖金") / dr("工时")
For Each sdr As DataRow In e.DataTable.Select ("姓名<>'部门' and 姓名 is not null")
sdr("奖金") = sdr("工时") * 工时奖金
Next
End If
End If