以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  有条件跨表统计  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=109790)

--  作者:chengjingliang
--  发布时间:2017/11/19 22:14:00
--  有条件跨表统计
有条件跨表统计,计算结果不对,不知错在哪?


\'跨表求和库明细表累计出库金额列(有配合)
Select Case e.DataCol.Name
        Case "月份","项目ID","工料一类"
        Dim Filter As String = "[月份] = \'" & e.DataRow("统计月") & "\' and [项目ID] = \'" & e.DataRow("项目ID") & "\'"
        e.DataRow("劳务消耗额") = DataTables("库明细").Compute("Sum(累计出库金额)","[工料一类] = \'劳务\'")
        e.DataRow("材料消耗额") = DataTables("库明细").Compute("Sum(累计出库金额)","[工料一类] = \'材料\'")
        e.DataRow("机械消耗额") = DataTables("库明细").Compute("Sum(累计出库金额)","[工料一类] = \'机械\'")

End Select


--  作者:有点甜
--  发布时间:2017/11/19 23:09:00
--  
Select Case e.DataCol.Name
        Case "月份","项目ID","工料一类"
        Dim Filter As String = "[月份] = \'" & e.DataRow("统计月") & "\' and [项目ID] = \'" & e.DataRow("项目ID") & "\'"
        e.DataRow("劳务消耗额") = DataTables("库明细").Compute("Sum(累计出库金额)", filter & " and [工料一类] = \'劳务\'")
        e.DataRow("材料消耗额") = DataTables("库明细").Compute("Sum(累计出库金额)", filter & " and [工料一类] = \'材料\'")
        e.DataRow("机械消耗额") = DataTables("库明细").Compute("Sum(累计出库金额)", filter & " and [工料一类] = \'机械\'")

End Select