要使用SQLserver外部数据源,这个统计代码怎么改?
Dim Filter1 As String = "1=1"
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter1 >"" Then
Filter1 = Filter1 & " And "
End If
Filter1 = Filter1 & "来电时间 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter1 >"" Then
Filter1 = Filter1 & " And "
End If
Filter1 = Filter1 & "来电时间 <= #" & .Value & "#"
End If
End With
Dim tjb As String = "热线统计表"
Dim d As fxDataSource
Dim bms As String = "管网管理所抢修热线|用户管理水表热线|咨询业务热线登记表|公司内部业务热线登记表"
Dim i As Integer = 0
For Each bm As String In bms.split("|")
Dim b1 As New SQLGroupTableBuilder(tjb,bm)
b1.C
b1.Groups.AddExp("来电时间","来电时间")
b1.Totals.AddExp(bm & "_接单量","1")
b1.Totals.AddExp(bm & "_已处理数量","iif(是否解决=true,1,0)")
b1.Totals.AddExp(bm & "_未处理数量","iif(是否解决=true,0,1)")
b1.filter = filter1
Dim d1 As fxDataSource = b1.BuildDataSource()
If i = 0 Then
d = d1
Else
d.Combine("来电时间",d1,"来电时间")
End If
i += 1
Next
d.Show(tjb)
MainTable = Tables(tjb) '打开生成的统计表"
Dim t As Table = Tables(tjb)
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
t.SpillNode = True
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "*"
Dim ls As new List(Of String)
For Each c As Col In t.Cols
If c.IsNumeric Then
ls.add(c.Name)
End If
Next
g.TotalOn = String.join(",", ls.ToArray)
g.Caption = "合计"
t.SubtotalGroups.Add(g)
t.Subtotal()