DataTables("入库主表").LoadTop = "10000"
DataTables("入库主表").LoadOrder = "入库日期 Desc"
DataTables("入库主表").Load
DataTables("入库主表").LoadChildren("入库记录表", "收货fa piao号", "收货fa piao号")
Dim Filter1 As String
Filter1 = "核销 = 0"
DataTables("入库记录表").LoadFilter = Filter1
DataTables("入库记录表").Load()
'================================
Dim YMax As WinForm.TextBox = e.Form.Controls("Y最大值")
Dim YMin As WinForm.TextBox = e.Form.Controls("Y最小值")
Dim cxsj As WinForm.DateTimePicker = e.Form.Controls("查询时间")
cxsj.value=now()
Dim g As New GroupTableBuilder("实时库存统计表", DataTables("入库记录表"))
g.Groups.AddDef("料号")
g.Groups.AddDef("品名")
g.Totals.AddDef("剩余数量")
g.Totals.AddDef("库存_良品")
g.Totals.AddDef("库存_不良品")
g.Totals.AddDef("库存_待处理品")
g.Totals.AddDef("库存_冻结产品")
dim t as table = e.form.controls("Table1").Table
t.DataSource = g.BuildDataSource
t.sort="料号"
t.Font =New Font("微软雅黑",9,FontStyle.Regular)
MainTable = Tables("主表")
'========================产生图表=================================
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Chart= e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.Bar
Chart.ChartType2 = ChartTypeEnum.XYPlot
Chart.AxisY.Min = YMin.text '指定Y轴的最小值
Chart.AxisY.Max =YMax.text '指定Y轴的最大值
Chart.AxisY2.Min = YMin.text '指定Y轴的最小值
Chart.AxisY2.Max =YMax.text '指定Y轴的最大值
Chart.SeriesList.Clear() '清除图表原来的图系
Chart.AxisY.Major = YMax.text*0.1
Series = Chart.SeriesList.Add() '给图表2增加一个图系
Series.FillColor = Color.DeepSkyBlue '设置条形图的填充颜色
Series.Length = t.Rows.Count '设置图系的长度
For i As Integer = 0 To t.Rows.Count - 1 '指定每个数据点的位置
Series.X(i) = i '指定水平坐标
Series.Y(i) = t.Rows(i)("剩余数量") '指定垂直坐标
Chart.AxisX.SetValueLabel(i, i+1) '指定字符表示
Next
Chart.AxisX.AnnoWithLabels = True '启用字符标示
Series.DataLabelText = "{#YVAL}"
'=====================
'--------Chart.SeriesList2.Clear() '清除图表原来的图系
Chart.SeriesList2.Clear() '清除图表原来的图系
Chart.AxisY2.Major = YMax.text*0.1
Series = Chart.SeriesList2.Add() '给图表2增加一个图系
Series.FillColor = Color.Red '设置条形图的填充颜色
Series.MarkShape = MarkShapeEnum.none
Series.Length = t.Rows.Count '设置图系的长度
For i As Integer = 0 To t.Rows.Count - 1 '指定每个数据点的位置
Series.X(i) = i '指定水平坐标
Series.Y(i) = 1000 '指定垂直坐标 (安全库存)
'Chart.AxisX.SetValueLabel(i, t.Rows(i)("料号")) '指定字符表示
Next
Chart.AxisX.AnnoWithLabels = True '启用字符标示