Dim s_date As Date = new Date(2013, 9, 24)
Dim e_date As Date = new Date(2013, 9, 27)
Tables("统计").StopRedraw
Dim filter As String = " 发货日期 >= #" & s_date & "# and 发货日期 <= #" & e_date & "#"
Dim dt As DataTable = DataTables("历史运单")
Dim aList As List(of String) = DataTables("历史运单").GetUniqueValues(filter,"装车线路")
If aList IsNot Nothing Then
For Each s As String In aList
Dim dr As DataRow = DataTables("统计").AddNew
dr("装车线路")=s
dr("黄村1")=dt.Compute("count(到站)","装车线路='" & s & "' and 到站 = '黄村(京)' and " & filter)
dr("黄渡1")=dt.Compute("count(到站)","装车线路='" & s & "' and 到站 = '黄渡(上)' and " & filter)
dr("其他站点1")=dt.Compute("count(到站)","装车线路='" & s & "' and 到站 <> '黄渡(上)'and 到站 <> '黄村(京)' and " & filter)
dr("黄村2")=dt.Compute("sum(装车数量)","装车线路='" & s & "' and 到站 = '黄村(京)' and " & filter)
dr("黄渡2")=dt.Compute("sum(装车数量)","装车线路='" & s & "' and 到站 = '黄渡(上)' and " & filter)
dr("其他站点2")=dt.Compute("sum(装车数量)","装车线路='" & s & "' and 到站 <> '黄渡(上)'and 到站 <> '黄村(京)' and " & filter)
Next
End If
Tables("统计").ResumeRedraw