以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 跨表计算 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=107783) |
||||
-- 作者:实话实说 -- 发布时间:2017/10/10 7:58:00 -- 跨表计算 实例:计算产品表的材料成本(窗口1按钮代码?)
|
||||
-- 作者:有点甜 -- 发布时间:2017/10/10 8:48:00 -- Dim dt1 As DataTable = DataTables("产品") Dim dt2 As DataTable = DataTables("bom") Dim dt3 As DataTable = DataTables("材料") For Each dr1 As DataRow In dt1.Select("") Dim sum As Double = 0 For Each dr2 As DataRow In dt2.Select("产品代码 = \'" & dr1("产品代码") & "\'") For Each dr3 As DataRow In dt3.Select("材料代码 = \'" & dr2("材料代码") & "\'") sum += dr2("产品用料") * dr3("材料单价") Next Next dr1("材料成本") = sum Next |
||||
-- 作者:实话实说 -- 发布时间:2017/10/10 9:24:00 -- 谢了 |