If _UserRole = "导购" Then
messagebox.Show("无权查看!")
End If
If _UserRole = "开发者" Then
Dim jb As new SQLJoinTableBuilder("查询表1","pos_t_saleflow")
jb.C
jb.AddTable("pos_t_saleflow","item_no","bi_t_item_info","item_no")
jb.AddCols("{pos_t_saleflow}.flow_no","{pos_t_saleflow}.branch_no","{pos_t_saleflow}.oper_id","{pos_t_saleflow}.item_no","{bi_t_item_info}.price","{bi_t_item_info}.item_name","{pos_t_saleflow}.sale_money","{pos_t_saleflow}.oper_date")
Dim t As Table = e.Form.Controls("Table1").Table
t.DataSource = jb.BuildDataSource
Dim bd1 As New GroupTableBuilder("统计表3", DataTables("代金券成本核算_Table1"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("oper_date",DateGroupEnum.Year,"年") '添加日期列用于分组,并用"年"代替原名称
bd1.Groups.AddDef("oper_date",DateGroupEnum.Month,"月") '添加日期列用于分组,并用"年"代替原名称
bd1.Groups.AddDef("oper_date",DateGroupEnum.Day,"日") '添加日期列用于分组,并用"年"代替原名称
bd1.Groups.AddDef("oper_id","导购")
bd1.Groups.AddDef("flow_no","流水")
bd1.Totals.AddDef("price","进价")
bd1.FromServer = True
dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2", DataTables("pos_t_payflow"))
Dim dt2 As fxDataSource
bd2.Groups.AddDef("oper_date",DateGroupEnum.Year,"年") '添加日期列用于分组,并用"年"代替原名称
bd2.Groups.AddDef("oper_date",DateGroupEnum.Month,"月") '添加日期列用于分组,并用"年"代替原名称
bd2.Groups.AddDef("oper_date",DateGroupEnum.Day,"日") '添加日期列用于分组,并用"年"代替原名称
bd2.Groups.AddDef("oper_id","导购")
bd2.Groups.AddDef("flow_no","流水")
bd2.Totals.AddDef("pay_amount","代金券")
'bd2.FromServer = True
dt2 = bd2.BuildDataSource()
Dim bd3 As New GroupTableBuilder("统计表3", DataTables("pos_t_saleflow"))
Dim dt3 As fxDataSource
bd3.Groups.AddDef("oper_date",DateGroupEnum.Year,"年") '添加日期列用于分组,并用"年"代替原名称
bd3.Groups.AddDef("oper_date",DateGroupEnum.Month,"月") '添加日期列用于分组,并用"年"代替原名称
bd3.Groups.AddDef("oper_date",DateGroupEnum.Day,"日") '添加日期列用于分组,并用"年"代替原名称
bd3.Groups.AddDef("oper_id","导购")
bd3.Groups.AddDef("flow_no","流水")
bd3.Totals.AddDef("sale_money","销售额")
bd3.FromServer = True
dt3 = bd3.BuildDataSource()
Dim nms As String() = { "年","月","日" ,"导购","流水" }
dt3.Combine(nms,dt1,nms) '将销售统计数据组合到进货统计数据
dt3.Combine(nms,dt2,nms) '将退货统计数据组合到进货统计数据
Tables("代金券成本核算_Table1").DataSource = dt3
Tables("代金券成本核算_Table1").Filter = "[代金券] Is Not Null"
Dim jb2 As new SQLJoinTableBuilder("查询表1","代金券成本核算_Table1")
jb2.C
jb2.AddTable("代金券成本核算_Table1","flow_no","pos_t_saleflow","flow_no")
jb2.AddCols("{pos_t_saleflow}.item_no","{代金券成本核算_Table1}.*")
Tables("代金券成本核算_Table1").DataSource = jb2.BuildDataSource
With DataTables("代金券成本核算_Table1").DataCols '用表达式列计算库存数据
.Add("亏损",Gettype(Double), "IsNull([销售额],0) - ISNULL([进价],0) - ISNULL([代金券],0)")
End With
End If
运行提示:对象"代金券成本核算_Table1"错误。 好像是这句话,忘了。
代码大致需求: 将商品表,流水表,付款明细表,根据某些列关联,统计到dt3的时候,就差商品名称没有了,我的思路是,dt3再和流水表绑定通过flow_no,然后再后商品表绑定通过item_no,这样就得到商品名称了。 没办法就这么绕,我的代码最后怎么写啊? 绕晕了都快!