Foxtable(狐表)用户栏目专家坐堂 → 双条件出库流水账


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

主题:双条件出库流水账

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/8/3 16:03:00 [显示全部帖子]

参考代码

 

Select Case e.DataCol.name
   
    Case "第一列","第二列", "第三列"
        Dim drs As List(of DataRow)
        Dim Filter As String
        filter = "[第一列] = '" & e.DataRow("第一列") & "' and 第二列 = '" & e.DataRow("第二列") & "'"
        Dim qc As Double = 0
       
        Dim fdr As DataRow = DataTables("表A").Find(filter)
        If fdr IsNot Nothing Then
            qc = fdr("第三列")
        End If
        Filter = "[_SortKey] >= " & e.DataRow("_SortKey") & " And [第一列] = '" & e.DataRow("第一列") & "' and 第二列 = '" & e.DataRow("第二列") & "'"
        drs = e.DataTable.Select(Filter)
        For Each dr As DataRow In drs
            Filter = "[_SortKey] <= " & dr("_SortKey") & " And [第一列] = '" & e.DataRow("第一列") & "' and 第二列 = '" & e.DataRow("第二列") & "'"
            Dim Val1 As Double = e.DataTable.Compute("Sum(第三列)",Filter)
            dr("第四列") = qc - Val1
        Next
        If (e.DataCol.name = "第一列" OrElse e.DataCol.name = "第二列") And  e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            If e.DataCol.Name = "第一列" Then
                Filter = "[第一列] = '" & e.oldvalue & "' and 第二列 = '" & e.DataRow("第二列") & "'"
            ElseIf e.DataCol.name = "第二列" Then
                Filter = "[第一列] = '" & e.DataRow("第一列") & "' and 第二列 = '" & e.oldvalue & "'"
            End If
            drs = e.DataTable.Select("[_SortKey] > " & e.DataRow("_SortKey") & " and " & Filter)
            For Each dr As DataRow In drs
                Filter = "[_SortKey] <= " & dr("_SortKey") & " And " & filter
                Dim Val1 As Double = e.DataTable.Compute("Sum(第三列)",Filter)
                dr("第四列") = Val1
            Next
        End If
End Select


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/8/3 18:01:00 [显示全部帖子]

 那你就把 _Sortkey 改成 _Identify

 回到顶部