Dim dr As DataRow = e.DataRow systemready = False Select Case e.DataCol.name Case "采购单价" If e.NewValue > 0 Then If dr.IsNull("采购数量") = False Then dr("采购金额") = dr("采购数量") * dr("采购单价") ElseIf dr.IsNull("采购金额") = False Then dr("采购数量") = dr("采购金额") / dr("采购单价") End If End If Case "采购数量" If e.NewValue > 0 Then If dr.IsNull("采购单价") = False Then dr("采购金额") = dr("采购数量") * dr("采购单价") ElseIf dr.IsNull("采购金额") = False Then dr("采购单价") = dr("采购金额") / dr("采购数量") End If End If Case "采购金额" If dr.IsNull("采购单价") = False AndAlso dr("采购单价") > 0 Then dr("采购数量") = dr("采购金额") / dr("采购单价") ElseIf dr.IsNull("采购数量") = False AndAlso dr("采购数量") > 0 Then dr("采购单价") = dr("采购金额") / dr("采购数量") End If End Select systemready = True
|