Foxtable(狐表)用户栏目专家坐堂 → 不同银行不同账号的流水账如何做?


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

主题:不同银行不同账号的流水账如何做?

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


加好友 发短信
等级:九尾狐 帖子:2609 积分:16926 威望:0 精华:11 注册:2011/9/20 16:13:00
  发帖心情 Post By:2013/10/26 12:42:00 [显示全部帖子]

通用代码

'--------------------------库存计算-----------------------------
Dim zd As New Dictionary(of String,String)
zd.Add("库存","物料编号")
zd.Add("本款本采购单","物料编号,规格,颜色,采购订单编号")
zd.Add("本规格库存","物料编号,规格,颜色")
Dim dr As DataRow
Dim mr As DataRow = e.DataRow
Dim drs As List(of DataRow)
For Each key As String In zd.Keys
    Dim vs() As String = zd(key).Split(",")
    Dim cs As New List(of String)
    cs.AddRange(vs)
    If cs.Contains(e.DataCol.Name) OrElse e.DataCol.Name = "入库" OrElse e.DataCol.Name = "出库" Then   '找出上一行
        dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And " & Functions.Execute("FilterStr_Buid",zd(key),mr,Nothing,Nothing), "[_SortKey] Desc")        
        If dr Is Nothing Then   '如果没有找到上一行,说明本行就是第一行
            mr(key) = mr("入库") - mr("出库")
            dr = mr
        End If
        drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And " & Functions.Execute("FilterStr_Buid",zd(key),dr,Nothing,Nothing), "[_SortKey]")          '上一行以下的所有行-----------------
        For i As Integer = 1 To drs.Count - 1    '重算余下行的余额
            drs(i)(key) = drs(i-1)(key) + drs(i)("入库") - drs(i)("出库")
        Next

        If cs.Contains(e.DataCol.Name) AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And " & Functions.Execute("FilterStr_Buid",zd(key),mr,e.DataCol.Name ,e.OldValue), "[_SortKey] Desc")     '找出被修改行的上一个【修改列】的行------------------------
            If dr Is Nothing Then
                dr = e.DataTable.Find(Functions.Execute("FilterStr_Buid",zd(key),mr,e.DataCol.Name ,e.OldValue), "[_SortKey]")                                              '被修改的就是第一行------------------------
                If dr IsNot Nothing Then
                    dr(key) = dr("入库") - dr("出库")
                End If
            End If
            If dr IsNot Nothing Then
                drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And " & Functions.Execute("FilterStr_Buid",zd(key),dr,e.DataCol.Name ,e.OldValue), "[_SortKey]")  '重算余下所有行------------------------
                For i As Integer = 1 To drs.Count - 1
                    drs(i)(key) = drs(i-1)(key) + drs(i)("入库") - drs(i)("出库")
                Next
            End If
        End If
    End If
Next


 回到顶部