你要看得懂代码啊
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"
End If
'Dim Chart As WinForm.Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
'Dim series As winform.ChartSeries
'Chart.SeriesList.Clear() '清除图表原来的图系
'Chart.AxisX.ClearValueLabel
'Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
'Chart.ChartType = ChartTypeEnum.Bar '图表类型改为Bar(条形)
Dim c6 As String = e.Form.controls("ComboBox01").Value
Dim ComboBox6 As WinForm.ComboBox = e.Form.Controls("ComboBox6")
Dim tp As DateGroupEnum = 0
Dim g As New GroupTableBuilder("临时统计表", DataTables("表b"))
g.Groups.AddDef(ComboBox6.Text)
g.Totals.AddDef(c6)
'g.Totals.AddDef("利润和")
'g.Totals.AddDef("采购合计")
'g.Totals.AddDef("返点金额")
g.VerticalTotal = True
g.GrandProportion = True
g.filter = filter1 & " and 销售合计 <> 0" '显示大于0的
g.Build()
'Dim t As Table = Tables("临时统计表")
't.Sort = "日期"
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim t As Table = Tables("临时统计表") '定义一个变量t引用数据表
Dim sm As Integer = 0
Chart= Forms("统计").Controls("Chart1") ' 引用窗口中的图表
chart.SeriesList.Clear
chart.AxisX.ClearValueLabel
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.ChartType = ChartTypeEnum.Pie '图表1类型改为Bar(条形)
Dim r As Row
For i As Integer = 0 To t.Rows.Count - 2
Series = Chart.SeriesList.Add() '增加一个图系
Series.Length = 1 '一个系列只能包括一个值
Series.Text = t.Rows(i)(ComboBox6.Text) '设置图系的标题
Series.Y(0) = t.Rows(i)(c6)'指定值
Series.DataLabelText = format(t.Rows(i)(c6 & "gdr"),"0.00%")'计算百分比
Next
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South'图列显示在东方(右方)
'
'e.Form.Controls("Label62").Text = Format(Val(DataTables("临时统计表").Compute("sum(订单核算_合计)")),"#.00")