Dim dt1 As DataTable = DataTables("申购明细") Dim dt2 As DataTable = DataTables("分拣单") dt2.DataRows.clear Dim filter As String = "" For Each chbm As String In dt1.GetValues("存货编码", filter) Dim drs = dt1.Select("存货编码 = '" & chbm & "'") Dim i As Integer = 0 Dim dr As DataRow Do While i < drs.count Dim idx = i Mod 3 If idx = 0 Then dr = dt2.addnew dr("日期") = drs(i)("日期") dr("存货编码") = drs(i)("存货编码") End If dr("客户名称" & idx+1) = drs(i)("客户名称") dr("数量" & idx+1) = drs(i)("出库数量") i += 1 Loop Next
|