Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
Select Case e.DataCol.Name
Case "数量", "销售单价", "销售商场", "条码"
Dim pr1 As DataRow
pr1 = DataTables("统计表").Find("管辖部门 = '" & e.DataRow("管辖部门") & "'")
If pr1 IsNot Nothing Then
DataTables("统计表").DataCols("管辖部门").RaiseDataColChanged(pr1)
End If
End Select
这个在销售记录里的代码刷新统计表这样刷新为什么新加的数据不会统计,,
下载信息 [文件大小: 下载次数: ] | |
点击浏览该文件:黛威尔手表有限公司.rar |
If e.DataCol.Name = "管辖部门" Then
Dim Filter As String = "[管辖部门] = '" & e.NewValue & "'"
e.DataRow("数量") = DataTables("销售资料").sqlCompute("Sum(数量)", Filter)
e.DataRow("金额") = DataTables("销售资料").sqlCompute("Sum(吊牌单价)", Filter)
e.DataRow("销售金额") = DataTables("销售资料").sqlCompute("Sum(销售单价)", Filter)
e.DataRow("入库数量") = DataTables("采购明细").sqlCompute("Sum(数量)", Filter)
e.DataRow("入库金额") = DataTables("采购明细").sqlCompute("Sum(数量*单价)", Filter)
e.DataRow("出库数量") = DataTables("出库明细").sqlCompute("Sum(数量)", Filter)
e.DataRow("出库金额") = DataTables("出库明细").sqlCompute("Sum(数量*单价)", Filter)
e.DataRow("退货数量") = DataTables("退货明细").sqlCompute("Sum(数量)", Filter)
e.DataRow("退货金额") = DataTables("退货明细").sqlCompute("Sum(数量*单价)", Filter)
End If
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim t As Table = Tables("统计表") '定义一个变量t引用数据表
Dim sm As Integer = t.Compute("Sum(数量)") '计算总数量
Chart = Forms("图表").Controls("Chart1") ' 引用窗口中的图表
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.ChartType = ChartTypeEnum.Pie '图表1类型改为Bar(条形)
For Each r As Row In t.Rows
Series = Chart.SeriesList.Add() '增加一个图系
Series.Length = 1 '一个系列只能包括一个值
Series.Text = r("管辖部门") & "(" & r("数量") & ")" '设置图系的标题
Series.Y(0) = r("数量") '指定值
Series.DataLabelText = Math.Round(r("数量") * 100 / sm, 2) & "%" '计算百分比
Next
Chart.LegendVisible = True '显示图列
Chart.LegendCompass = CompassEnum.East '图列显示在东方(右方)
Chart =Forms("图表").Controls("Chart2") ' 引用窗口中的图表
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.ChartType = ChartTypeEnum.Bar '图表1类型该为Bar(条形)
Chart.ChartType2 = ChartTypeEnum.XYPlot '图表2类型该为线形
Chart.DataSource = "统计表" '设置绑定表
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '给图表1增加一个图系
Series.Text = "数量"
Series.X.DataField = "管辖部门" 'X轴绑定到产品列
Series.Y.DataField = "数量" 'Y轴绑定到数量列
Chart.SeriesList2.Clear() '清除图表原来的图系
Series = Chart.SeriesList2.Add() '给图表2增加一个图系
Series.Text = "金额"
Series.X.DataField = "管辖部门" 'X轴绑定到产品列
Series.Y.DataField = "金额" 'Y轴绑定到数量列
Chart.LegendVisible = True '显示图列
Chart.LegendCompass = CompassEnum.South '图列显示在南方(底端)
Chart.AxisY.Text = "数量"
Chart.AxisY2.Text = "金额"
Chart.SeriesList(0).FillColor = Color.Aqua
Forms("图表").Controls("Label4").text = DataTables("统计表").Compute("sum(数量)") & "只"
Forms("图表").Controls("Label5").text = DataTables("统计表").Compute("sum(金额)") & "元"
Forms("图表").Controls("Label05").text = DataTables("统计表").Compute("sum(入库数量)") - DataTables("统计表").Compute("sum(出库数量)") + DataTables("统计表").Compute("sum(退货数量)") & "只"
Forms("图表").Controls("Label07").text = DataTables("统计表").Compute("sum(入库金额)") - DataTables("统计表").Compute("sum(出库金额)") + DataTables("统计表").Compute("sum(退货金额)") & "元"
Forms("图表").Controls("Label06").text = DataTables("统计表").Compute("sum(出库数量)") - DataTables("统计表").Compute("sum(退货数量)") - DataTables("统计表").Compute("sum(数量)") & "只"
Forms("图表").Controls("Label08").text = DataTables("统计表").Compute("sum(出库金额)") - DataTables("统计表").Compute("sum(退货金额)") - DataTables("统计表").Compute("sum(金额)") & "元"
Forms("图表").Controls("Label9").text = DataTables("统计表").Compute("sum(入库数量)") & "只"
Forms("图表").Controls("Label13").text = DataTables("统计表").Compute("sum(入库金额)") & "元"
Forms("图表").Controls("Label10").text = DataTables("统计表").Compute("sum(出库数量)") & "只"
Forms("图表").Controls("Label03").text = DataTables("统计表").Compute("sum(出库金额)") & "元"
Forms("图表").Controls("Label01").text = DataTables("统计表").Compute("sum(退货数量)") & "只"
Forms("图表").Controls("Label04").text = DataTables("统计表").Compute("sum(退货金额)") & "元"
第一个图为什么会变了,,刚刚出错好像是e.forms,我给换成Forms("图表"),,其他的都出来了,就第一个图乱了,