一段计算出勤补贴的代码,代码出错。
不同的核算标准和单位,其满勤补贴和缺勤扣除的标准也不同,"√"为满勤,得满勤补贴;"-1"为缺勤一天,得"满勤补贴" -" 缺勤扣除","-2"为缺勤2天,得"满勤补贴" -" 缺勤扣除"*2,以此类推。此段代码运行出错,请各位老师帮助指教,谢谢!!
'报酬明细_DataColChanged
Select Case e.DataCol.Name
Case "核算标准","单位"
Dim dr As DataRow = e.DataRow
Dim pr As DataRow
Dim mqbt As Double
If dr.IsNull("核算标准") OrElse dr.IsNull("单位") Then
mqbt = Nothing
Else
Dim filter As String
filter = "核算标准 = '" & dr("核算标准") & "' And 单位 = '" & dr("单位") & "'"
pr = DataTables("核算标准").Find(filter)
If pr IsNot Nothing Then
mqbt =CDbl( pr("满勤补贴"))
End If
End If
End Select
Select Case e.DataCol.Name
Case "核算标准","单位"
Dim dr As DataRow = e.DataRow
Dim pr As DataRow
Dim qqkc As Double
If dr.IsNull("核算标准") OrElse dr.IsNull("单位") Then
qqkc = Nothing
Else
Dim filter As String
filter = "核算标准 = '" & dr("核算标准") & "' And 单位 = '" & dr("单位") & "'"
pr = DataTables("核算标准").Find(filter)
If pr IsNot Nothing Then
qqkc = CDbl(pr("缺勤扣除"))
End If
End If
End Select
If e.DataCol.Name = "出勤状况" Then
If e.DataRow("出勤状况") = "√" Then
e.DataRow("出勤补贴") = "mqbt"
ElseIf e.DataRow("出勤状况") = "-1"
e.DataRow("出勤补贴") = "mqbt-qqkc*1"
ElseIf e.DataRow("出勤状况") = "-2"
e.DataRow("出勤补贴") = "mqbt-qqkc*2"
ElseIf e.DataRow("出勤状况") = "-3"
e.DataRow("出勤补贴") = "mqbt-qqkc*3"
ElseIf e.DataRow("出勤状况") = "-4"
e.DataRow("出勤补贴") = "mqbt-qqkc*4"
ElseIf e.DataRow("出勤状况") = "-5"
e.DataRow("出勤补贴") = "mqbt-qqkc*5"
Else
e.DataRow("出勤补贴") = Nothing
End If
End If
出错截图:
此主题相关图片如下:k.png
[此贴子已经被作者于2011-10-16 21:58:54编辑过]