Foxtable(狐表)用户栏目专家坐堂 → 如何进行按月分类汇总


  共有3617人关注过本帖树形打印复制链接

主题:如何进行按月分类汇总

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/3/5 15:54:00 [显示全部帖子]


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/3/5 17:34:00 [显示全部帖子]

没有的,就用代码动态添加进去,具体问题,请上传例子。

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/3/5 17:51:00 [显示全部帖子]

Dim g As New CrossTableBuilder("统计表1", DataTables("订单明细表"))
Dim dt As DataTable
g.HGroups.AddDef("客户产品号")
g.VGroups.AddDef("下单日期", "{0}月")
g.Totals.AddDef("订货数量", "订货数量")
g.Totals.AddDef("未税总价", "未税总价")
g.Decimals = 2

dt = g.Build(True)
Dim doc As New PrintDoc
Dim rt As New prt.RenderTable
Dim Count As Integer = 0
For Each Col As DataCol In Dt.DataCols
    If count > 0 Then
        If Col.Caption.StartsWith(count) = False Then
            For i As Integer = count To Col.Caption.Split("月")(0) - 1
                rt.Cells(0,Count).Text = i & "月_订货数量"
                For r As Integer = 0 To dt.DataRows.Count - 1
                    rt.Cells(r +1,Count).Text = ""
                Next
                count += 1
                rt.Cells(0,Count).Text = i & "月_未税总价"
                For r As Integer = 0 To dt.DataRows.Count - 1
                    rt.Cells(r +1,Count).Text = ""
                Next
                count += 1
            Next
        End If
    End If
    rt.Cells(0,Count).Text = Col.Name
    For r As Integer = 0 To dt.DataRows.Count - 1
        rt.Cells(r +1,Count).Text = dt.DataRows(r)(Col.Name)
    Next
    Count = Count + 1
Next
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
rt.CellStyle.Spacing.All = 1
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
doc.Body.Children.Add(rt)
doc.Preview()


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/3/5 19:21:00 [显示全部帖子]

Dim g As New CrossTableBuilder("统计表1", DataTables("aa"))
Dim dt As DataTable
g.HGroups.AddDef("客户产品号")
g.VGroups.AddDef("下单日期", "{0}月")
g.Totals.AddDef("订货数量", "订货数量")
g.Totals.AddDef("未税总价", "未税总价")
g.Decimals = 2

dt = g.Build(True)

Dim doc As New PrintDoc
Dim rt As New prt.RenderTable
Dim Count As Integer = 0
For Each Col As DataCol In Dt.DataCols
    If count > 0 Then
        If Col.Caption.StartsWith(count) = False Then
msgbox(2)
            For i As Integer = count To Col.Caption.Split("月")(0) - 1
                rt.Cells(0,Count).Text = i & "月_订货数量"
                For r As Integer = 0 To dt.DataRows.Count - 1
                    rt.Cells(r +1,Count).Text = ""
                Next
                count += 1
                rt.Cells(0,Count).Text = i & "月_未税总价"
                For r As Integer = 0 To dt.DataRows.Count - 1
                    rt.Cells(r +1,Count).Text = ""
                Next
                count += 1
            Next
        End If
    End If
    rt.Cells(0,Count).Text = Col.Caption
    For r As Integer = 0 To dt.DataRows.Count - 1
        rt.Cells(r +1,Count).Text = dt.DataRows(r)(Col.Name)
    Next
    Count = Count + 1
Next
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
rt.CellStyle.Spacing.All = 1
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
doc.Body.Children.Add(rt)
doc.Preview()

 


 回到顶部