Foxtable(狐表)用户栏目专家坐堂 → [求助]请问如何按起止日期进行交叉统计?


  共有14791人关注过本帖树形打印复制链接

主题:[求助]请问如何按起止日期进行交叉统计?

美女呀,离线,留言给我吧!
yangming
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:超级版主 帖子:4109 积分:23338 威望:0 精华:21 注册:2008/9/1 20:07:00
  发帖心情 Post By:2011/11/30 13:54:00 [显示全部帖子]

按车号:

Dim Filter As String
With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        Filter =  "日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 <= #" & .Value & "#"
    End If
End With
Dim b As New CrossTableBuilder("统计表1",DataTables("班线营收"))
b.HGroups.AddDef("车号")
b.VGroups.AddDef("日期")
b.Totals.AddDef("运行里程")
b.Totals.AddDef("运量人数")
b.Totals.AddDef("运量金额")
b.Totals.AddDef("路配人数")
b.Totals.AddDef("路配金额")
b.Totals.AddDef("小件营收")
b.Totals.AddDef("人数合计")
b.Totals.AddDef("营收合计")
b.OrderByTotal = True
b.VerticalTotal= True
b.Filter = Filter
b.Build
MainTable = Tables("统计表1")

 

按驾驶员

Dim Filter As String
With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        Filter =  "日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 <= #" & .Value & "#"
    End If
End With
Dim b As New CrossTableBuilder("统计表1",DataTables("班线营收"))
b.HGroups.AddDef("驾驶员")
b.VGroups.AddDef("日期")
b.Totals.AddDef("运行里程")
b.Totals.AddDef("运量人数")
b.Totals.AddDef("运量金额")
b.Totals.AddDef("路配人数")
b.Totals.AddDef("路配金额")
b.Totals.AddDef("小件营收")
b.Totals.AddDef("人数合计")
b.Totals.AddDef("营收合计")
b.OrderByTotal = True
b.VerticalTotal= True
b.Filter = Filter
b.Build
MainTable = Tables("统计表1")

 

 

按乘务员

Dim Filter As String
With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        Filter =  "日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 <= #" & .Value & "#"
    End If
End With
Dim b As New CrossTableBuilder("统计表1",DataTables("班线营收"))
b.HGroups.AddDef("乘务员")
b.VGroups.AddDef("日期")
b.Totals.AddDef("运行里程")
b.Totals.AddDef("运量人数")
b.Totals.AddDef("运量金额")
b.Totals.AddDef("路配人数")
b.Totals.AddDef("路配金额")
b.Totals.AddDef("小件营收")
b.Totals.AddDef("人数合计")
b.Totals.AddDef("营收合计")
b.OrderByTotal = True
b.VerticalTotal= True
b.Filter = Filter
b.Build
MainTable = Tables("统计表1")

[此贴子已经被作者于2011-11-30 13:56:49编辑过]

 回到顶部