按车号:
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编辑过]