以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 汇总合计 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=184283) |
-- 作者:nuoyan89 -- 发布时间:2022/11/30 22:54:00 -- 汇总合计 老师,红色的金额我让让他根据项目,费用明细然后进行汇总,请帮忙看看,谢谢 Dim w As Table = Forms("支出费用汇总").Controls("设备状态表").Table For Each f As Row In Tables("收付款明细_信息查询").GetCheckedRows Dim s2 As DataRow = w.DataTable.Find("项目=\'" & f("项目") & "\' and 费用明细=\'" & f("费用明细") & "\'") If s2 Is Nothing Then s2 = w.DataTable.addnew s2("项目") = f("项目") s2("费用明细") = f("费用明细") s2("操作日期") = Date.Today s2("操作人员") = _UserName End If s2("金额") = f("金额") (根据蓝色部分的条件进行汇总) Next w.RaiseCurrentChanged |
-- 作者:有点蓝 -- 发布时间:2022/12/1 8:52:00 -- http://www.foxtable.com/webhelp/topics/0393.htm |
-- 作者:nuoyan89 -- 发布时间:2022/12/1 16:19:00 -- 老师,请帮忙看看,谢谢 Forms("支出费用汇总").Open() Dim w As Table = Forms("支出费用汇总").Controls("设备状态表").Table For Each f As Row In Tables("收付款明细_信息查询").GetCheckedRows Dim s2 As DataRow = w.DataTable.Compute("Sum(金额)", "项目=\'" & f("项目") & "\' and 费用明细=\'" & f("费用明细") & "\'") If s2 Is Nothing Then s2 = w.DataTable.addnew s2("项目") = f("项目") s2("费用明细") = f("费用明细") s2("操作日期") = Date.Today s2("操作人员") = _UserName End If s2("金额") = val(s2("金额")) Next w.RaiseCurrentChanged |
-- 作者:有点蓝 -- 发布时间:2022/12/1 16:33:00 -- 改错地方了,find不要改 s2("金额") = w.DataTable.Compute("Sum(金额)", "项目=\'" & f("项目") & "\' and 费用明细=\'" & f("费用明细") & "\'")
|
-- 作者:nuoyan89 -- 发布时间:2022/12/1 16:48:00 -- 老师,我改成了以下这样的可以了,谢谢 s2("金额") = DataTables("收付款明细_信息查询").Compute("Sum(金额)", "项目=\'" & f("项目") & "\' and 费用明细=\'" & f("费用明细") & "\'")
|