以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  这个怎么把按照配方名称查,有多少个品种显示出来,怎么加啊  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=151650)

--  作者:wujie
--  发布时间:2020/6/30 12:11:00
--  这个怎么把按照配方名称查,有多少个品种显示出来,怎么加啊
Dim d1 As Date = e.Form.Controls("U").Value
Dim d2 As Date = e.Form.Controls("V").Value


If d1 = Nothing Or d2 = Nothing Then
    MessageBox.Show("日期都不能为空","友情提醒",MessageBoxButtons.OK,MessageBoxIcon.Warning)
Else
    With DataTables("生产记录")
        .LoadFilter = "日期>=#" & d1 & "# and 日期<=#" & d2 & "#"
        .Load()
    End With
 
    Dim b As New GroupTableBuilder("统计表2",DataTables("生产记录"))
    b.Groups.AddDef("配方名称")
    b.Groups.AddDef("原料名称") 
    b.Totals.AddDef("设定值")
    b.Totals.AddDef("实际值")
    b.Totals.AddDef("误差值")

    b.Build \'生成统计表
    MainTable = Tables("统计表2")  
    Tables("窗口1_Table1").DataSource =b.BuildDataSource()
 End If

Dim g As New Subtotalgroup 
g.Aggregate = AggregateEnum.Sum 
g.GroupOn = "配方名称" 
g.TotalOn = "设定值,实际值,误差值" 
g.Caption = "合计" 
 With Tables("窗口1_Table1")
    .SubtotalGroups.Clear() 
    .SubtotalGroups.Add(g) 
    .Subtotal() 
End With

With Tables("窗口1_Table1")
    .MergeMode = MergeModeEnum.Standard
    .MergeCols.Clear()
    .MergeCols.Add("配方名称")
    .MergeSort = "配方名称"
    .AllowMerge = True
End With

--  作者:有点蓝
--  发布时间:2020/6/30 13:39:00
--  
    Dim b As New GroupTableBuilder("统计表2",DataTables("生产记录"))
    b.Groups.AddDef("配方名称")
    b.Groups.AddDef("原料名称") 
    b.Totals.AddDef("设定值")
    b.Totals.AddDef("实际值")
    b.Totals.AddDef("误差值")
    b.Totals.AddDef("品种",AggregateEnum.Count)
    Tables("窗口1_Table1").DataSource =b.BuildDataSource()