Foxtable(狐表)用户栏目专家坐堂 → 代码计算


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

主题:代码计算

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


加好友 发短信 一级勋章 三级勋章 二级勋章
等级:超级版主 帖子:6318 积分:33957 威望:0 精华:10 注册:2008/8/31 20:56:00
  发帖心情 Post By:2015/9/4 19:55:00 [显示全部帖子]

Select Case e.DataCol.name
    Case "是否结账"
        Dim dr As DataRow = e.DataRow
        If dr("发生年月").Length = 8 Then
            Dim d1 As Date = new Date(dr("发生年月").substring(0,4), dr("发生年月").substring(5,2), 1)
            Dim d2 As Date = d1.AddMonths(1)
            Dim s As String = Format(d2,"yyy年MM月")
            If dr("是否结账")="是" Then
                Dim drs1 As List (of DataRow)=DataTables("计划耗用结存").Select("发生年月='" & dr("发生年月") & "'")
                For Each dr1 As DataRow In drs1
                    If dr1("月末结余_投入数") <> 0 OrElse dr1("月末结余_计划数") <> 0 OrElse dr1("月末结余_应存数") <> 0 OrElse dr1("月末结余_盘点数") <> 0 Then
                        Dim dr2 As DataRow =DataTables("计划耗用结存").find("发生年月= '" & s & " ' and 物料编码= ' " & dr1("物料编码") & "' and 部门= '" & dr1("部门") & "'")
                        If dr2 Is Nothing Then
                            Dim r As Row = Tables("计划耗用结存").Addnew()
                            r("发生年月") = s
                            r("物料编码")=dr1("物料编码")
                            r("部门")=dr1("部门")
                            r("月初结余_计划数")=dr1("月末结余_计划数")
                        End If
                    End If
                Next
            End If
        End If
End Select

 回到顶部