Foxtable(狐表)用户栏目专家坐堂 → 想把统计结果 复制到 kucun表,但是只想复制一次。应该怎么设置啊,因为是临时表,所以也不能找之前的记录


  共有2326人关注过本帖树形打印复制链接

主题:想把统计结果 复制到 kucun表,但是只想复制一次。应该怎么设置啊,因为是临时表,所以也不能找之前的记录

帅哥哟,离线,有人找我吗?
jinzhengbe
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1062 积分:9781 威望:0 精华:0 注册:2012/3/13 5:23:00
想把统计结果 复制到 kucun表,但是只想复制一次。应该怎么设置啊,因为是临时表,所以也不能找之前的记录  发帖心情 Post By:2015/8/24 20:06:00 [只看该作者]

Dim bd1 As New GroupTableBuilder("统计表1",DataTables("kucun"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("name") '根据name分组
bd1.Totals.AddDef("oldkucun","上次库存") '对shuliang进行统计
dt1 = bd1.BuildDataSource()

Dim bd2 As New GroupTableBuilder("统计表2",DataTables("chuanhuo"))
Dim dt2  As fxDataSource
bd2.Groups.AddDef("name") '根据name分组
bd2.Totals.AddDef("shuliang","串货_shuliang") '对shuliang进行统计
'bd2.Totals.AddDef("金额","销售_金额") '对金额进行统计
dt2 = bd2.BuildDataSource()

Dim bd3 As New GroupTableBuilder("统计表3",DataTables("chuanhuo1"))
Dim dt3 As fxDataSource
bd3.Groups.AddDef("name") '根据name分组
bd3.Totals.AddDef("yihuishounum","串入_shuliang") '对shuliang进行统计
'bd3.Totals.AddDef("金额","退货_金额") '对金额进行统计
dt3 = bd3.BuildDataSource()

Dim bd4 As New GroupTableBuilder("统计表4",DataTables("jieru"))
Dim dt4 As fxDataSource
bd4.Groups.AddDef("name") '根据name分组
bd4.Totals.AddDef("shuliang","借入_shuliang") '对shuliang进行统计
'bd3.Totals.AddDef("金额","退货_金额") '对金额进行统计
dt4 = bd4.BuildDataSource()

Dim bd5 As New GroupTableBuilder("统计表5",DataTables("tui"))
Dim dt5 As fxDataSource
bd5.Groups.AddDef("name") '根据name分组
bd5.Totals.AddDef("yihuishounum","借还_shuliang") '对shuliang进行统计
'bd3.Totals.AddDef("金额","退货_金额") '对金额进行统计
dt5 = bd5.BuildDataSource()

Dim bd6 As New GroupTableBuilder("统计表6",DataTables("rukudan"))
Dim dt6 As fxDataSource
bd6.Groups.AddDef("name") '根据name分组
bd6.Totals.AddDef("shuliang","入库_shuliang") '对shuliang进行统计
'bd3.Totals.AddDef("金额","退货_金额") '对金额进行统计
dt6 = bd6.BuildDataSource()

Dim bd7 As New GroupTableBuilder("统计表7",DataTables("xiaoshou"))
Dim dt7 As fxDataSource
bd7.Groups.AddDef("name") '根据name分组
bd7.Totals.AddDef("shuliang","销售_shuliang") '对shuliang进行统计

dt7 = bd7.BuildDataSource()

Dim bd8 As New GroupTableBuilder("统计表8",DataTables("weixin"))
Dim dt8 As fxDataSource
bd8.Groups.AddDef("name") '根据name分组
bd8.Totals.AddDef("shuliang","微信数量") '对shuliang进行统计
'bd3.Totals.AddDef("金额","退货_金额") '对金额进行统计
dt8 = bd8.BuildDataSource()

Dim bd9 As New GroupTableBuilder("统计表9",DataTables("product"))
Dim dt9 As fxDataSource
bd9.Groups.AddDef("name") '根据name分组
bd9.Totals.AddDef("dayin","dayin") '对shuliang进行统计
dt9 = bd9.BuildDataSource()

Dim bd10 As New GroupTableBuilder("统计表10",DataTables("weixin1"))
Dim dt10 As fxDataSource
bd10.Groups.AddDef("name") '根据name分组
bd10.Totals.AddDef("shuliang","微信未结") '对shuliang进行统计
'bd3.Totals.AddDef("金额","退货_金额") '对金额进行统计
dt10 = bd10.BuildDataSource()


dt1.Combine("name",dt7,"name")
dt1.Combine("name",dt8,"name")

dt1.Combine("name",dt2,"name") '将销售统计数据组合到进货统计数据
dt1.Combine("name",dt3,"name") '将退货统计数据组合到进货统计数据
dt1.Combine("name",dt4,"name")
dt1.Combine("name",dt5,"name")
dt1.Combine("name",dt10,"name")
dt1.Combine("name",dt6,"name")
dt1.Combine("name",dt9,"name")


Tables("窗口4_Table1").DataSource = dt1 '将统计结果绑定到Table
With DataTables("窗口4_Table1").DataCols  '用表达式列计算库存数据
  .Add("当前库存_shuliang",Gettype(Integer), "IsNull([上次库存],0) - ISNULL([销售_shuliang],0) -  ISNULL([微信数量],0) + ISNULL([微信未结],0) + ISNULL([串入_shuliang],0) + ISNULL([借入_shuliang],0) - ISNULL([借还_shuliang],0) + ISNULL([入库_shuliang],0) + ISNULL([串货_shuliang],0)")
End With

Dim Cols1() As String = {"入库_shuliang","销售_shuliang","微信数量","微信未结","name","串入_shuliang","串货_shuliang","借入_shuliang","借还_shuliang"}
Dim Cols2() As String = {"in","xiaoshou","weixin","weixin1","name","chuanru","chuanchu","jieru","jiechu"}

For Each dr1 As DataRow In DataTables("窗口4_table1").Select("[当前库存_shuliang]<>0 and dayin = 0")

    Dim dr2 As DataRow = DataTables("kucun").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
        dr1("dayin")= 1 
    
Next
Next

Tables("product").save
Tables("kucun").save


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/8/24 20:09:00 [只看该作者]

 复制完以后把按钮设置成不可用。

 回到顶部