Dim trv As WinForm.TreeView = e.Sender
Dim flt As String = "1=2"
Dim flt1 As String = "1=2"
For Each nd As WinForm.TreeNode In e.node.Nodes '清除子节点选中状态
nd.Checked = False
Next
If e.node.ParentNode IsNot Nothing Then '去掉父节点选中状态
e.node.ParentNode.Checked = False
End If
For Each nd As WinForm.TreeNode In trv.AllNodes
If nd.Checked Then
Select nd.level
Case 0 '注意下面的条件都要用括号括起来
If nd.Text="显示全部" Then
Tables("订单").ApplyFilter=False
Else
Return
End If
Case 1
If nd.FullPath.StartsWith("按产品名称") Then
flt &= " or 产品名称 = '" & nd.text & "'"
Else If nd.FullPath.StartsWith("按到货完结")
flt1 &= " or 到货完结 = '" & nd.text & "'"
End If
Case 2
If nd.FullPath.StartsWith("按产品名称") Then
flt &= " or 产品名称 = '" & nd.ParentNode.text & "' and 产品规格 = '" & nd.text & "'"
End If
End Select
End If
Next
Tables("采购合同表").Filter = "合同编号 in ('" & DataTables("采购明细表").GetComboListString("合同编号", "(" & iif(flt="1=2","1=1",flt) & ") And (" & iif(flt1="1=2","1=1",flt1) & ")").replace("|", "','") & "')"