以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 求助:流水计算,如果在filter后,计算? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=102265) |
-- 作者:yancheng -- 发布时间:2017/6/16 13:10:00 -- 求助:流水计算,如果在filter后,计算? 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的情况下。没问题。只是不排序 如果 加上最后一条代码,上面的:余额计算,代码如果改?
|
-- 作者:有点色 -- 发布时间:2017/6/16 15:42:00 -- Tables("会计分录序时薄_table2").sort = "日期 desc, _Sortkey desc" Dim sum1 As Double = 0 Dim sum2 As Double = 0 For Each r As Row In Tables("会计分录序时薄_table2").Rows sum1 += r("借方金额") sum2 += r("贷方金额") r("余额") = sum1 - sum2 Next |