以文本方式查看主题

-  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=122758)

--  作者:jamhuton
--  发布时间:2018/8/1 17:25:00
--  汇总求助

Select Case e.DataCol.name
    Case "服务商","月份","业务类型"
        If e.DataRow.IsNull("业务类型") Then
            e.DataRow("金额") = DataTables("仓库租金").Compute("sum(成本)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
        ElseIf e.DataRow.IsNull("业务类型") Then
            e.DataRow("金额") = DataTables("国内物流").Compute("sum(运输成本)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
            e.DataRow("业务量") = DataTables("国内物流").Compute("count(箱号)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
        ElseIf e.DataRow.IsNull("业务类型") Then
            e.DataRow("金额") = DataTables("出库").Compute("sum(运输成本)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
            e.DataRow("业务量") = DataTables("出库").Compute("count(箱号)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
        ElseIf e.DataRow.IsNull("业务类型") Then
            e.DataRow("金额") = DataTables("入库").Compute("sum(装卸成本)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
            e.DataRow("业务量") = DataTables("入库").Compute("count(箱号)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
        ElseIf e.DataRow.IsNull("业务类型") Then
            e.DataRow("金额") = DataTables("进口账单").Compute("sum(成本合计)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
            e.DataRow("业务量") = DataTables("进口账单").Compute("count(报关单号)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
        End If
End Select

老师帮我看看,这代码咋不起作用。

--  作者:有点甜
--  发布时间:2018/8/1 17:39:00
--  
Select Case e.DataCol.name
    Case "服务商","月份","业务类型"
        If e.DataRow("业务类型") = "xxx" Then
            e.DataRow("金额") = DataTables("仓库租金").Compute("sum(成本)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
            e.DataRow("金额") = DataTables("国内物流").Compute("sum(运输成本)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
            e.DataRow("业务量") = DataTables("国内物流").Compute("count(箱号)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
        ElseIf e.DataRow("业务类型") = "bbbb" Then
            e.DataRow("金额") = DataTables("出库").Compute("sum(运输成本)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
            e.DataRow("业务量") = DataTables("出库").Compute("count(箱号)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
        ElseIf e.DataRow("业务类型") = "ccc" Then
            e.DataRow("金额") = DataTables("入库").Compute("sum(装卸成本)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
            e.DataRow("业务量") = DataTables("入库").Compute("count(箱号)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
        ElseIf e.DataRow("业务类型") = "abc" Then
            e.DataRow("金额") = DataTables("进口账单").Compute("sum(成本合计)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
            e.DataRow("业务量") = DataTables("进口账单").Compute("count(报关单号)","[服务商]= \'" & e.DataRow("服务商") & "\' And [月份]= \'" & e.DataRow("月份") & "\'And [业务类型]= \'" & e.DataRow("业务类型") & "\'" )
        End If
End Select