Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共5 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:求筛选后合计代码

1楼
老有所乐 发表于:2009/4/27 11:57:00
在“销售明细”表窗口,“筛选并合计”按钮是模糊筛选,输入关键字后,点击该按钮,会筛选所要的记录。要求能将筛选的结果最后加一行合计,对筛选出的数量和金额合计。请师傅帮忙,谢谢!
 
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:进销存3.table

2楼
八婺 发表于:2009/4/27 12:11:00
对主表进行合计还是DataList控件?
3楼
老有所乐 发表于:2009/4/27 14:54:00

不好意思,发帖后有事去了。
我想最好两个都要,不行就Datalist吧,谢谢先生关心!

4楼
八婺 发表于:2009/4/27 15:53:00
筛选并合计按钮代码:

Dim Filter As String = ""
Dim Val As String = Forms("窗口2").Controls("TextBox1").Value
if Val is nothing then
    MessageBox.Show("对不起,请先输入查找内容!", "提示")
Else
    For each c As col In CurrentTable.Cols
        If c.IsString Then
            If Filter > "" Then
                Filter = Filter & " Or "
            End If
            Filter = Filter &  c.Name & " Like '*" & Val & "*'"
        End If
    Next
    CurrentTable.Filter = Filter
   
    if CurrentTable.Rows.Count-1 >= 0 Then
        Dim t As Table = Tables("销售明细")
        Dim g As SubtotalGroup
        t.SubtotalGroups.Clear()
        t.GroupAboveData = False
        t.TreeVisible = False
        g = New SubtotalGroup
        g.Aggregate = AggregateEnum.Sum
        g.GroupOn = "*"
        g.TotalOn = "数量,金额"
        g.Caption = "总计"
        t.SubtotalGroups.Add(g)
        t.Subtotal()
       
        Dim dst1 As WinForm.DataList = Forms("窗口2").Controls("DataList1")
        dst1.ColumnList=("ID|日期|年|月|日|商品名称|规格|单位|数量|金额|客户|经手人")
        dst1.Filter = CurrentTable.Filter
        dst1.DataTable = DataTables("销售明细")
        dst1.Build()
        dst1.GrandTotal(AggregateEnum.Sum,"合计","数量","金额")
       
    Else
        MessageBox.Show("对不起,没有符合条件的数据!", "提示")
    End If
end if
5楼
老有所乐 发表于:2009/4/27 16:52:00
谢谢您,八婺老师!我慢慢琢磨去。
共5 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02734 s, 3 queries.