Dim Filter As String '定义筛选
For Each dc As Col In Tables("付款主表.付款录入").Cols '遍历表的所有列
Select Case dc.Name
Case "平台公司","报表编号","合同金额","合同编号","是否签署合同"
Case Else
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "[" & dc.Name & "] Is Null"
End Select
Next
Tables("付款主表.付款录入").DataTable.DeleteFor(Filter)
Functions.Execute("多选目录树","付款录入","付款主表","应付会计,当前状态,报表编号","当前状态|应付会计|报表编号")
Dim r1 As Row = Tables("付款主表").Current
If r1 IsNot Nothing
If r1.IsNull("平台公司") Or r1.IsNull("成本类型") Then
MessageBox.Show("平台公司和成本类型必须输入","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return Nothing
End If
End If
If Tables("付款主表.付款录入").Rows.Count = 0 Then
MessageBox.Show("请输入明细数据","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return Nothing
End If
For Each r As Row In Tables("付款主表.付款录入").Rows
For Each cl As Col In Tables("付款主表.付款录入").Cols
Select Case cl.Name
Case "平台公司","供应商","成本中心代码","付款金额","银行账号","流程类型","流程编号"
If r.IsNull(cl.Name) Then
MessageBox.Show(cl.Name & "请填写完整!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return Nothing
End If
End Select
Next
Next
If Tables("付款录入").DataTable.HasChanges Or Tables("付款主表").DataTable.HasChanges Then
Tables("付款录入").DataTable.Save
Tables("付款主表").DataTable.Save
MessageBox.Show("数据保存成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
Functions.Execute("多选目录树","付款录入","付款主表","应付会计,当前状态,报表编号","当前状态|应付会计|报表编号")
Dim frmName As Object = Args(0) 'e事件
Dim TableName As String = Args(1) '表名
Dim Cols As String = Args(2) '列名
Dim ColName As String = Args(3)
Dim cmd As New SQL Command
Dim dt As DataTable
cmd.Conn ecti
cmd.Com mandText = "SEL ECT DISTINCT " & Cols & " Fro m {" & TableName & "}"
dt = cmd.ExecuteReader()
Dim Cmb_FilterCol As WinForm.CheckedComboBox = Forms(frmName).Controls("Cmb_FilterCol")
Dim Values() As String = Args(2).Split(",")
Cmb_FilterCol.Items.Clear
For i As Integer = 0 To Values.Length -1
Cmb_FilterCol.Items.Add(Values(i))
Next
Cmb_FilterCol.Value = ""
Cmb_FilterCol.Value = ColName
生成目录树的代码是这样的:
'此函数用于更新主窗口左侧的Treeview控件
Dim TvwCtl As WinForm.TreeView = Args(0) '要更新的Treeview控件
Dim TableName As String = Args(1)
Dim FrmName As String = Args(2)
Dim Val As Integer
Dim MyFilter As String
Dim dr As DataRow = DataTables("查询参数设置").SqlFind("单据名称='" & FrmName & "'")
If dr IsNot Nothing Then
Val = dr("查询月数")
End If
Dim str As String
Dim lr As DataRow = DataTables("功能导航").SqlFind("模块名称='" & FrmName & "'")
If lr IsNot Nothing Then
Dim nms As New List(of String)
If lr IsNot Nothing AndAlso lr.IsNull("查询角色") = False
nms.AddRange(lr("查询角色").Split(","))
End If
For Each nm As String In nms
str = str & ",'" & nm & "'"
Next
If str > "" Then
str = str.Trim(",")
Dim dx As DataRow
If Val > = 0 Then
MyFilter = "日期>='" & Functions.Execute("服务器时间").AddMonths(-Val) & "' And 日期 <='" & Functions.Execute("服务器时间") & "' And 单据名称='" & FrmName & "' And 应付会计 In (" & str & ")"
End If
End If
End If
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.Conne cti
cmd.Comm andText = "SEL ECT * F rom {" & TableName & "} Where " & MyFilter.Replace("日期",Args(4))
dt = cmd.ExecuteReader()
If dt.DataRows.Count = 0 Then Return Nothing
Dim Columns As String = Args(3) '要构建Treeview的字段
TvwCtl.StopRedraw
TvwCtl.Nodes.Clear
TvwCtl.BuildTree(dt,Columns,"当前状态<>'确认付款'","当前状态,应付会计")
For Each nd As WinForm.TreeNode In TvwCtl.AllNodes
If nd.Text.IndexOf("待递交") >= 0 Then
nd.ExpandAll
End If
Next
TvwCtl.ResumeRedraw
'Tables("付款主表.付款录入").AutoSizeCols