以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]关于日和月计算 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=133717) |
||||
-- 作者:工匠 -- 发布时间:2019/4/18 16:30:00 -- [求助]关于日和月计算 老师好,请帮看看,如何在记录表相关列发变化,在日统计和月统计进行计算“数量”和“赠品”的总数,谢谢! 现在月统计有计算,日统计每月计算到
谢谢!
[此贴子已经被作者于2019/4/18 17:08:48编辑过]
|
||||
-- 作者:有点甜 -- 发布时间:2019/4/18 18:12:00 -- Select Case e.DataCol.name Case "销售","数量","赠品" For Each xm As String In e.DataRow("销售").split("|") Dim dr As DataRow = DataTables("月统计").find("销售 = \'" & xm & "\' and 年月 = \'" & e.DataRow("年月") & "\'") If dr IsNot Nothing Then dr("数量") = DataTables("记录").Compute("sum(数量)","销售 like \'*" & xm & "*\' and 年月 = \'" & e.DataRow("年月") & "\'") dr("赠品") = DataTables("记录").Compute("sum(赠品)","销售 like \'*" & xm & "*\' and 年月 = \'" & e.DataRow("年月") & "\'") End If Next For Each xm1 As String In e.DataRow("销售").split("|") Dim dr1 As DataRow = DataTables("日统计").find("销售 = \'" & xm1 & "\' and 日期 = \'" & e.DataRow("日期") & "\'") If dr1 IsNot Nothing Then dr1("数量") = DataTables("记录").Compute("sum(数量)","销售 like \'*" & xm1 & "*\' and 日期 = \'" & e.DataRow("日期") & "\'") dr1("赠品") = DataTables("记录").Compute("sum(赠品)","销售 like \'*" & xm1 & "*\' and 日期 = \'" & e.DataRow("日期") & "\'") End If Next End Select |