If e.DataCol.Name = "收货入库" Then
Dim t1 As Table = Tables("订货记录_Table1")
If e.DataRow("收货入库")=False OrElse e.DataTable.Compute("Count([订货编号])", "订货编号 = '" & e.DataRow("订货编号") & "'and 收货入库=false") > 0 Then
t1.Current("收货入库") = False
Else
t1.Current("收货入库") = True
End If
Dim pr1 As DataRow
pr1 = DataTables("订货记录_Table3").sqlFind("货名 = '" & e.DataRow("货名") & "' And 入库编号 = '" & e.DataRow("订货编号") & "'")
If pr1 IsNot Nothing Then
If e.DataRow("收货入库")=True
pr1("入库数量")= pr1("入库数量") + e.NewValue - e.OldValue
Tables("订货记录_Table3").DataTable.LoadFilter = ""
Tables("订货记录_Table3").DataTable.Load
Else
pr1.Delete
pr1.save
Tables("订货记录_Table3").DataTable.LoadFilter = ""
Tables("订货记录_Table3").DataTable.Load
End If
Else
If e.DataRow("收货入库")=True
Dim nr As Row = Tables("订货记录_Table3").AddNew()
nr("货名")= e.DataRow("货名")
nr("入库数量")= e.DataRow("数量")
nr("入库日期")= e.DataRow("订货日期")
nr("入库编号")= e.DataRow("订货编号")
Tables("订货记录_Table3").DataTable.LoadFilter = ""
Tables("订货记录_Table3").DataTable.Load
End If
End If
End If