-- 作者:阆子天涯
-- 发布时间:2014/4/25 22:02:00
--
Dim rq As WinForm.DateTimePicker = e.Form.Controls("日期") Dim djlx As WinForm.ComboBox = e.Form.Controls("单据类型") Dim pp As WinForm.ComboBox = e.Form.Controls("品牌") Dim md As WinForm.ComboBox = e.Form.Controls("门店") Dim djbh As WinForm.TextBox = e.Form.Controls("单据编号")
If rq.Value = Nothing Then djbh.Text ="" Else Dim bh As String = Format(rq.value,"yyyyMMdd") \'取得编号的8位前缀 If Tables("库调明细表_主表").Current("业务单号").StartsWith(bh) = False Dim max As String Dim idx As Integer max = DataTables("库调明细表_主表").Compute("Max(业务单号)","[单据日期] = #" & rq.Value & "# And [_Identify] <> " & Tables("库调明细表_主表").current("_Identify") & " And 品牌 = \'" & pp.text & "\' And 门店 = \'" & md.text & "\'") If max > "" Then \'如果存在最大编号 idx = CInt(max.Substring(9,3)) + 1 Else idx = 1 End If djbh.text ="KFD"& bh & "-" & Format(idx,"000") End If End If
For Each r1 As Row In Tables("库调明细_副表").Rows Dim r2 As Row = Tables("库调明细表_主表").AddNew For Each c As Col In Tables("库调明细_副表").Cols If Tables("库调明细表_主表").Cols.Contains(c.name) Then r2(c.name) = r1(c.name) End If Next r2("单据日期")= rq.Value r2("收发类型")= djlx.text r2("门店")= md.text r2("业务单号")= djbh.text Next
此主题相关图片如下:uf~~$u0ub%{c{k(h_`g0gc.jpg
|