-- 作者:bm
-- 发布时间:2012/2/29 19:24:00
-- 帮忙优化代码,应用的时候感觉卡卡的
If e.form.controls("ComboBox1").value = "" Then messagebox.show("请输入或选择来源例.") Return ElseIf e.form.controls("ComboBox2").value = "" Then messagebox.show("请输入或选条件例.") Return End If
Dim Result As DialogResult Result = MessageBox.Show("确认对账吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If Result = DialogResult.Yes Then Dim s1 As Object = e.Form.Controls("ComboBox1").Value Dim s2 As Object = e.Form.Controls("ComboBox2").Value Dim sum As Double = Tables("支出明细").Compute("Sum(金额)",s1 & " = \'" & s2 & "\'") Dim r As Row = Tables("应付运费").AddNew r("应付金额") = sum r("录入日期") = Date.now Dim F As Object If Tables("支出明细").Filter <> "" Then F = "(" & Tables("支出明细").Filter & ") And " End If f = f & F & s1 & " = \'" & s2 & "\'" Dim drs As List(Of DataRow) = DataTables("支出明细").Select(f) For Each dr As DataRow In drs r("收款人") = dr("收款人") r.Locked = True r.Save() dr("支出账户")="已对账" dr("日期") = Date.now dr("流水号") = r("应付流水") dr.Save() Next e.Form.close() Else Return End If
|