Foxtable(狐表)用户栏目专家坐堂 → 关于自定义汇总


  共有3104人关注过本帖平板打印复制链接

主题:关于自定义汇总

帅哥哟,离线,有人找我吗?
lgj716330
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1312 积分:10148 威望:0 精华:0 注册:2013/11/8 15:27:00
关于自定义汇总  发帖心情 Post By:2015/12/10 17:00:00 [只看该作者]

如图,我要在筛选过程中进行自定义汇总,如何使得“年份”不用汇总,同时只有选择科目的时候才进行总计,科目不选就没有总计
图片点击可在新窗口打开查看此主题相关图片如下:3333.jpg
图片点击可在新窗口打开查看


Dim Filter As String '设置筛选条件
With e.Form.Controls("DW")
    If .Value IsNot Nothing Then
        Filter = "所属单位 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("NF") 
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "年 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("KM")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "一级科目 = '" & .Value & "'"
    End If
End With
If Filter > "" Then
    Tables("损益进度(总体)").Filter = Filter
End If
Dim t As Table = Tables("损益进度(总体)") 
Dim g As Subtotalgroup 
Dim cs As String = ""
For Each c As Col In Tables("损益进度(总体)").cols
    If c.Visible AndAlso c.IsNumeric Then
        cs &= c.name & ","
    End If
Next
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
t.SpillNode = False


g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "*"
g.TotalOn = cs.trim(",")
g.Caption = "总计"
t.SubtotalGroups.Add(g)

t.Subtotal()

 回到顶部
总数 27 1 2 3 下一页