以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]计算  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=194848)

--  作者:苏州老街
--  发布时间:2025/1/20 18:01:00
--  [求助]计算
老师好,我想在下面代码中再增加两个计算条件。标出的是新增条件。

Select Case e.DataCol.Name
    Case "客户id","商品名称","摘要","付款金额"
        Dim drs As List(of DataRow)
        Dim Filter As String
        Filter = "[_Identify] >= " & e.DataRow("_Identify") & " And [客户id] = \'" & e.DataRow("客户id") & "\'"
        drs = e.DataTable.Select(Filter)
        
      
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:新建文本文档.txt


--  作者:有点蓝
--  发布时间:2025/1/20 20:23:00
--  
Select Case e.DataCol.Name
    Case "客户id","商品名称","摘要","付款金额"
        Dim drs As List(of DataRow)
        Dim Filter As String
        Filter = "[_Identify] >= " & e.DataRow("_Identify") & " And [客户id] = \'" & e.DataRow("客户id") & "\' and [商品名称] = \'" & e.DataRow("商品名称") & "\' and .........."
        drs = e.DataTable.Select(Filter)
        
        For i As Integer = 0 To drs.Count - 1
            Dim dr = drs(i)
            If i = drs.Count - 1 Then
                Filter = "[_Identify] <= " & dr("_Identify") & " And [客户id] = \'" & dr("客户id") & "\' and [商品名称] = \'" & e.DataRow("商品名称") & "\' and .........."
                Dim Val1 As Double = e.DataTable.Compute("Sum(付款金额)",Filter)
                dr("累计付款") = Val1
            Else
                dr("累计付款") = Nothing
            End If
        Next
        If e.DataCol.Name = "客户id" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            Filter = "[_Identify] > " & e.DataRow("_Identify") & " And [客户id] = \'" & e.OldValue & "\'  and [商品名称] = \'" & e.DataRow("商品名称") & "\' and .........."
            drs = e.DataTable.Select(Filter)
            For i As Integer = 0 To drs.Count - 1
                Dim dr = drs(i)
                If i = drs.Count - 1 Then
                    Filter = "[_Identify] <= " & dr("_Identify") & " And [客户id] = \'" & dr("客户id") & "\'  and [商品名称] = \'" & e.DataRow("商品名称") & "\' and .........."
                    Dim Val1 As Double = e.DataTable.Compute("Sum(付款金额)",Filter)
                    dr("累计付款") = Val1
                Else
                    dr("累计付款") = Nothing
                End If
            Next
        End If
        If e.DataCol.Name = "商品名称" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            Filter = "[_Identify] > " & e.DataRow("_Identify") & " And [商品名称] = \'" & e.OldValue & "\'  and [客户id] = \'" & e.DataRow("客户id") & "\' and .........."
            drs = e.DataTable.Select(Filter)
            For i As Integer = 0 To drs.Count - 1
                Dim dr = drs(i)
                If i = drs.Count - 1 Then
                    Filter = "[_Identify] <= " & dr("_Identify") & " And [商品名称] = \'" & e.OldValue & "\'  and [客户id] = \'" & e.DataRow("客户id") & "\' and .........."
                    Dim Val1 As Double = e.DataTable.Compute("Sum(付款金额)",Filter)
……
        If e.DataCol.Name = "摘要" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            Filter = "[_Identify] > " & e.DataRow("_Identify") & " And [摘要] = \'" & e.OldValue & "\'  and [商品名称] = \'" & e.DataRow("商品名称") & "\' and .........."

……
End Select

--  作者:苏州老街
--  发布时间:2025/1/20 22:55:00
--  
谢谢老师