此主题相关图片如下:qq截图20130204004835.png
如上图,如何实现 Click "刷新"按钮后,上表重新加载呢?也就是说,如何实现"项目名称"增加或修改或删除后,此统计查询表能够实现自动更新呢?
上表是一个统计查询表,在主窗口打开后, afterload事件中自动生成的,代码如下:
Dim Bar As WinForm.NavBar
Bar = e.Form.Controls("NavBar1")
Bar.SelectedIndex = 0
Dim bd1 As New GroupTableBuilder("统计表1",DataTables("总明细表"))
Dim dt1 As fxDataSource
'bd1.Groups.AddDef("项目编号") '根据项目分组
bd1.Groups.AddDef("项目名称")
'bd1.Groups.AddDef("公司名称")
'bd1.Groups.AddDef("合同状态")
'bd1.Groups.AddDef("报备者1")
'bd1.Groups.AddDef("权重1")
'bd1.Groups.AddDef("报备者2")
'bd1.Groups.AddDef("权重2")
'bd1.Groups.AddDef("报备者3")
'bd1.Groups.AddDef("权重3")
'bd1.Groups.AddDef("合同签订日期")
'bd1.Groups.AddDef("利息率")
'bd1.Groups.AddDef("提成率")
bd1.Totals.AddDef("变动额度","合同金额") '对金额进行统计
bd1.Filter = "操作类型 = '合同金额变动'"
dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2",DataTables("总明细表"))
Dim dt2 As fxDataSource
bd2.Groups.AddDef("项目名称") '根据项目分组
bd2.Totals.AddDef("变动额度","已发货金额") '对金额进行统计
bd2.Filter = "操作类型 = '发货金额变动'"
dt2 = bd2.BuildDataSource()
Dim bd3 As New GroupTableBuilder("统计表3",DataTables("总明细表"))
Dim dt3 As fxDataSource
bd3.Groups.AddDef("项目名称") '根据项目分组
bd3.Totals.AddDef("变动额度","已开piao金额") '对金额进行统计
bd3.Filter = "操作类型 = '开piao金额变动'"
dt3 = bd3.BuildDataSource()
Dim bd4 As New GroupTableBuilder("统计表4",DataTables("总明细表"))
Dim dt4 As fxDataSource
bd4.Groups.AddDef("项目名称") '根据项目分组
bd4.Totals.AddDef("变动额度","已收款金额") '对金额进行统计
bd4.Filter = "操作类型 = '收款金额变动'"
dt4 = bd4.BuildDataSource()
Dim bd5 As New GroupTableBuilder("统计表5",DataTables("总明细表"))
Dim dt5 As fxDataSource
bd5.Groups.AddDef("项目名称") '根据项目分组
bd5.Totals.AddDef("变动额度","未收应收款金额") '对金额进行统计
bd5.Totals.AddDef("利息扣除","逾期利息扣除") '对金额进行统计
bd5.Filter = "操作类型 = '应收款金额变动'"
dt5 = bd5.BuildDataSource()
Dim bd6 As New GroupTableBuilder("统计表6",DataTables("总明细表"))
Dim dt6 As fxDataSource
bd6.Groups.AddDef("项目名称") '根据项目分组
bd6.Totals.AddDef("变动额度","其它扣除") '对金额进行统计
bd6.Filter = "操作类型 = '其它扣除项'"
dt6 = bd6.BuildDataSource()
Dim bd7 As New GroupTableBuilder("统计表7",DataTables("项目信息表"))
Dim dt7 As fxDataSource
bd7.Groups.AddDef("项目名称") '根据项目分组
bd7.Totals.AddDef("提成率","提成率") '对金额进行统计
dt7 = bd7.BuildDataSource()
dt1.Combine("项目名称",dt2,"项目名称") '将销售统计数据组合到进货统计数据
dt1.Combine("项目名称",dt3,"项目名称")
dt1.Combine("项目名称",dt4,"项目名称")
dt1.Combine("项目名称",dt5,"项目名称")
dt1.Combine("项目名称",dt6,"项目名称")
dt1.Combine("项目名称",dt7,"项目名称")
Tables("项目数据统计_Table1").DataSource = dt1 '将统计结果绑定到Table
With DataTables("项目数据统计_Table1").DataCols '用表达式列计算库存数据
.Add("未收款金额",Gettype(Double), "IsNull([已发货金额],0) - ISNULL([已收款金额],0)")
.Add("累计提成余额",Gettype(Double), "IsNull([已收款金额],0) * IsNull([提成率],0) - ISNULL([逾期利息扣除],0) - ISNULL([其它扣除],0)")
End With
[此贴子已经被作者于2013-2-4 1:00:09编辑过]