Sub btnAdd_Click
Dim BarCode As String = txtBarcode.Text
'if no barcode
If BarCode = "" Then
txtBarcode.RequestFocus
SoundBeep(100,800)
ToastMessageShow("Barcode required!",False)
Else
'else there is a barcode scanned,
'get the item info: Description and Price
Dim ItemInfo() As String
ItemInfo = DBCalls.GetItemInfo(BarCode)
'if the ItemInfo is valid
If ItemInfo <> Null Then
'if Item comes back as ITEM NOT FOUND
If ItemInfo(0) = "ITEM NOT FOUND" Then
txtBarcode.RequestFocus
txtBarcode.Text = ""
SoundBeep(100,800)
ToastMessageShow("ITEM NOT FOUND!",False)
Else
'else we do have a valid scan,
'save to ScanDetail table
Dim PLU As String = BarCode
Dim ItemDesc As String = txtLastItemDesc.Text
Dim ItemPrice As Double = txtLastPrice.Text
Dim Qty As String = txtQty.Text
If Qty.Contains(",") Then
Qty = txtQty.Text.Replace(",","")
End If
txtLastQty.Text = Qty
'insert data
DBCalls.SaveScanDetail(HID,PLU,ItemDesc,Qty,ItemPrice,Main.gUserID)
'load Scanned Items - Top 20
ScannedItems_ClearAll
Load_ScannedItems
SetScannedCount
End If
Else
'invalid scanned data
txtBarcode.Text = ""
txtBarcode.RequestFocus
SoundBeep(100,800)
ToastMessageShow("Invalid scanned data or setup incomplete!",False)
End If
End If
End Sub