Foxtable(狐表)用户栏目专家坐堂 → 求帮助:动态表达式代码


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

主题:求帮助:动态表达式代码

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/2/24 22:36:00 [显示全部帖子]

 你的主表和子表,是通过 入库单号 关联的,所以应该这样写

Select Case e.DataCol.Name
    Case "存货编码","数量"
        Dim drs As List(of DataRow)
        Dim Filter As String     
        Filter = "[_SortKey] > " & e.DataRow("_SortKey") & " And [存货编码] = '" & e.DataRow("存货编码") & "'"
        drs = e.DataTable.Select(Filter)
        For Each dr As DataRow In drs
            Filter = "[_SortKey] <= " & dr("_SortKey") & " And [存货编码] = '" & dr("存货编码") & "' and [入库单号] = '" & e.DataRow("入库单号") & "'"
            Dim Val1 As Double = e.DataTable.Compute("Sum(数量)",Filter)
            dr("累计入仓数量") = Val1
        Next
        If e.DataCol.Name = "存货编码" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            Filter = "[_SortKey] > " & e.DataRow("_SortKey") & " And [存货编码] = '" & e.OldValue & "'"
            drs = e.DataTable.Select(Filter)
            For Each dr As DataRow In drs
                Filter = "[_SortKey] <= " & dr("_SortKey") & " And [存货编码] = '" & dr("存货编码") & "'"
                Dim Val1 As Double = e.DataTable.Compute("Sum(数量)",Filter)
                dr("累计入仓数量") = Val1
            Next
        End If
End Select
[此贴子已经被作者于2014-2-24 22:38:22编辑过]

 回到顶部