Dim Filter As String
If e.node.name = "全部" Then
filter = ""
Else
'Dim d1,d2 As Date
'Dim Year As Integer = e.Node.DataRow("年")
'Dim Month As Integer = e.Node.DataRow("月")
Dim yjkm As String = e.Node.DataRow("会计科目_一级科目")
Dim ejkm As String = e.Node.DataRow("会计科目_二级科目")
Dim sjkm As String = e.Node.DataRow("会计科目_三级科目")
'd1 = new Date(Year,1,1)
'd2 = new Date(Year,Month,1)
Select Case e.Node.Level
Case 0
filter= "会计科目_一级科目= '" & yjkm & "'"
Case 1
filter="会计科目_一级科目= '" & yjkm & "' and 会计科目_二级科目= '" & ejkm & "'"
Case 2
Filter ="会计科目_一级科目= '" & yjkm & "' and 会计科目_二级科目= '" & ejkm & "' and 会计科目_三级科目= '" & sjkm & "'"
'Case 4
'Filter = "入库日期 >= '" & d1 & "' and 入库日期 < '" & d1.AddYears(1) & "' And 入库日期 >= '" & d2 & "'and 入库日期 < '" & d2.AddMonths(1) & "' And 合同名称 = '" & htmc & "' And 供应商 = '" & gys & "'"
End Select
End If
If filter > "" Then
DataTables("凭证明细").RemoveFor(filter)
DataTables("凭证明细").AppendLoad(filter)
Tables("会计分录序时薄_table2").Filter= filter
Else
DataTables("凭证明细").LoadFilter= filter
DataTables("凭证明细").load()
Tables("会计分录序时薄_table2").Filter= filter
End If
'计算余额列----------------
For Each r As Row In Tables("会计分录序时薄_table2").Rows
Dim Val1 As Double = Tables("会计分录序时薄_table2").Compute("Sum(借方金额)","[_SortKey] <= " & r("_SortKey"))
Dim Val2 As Double = Tables("会计分录序时薄_table2").Compute("Sum(贷方金额)","[_SortKey] <= " & r("_SortKey"))
r("余额") = Val1 - Val2
Next
'Tables("会计分录序时薄_table2").sort = "日期 desc, _Sortkey desc"
不加最后一条代码,不filter的情况下。没问题。只是不排序
如果 加上最后一条代码,上面的:余额计算,代码如果改?