S
scorpion53061
I really messed this up now. ....it is not picking up any rows though it is
suppose to have.
Do
i = i + 1
If i = dstrancopy.Tables(0).Rows.Count - 1 Then
Exit Do
End If
Dim strexpression As String = "ITEM = '" &
dstrancopy.Tables(0).Rows(i + 1).Item("ITEM") & "'"
Dim foundrows As DataRow() =
dstrancopy.Tables(0).Select(strexpression, "DESC", DataViewRowState.Added)
For Each r In foundrows
For itemcheck = 0 To listds.Tables(0).Rows.Count - 1
If listds.Tables(0).Rows(itemcheck).Item("ITEMNO") =
r.Item("ITEM") Then
thisitemisalreadyin = True
Exit For
End If
Next
If thisitemisalreadyin = True Then
Exit For
End If
drnew1 = listds.Tables(0).NewRow
drnew1.Item("ITEMNO") = r.Item("ITEMNO")
For Each c In r.Table.Columns
If Format(r.Item("DATE"), "MMM") = "JAN" Then
January = 0
If LTrim(RTrim(r.Item("UM"))) = "E" Or
LTrim(RTrim(r.Item("UM"))) = "EA" Or LTrim(RTrim(r.Item("UM"))) = "NK" Then
tempamount = Format(r.Item("UCOST") *
r.Item("qty"), "##0.##")
End If
If LTrim(RTrim(r.Item("UM"))) = "C" Then
tempamount = Format(r.Item("UCOST") *
(r.Item("qty") / 100), "##0.##")
End If
If LTrim(RTrim(r("UM"))) = "M" Then
tempamount = Format(r.Item("UCOST") *
(r.Item("qty") / 1000), "##0.##")
End If
January = January + tempamount
If tempamount = 0 Or tempamount = Nothing Then
drnew1.Item("JAN") = 0
Else
drnew1.Item("JAN") = January
End If
End If
listds.Tables(0).Rows.Add(drnew1)
'next column
Next c
Next
Loop
suppose to have.
Do
i = i + 1
If i = dstrancopy.Tables(0).Rows.Count - 1 Then
Exit Do
End If
Dim strexpression As String = "ITEM = '" &
dstrancopy.Tables(0).Rows(i + 1).Item("ITEM") & "'"
Dim foundrows As DataRow() =
dstrancopy.Tables(0).Select(strexpression, "DESC", DataViewRowState.Added)
For Each r In foundrows
For itemcheck = 0 To listds.Tables(0).Rows.Count - 1
If listds.Tables(0).Rows(itemcheck).Item("ITEMNO") =
r.Item("ITEM") Then
thisitemisalreadyin = True
Exit For
End If
Next
If thisitemisalreadyin = True Then
Exit For
End If
drnew1 = listds.Tables(0).NewRow
drnew1.Item("ITEMNO") = r.Item("ITEMNO")
For Each c In r.Table.Columns
If Format(r.Item("DATE"), "MMM") = "JAN" Then
January = 0
If LTrim(RTrim(r.Item("UM"))) = "E" Or
LTrim(RTrim(r.Item("UM"))) = "EA" Or LTrim(RTrim(r.Item("UM"))) = "NK" Then
tempamount = Format(r.Item("UCOST") *
r.Item("qty"), "##0.##")
End If
If LTrim(RTrim(r.Item("UM"))) = "C" Then
tempamount = Format(r.Item("UCOST") *
(r.Item("qty") / 100), "##0.##")
End If
If LTrim(RTrim(r("UM"))) = "M" Then
tempamount = Format(r.Item("UCOST") *
(r.Item("qty") / 1000), "##0.##")
End If
January = January + tempamount
If tempamount = 0 Or tempamount = Nothing Then
drnew1.Item("JAN") = 0
Else
drnew1.Item("JAN") = January
End If
End If
listds.Tables(0).Rows.Add(drnew1)
'next column
Next c
Next
Loop