Dim DT1 As String = e.form.Controls("DateTimePicker1").Value
Dim DT2 As String = e.form.Controls("DateTimePicker2").Value
If DT1 Is Nothing Or DT2 Is Nothing Then
MsgBox("请选择查询起止日期!",64,"提示")
Return
End If
If DT1 IsNot Nothing Or DT2 IsNot Nothing Then
Dim b As New SQLGroupTableBuilder("汇总统计","SFMX")
b.Filter = "[RQ] >= #"& DT1 &"# And [RQ]<= #"& DT2 &"# And [ZT] = "& True &""
b.Groups.AddDef("XM","项目类别")
b.Groups.AddDef("RQ","收费日期")
b.Totals.AddDef("JE","分项合计")
b.VerticalTotal = True
b.Build
MainTable = Tables("汇总统计")
Tables("汇总统计_Table1").DataSource = b.BuildDataSource()
Tables("汇总统计_Table1").SetColVisibleWidth("项目类别|90|收费日期|120|分项合计|90")
DataTables("汇总统计").AllowEdit = False
End If
需要的效果是按日期再次分组,显示"yyyy-mm-dd",不按年、月或日分组。本质还是按日分组。