Foxtable(狐表)用户栏目专家坐堂 → [求助]库存消耗自动计算


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

主题:[求助]库存消耗自动计算

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


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/5/16 10:45:00 [显示全部帖子]

For Each dr As DataRow In DataTables("库存消耗").DataRows
    Dim fdr As DataRow = DataTables("排程").DataRows(0)
    Dim flag As Boolean = False
    Dim sum As Double = 0
    For Each dc As DataCol In fdr.DataTable.DataCols
        If flag Then
            For i As Integer = 1 To fdr.DataTable.DataRows.Count-1
                Dim cdr As DataRow = fdr.DataTable.DataRows(i)
                sum += val(dr(cdr("第一列"))) * val(cdr(dc.name))
            Next
            If sum >= dr("库存")
                dr("预计消耗日期") = fdr(dc.name)
                Exit For
            End If
        Else
            If fdr(dc) = dr("库存统计日期") Then
                flag = True
            End If         
        End If
    Next
   
Next

 回到顶部