以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 汇总后想要实现的效果 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=158736) |
||||
-- 作者:HANZHIGANG -- 发布时间:2020/12/1 9:37:00 -- 汇总后想要实现的效果 统计后想实现的效果,如上传EXCEL中的两个表 请指导,多谢
|
||||
-- 作者:有点蓝 -- 发布时间:2020/12/1 9:40:00 -- 参考:http://www.foxtable.com/webhelp/topics/1911.htm、http://www.foxtable.com/webhelp/topics/1964.htm |
||||
-- 作者:HANZHIGANG -- 发布时间:2020/12/1 16:00:00 -- 汇总后想要实现的效果 不行啊,蓝版,各种组合,最终没出来要的结果,整一下午没整明白。 只能求贴代码了
|
||||
-- 作者:有点蓝 -- 发布时间:2020/12/1 16:04:00 -- 请上传实例测试 |
||||
-- 作者:HANZHIGANG -- 发布时间:2020/12/1 16:28:00 -- 实现EXCEL中的效果 多谢
|
||||
-- 作者:有点蓝 -- 发布时间:2020/12/1 16:53:00 --
|
||||
-- 作者:HANZHIGANG -- 发布时间:2020/12/1 17:26:00 -- Dim StartDate As Date Dim EndDate As Date With RibbonTabs("功能区1").Groups("功能组1") StartDate = .Items("StartDate").Value EndDate = .Items("EndDate").Value If .Items("StartDate").Value IsNot Nothing And .Items("EndDate").Value IsNot Nothing Then Dim g As New GroupTableBuilder("月末汇总", DataTables("运单管理")) g.Groups.AddDef("部门") g.Groups.AddDef("上游客户") g.Groups.AddDef("车辆类型") g.Totals.AddDef("上游金额") g.Totals.AddDef("已付成本") g.Totals.AddDef("计提成本") g.Totals.AddDef("总成本") g.Totals.AddDef("毛利润") g.VerticalTotal = True g.Decimals = 2 g.SubTotal = True g.FromServer = True g.Filter = "[调度日期] >= #" & StartDate & "# And [调度日期] <= #" & EndDate & "#" g.Build() MainTable = Tables("月末汇总") With Tables("月末汇总") .MergeMode = MergeModeEnum.Standard \'标准合并模式 .MergeCols.Clear() \'清除原来的合并列 .MergeCols.Add("部门") \'加入要合并的列 .MergeSort = "部门" \'设置合并模式下的排序方式 .AllowMerge = True \'启用合并模式 End With Dim t1 As Table = Tables("月末汇总") Dim g1 As Subtotalgroup t1.SubtotalGroups.Clear() t1.GroupAboveData = False t1.TreeVisible = False t1.SpillNode = True g1 = New Subtotalgroup g1.Aggregate = AggregateEnum.Sum g1.GroupOn = "上游客户" g1.TotalOn = "上游金额,已付成本,计提成本,总成本,毛利润" g1.Caption = "{0} 小计" t1.SubtotalGroups.Add(g1) Dim Products As List(Of String) = DataTables("月末汇总").GetValues("车辆类型",g.Filter) For Each s As String In Products g1 = New Subtotalgroup g1.Aggregate = AggregateEnum.Sum g1.GroupOn = "部门" g1.Caption = "{0} " & s & " 小计_" t1.SubtotalGroups.Add(g1) Next g1 = New Subtotalgroup g1.Aggregate = AggregateEnum.Sum g1.GroupOn = "部门" g1.TotalOn = "上游金额,已付成本,计提成本,总成本,毛利润" g1.Caption = "{0} 合计" t1.SubtotalGroups.Add(g1) g1 = New Subtotalgroup g1.Aggregate = AggregateEnum.Sum g1.GroupOn = "*" g1.TotalOn = "上游金额,已付成本,计提成本,总成本,毛利润" g1.Caption = "总计" t1.SubtotalGroups.Add(g1) t1.Subtotal() Dim r As Row Dim arr() As String With Tables("月末汇总") For i As Integer = .Rows.Count(True) - 1 To 0 Step -1 \'Count加上参数True r = .Rows(i,True) \'Rows也需要加上参数True If r.IsGroup AndAlso r("部门") Like "*小计_" Then \'如果是分组行 arr = r("部门").split(" ") r("部门") = Nothing r("车辆类型") = arr(1) & "小计" r("已付成本") = .Compute("sum(已付成本)","部门=\'" & arr(0) & "\' And 车辆类型=\'" & arr(1) & "\'") r("计提成本") = .Compute("sum(计提成本)","部门=\'" & arr(0) & "\' And 车辆类型=\'" & arr(1) & "\'") End If Next End With Else MessageBox.Show("请填写调度起始期后再进行统计!") End If End With |
||||
-- 作者:有点蓝 -- 发布时间:2020/12/1 17:40:00 -- 列名不正确 |
||||
-- 作者:HANZHIGANG -- 发布时间:2020/12/2 9:56:00 -- 汇总后想要实现的效果 Dim Products As List(Of String) = DataTables("月末汇总").GetValues("车辆类型",g.Filter) 蓝版,调度日期的列名是没错的 我逐句做了调试,应该是上面这句代码出的问题,g.Filter,应该是这个条件,但我不知道怎么改,您再帮看一下 |
||||
-- 作者:有点蓝 -- 发布时间:2020/12/2 9:57:00 --
|