Foxtable(狐表)用户栏目专家坐堂 → [求助]设置统计表的格式怎么样设置?


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

主题:[求助]设置统计表的格式怎么样设置?

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


加好友 发短信
等级:幼狐 帖子:97 积分:870 威望:0 精华:0 注册:2016/9/27 14:05:00
[求助]设置统计表的格式怎么样设置?  发帖心情 Post By:2016/11/1 8:55:00 [只看该作者]

Dim bd1 As New GroupTableBuilder("统计表1",DataTables("板材用料表"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("产品编号") '根据型号分组
bd1.Totals.AddDef("金额","板材成本") '对数量进行统计
bd1.Decimals = 2
dt1 = bd1.BuildDataSource()


Dim bd2 As New GroupTableBuilder("统计表2",DataTables("包装箱板材用量"))
Dim dt2  As fxDataSource
bd2.Groups.AddDef("产品编号") '根据型号分组
bd2.Totals.AddDef("金额","包装箱板材成本") '对数量进行统计
bd2.Decimals = 2
dt2 = bd2.BuildDataSource()

Dim bd3 As New GroupTableBuilder("统计表3",DataTables("油漆用量表"))
Dim dt3  As fxDataSource
bd3.Groups.AddDef("产品编号") '根据型号分组
bd3.Totals.AddDef("单机金额","油漆成本") '对数量进行统计

bd3.Decimals = 2
dt3 = bd3.BuildDataSource()


Dim bd4 As New GroupTableBuilder("统计表4",DataTables("BOM表"))
Dim dt4  As fxDataSource
bd4.Groups.AddDef("产品编号") '根据型号分组
bd4.Totals.AddDef("金额","BOM成本") '对数量进行统计
bd4.Decimals = 2
dt4 = bd4.BuildDataSource()

Dim bd5 As New GroupTableBuilder("统计表5",DataTables("订单工时成本"))
Dim dt5  As fxDataSource
bd5.Filter = "[部门] = '木工'"
bd5.Groups.AddDef("产品编号") '根据型号分组
bd5.Totals.AddDef("单位工时成本","工时成本_木工") '对数量进行统计
bd5.Decimals = 2
dt5 = bd5.BuildDataSource()

Dim bd6 As New GroupTableBuilder("统计表6",DataTables("订单工时成本"))
Dim dt6  As fxDataSource
bd6.Filter = "[部门] = '涂装'"
bd6.Groups.AddDef("产品编号") '根据型号分组
bd6.Totals.AddDef("单位工时成本","工时成本_涂装") '对数量进行统计
bd6.Decimals = 2
dt6 = bd6.BuildDataSource()

Dim bd7 As New GroupTableBuilder("统计表7",DataTables("订单工时成本"))
Dim dt7  As fxDataSource
bd7.Filter = "[部门] = '装配'"
bd7.Groups.AddDef("产品编号") '根据型号分组
bd7.Totals.AddDef("单位工时成本","工时成本_装配") '对数量进行统计
bd7.Decimals = 2
dt7 = bd7.BuildDataSource()

Dim bd8 As New GroupTableBuilder("统计表8",DataTables("订单工时成本"))
Dim dt8  As fxDataSource
bd8.Filter = "[部门] = '五金'"
bd8.Groups.AddDef("产品编号") '根据型号分组
bd8.Totals.AddDef("单位工时成本","工时成本_五金") '对数量进行统计
bd8.Decimals = 2
dt8 = bd8.BuildDataSource()

Dim bd9 As New GroupTableBuilder("统计表9",DataTables("订单工时成本"))
Dim dt9  As fxDataSource
bd9.Filter = "[部门] = '光电'"
bd9.Groups.AddDef("产品编号") '根据型号分组
bd9.Totals.AddDef("单位工时成本","工时成本_光电") '对数量进行统计
bd9.Decimals = 2
dt9 = bd9.BuildDataSource()



dt1.Combine("产品编号",dt2,"产品编号") '
dt1.Combine("产品编号",dt3,"产品编号")
dt1.Combine("产品编号",dt4,"产品编号")
dt1.Combine("产品编号",dt5,"产品编号")
dt1.Combine("产品编号",dt6,"产品编号")
dt1.Combine("产品编号",dt7,"产品编号")
dt1.Combine("产品编号",dt8,"产品编号")
dt1.Combine("产品编号",dt9,"产品编号")


Tables("统计_Table1").DataSource = dt1 

With DataTables("统计_Table1").DataCols  
    .Add("工时成本_小计",Gettype(Integer), "IsNull([工时成本_木工],0) + ISNULL([工时成本_涂装],0) + ISNULL([工时成本_装配],0)  + ISNULL([工时成本_五金],0)+ ISNULL([工时成本_光电],0)   ")
   
End With



With DataTables("统计_Table1").DataCols  
    .Add("合计",Gettype(Integer), "IsNull([板材成本],0) + ISNULL([包装箱板材成本],0) + ISNULL([油漆成本],0)  + ISNULL([BOM成本],0)+ ISNULL([工时成本_小计],0)   ")
   
End With


以上代码,我想设置每个格里的数据都居中,数值都带两位小数,如何设置?



 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110572 积分:562750 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/1 9:27:00 [只看该作者]

参考:http://www.foxtable.com/webhelp/scr/1786.htm


For Each c As Col In Tables("表A").Cols
    c.TextAlign  = TextAlignEnum.Center
    If c.IsNumeric Then
        c.DataCol.SetFormat("0.00")
    End If
Next

 回到顶部