Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim pcode As String = ""
- Dim pID As Integer
- Dim pname As String = ""
- Dim desc As String = ""
- Dim uom As String = ""
- Dim price As Decimal
- Dim total As Decimal
- With pForm.QformEdit.dgvData
- Dim i As Integer
- Dim counter As Integer = 0
- For Each row As DataGridViewRow In dgvInventory.Rows
- pID = row.Cells("productID").Value
- pcode = row.Cells("productCode").Value.ToString()
- pname = row.Cells("productName").Value.ToString()
- desc = row.Cells("description").Value.ToString()
- uom = row.Cells("uom").Value.ToString()
- price = row.Cells("SellingPrice").Value.ToString()
- total = row.Cells("SellingPrice").Value * 1
- If row.Cells("chk").Value = True Then
- 'before adding check if the product is already added to the list
- For i = 0 To .RowCount - 1
- If pID = .Item(2, i).Value Then
- counter = counter + 1
- If counter <> 0 Then
- 'if item exist do not add
- End If
- End If
- Next i
- If counter = 0 Then
- Dim R As DataRow = dt.NewRow
- R("Delete") = "Delete"
- R("lookup") = "Select"
- R("Product_ID") = pID
- R("pCode") = pcode
- R("description") = desc
- R("uom") = uom
- R("unit_price") = price
- R("qty") = 1
- R("total") = total
- R("disc_percentage") = 0
- R("disc_amount") = 0
- R("gtotal") = total
- 'R("item_for") = "q"
- 'R("returned_status") = "sold"
- 'R("transaction_id") = selected_ID
- 'R("user_ID") = 0
- dt2 = pForm.QformEdit.dgvData.DataSource
- dt.Rows.Add(R)
- dt2.Merge(dt, True, MissingSchemaAction.Ignore)
- pForm.QformEdit.dgvData.DataSource = dt2
- End If
- End If
- Next
- 'MessageBox.Show(pID & "" & pcode & " " & pname)
- End With
Add Comment
Please, Sign In to add comment