以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  同列收入合计  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=149225)

--  作者:fubblyc
--  发布时间:2020/4/26 21:31:00
--  同列收入合计
老师,许久没用,有点生疏了,

图片点击可在新窗口打开查看此主题相关图片如下:微信截图_20200426212911.png
图片点击可在新窗口打开查看
如上图,用如下代码不对:
DataColChanged,只要有填了收入金额,就要自动统计收入合计
If e.DataCol.name = "收入金额"  Then
    If e.DataRow("收或支") = "收入合计" Then
        e.DataRow("收入金额") = e.DataTable.Compute("sum(收入金额)","收或支 = \'收\' and 卡号 = \'" & e.DataRow("卡号") & "\' and  日期 = \'" & e.DataRow("日期") & "\' ")
    End If
End If

--  作者:有点蓝
--  发布时间:2020/4/26 22:09:00
--  
If e.DataCol.name = "收入金额"  Then
dim dr as datarow = e.DataTable.find("收或支=\'收入合计\' and 卡号 = \'" & e.DataRow("卡号") & "\' and  日期 = \'" & e.DataRow("日期") & "\' ")
    If dr isnot nothing Then
        dr("收入金额") = e.DataTable.Compute("sum(收入金额)","收或支 = \'收\' and 卡号 = \'" & e.DataRow("卡号") & "\' and  日期 = \'" & e.DataRow("日期") & "\' ")
    End If
End If