Select Case e.DataCol.name
Case "金额", "已收金额"
If e.DataRow.IsNull("金额") OrElse e.DataRow.IsNull("已收金额") OrElse e.DataRow.IsNull("客户名") OrElse e.DataRow.IsNull("账单月份") Then
e.DataRow("月收款状态") = Nothing
Else
Dim filter As String = "[客户名] = '" & e.DataRow("客户名") & "' and 账单月份 = '" & e.DataRow("账单月份") & "'"
Dim ddje As Integer = e.DataTable.Compute("sum(金额)", filter)
Dim ddys As Integer = e.DataTable.Compute("sum(已收金额)", filter)
If ddje > ddys Then
e.DataTable.replacefor("月收款状态", "未收完", filter)
Else
e.DataTable.replacefor("月收款状态", "已收完", filter)
End If
End If
Case "客户名"
If e.NewValue > "" Then
Dim filter As String = "[客户名] = '" & e.NewValue & "' and 账单月份 = '" & e.DataRow("账单月份") & "'"
Dim ddje As Integer = e.DataTable.Compute("sum(金额)", filter)
Dim ddys As Integer = e.DataTable.Compute("sum(已收金额)", filter)
If ddje > ddys Then
e.DataTable.replacefor("月收款状态", "未收完", filter)
Else
e.DataTable.replacefor("月收款状态", "已收完", filter)
End If
End If
If e.OldValue > "" Then
Dim filter As String = "[客户名] = '" & e.OldValue & "' and 账单月份 = '" & e.DataRow("账单月份") & "'"
Dim ddje As Integer = e.DataTable.Compute("sum(金额)", filter)
Dim ddys As Integer = e.DataTable.Compute("sum(已收金额)", filter)
If ddje > ddys Then
e.DataTable.replacefor("月收款状态", "未收完", filter)
Else
e.DataTable.replacefor("月收款状态", "已收完", filter)
End If
End If
Case "账单月份"
If e.NewValue > "" Then
Dim filter As String = "[客户名] = '" & e.DataRow("客户名") & "' and 账单月份 = '" & e.NewValue & "'"
Dim ddje As Integer = e.DataTable.Compute("sum(金额)", filter)
Dim ddys As Integer = e.DataTable.Compute("sum(已收金额)", filter)
If ddje > ddys Then
e.DataTable.replacefor("月收款状态", "未收完", filter)
Else
e.DataTable.replacefor("月收款状态", "已收完", filter)
End If
End If
If e.OldValue > "" Then
Dim filter As String = "[客户名] = '" & e.DataRow("客户名") & "' and 账单月份 = '" & e.OldValue & "'"
Dim ddje As Integer = e.DataTable.Compute("sum(金额)", filter)
Dim ddys As Integer = e.DataTable.Compute("sum(已收金额)", filter)
If ddje > ddys Then
e.DataTable.replacefor("月收款状态", "未收完", filter)
Else
e.DataTable.replacefor("月收款状态", "已收完", filter)
End If
End If
End Select