以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  分组统计  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=135505)

--  作者:sj67502588
--  发布时间:2019/5/28 12:28:00
--  分组统计
我已经通过下面的代码把上面这个表做出来了,那么现在有没有办法把上面这张表里,库存为零的项目单独摘出来,放到下面的一个表中呢
图片点击可在新窗口打开查看此主题相关图片如下:360截图20190527145030017.jpg
图片点击可在新窗口打开查看
Dim mc As String = e.Form.Controls("ComboBox1").text
Dim bd1 As New GroupTableBuilder("库存",DataTables("球拍入库管理"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("球拍型号") \'根据型号分组
bd1.Totals.AddDef("球拍型号", AggregateEnum.Count, "库存") \'对数量进行统计
bd1.Filter = "[所属经销商]=\'" & mc & "\' And [已售]=False And [作废]= false"
dt1 = bd1.BuildDataSource()
bd1.Build
 
Dim bd2 As New GroupTableBuilder("总入库",DataTables("球拍入库管理"))
Dim dt2  As fxDataSource
bd2.Groups.AddDef("球拍型号") \'根据型号分组
bd2.Totals.AddDef("球拍型号", AggregateEnum.Count, "入库") \'对数量进行统计
bd2.Filter = "[所属经销商]=\'" & mc & "\'"
dt2 = bd2.BuildDataSource()
bd2.Build

dt1.Combine("球拍型号",dt2,"球拍型号") \'将销售统计数据组合到进货统计数据
Tables("查看库存_库存表").DataSource = dt1 \'将统计结果绑定到Table
Tables("查看库存_库存表").grid.Cols("球拍型号").width = 230
Tables("查看库存_库存表").grid.Cols("库存").width = 50
Tables("查看库存_库存表").grid.Cols("入库").width = 50
Tables("查看库存_库存表").Cols("球拍型号").TextAlign = TextAlignEnum.Center
Tables("查看库存_库存表").Cols("库存").TextAlign = TextAlignEnum.Center
Tables("查看库存_库存表").Cols("入库").TextAlign = TextAlignEnum.Center
Tables("查看库存_库存表").Cols("入库").Visible = False

For Each r As Row In Tables("查看库存_库存表").rows
    For Each c As Col In r.Table.cols
        If c.IsNumeric AndAlso r.IsNull(c.name) Then
            r(c.name) = 0
        End If
    Next
Next

--  作者:有点甜
--  发布时间:2019/5/28 12:44:00
--  

方法1、直接拷贝过去,即可

 

http://www.foxtable.com/webhelp/scr/0680.htm

 

http://www.foxtable.com/webhelp/scr/1533.htm

 

方法2、下面的表绑定上面的表,然后筛选条件设置一下即可