能帮我看看这个吗?为什么生成的统计表没有年啊?
在图标上的顺序就乱了!
可以让 "业务往来_送货日期 把年生成在里面吗?
此主题相关图片如下:a.jpg
此主题相关图片如下:b.jpg
Dim d1 As Date = e.Form.Controls("DateTimePicker5").Value
If d1 = Nothing Then d1 = Date.Today
Dim filter1 As String = ""
If e.Form.Controls("RadioButton1").Checked Then
filter1 = "业务往来_送货日期 = #" & d1 & "#"
ElseIf e.Form.Controls("RadioButton2").Checked Then
Dim w As Integer = d1.DayOfWeek '算出今天是星期几
Dim dt1 As Date = d1.AddDays(0 - w) '获取本周的第一天 ,星期一到星期天
Dim dt2 As Date = d1.AddDays(6 - w) '获取本周的最后一天
filter1 = "业务往来_送货日期 >= #" & dt1 & "# and 业务往来_送货日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton3").Checked Then
Dim y As Integer = d1.Year
Dim m As Integer = d1.Month
Dim dt1 As New Date(y, m, 1)
Dim dt2 As New Date(y, m, Date.DaysInMonth(y, m)) '获取本月的最后一天
filter1 = "业务往来_送货日期 >= #" & dt1 & "# and 业务往来_送货日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton4").Checked Then
Dim y As Integer = d1.Year
Dim q As Integer = (d1.Month - 1) \ 3 + 1 '计算现在是第几个季度
Dim dt1 As New Date(y, 3 * (q - 1) + 1, 1) '获取本季度的第一天
Dim dt2 As New Date(y, 3 * q, Date.DaysInMonth(y,3 * q)) '获取本季度的最后一天
filter1 = "业务往来_送货日期 >= #" & dt1 & "# and 业务往来_送货日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton5").Checked Then
Dim y As Integer = d1.Year
Dim dt1 As New Date(y, 1, 1)
Dim dt2 As New Date(y, 12, 31)
filter1 = "业务往来_送货日期 >= #" & dt1 & "# and 业务往来_送货日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton6").Checked Then
filter1 = "1=1"
Else If e.Form.Controls("RadioButton07").Checked Then
filter1 = "业务往来_送货日期 < #" & d1 & "#"
End If
Dim c6 As String = e.Form.controls("ComboBox6").Value
If c6 <> "全部" Then
Dim tt As Table = e.Form.Controls("Table10").Table
If tt.Current IsNot Nothing Then
filter1 &= " and " & c6 & " = '" & tt.Current(c6) & "'"
End If
End If
[此贴子已经被作者于2016/3/17 16:50:37编辑过]