Dim sd As WinForm.DateTimePicker
Dim ed As WinForm.DateTimePicker
sd = e.Form.Controls("DateTimePicker1")
ed = e.Form.Controls("DateTimePicker2")
Dim cpbh As String = e.Form.Controls("项目").Value
If cpbh = "" Then
DataTables("应付款项").LoadFilter=" [出车日期] >= #" & sd.Value & "# and [出车日期] <= #" & ed.Value & "#"
DataTables("应付款项").Load
Else
DataTables("应付款项").LoadFilter=" [出车日期] >= #" & sd.Value & "# and [出车日期] <= #" & ed.Value & "# and [项目] like '%" & cpbh & "%' "
DataTables("应付款项").Load
End If
Dim bd1 As New GroupTableBuilder("统计表1",DataTables("应付款项"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("项目")
bd1.Groups.AddDef("客户")
bd1.Groups.AddDef("送货地址")
bd1.Groups.AddDef("司机")
bd1.Groups.AddDef("车牌")
bd1.Totals.AddDef("体积","订单_体积")
bd1.Totals.AddDef("重量","订单_重量")
bd1.Totals.AddDef("装载量","车辆_装载量")
bd1.Totals.AddDef("罚款金额","订单_罚款")
bd1.Totals.AddDef("合计","订单_合计")
dt1 = bd1.BuildDataSource()
Dim nms As String() = {"项目","客户","司机","车牌"}
Tables("数据汇总_Table1").DataSource = dt1
With DataTables("数据汇总_Table1").DataCols
.Add("车辆_配载率",Gettype(Integer), "IsNull([Sum(装载量)],0) / ISNULL([Sum(体积)],0)" )
End With
Tables("数据汇总_Table1").AutoSizeCols()
Dim tjSum As Integer = DataTables("应付款项").Compute("Sum(体积)")
Dim zlSum As Integer = DataTables("应付款项").Compute("Sum(重量)")
Dim fkSum As Integer = DataTables("应付款项").Compute("Sum(罚款金额)")
Dim yfSum As Integer = DataTables("应付款项").Compute("Sum(合计)")
e.Form.Controls("Label2").Text = tjSum
e.Form.Controls("Label4").Text = zlSum
e.Form.Controls("Label6").Text = fkSum
e.Form.Controls("Label8").Text = yfSum