Dim g1 As New SQLGroupTableBuilder("统计表1", "母猪基本信息")
g1.C
Dim d1 As fxDataSource
g1.Groups.AddDef("销售_日期", DateGroupEnum.Year, "日期_年")
g1.Groups.AddDef("销售_日期", "日期_月")
g1.Totals.AddDef("销售_金额", "销售_母猪")
d1 = g1.BuildDataSource()
Dim g2 As New SQLGroupTableBuilder("统计表2", "公猪信息")
g2.C
Dim d2 As fxDataSource
g2.Groups.AddDef("销售_日期", DateGroupEnum.Year, "日期_年")
g2.Groups.AddDef("销售_日期", "日期_月")
g2.Totals.AddDef("销售_金额", "销售_公猪")
d2 = g2.BuildDataSource()
Dim g3 As New SQLGroupTableBuilder("统计表3", "肉猪信息")
g3.C
Dim d3 As fxDataSource
g3.Groups.AddDef("销售_日期", DateGroupEnum.Year, "日期_年")
g3.Groups.AddDef("销售_日期", "日期_月")
g3.Totals.AddDef("销售_金额", "销售_肉猪")
d3 = g3.BuildDataSource()
Dim g4 As New SQLGroupTableBuilder("统计表4", "补贴项目")
g4.C
Dim d4 As fxDataSource
g4.Groups.AddDef("日期", DateGroupEnum.Year, "日期_年")
g4.Groups.AddDef("日期", "日期_月")
g4.Totals.AddDef("金额", "补贴项目")
d4 = g4.BuildDataSource()
Dim g5 As New SQLGroupTableBuilder("统计表5", "其他收入")
g5.C
Dim d5 As fxDataSource
g5.Groups.AddDef("日期", DateGroupEnum.Year, "日期_年")
g5.Groups.AddDef("日期", "日期_月")
g5.Totals.AddDef("金额", "其他收入")
d5 = g5.BuildDataSource()
Dim nms As String() = {"日期_年","日期_月"}
d1.Combine(nms,d2,nms)
d1.Combine(nms,d3,nms)
d1.Combine(nms,d4,nms)
d1.Combine(nms,d5,nms)
Tables("收入统计_Table1").DataSource = d1
With DataTables("收入统计_Table1").DataCols
.Add("合计",Gettype(Integer), "IsNull([销售_母猪],0) + ISNULL([销售_公猪],0) + ISNULL([销售_肉猪],0) + ISNULL([补贴项目],0) + ISNULL([其他收入],0)")
.Add("比例_销售_母猪",Gettype(Double),"IsNull([销售_母猪],0) / IsNull([合计],0)")
.Add("比例_销售_公猪",Gettype(Double),"IsNull([销售_公猪],0) / IsNull([合计],0)")
.Add("比例_销售_肉猪",Gettype(Double),"IsNull([销售_肉猪],0) / IsNull([合计],0)")
.Add("比例_补贴项目",Gettype(Double),"IsNull([补贴项目],0) / IsNull([合计],0)")
.Add("比例_其他收入",Gettype(Double),"IsNull([其他收入],0) / IsNull([合计],0)")
End With
请教老师,如何把黄色部分的显示结果是以双精度小数显示,但想改成是以Format(0.56,"00.0%")显示,需要怎么改?
还有紫色部分的被除数及时空值也不能为0,该怎么改?