Dim trv As WinForm.TreeView = e.Sender
Dim flt, flt1, flt2, flt3, flt4, flt5 As String
If e.Node.Name = "显示所有数据" Then'专处理显示所有数据的勾选选项打勾后缴费情况表的筛选问题,打勾全显,去除勾不显.
If e.Node.Checked Then
For Each nd As WinForm.TreeNode In trv.AllNodes
nd.Checked = False
Next
e.Node.Checked = True
Else
flt = "1=2"
End If
Else
flt = "1=2"
Dim nms As String() = {"明细分类", "住址_巷", "住址_号", "住址_房", "姓名", "手机号码", "车牌号码"} '指定生成目录树的各列
Dim qts As String() = {"'", "'", "'", "'", "'", "'", "'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
Dim nms1 As String() = {"明细分类", "年", "月", "车牌号码"} '指定生成目录树的各列
Dim qts1 As String() = {"'", "", "", "'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
Dim nms2 As String() = {"住址_巷", "住址_号", "住址_房", "单位名称", "姓名", "手机号码"} '指定生成目录树的各列
Dim qts2 As String() = {"'", "'", "'", "'", "'", "'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
Dim nms3 As String() = {"单位名称", "手机号码"} '指定生成目录树的各列
Dim qts3 As String() = {"'", "'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
For Each nd1 As WinForm.TreeNode In e.Node.AllNodes '清除子节点的选中标记
nd1.Checked = e.Node.Checked
Next
Dim pd As WinForm.TreeNode = e.Node.ParentNode
If pd IsNot Nothing Then
Dim bb As Boolean = True
For Each nd2 As WinForm.TreeNode In pd.Nodes
If nd2.Checked = False Then
bb = False
Exit For
End If
Next
pd.Checked = bb
End If
For Each nd As WinForm.TreeNode In trv.AllNodes
If nd.Checked Then
Dim val As String = ""
Dim rts() As String = nd.FullPath.Split("\")
If nd.FullPath Like DataTables("分类").DataRows(0)("分类") & "*" Then
For i As Integer = 1 To rts.length - 1
If val > "" Then
val = val & " And "
End If
val = val & nms(i - 1) & " = " & qts(i - 1) & rts(i) & qts(i - 1)
Next
If flt1 > "" Then
flt1 = flt1 & " or (" & val & ")"
Else
flt1 = val
End If
ElseIf nd.FullPath Like DataTables("分类").DataRows(1)("分类") & "*" Then
For i1 As Integer = 1 To rts.length - 1
If val > "" Then
val = val & " And "
End If
If rts.Length <= 2 Then
val = val & nms1(i1 - 1) & " = " & qts1(i1 - 1) & rts(i1) & qts1(i1 - 1)
End If
Next
If flt2 > "" Then
flt2 = flt2 & " And (" & val & ")"
Else
flt2 = val
End If
Dim d1, d2 As Date
If rts.Length = 3 Then
d1 = New Date(CInt(rts(2)), 1, 1)
d2 = New Date(CInt(rts(2)), 12, 31)
ElseIf rts.Length > 3 Then
d1 = New Date(CInt(rts(2)), CInt(rts(3)), 1)
d2 = New Date(CInt(rts(2)), CInt(rts(3)), Date.DaysInMonth(CInt(rts(2)), CInt(rts(3))))
End If
val = val & " 日期 >= #" & d1 & "# And 日期 <=#" & d2 & "#"
If nd.Level = 4 Then
If val > "" Then
val = val & " And "
End If
val = val & " 车牌号码 = '" & nd.Text & "'"
End If
If flt3 > "" Then
flt3 = flt3 & " or (" & val & ")"
Else
flt3 = val
End If
ElseIf nd.FullPath Like DataTables("分类").DataRows(2)("分类") & "*" Then
For i As Integer = 1 To rts.length - 1
If val > "" Then
val = val & " And "
End If
val = val & nms2(i - 1) & " = " & qts2(i - 1) & rts(i) & qts2(i - 1)
Next
If flt4 > "" Then
flt4 = flt4 & " or (" & val & ")"
Else
flt4 = val
End If
Else
For i As Integer = 1 To rts.length - 1
If val > "" Then
val = val & " And "
End If
val = val & nms3(i - 1) & " = " & qts3(i - 1) & rts(i) & qts3(i - 1)
Next
If flt5 > "" Then
flt5 = flt5 & " or (" & val & ")"
Else
flt5 = val
End If
End If
End If
Next
If flt1 > "" Then
flt1 = "分类= '" & DataTables("分类").DataRows(0)("分类") & "' And (" & flt1 & ")"
End If
If flt2 > "" Then
flt2 = "分类= '" & DataTables("分类").DataRows(1)("分类") & "' And (" & flt2 & ")"
End If
If flt4 > "" Then
flt4 = "分类= '" & DataTables("分类").DataRows(2)("分类") & "' And (" & flt4 & ")"
End If
If flt5 > "" Then
flt5 = "分类= '" & DataTables("分类").DataRows(3)("分类") & "' And (" & flt5 & ")"
End If
If flt1 > "" Then
flt = "(" & flt1 & ")"
End If
If flt2 > "" Then
If flt > "" Then
flt = flt & " Or "
End If
flt = flt & "(" & flt2 & ")"
End If
If flt4 > "" Then
If flt > "" Then
flt = flt & " Or "
End If
flt = flt & "(" & flt4 & ")"
End If
If flt5 > "" Then
If flt > "" Then
flt = flt & " Or "
End If
flt = flt & "(" & flt5 & ")"
End If
End If
Tables("主界面_Table5").Filter = flt
With DataTables("缴费情况")
.LoadFilter = flt '设置加载条件
.LoadPage = 0
.LoadTop = 30 '每页5行
.LoadOrder = "_Identify"
.LoadReverse = True
.Load()
e.Form.Controls("TextBox3").Value = 1 & "/" & .TotalPages
End With