Dim t1 As Table = Tables("Shipment.customsinvoice")
If t1.Rows.Count = 0 Then Return ""
Dim cr1 As Row
Dim cr2 As Row
Dim str As String = ""
For i As Integer = t1.TopPosition To t1.BottomPosition
str = str & "," & t1.Rows(i)("_Identify")
Next
str = str.Trim(",")
t1.Filter = "supplier <> 'GSS' and [_Identify] in (" & str & ")"
Dim cr As Row
Dim Total As Double
Dim Totalp As Double
If t1.Rows.Count > 1 Then
cr = t1.Rows(0)
Total = cr("Netweight_Total")
Totalp = cr("Totalprice")
For i As Integer = t1.Rows.Count - 1 To 1 Step -1
If cr("ShippingNO") = t1.Rows(i)("ShippingNO") AndAlso cr("NameinChinese") = t1.Rows(i)("NameinChinese") AndAlso cr("Unit") = t1.Rows(i)("unit") AndAlso cr("HS") = t1.Rows(i)("HS") AndAlso cr("Declaration") = t1.Rows(i)("Declaration") AndAlso cr("PO_UnitPrice") = t1.Rows(i)("PO_UnitPrice")
cr("Qty") += val(t1.Rows(i)("Qty"))
cr("TotalPrice") += val(t1.Rows(i)("TotalPrice"))
cr("GrossWeight_total") += val(t1.Rows(i)("GrossWeight_Total"))
' cr("Netweight_Total") += val(t.Rows(i)("Netweight_Total"))
Total += val(t1.Rows(i)("Netweight_Total"))
cr("Netweight_PC") = Total /cr("Qty")
Totalp += val(t1.Rows(i)("Totalprice"))
cr("PO_UnitPrice") = Totalp /cr("Qty")
cr("GSSPartNo") &= "," & t1.Rows(i)("GSSPartNo")
t1.Rows(i).delete
Else
cr = t1.Rows(i)
End If
Next
End If
t1.Filter = "supplier = 'GSS' and [_Identify] in (" & str & ")"
If t1.Rows.Count <= 1 Then
t1.Filter = ""
Return ""
End If
msgbox(1)
cr = t1.Rows(0)
Total = cr("Netweight_Total")
Totalp = cr("Totalprice")
For i As Integer = t1.Rows.Count - 1 To 1 Step -1
If cr("ShippingNO") = t1.Rows(i)("ShippingNO") AndAlso cr("MaterialName") = t1.Rows(i)("MaterialName") AndAlso cr("Unit") = t1.Rows(i)("unit") AndAlso cr("HS") = t1.Rows(i)("HS")
cr("Qty") += val(t1.Rows(i)("Qty"))
cr("TotalPrice") += val(t1.Rows(i)("TotalPrice"))
cr("GrossWeight_total") += val(t1.Rows(i)("GrossWeight_Total"))
' cr("Netweight_Total") += val(t.Rows(i)("Netweight_Total"))
Total += val(t1.Rows(i)("Netweight_Total"))
cr("Netweight_PC") = Total /cr("Qty")
Totalp += val(t1.Rows(i)("Totalprice"))
cr("PO_UnitPrice") = Totalp /cr("Qty")
cr("GSSPartNo") &= "," & t1.Rows(i)("GSSPartNo")
t1.Rows(i).delete
Else
cr = t1.Rows(i)
End If
Next
t1.Filter = ""