Dim b As New SQLGroupTableBuilder("统计表00004","投标评价") '20160930
b.C
b.Groups.AddDef("项目属地")
b.Groups.AddDef("投标结果")
b.Totals.AddExp("投标执行_投标报价_最低","投标执行_投标报价_最低*-1","投标报价_最低",AggregateEnum.Sum)
b.Totals.AddExp("投标执行_投标报价_次低","投标执行_投标报价_次低*-1","投标报价_次低",AggregateEnum.Sum)
b.Totals.AddExp("投标执行_投标报价_中间","投标执行_投标报价_中间*-1","投标报价_中间",AggregateEnum.Sum)
b.Totals.AddExp("投标执行_投标报价_次高","投标执行_投标报价_次高*-1","投标报价_次高",AggregateEnum.Sum)
b.Totals.AddExp("投标执行_投标报价_最高","投标执行_投标报价_最高*-1","投标报价_最高",AggregateEnum.Sum)
b.Filter = "投标日期 >= #" & e.Form.Controls("DateTimePicker1").Value & "# And 投标日期 <= #" & e.Form.Controls("DateTimePicker2").Value & "# and 投标结果 Like '%项目未中标%'"
b.VerticalTotal = True
b.GrandProportion = True
Tables("投标评价_Table2").DataSource = b.BuildDataSource()
DataTables("投标评价_Table2").DataCols.Add _
("点数",Gettype(Double), "投标执行_投标报价_最低 + 投标执行_投标报价_次低 + 投标执行_投标报价_中间 + 投标执行_投标报价_次高 + 投标执行_投标报价_最高")
Dim dr As Row
For i As Integer = 0 To Tables("投标评价_Table2").Rows.Count(True) - 1
dr = Tables("投标评价_Table2").Rows(i,True)
dr("投标执行_投标报价_最低gdr") = Format(dr("投标执行_投标报价_最低") / dr("点数"),"0.00")
dr("投标执行_投标报价_次低gdr") = Format(dr("投标执行_投标报价_次低") / dr("点数"),"0.00")
dr("投标执行_投标报价_中间gdr") = Format(dr("投标执行_投标报价_中间") / dr("点数"),"0.00")
dr("投标执行_投标报价_次高gdr") = Format(dr("投标执行_投标报价_次高") / dr("点数"),"0.00")
dr("投标执行_投标报价_最高gdr") = Format(dr("投标执行_投标报价_最高") / dr("点数"),"0.00")
Next
Tables("投标评价_Table2").AutoSizeCols()
Tables("投标评价_Table2").Cols("点数").Width = 40
Tables("投标评价_Table2").Cols("点数").Move(2)
Tables("投标评价_Table2").SetHeaderRowHeight(20,20) '投标评价 统计表00003 20160929
Tables("投标评价_Table2").Cols.Frozen = 2 '副本冻结前两列
Tables("投标评价_Table2").Grid.Cols("项目属地").style.BackColor = Color.GhostWhite '冻结
Tables("投标评价_Table2").Grid.Cols("投标结果").style.BackColor = Color.GhostWhite '冻结
DataTables("投标评价_Table2").SysStyles("Normal").BackColor = Color. GhostWhite
Tables("投标评价_Table2").Grid.Cols("投标执行_投标报价_最低gdr").style.BackColor = Color.LightSalmon
Tables("投标评价_Table2").Grid.Cols("投标执行_投标报价_次低gdr").style.BackColor = Color.LightSalmon
Tables("投标评价_Table2").Grid.Cols("投标执行_投标报价_中间gdr").style.BackColor = Color.LightSalmon
Tables("投标评价_Table2").Grid.Cols("投标执行_投标报价_次高gdr").style.BackColor = Color.LightSalmon
Tables("投标评价_Table2").Grid.Cols("投标执行_投标报价_最高gdr").style.BackColor = Color.LightSalmon
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim t As Table = Tables("投标评价_Table2") '定义一个变量t引用数据表
Chart= e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.ChartType = ChartTypeEnum.Bar '图表类型该为Bar(条形)
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一图系
Dim cls() As String = {"投标执行_投标报价_最低gdr","投标执行_投标报价_次低gdr","投标执行_投标报价_中间gdr","投标执行_投标报价_次高gdr","投标执行_投标报价_最高gdr"}
Dim ns() As String = {"最低","次低","中间","次高","最高"}
Dim dr22 As Row = t.Rows(t.Rows.Count(True) - 1,True)
Series.Length = cls.Length '图系的数据点数等于表的行数
For i As Integer = 0 To cls.Length - 1 '指定每个数据点的位置
Series.X(i) = i '指定水平坐标
Series.Y(i) = dr22(cls(i)) '指定垂直坐标
Chart.AxisX.SetValueLabel(i, ns(i))
' Series.DataLabelText = "{#YVAL}"
Next
Chart.AxisX.AnnoWithLabels = True '启用字符标示
Chart.BarClusterWidth = 20
Chart.AxisX.AnnoRotation = 0 'X轴标示逆时针旋转45度