Foxtable(狐表)用户栏目专家坐堂 → [求助]计算


  共有13人关注过本帖树形打印复制链接

主题:[求助]计算

帅哥哟,离线,有人找我吗?
苏州老街
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:730 积分:4673 威望:0 精华:0 注册:2016/10/19 16:45:00
[求助]计算  发帖心情 Post By: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


 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:111932 积分:569814 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By: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

 回到顶部
帅哥哟,离线,有人找我吗?
苏州老街
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:730 积分:4673 威望:0 精华:0 注册:2016/10/19 16:45:00
  发帖心情 Post By:2025/1/20 22:55:00 [只看该作者]

谢谢老师

 回到顶部