Dim dr As DataRow = e.DataRow Select Case e.DataCol.name Case "年限" If dr.IsNull("年限") Then dr("使用期限") = Nothing Else dr("使用期限") = dr("年限") * 12 End If Case "残值率" If dr.IsNull("残值率") Then dr("预计净残值") = Nothing Else dr("预计净残值") = dr("原值") * dr("残值率") End If Case "原值","年限","残值率" If dr.IsNull("原值") OrElse dr.IsNull("年限") OrElse dr.IsNull("残值率") Then dr("月折旧额") = Nothing Else dr("月折旧额") = (dr("原值") * (1 - dr("残值率"))) / dr("使用期限") End If End Select
|