这是数据源格式:
此主题相关图片如下:qq图片20211205225928.png
统计后长时间格式的起、止时间不显示数据:
此主题相关图片如下:qq图片20211205230516.png
If e.Form.Controls("ComboBox1").Value = "" Then'当日期为空取消保存操作
messagebox.show("请选择分类")
Return
End If
If e.Form.Controls("DateTimePicker1").Value = Nothing OrElse e.Form.Controls("DateTimePicker2").Value = Nothing Then '当日期为空取消保存操作
messagebox.show("请选择起止时间")
Return
End If
If e.Form.Controls("ComboBox1").Value = e.Form.Controls("ComboBox1").Items(2)
Dim Filter1 As String
Filter1 = "分类 = '" & e.Form.Controls("ComboBox1").Value & "'"
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If Filter1 > "" Then
Filter1 = Filter1 & " And "
End If
Filter1 = Filter1 & "缴费_临时停放_起计时间 >= #" & Format(.Value.adddays(-1),"G") & "#"
End If
End With
With e.Form.Controls("DateTimePicker2")
If .Value IsNot Nothing Then
If Filter1 > "" Then
Filter1 = Filter1 & " And "
End If
Filter1 = Filter1 & "缴费_临时停放_止计时间 <= #" & Format(.Value.adddays(1),"G") & "#"
End If
End With
With e.Form.Controls("DropBox1")
If .Value IsNot Nothing Then
If Filter1 > "" Then
Filter1 = Filter1 & " And "
End If
Filter1 = Filter1 & "车牌号码 = '" & .Value & "'"
End If
End With
If Filter1 > "" Then
With Tables("安费用所属期查询统计_Table1")
Dim g3 As Subtotalgroup
.SubtotalGroups.Clear()
For i As Integer = DataTables("缴费情况").DataRows.count - 1 To 0 Step -1
Dim tr As DataRow = DataTables("缴费情况").DataRows(i)
If tr.Isnull("车牌号码") Then
tr.delete
End If
Next
Dim bc3 As New SQLGroupTableBuilder("统计表5","缴费情况")
bc3.Filter = "[缴费_临时停放_起计时间] >= #" & e.Form.Controls("DateTimePicker1").Value & "# And [缴费_临时停放_止计时间] <= #" & e.Form.Controls("DateTimePicker2").Value & "#"
bc3.Groups.AddDef("缴费_临时停放_起计时间",DateGroupEnum.Year,"年")
bc3.Groups.AddDef("缴费_临时停放_起计时间",DateGroupEnum.Month,"月")
bc3.Groups.AddDef("车牌号码")
bc3.Groups.AddDef("缴费_临时停放_起计时间")
bc3.Groups.AddDef("缴费_临时停放_止计时间")
bc3.Totals.AddDef("缴费_临时停放_计费时间")
bc3.Totals.AddDef("缴费_临时停放_缴费金额")
.DataSource = bc3.BuildDataSource()
End With
End If
With Tables("安费用所属期查询统计_Table1")
Dim g3 As Subtotalgroup
.SubtotalGroups.Clear()
LockBaseMainForm() '锁定主界面
.StopRedraw()
g3 = New Subtotalgroup
g3.GroupOn = "月"
g3.TotalOn = "缴费_临时停放_缴费金额"
g3.Caption = "本月发生额"
.SubtotalGroups.Add(g3)
g3 = New Subtotalgroup
g3.GroupOn = "月"
g3.Caption = "{0}月"
.SubtotalGroups.Add(g3)
.Sort = "年,月"
.Subtotal(True)
Dim r As Row
For i As Integer = 0 To .Rows.Count(True) - 1
r = .Rows(i,True)
If r.IsGroup AndAlso r("年") Like "*月" '如果是分组行
Dim f As String = "年 = " & .Rows(i-2,True)("年") & " And 月 <= " & r("年").trim("月")
r("年") = "本年累计"
r("缴费_临时停放_缴费金额") = .Compute("Sum(缴费_临时停放_缴费金额)",f)
End If
Next
DataTables("安费用所属期查询统计_Table1").DataCols("缴费_临时停放_起计时间").SetDateTimeFormat(DateTimeFormatEnum.DateLongTime)
DataTables("安费用所属期查询统计_Table1").DataCols("缴费_临时停放_止计时间").SetDateTimeFormat(DateTimeFormatEnum.DateLongTime)
DataTables("安费用所属期查询统计_Table1").DataCols("缴费_临时停放_缴费金额").SetFormat("#,###.##")
.SetColVisibleWidth("年|50|月|40|车牌号码|100|缴费_临时停放_起计时间|130|缴费_临时停放_止计时间|130|缴费_临时停放_计费时间|50|缴费_临时停放_缴费金额|70")
.SetHeaderRowHeight(0,0,25)
.ResumeRedraw()
UnLockBaseMainForm() '解锁主界
End With
End If
[此贴子已经被作者于2021/12/5 23:09:47编辑过]