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