Foxtable(狐表)用户栏目专家坐堂 → 分组统计


  共有10252人关注过本帖平板打印复制链接

主题:分组统计

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


加好友 发短信
等级:婴狐 帖子:91 积分:712 威望:0 精华:0 注册:2012/7/10 21:39:00
分组统计  发帖心情 Post By:2012/11/20 16:23:00 [只看该作者]

根据需要的时间及其他条件进行查询,用的是外部表,希望在窗口表中显示分组统计

代码如下:

s1 = " scph in (select scph from s_scph where jdrq between '" & d1 & "' and  '" & d2 & "' and kfbh = '" &  Trim(e.Form.Controls("Lkfbh").Text) & "')"
s3 = "Select (Select kfbh from sc_ddzb where scph = a.scph) 客户编号,(Select kfjc from sc_ddzb where scph = a.scph) 客户简称,scph 订单编号,xh 序号,cpbh 产品编号,cpmc 产品名称,lxbh 编号,xm 工序,xmsm 成本名称,je 预算单价,dhsl 订单数量,ysje 预算金额," _
& "(Select avg(dj) from sc_wfjgmx where ddbh = a.scph And xh = a.xh And lxbh = a.lxbh) As 实际单价,(Select sum(sl) from sc_wfjgmx where ddbh = a.scph And xh = a.xh And lxbh = a.lxbh) As 加工数量,((Select avg(dj) from sc_wfjgmx where ddbh = a.scph " _
& "And xh = a.xh And lxbh = a.lxbh)*(Select sum(sl) from sc_wfjgmx where ddbh = a.scph And xh = a.xh And lxbh = a.lxbh))As 加工金额 from sc_cpys a where lxbh In (2103,2106,5104,5107) and "
tb2.Fill(s3 & s1,"spData",True)
Dim b As New GroupTableBuilder("ddgx_hz",dtb2)
b.Groups.AddDef("工序","工序") '添加日期列用于分组,并用"年"代替原名称
'b.Groups.AddDef("工序","工序") '添加日期列用于分组,并用"月"代替原名称
b.Totals.AddDef("预算金额") '添加数量列用于统计
b.Totals.AddDef("加工金额") '添加金额列用于统计
b.Subtotal = False '生成汇总模式
b.Build '生成统计表

想实现用工序分组汇总,请教求解...

[此贴子已经被作者于2012-11-20 16:24:20编辑过]

 回到顶部
总数 11 1 2 下一页