Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]计算

1楼
苏州老街 发表于: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楼
有点蓝 发表于: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
共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02344 s, 3 queries.