Dim dt As DataTable = DataTables("汇总表")
dt.DataRows.Clear
Dim ls As List(of String()) = DataTables("入库详单").GetValues("入库日期|产品序号")
For Each ary As String() In ls
Dim dr As DataRow = dt.AddNew
dr("日期") = ary(0)
Dim fdr As DataRow = DataTables("配件材料信息表").Find("产品序号 = '" & ary(1) & "'")
If fdr IsNot Nothing Then
dr("名称") = fdr("产品名称")
dr("规格型号") = fdr("产品规格")
dr("类型") = fdr("产品类型")
dr("单位") = fdr("单位")
dr("结存数量") = fdr("现有库存")
End If
dr("库存数量") = DataTables("入库详单").Compute("sum(入库数量)", "入库日期 = #" & ary(0) & "# and 产品序号 = '" & ary(1) & "'")
fdr = DataTables("出库详单").Find("出库日期 = #" & ary(0) & "# and 产品序号 = '" & ary(1) & "'")
If fdr IsNot Nothing Then
dr("领用单位") = fdr("单位")
dr("领用数量") = DataTables("出库详单").Compute("sum(出库数量)", "出库日期 = #" & ary(0) & "# and 产品序号 = '" & ary(1) & "'")
Dim pdr As DataRow = DataTables("出库主表").Find("出库单号 = '" & fdr("出库单号") & "'")
If pdr IsNot Nothing Then
dr("发料人") = pdr("经手人")
dr("领料人") = pdr("领料员")
End If
dr("使用地方") = fdr("取出库房")
End If
Next
ls = DataTables("出库详单").GetValues("出库日期|产品序号")
For Each ary As String() In ls
Dim fdr As DataRow = DataTables("配件材料信息表").Find("产品序号 = '" & ary(1) & "'")
If fdr IsNot Nothing Then
If dt.Find("日期 = #" & ary(0) & "# and 名称 = '" & fdr("产品名称") & "' and 规格型号 = '" & fdr("产品规格") & "'") Is Nothing Then
Dim dr As DataRow = dt.AddNew
dr("日期") = ary(0)
dr("名称") = fdr("产品名称")
dr("规格型号") = fdr("产品规格")
dr("类型") = fdr("产品类型")
dr("单位") = fdr("单位")
dr("结存数量") = fdr("现有库存")
fdr = DataTables("出库详单").Find("出库日期 = #" & ary(0) & "# and 产品序号 = '" & ary(1) & "'")
If fdr IsNot Nothing Then
dr("领用单位") = fdr("单位")
dr("领用数量") = DataTables("出库详单").Compute("sum(出库数量)", "出库日期 = #" & ary(0) & "# and 产品序号 = '" & ary(1) & "'")
Dim pdr As DataRow = DataTables("出库主表").Find("出库单号 = '" & fdr("出库单号") & "'")
If pdr IsNot Nothing Then
dr("发料人") = pdr("经手人")
dr("领料人") = pdr("领料员")
End If
dr("使用地方") = fdr("取出库房")
End If
End If
End If
Next