Foxtable(狐表)用户栏目专家坐堂 → 求助统计-有实例


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

主题:求助统计-有实例

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


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

Dim dt1 As DataTable = DataTables("销售订单出货异常明细表")
Dim dt2 As DataTable = DataTables("异常责任统计表")

Dim dic As new Dictionary(Of String ,Integer)
For Each dr As DataRow In dt2.Select("")
    For Each dc As DataCol In dt2.DataCols
        If dc.name Like "评审日期_*" Then
            If dr("责任生管") = "合计" Then
                If dic.ContainsKey(dc.name) Then
                    dr(dc.name) = dic(dc.name)
                Else
                    dr(dc.name) = 0
                End If
            Else
                dr(dc.name) = Nothing
            End If
        End If
    Next
    Dim count As Integer = 0
    For Each cdr As DataRow In dt1.Select("责任生管 = '" & dr("责任生管") & "' and 制造中心 = '" & dr("制造中心") & "'")
        Dim d As Integer = cdr("评审日期").Day
        If dt2.DataCols.Contains("评审日期_" & d) Then
            If dic.ContainsKey("评审日期_" & d) = False Then dic.Add("评审日期_" & d, 0)
            dr("评审日期_" & d) = val(dr("评审日期_" & d)) + 1
            count += 1
            dic("评审日期_" & d) += 1
        End If
    Next
    dr("合计") = count
Next


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


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

Dim dt1 As DataTable = DataTables("销售订单出货异常明细表")
Dim dt2 As DataTable = DataTables("异常责任统计表")
Dim acount As Integer = 0
Dim dic As new Dictionary(Of String ,Integer)
For Each dr As DataRow In dt2.Select("")
    For Each dc As DataCol In dt2.DataCols
       
        If dc.name Like "评审日期_*"  Then
            If dr("责任生管") = "合计" Then
                If dic.ContainsKey(dc.name) Then
                    dr(dc.name) = dic(dc.name)
                Else
                    dr(dc.name) = 0
                End If
            Else
                dr(dc.name) = Nothing
            End If
        Else If dc.name = "合计"
            If dr("责任生管") = "合计" Then
                dr(dc.name) = acount
            Else
                dr(dc.name) = 0
            End If
        End If
    Next
    Dim count As Integer = 0
    For Each cdr As DataRow In dt1.Select("责任生管 = '" & dr("责任生管") & "' and 制造中心 = '" & dr("制造中心") & "'")
        Dim d As Integer = cdr("评审日期").Day
        If dt2.DataCols.Contains("评审日期_" & d) Then
            If dic.ContainsKey("评审日期_" & d) = False Then dic.Add("评审日期_" & d, 0)
            dr("评审日期_" & d) = val(dr("评审日期_" & d)) + 1
            count += 1
            dic("评审日期_" & d) += 1
        End If
    Next
    dr("合计") += count
    acount += count
Next

 回到顶部