以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 删除行 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=179796) |
|
-- 作者:朱女士 -- 发布时间:2022/9/9 10:14:00 -- 删除行
|
|
-- 作者:有点蓝 -- 发布时间:2022/9/9 10:16:00 -- 贴出这个事件的完整代码 |
|
-- 作者:朱女士 -- 发布时间:2022/9/9 10:24:00 -- Dim zf1,zf2,zf3,zf4,zs1,zs2,zs3 As String Dim zd1,zd2,zd3,zd4,zd5,zd6,zd7,zd8,zd9,zd10,zd11,zd12 As String zf1="期初" zf2="入库" zf3="出库" zf4="库存" zs1="_数量" zs2="_重量" zs3="_含税额" zd1=zf1+zs1 zd2=zf1+zs2 zd3=zf1+zs3 zd4=zf2+zs1 zd5=zf2+zs2 zd6=zf2+zs3 zd7=zf3+zs1 zd8=zf3+zs2 zd9=zf3+zs3 zd10=zf4+zs1 zd11=zf4+zs2 zd12=zf4+zs3 Dim dtb As New DataTableBuilder("实时库存计算表") dtb.AddDef("供应商", Gettype(String), 8) dtb.AddDef("原料名称", Gettype(String), 16) dtb.AddDef("原料代码",Gettype(String), 20) dtb.adddef("ylggddm",Gettype(String), 26) dtb.AddDef("原料规格", Gettype(String), 22) dtb.AddDef("长", Gettype(String), 6) dtb.AddDef("宽", Gettype(String), 6) dtb.AddDef("厚", Gettype(String), 6) dtb.AddDef("含税价",Gettype(Double)) dtb.AddDef("单位重量",Gettype(Double)) dtb.AddDef(zd10, GetType(Double)) dtb.AddDef(zd11, GetType(Double)) dtb.AddDef(zd12, GetType(Double)) dtb.AddDef(zd1,Gettype(Double)) dtb.AddDef(zd2,Gettype(Double)) dtb.AddDef(zd3,Gettype(Double)) dtb.AddDef(zd4,Gettype(Double)) dtb.AddDef(zd5,Gettype(Double)) dtb.AddDef(zd6,Gettype(Double)) dtb.AddDef(zd7,Gettype(Double)) dtb.AddDef(zd8,Gettype(Double)) dtb.AddDef(zd9,Gettype(Double)) dtb.Build() \'以下是计算部分 DataTables("ylqcb").LoadFilter = "" DataTables("ylqcb").Load DataTables("ylrkb").LoadFilter = "" DataTables("ylrkb").Load DataTables("ylckb").LoadFilter = "" DataTables("ylckb").Load For Each nm As String In DataTables("ylqcb").GetValues("ylggddm") Dim dr As DataRow = DataTables("实时库存计算表").find("ylggddm=\'" & nm & "\'") If dr Is Nothing Then dr =DataTables("实时库存计算表").AddNew() Dim pr As DataRow = DataTables("ylqcb").find("ylggddm=\'" & nm & "\'") If pr IsNot Nothing Then dr("供应商") = pr("供应商") dr("原料名称") = pr("ylmc") dr("原料规格") =pr("原料规格") dr("ylggddm")=nm dr("原料代码") = pr("yldm") dr("长") = pr("长") dr("宽") = pr("宽") dr("厚") = pr("厚") dr("含税价")=pr("含税价") dr("单位重量")=pr("单位重量") End If End If Next For Each nm As String In DataTables("ylrkb").GetValues("ylggddm") Dim dr As DataRow = DataTables("实时库存计算表").find("ylggddm=\'" & nm & "\'") If dr Is Nothing Then dr =DataTables("实时库存计算表").AddNew() Dim wr As DataRow = DataTables("ylrkb").find("ylggddm=\'" & nm & "\'") If wr IsNot Nothing Then dr("供应商") = wr("供应商") dr("原料名称") = wr("ylmc") dr("原料规格") =wr("原料规格") dr("ylggddm")=nm dr("原料代码") = wr("yldm") dr("长") = wr("长") dr("宽") = wr("宽") dr("厚") = wr("厚") dr("含税价")=wr("含税价") dr("单位重量")=wr("单位重量") End If End If Next For Each nm As String In DataTables("实时库存计算表").GetValues("ylggddm") Dim dr As DataRow = DataTables("实时库存计算表").find("ylggddm=\'" & nm & "\'") dr("期初_数量") = DataTables("ylqcb").Compute("Sum(期初_数量)","[ylggddm] = \'" & dr("ylggddm") & "\'") dr("期初_重量") = DataTables("ylqcb").Compute("Sum(期初_重量)","[ylggddm] = \'" & dr("ylggddm") & "\'") dr("期初_含税额") = DataTables("ylqcb").Compute("Sum(期初_含税额)","[ylggddm] = \'" & dr("ylggddm") & "\'") dr("入库_数量") = DataTables("ylrkb").Compute("Sum(入库_数量)","[ylggddm] = \'" & dr("ylggddm") & "\'") dr("入库_重量") = DataTables("ylrkb").Compute("Sum(入库_重量)","[ylggddm] = \'" & dr("ylggddm") & "\'") dr("入库_含税额") = DataTables("ylrkb").Compute("Sum(入库_含税额)","[ylggddm] = \'" & dr("ylggddm") & "\'") dr("出库_数量") = DataTables("ylckb").Compute("Sum(出库_数量)","[ylggddm] = \'" & dr("ylggddm") & "\'") dr("出库_重量") = DataTables("ylckb").Compute("Sum(出库_重量)","[ylggddm] = \'" & dr("ylggddm") & "\'") dr("出库_含税额") = DataTables("ylckb").Compute("Sum(出库_含税额)","[ylggddm] = \'" & dr("ylggddm") & "\'") dr("库存_数量") = dr("期初_数量") + dr("入库_数量") - dr("出库_数量") If dr("库存_数量") = 0 Then dr("库存_数量") = Nothing End If dr("库存_重量") = dr("期初_重量") + dr("入库_重量") - dr("出库_重量") If dr("库存_重量") = 0 Then dr("库存_重量") = Nothing End If dr("库存_含税额")=dr("期初_含税额")+dr("入库_含税额")-dr("出库_含税额") If dr("库存_含税额") = 0 Then dr("库存_含税额") = Nothing End If If dr("库存_数量") = 0 AndAlso dr("库存_重量") = 0 AndAlso dr("库存_含税额") = 0 Then CurrentTable.Current.Delete() End If Next messagebox.show("计算完毕","提示!") MainTable=Tables("实时库存计算表")
|
|
-- 作者:有点蓝 -- 发布时间:2022/9/9 10:30:00 -- If dr("库存_数量") = 0 AndAlso dr("库存_重量") = 0 AndAlso dr("库存_含税额") = 0 Then dr.Delete() End If
|