麻烦老师指导下,下面代码应该要如何整合了?
----调用商品资料信息------
If e.DataCol.Name = "商品编号" Then
Dim nms() As String = {"商品名称","单位","规格","销售价"}
If e.NewValue Is Nothing Then
For Each nm As String In nms
e.DataRow(nm) = Nothing
Next
Else
Dim dr As DataRow
dr = DataTables("商品资料").Find("[商品编号] = '" & e.NewValue & "'")
If dr IsNot Nothing
For Each nm As String In nms
e.DataRow(nm) = dr(nm)
Next
End If
End If
End If
-----获取不同客户最新销售价-----
If e.DataCol.Name = "客户名称" Or e.DataCol.Name = "商品编号" Then
Dim dr1 As DataRow
Dim Filter As String
Filter = "[客户名称] = '" & e.DataRow("客户名称") & "' And [商品编号] = '" & e.DataRow("商品编号") & "' And [_Identify] <> " & e.DataRow("_Identify")
dr1 = DataTables("出库").Find(Filter ,"日期 Desc")
If dr1 IsNot Nothing Then
e.DataRow("销售价") = dr1("销售价")
End If
End If