Imports System.ComponentModel Imports System.Data.Common.CommandTrees.ExpressionBuilder Imports System.Data.SqlClient Public Class FrmBilling Private ReadOnly SQL As New SQLControl Private ReadOnly BaseFormClass As New BaseFormClass Dim op As String Dim Firstnum As Double Dim Secondnum As Double Dim Answer As Double Private Sub ChangeDGVLanguage() Try 'Me.OrderLinesDGV.Columns(0).HeaderText = "DELETE ROW" 'Me.OrderLinesDGV.Columns(1).HeaderText = "EDIT ROW" If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnClose_Click(sender As Object, e As EventArgs) Handles BtnClose.Click Try FrmMainForm.Select() FrmBillingImageEN.Close() Me.Close() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CheckMultipleStation() Try 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT * FROM Application.AdminTbl Where SocietyID = 1") If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 And SQL.DBDS.Tables(0).Rows(0).Item("UseMultipleCashRegisterStation") = False Then Me.StationNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("StationNumber") 'Else 'Dim FormSelectStation As New FrmSelectStation 'FrmSelectStation.ShowDialog() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub FrmBilling_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'AcDataDataSet.OrderLines' table. You can move, or remove it, as needed. Me.OrderLinesQueryTableAdapter.Fill(Me.AcDataDataSet.OrderLinesQuery) Try BaseFormClass.SetEventHandlersTextBox(Me) BaseFormClass.SetEventHandlersComboBox(Me) BaseFormClass.SetEventHandlersButton(Me) Me.LanguageIDTB.Text = FrmLanguages.strLanguageID Me.LanguageDescTB.Text = FrmLanguages.strLanguageDesc Me.LanguageCodeTB.Text = FrmLanguages.strLanguageCode If Me.LanguageIDTB.Text = "1" Then FrmBillingChangeLanguage_en_US() ElseIf Me.LanguageIDTB.Text = "2" Then FrmBillingChangeLanguage_fr_FR() End If LoadCustomerCBX() LoadCompanyCBX() LoadProductCBX() Me.ProductCBX.Enabled = False CheckMultipleStation() GetCashierAssignedStation() CheckIfCashierHasOpenOrder() ShowOpenOrders() BtnShowDGVButtons() SetDGVRowTemplate() CheckTaxesSetup() RecordsCounted() OrderLinesDGV.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter OrderLinesDGV.Columns("OrderLineID").Visible = False OrderLinesDGV.Columns("InvoicedQuantity").Visible = False OrderLinesDGV.Columns("BackOrderYesNo").Visible = False OrderLinesDGV.Columns("BackOrderQuantity").Visible = False OrderLinesDGV.Columns("OrderNo").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter OrderLinesDGV.Columns("ProductID").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter OrderLinesDGV.Columns("Quantity").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter OrderLinesDGV.Columns("UnitPrice").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight OrderLinesDGV.Columns("ExtendedPrice").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight OrderLinesDGV.Columns("DiscountRate").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight OrderLinesDGV.Columns("DiscountAmount").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight OrderLinesDGV.Columns("LineTotal").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight OrderLinesDGV.Columns("InvoicedQuantity").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter OrderLinesDGV.Columns("BackOrderQuantity").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter OrderLinesDGV.Columns("Quantity").Width = 75 If DeliveryToCustomerCB.Checked = True Then Me.CustomerTB.Visible = True Me.SocietyTB.Visible = False End If If DeliveryToCustomerCB.Checked = False Then Me.CustomerTB.Visible = False Me.SocietyTB.Visible = True End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub SetDGVRowTemplate() Try OrderLinesDGV.AllowUserToAddRows = False Dim row As DataGridViewRow = Me.OrderLinesDGV.RowTemplate 'row.DefaultCellStyle.BackColor = Color.Bisque row.Height = 35 row.MinimumHeight = 20 OrderLinesDGV.AllowUserToDeleteRows = True OrderLinesDGV.DefaultCellStyle.BackColor = Color.White 'OrderLinesDGV.AlternatingRowsDefaultCellStyle.BackColor = Color.White OrderLinesDGV.DefaultCellStyle.SelectionBackColor = Color.FromArgb(245, 243, 178) OrderLinesDGV.DefaultCellStyle.SelectionForeColor = Color.Black OrderLinesDGV.Columns.Item(0).DefaultCellStyle.BackColor = Color.Red OrderLinesDGV.Columns.Item(0).DefaultCellStyle.ForeColor = Color.White OrderLinesDGV.Columns.Item(1).DefaultCellStyle.BackColor = Color.Lime OrderLinesDGV.Columns.Item(1).DefaultCellStyle.ForeColor = Color.Black If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Sub LoadCustomerCBX() Try 'REFRESH COMBOBOX CustomerCBX.Items.Clear() 'RUN QUERY SQL.ExecQuery("SELECT DISTINCT CustomerID, FilingName, Society FROM Sales.Customers ORDER BY FilingName") 'LOOP ROW & ADD TO COMBOBOX For Each r As DataRow In SQL.DBDT.Rows CustomerCBX.Items.Add(r("FilingName").ToString) Next CustomerCBX.AutoCompleteMode = AutoCompleteMode.Append CustomerCBX.DropDownStyle = ComboBoxStyle.DropDown CustomerCBX.AutoCompleteSource = AutoCompleteSource.ListItems If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub LoadProductCBX() Try 'REFRESH COMBOBOX ProductCBX.Items.Clear() 'RUN QUERY SQL.ExecQuery("SELECT ProductID, ProductName, SellingPrice1,SellingPrice2,SellingPrice3,SellingPrice4,SellingPrice5 FROM Warehouse.ProductsActivated ORDER BY ProductName ASC") If SQL.HasException(True) Then Exit Sub 'LOOP ROW & ADD TO COMBOBOX For Each r As DataRow In SQL.DBDT.Rows ProductCBX.Items.Add(r("ProductName").ToString) Next ProductCBX.Sorted = True ProductCBX.AutoCompleteMode = AutoCompleteMode.None ProductCBX.DropDownStyle = ComboBoxStyle.DropDown ProductCBX.AutoCompleteSource = AutoCompleteSource.ListItems If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub LoadCompanyCBX() Try 'REFRESH COMBOBOX SocietyCBX.Items.Clear() 'RUN QUERY SQL.ExecQuery("SELECT DISTINCT CustomerID, Society FROM Sales.Customers ORDER BY Society") 'LOOP ROW & ADD TO COMBOBOX For Each r As DataRow In SQL.DBDT.Rows SocietyCBX.Items.Add(r("Society").ToString) Next SocietyCBX.AutoCompleteMode = AutoCompleteMode.Append SocietyCBX.DropDownStyle = ComboBoxStyle.DropDown SocietyCBX.AutoCompleteSource = AutoCompleteSource.ListItems If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CheckTaxesSetup() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT SocietyID, UseTax1, UseTax2, UseTax3,TaxeRate1Desc, TaxeRate2Desc,TaxeRate3Desc FROM Application.BusinessTaxes WHERE SocietyID = 1") If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 Then If SQL.DBDS.Tables(0).Rows(0).Item("UseTax1") = True Then LblTax1.Text = SQL.DBDS.Tables(0).Rows(0).Item("TaxeRate1Desc") End If If SQL.DBDS.Tables(0).Rows(0).Item("UseTax2") = True Then LblTax2.Text = SQL.DBDS.Tables(0).Rows(0).Item("TaxeRate2Desc") End If If SQL.DBDS.Tables(0).Rows(0).Item("UseTax3") = True Then LblTax3.Text = SQL.DBDS.Tables(0).Rows(0).Item("TaxeRate3Desc") End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Sub GetCashierAssignedStation() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT * FROM Application.Employees Where EmployeeID = '" & CashierIDTB.Text & "' ") Me.StationNumberTempTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("StationID") If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Sub CashierMultipleStationsTrue() Try 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT * FROM Application.AdminTbl Where SocietyID = 1") If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 And SQL.DBDS.Tables(0).Rows(0).Item("UseMultipleCashRegisterStation") = True Then Me.StationNumberTB.Text = Me.StationNumberTempTB.Text End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Function GetInvoice() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT * FROM Application.Employees Where EmployeeID = '" & CashierIDTB.Text & "' ") Dim StationID As String = (SQL.DBDS.Tables(0).Rows(0).Item("StationID")) If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("Select top 1 OrderNo From Sales.Orders where OrderNo like '" & StationID & "%' Order By ID Desc") If SQL.DBDS.Tables(0).Rows.Count = 0 Then Return StationID & "00000001" Else If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 Then GetInvoice = CLng(SQL.DBDS.Tables(0).Rows(0).Item("OrderNo").ToString) + 1 Else GetInvoice = StationID & "1" Return GetInvoice End If If SQL.HasException(True) Then Exit Function Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try Return False End Function Public Function GetOrdersNo() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT * FROM Application.Employees Where EmployeeID = '" & CashierIDTB.Text & "' ") Dim StationID As String = (SQL.DBDS.Tables(0).Rows(0).Item("StationID")) If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("Select top 1 OrderNo From Application.OrdersNo where OrderNo like '" & StationID & "%' Order By ID Desc") If SQL.DBDS.Tables(0).Rows.Count = 0 Then Return StationID & "00000001" Else If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 Then GetOrdersNo = CLng(SQL.DBDS.Tables(0).Rows(0).Item("OrderNo").ToString) + 1 Else GetOrdersNo = StationID & "1" Return GetOrdersNo() End If If SQL.HasException(True) Then Exit Function Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try Return False End Function Private Sub BtnNewOrder_Click(sender As Object, e As EventArgs) Handles BtnNewOrder.Click Try If Me.StationNumberTB.Text = "" Then MessageBox.Show("You must choose a station number to create a new order!.", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub Else OrderNoTB.Text = GetInvoice() InvoiceNumberTB.Text = OrderNoTB.Text InvoiceNumberTB.Text = Replace(Me.InvoiceNumberTB.Text, "-", "") OrderNoTempTB.Text = OrderNoTB.Text OrderNoTempTB.Text = Replace(Me.OrderNoTempTB.Text, "-", "") OrderDateTB.Text = Now() InvoiceDateTB.Text = Now() DeliveryDateExpectedTB.Text = Now() DatePaidTB.Text = Now() BackOrderIDTB.Text = 0 CustomerPOTB.Text = 0 OrderNoteTB.Text = "You can edit this order note right HERE!" SubTotalTB.Text = "0.00" TaxTotal1TB.Text = "0.00" TaxTotal2TB.Text = "0.00" TaxTotal3TB.Text = "0.00" TotalTB.Text = "0.00" CurrentStatusTB.Text = "New ORDER" LoadNewRecord() CreateNewOrder() CheckCashierSetup() CheckIfCashierHasOpenOrder() Me.SelectedOrderTB.Text = Me.OrderNoTempTB.Text Me.OrderNoTB.Visible = True Me.OrderNoSelectedTB.Visible = False CheckOpenOrders() LoadOrderRecords() UpdateOrdersNo() ProductCBX.Select() End If Me.ProductCBX.Enabled = True LoadSelectedOrderData() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub UpdateOrdersNo() Try 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.AddParam("@OrderNo", OrderNoTempTB.Text) SQL.AddParam("@StationID", StationNumberTB.Text) SQL.ExecQuery("INSERT INTO Application.OrdersNo(OrderNo,StationID) " & "VALUES (@OrderNo,@StationID) ", True) If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub SocietyCBX_Enter(sender As Object, e As EventArgs) Handles SocietyCBX.Enter Try SocietyCBX.DroppedDown = True If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub StationNumberTB_Enter(sender As Object, e As EventArgs) Handles StationNumberTB.Enter 'CheckMultipleStation() End Sub Private Sub BtnSelectStation_Click(sender As Object, e As EventArgs) Handles BtnSelectStation.Click Try Me.StationChangedCB.Checked = True Dim FormSelectStation As New FrmSelectStation FrmSelectStation.ShowDialog() FrmSelectStation.StationNumberCBX.Select() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub OrderNoTB_TextChanged(sender As Object, e As EventArgs) Handles OrderNoTB.TextChanged Try If OrderNoTB.Text.Length >= 4 Then Dim s As String = OrderNoTB.Text.Replace("-", "") 'For Dim x As Integer = 3 s = s.Insert(x + ((x \ 3) - 1), "-") 'Next s = s.TrimEnd("-"c) OrderNoTB.Text = s OrderNoTB.SelectionStart = s.Length End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub TsmBilling3_MouseHover(sender As Object, e As EventArgs) Try Me.TsmBilling4.ShowDropDown() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub TsmBilling6a_Click(sender As Object, e As EventArgs) Handles TsmBilling6a.Click Try Dim FormDesktopClock As New FrmDesktopClock FrmDesktopClock.Show() TsmBilling6.HideDropDown() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub TsmBilling6b_Click(sender As Object, e As EventArgs) Handles TsmBilling6b.Click Try Dim FormACCalculator As New FrmACCalculator For Each f As Form In Me.MdiChildren f.Close() Next FormACCalculator.Show() TsmBilling6.HideDropDown() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub TsmBilling5a_Click(sender As Object, e As EventArgs) Handles TsmBilling5a.Click Try Dim FormInternet As New FrmInternet FormInternet.Show() TsmBilling5.HideDropDown() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub TsmBilling1_MouseHover(sender As Object, e As EventArgs) Handles TsmBilling1.MouseHover TsmBilling1.ShowDropDown() End Sub Private Sub TsmBilling2_MouseHover(sender As Object, e As EventArgs) Handles TsmBilling2.MouseHover TsmBilling2.ShowDropDown() End Sub Private Sub TsmBilling3_MouseHover_1(sender As Object, e As EventArgs) Handles TsmBilling3.MouseHover TsmBilling3.ShowDropDown() End Sub Private Sub TsmBilling4_MouseHover(sender As Object, e As EventArgs) Handles TsmBilling4.MouseHover TsmBilling4.ShowDropDown() End Sub Private Sub TsmBilling5_MouseHover(sender As Object, e As EventArgs) Handles TsmBilling5.MouseHover TsmBilling5.ShowDropDown() End Sub Private Sub TsmBilling6_MouseHover(sender As Object, e As EventArgs) Handles TsmBilling6.MouseHover TsmBilling6.ShowDropDown() End Sub Private Sub TsmBilling7_MouseHover(sender As Object, e As EventArgs) Handles TsmBilling7.MouseHover TsmBilling7.ShowDropDown() End Sub Private Sub TsmBilling8_MouseHover(sender As Object, e As EventArgs) Handles TsmBilling9.MouseHover TsmBilling9.ShowDropDown() End Sub Private Sub BtnDeleteThisOrder_Click(sender As Object, e As EventArgs) Handles BtnDeleteThisOrder.Click Try If Me.OrderNoTB.Text <> "" And Me.RecordsCountTB.Text = 0 Then If MsgBox("Do you really want to delete this order? '" & OrderNoTB.Text & "'" & vbCrLf & "All the selected items in the rows must be deleted first!", MsgBoxStyle.YesNo, "DELETE ORDER?") = vbYes Then 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If ChooseAReasonForDeleteAnOrder() Else MessageBox.Show("The deletion has been aborted!.", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub TsmBilling1a_Click(sender As Object, e As EventArgs) Handles TsmBilling1a.Click TsmBilling1.HideDropDown() End Sub Private Sub TsmBilling1b_Click(sender As Object, e As EventArgs) TsmBilling1.HideDropDown() End Sub Private Sub TsmBilling2a_Click(sender As Object, e As EventArgs) Handles TsmBilling2a.Click TsmBilling2.HideDropDown() End Sub Private Sub TsmBilling3a_Click(sender As Object, e As EventArgs) Handles TsmBilling3a.Click BtnAddCustomer.PerformClick() TsmBilling3.HideDropDown() End Sub Private Sub TsmBilling4a_Click(sender As Object, e As EventArgs) Handles TsmBilling4a.Click TsmBilling4.HideDropDown() End Sub Private Sub TsmBilling7a_Click(sender As Object, e As EventArgs) Handles TsmBilling7a.Click TsmBilling7.HideDropDown() End Sub Private Sub TsmBilling7b_Click(sender As Object, e As EventArgs) Handles TsmBilling7b.Click TsmBilling7.HideDropDown() End Sub Public Function CloseAllDropdown() Try TsmBilling1.HideDropDown() TsmBilling2.HideDropDown() TsmBilling3.HideDropDown() TsmBilling4.HideDropDown() TsmBilling5.HideDropDown() TsmBilling6.HideDropDown() TsmBilling7.HideDropDown() TsmBilling9.HideDropDown() Return True Catch ex As Exception MsgBox(ex.Message) Return False End Try End Function Private Sub BtnShowDGVButtons() Try Dim DeleteBtn As New DataGridViewButtonColumn With { .Text = "Delete", .FlatStyle = FlatStyle.Popup } OrderLinesDGV.Columns.Insert(0, DeleteBtn) With DeleteBtn .HeaderText = "DELETE" .Text = "Delete" .Name = "BtnDeleteOrderLine" .UseColumnTextForButtonValue = True .Width = "50" End With DeleteBtn.DefaultCellStyle.BackColor = Color.Red DeleteBtn.DefaultCellStyle.ForeColor = Color.White Dim EditBtn As New DataGridViewButtonColumn With { .Text = "Edit", .FlatStyle = FlatStyle.Popup } OrderLinesDGV.Columns.Insert(1, EditBtn) With EditBtn .HeaderText = "EDIT" .Text = "Edit" .Name = "BtnEditOrderLine" .UseColumnTextForButtonValue = True .Width = "50" End With EditBtn.DefaultCellStyle.BackColor = Color.Lime EditBtn.DefaultCellStyle.ForeColor = Color.Black If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ShowOpenOrders() Try 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT * FROM Sales.OpenOrders Where CashierID = '" & CashierIDTB.Text & "' ORDER BY OrderNo ASC") Dim SelectBtn As New DataGridViewButtonColumn() OpenOrdersDGV.Columns.Add(SelectBtn) With SelectBtn .HeaderText = "" .Text = "SELECT" .Name = "BtnSelectOrder" .UseColumnTextForButtonValue = True .Width = "150" End With 'Adjust header styles With OpenOrdersDGV.ColumnHeadersDefaultCellStyle .BackColor = Color.Lime .ForeColor = Color.Black .Font = New Font("century gothic", 9, FontStyle.Regular) .WrapMode = DataGridViewTriState.False End With OpenOrdersDGV.SelectionMode = DataGridViewSelectionMode.FullRowSelect OpenOrdersDGV.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight OpenOrdersDGV.MultiSelect = False With Me.OpenOrdersDGV .RowsDefaultCellStyle.BackColor = Color.Lime .AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(192, 255, 192) End With OpenOrdersDGV.DataSource = SQL.DBDT Me.OpenOrdersDGV.Columns("CashierID").Width = 0 Me.OpenOrdersDGV.Columns("OrderPaid").Width = 0 Me.OpenOrdersDGV.Columns("StationID").Width = 0 Me.OpenOrdersDGV.RowTemplate.Height = 35 Me.OpenOrdersDGV.Columns(1).HeaderCell.Style.Font = New Font(OpenOrdersDGV.Font, FontStyle.Bold) Me.OpenOrdersDGV.RefreshEdit() LoadOrderRecords() If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnSelectSalesperson_Click(sender As Object, e As EventArgs) Handles BtnSelectSalesperson.Click Try If String.IsNullOrEmpty(OrderNoTB.Text.Trim()) Then 'String.IsNullOrEmpty(OrderNoTempTB.Text.Trim()) Then MessageBox.Show("To select a salesperson for an order you must have created or selected an order.", "AutoCashRegister message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub Else Dim FormSalesperson As New FrmSalespersons FrmSalespersons.Show() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub DisplayOrderFromSelected() Try If OrderNoTempTB.Text.Length >= 4 Then Dim s As String = OrderNoTempTB.Text.Replace("-", "") Dim x As Integer = 3 s = s.Insert(x + ((x \ 3) - 1), "-") s = s.TrimEnd("-"c) OrderNoTempTB.Text = s OrderNoTempTB.SelectionStart = s.Length Me.OrderNoSelectedTB.Text = Me.OrderNoTempTB.Text End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Sub OpenOrdersDGV_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles OpenOrdersDGV.CellContentClick Try If OthersGB.Visible = True Then OthersGB.Visible = False BtnPayment.Visible = True Me.BtnClosePayments.Visible = False End If Dim dgv As DataGridView = OpenOrdersDGV Me.SelectedOrderTB.Text = Convert.ToString(dgv.CurrentRow.Cells(1).Value) DisplayOrderFromSelected() LoadSelectedOrderData() LoadOrderRecords() Me.OrderNoTB.Text = Me.OrderNoSelectedTB.Text Me.OrderNoTB.Visible = False Me.OrderNoSelectedTB.Visible = True Me.ProductCBX.Enabled = True Me.QtyTB.Text = 1 Me.UnitPriceTB.Text = "000.0000" Me.ExtendedPriceTB.Text = "$0.00" Me.DiscountRateTB.Text = "00.00000" Me.DiscountAmountTB.Text = "$0.00" Me.LineTotalTB.Text = "$0.00" RecordsCounted() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Sub CheckCashierSetup() Try 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If 'Get the information about cashier setup from the employee's file SQL.RunQuery("SELECT * FROM Application.EmployeesLoadDataGrid Where EmployeeID = '" & CashierIDTB.Text & "' ") If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 And SQL.DBDS.Tables(0).Rows(0).Item("IsCashier") = False And SQL.DBDS.Tables(0).Rows(0).Item("IsAManager") = False Then MessageBox.Show("Only an employee with the cashier privilege can open an invoicing form!.", "AutoCashRegister message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 And SQL.DBDS.Tables(0).Rows(0).Item("UseBillingInvoicing") = True And SQL.DBDS.Tables(0).Rows(0).Item("AutoLoginToRegister") = True Then Me.StationNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("StationID") End If If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CheckIfCashierHasOpenOrder() Try 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.ExecQuery("SELECT * FROM Sales.OpenOrders Where CashierID = '" & CashierIDTB.Text & "' ORDER BY OrderNo ASC") If SQL.DBDT.Rows.Count >= 1 Then Me.BtnSelectStation.Enabled = False Me.StationChangedCB.Enabled = False Else Me.BtnSelectStation.Enabled = True Me.StationChangedCB.Enabled = True End If If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnNewOrder_MouseEnter(sender As Object, e As EventArgs) Handles BtnNewOrder.MouseEnter BtnNewOrder.BackColor = Color.Lime BtnNewOrder.ForeColor = Color.Black End Sub Private Sub BtnNewOrder_MouseLeave(sender As Object, e As EventArgs) Handles BtnNewOrder.MouseLeave BtnNewOrder.BackColor = Color.FromArgb(255, 238, 255) BtnNewOrder.ForeColor = Color.Black End Sub Private Sub BtnDeleteThisOrder_MouseEnter(sender As Object, e As EventArgs) Handles BtnDeleteThisOrder.MouseEnter BtnDeleteThisOrder.BackColor = Color.Lime BtnDeleteThisOrder.ForeColor = Color.Black End Sub Private Sub BtnDeleteThisOrder_MouseLeave(sender As Object, e As EventArgs) Handles BtnDeleteThisOrder.MouseLeave BtnDeleteThisOrder.BackColor = Color.Red BtnDeleteThisOrder.ForeColor = Color.White End Sub Private Sub BtnSelectStation_MouseEnter(sender As Object, e As EventArgs) Handles BtnSelectStation.MouseEnter BtnSelectStation.BackColor = Color.Lime BtnSelectStation.ForeColor = Color.Black End Sub Private Sub BtnSelectStation_MouseLeave(sender As Object, e As EventArgs) Handles BtnSelectStation.MouseLeave BtnSelectStation.BackColor = Color.White BtnSelectStation.ForeColor = Color.FromArgb(64, 0, 64) End Sub Private Sub BtnPayment_MouseEnter(sender As Object, e As EventArgs) Handles BtnPayment.MouseEnter BtnPayment.BackColor = Color.Lime BtnPayment.ForeColor = Color.Black End Sub Private Sub BtnPayment_MouseLeave(sender As Object, e As EventArgs) Handles BtnPayment.MouseLeave BtnPayment.BackColor = Color.FromArgb(255, 238, 255) BtnPayment.ForeColor = Color.Black End Sub Private Sub CustomerCBX_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CustomerCBX.SelectedIndexChanged Try If RecordsCountTB.Text <> 0 Then MessageBox.Show("You can't change a customer when you have items in this order, the main reason is not all customers have the same price for products!" & vbCrLf & vbCrLf & "Remove all items, then you can change the customer.", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Information) Exit Sub Else ChangeCustomer() UpdateOrdersCustomerInfo() Me.ProductCBX.Select() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub LoadSelectedOrderData() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT * FROM Sales.Orders WHERE OrderNo = '" & SelectedOrderTB.Text & "'") If SQL.DBDS.Tables(0).Rows.Count = 0 Then MessageBox.Show("There were no open orders found for this cashier, click on the button NEW ORDER when the billing form opens!.") Exit Sub End If If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 Then OrderNoTB.Visible = False OrderNoSelectedTB.Visible = True OrderNoSelectedTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("OrderNo") OrderNoTempTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("OrderNo") ProductIDTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("ID") CustomerIDTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CustomerID") StationNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("StationID") CashierIDTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CashierID") CashierNameTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CashierName") InvoiceNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("InvoiceNumber") CustomerCBX.Text = SQL.DBDS.Tables(0).Rows(0).Item("CustomerName") SocietyCBX.Text = SQL.DBDS.Tables(0).Rows(0).Item("SocietyName") AddressTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Address1") Address2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Address2") CityTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("City") StateProvinceTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("StateProvince") ZipCodeTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("ZipCode") CountryTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Country") PhoneNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Phone") ExtensionTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Extension") CellNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Cell") OrderNoteTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("OrderNote") CustomerPOTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CustomerPO") AttentionOfTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("AttentionOf") CustomerEmailTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CustomerEmail") NotesTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CustomerNotes") BackOrderIDTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("BackOrderID") CustomerTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CustomerName") SocietyTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("SocietyName") CustomerTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryToCustomer") SocietyTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryToSociety") DeliveryAddress1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryAddress1") DeliveryAddress2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryAddress2") DeliveryCityTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryCity") DeliveryStateProvinceTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryStateProvince") DeliveryZipCodeTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryZipCode") DeliveryCountryTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryCountry") DeliveryPhoneNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryPhone") DeliveryCellPhoneTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryCell") DeliveryDateExpectedTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryDateExpected") DeliveryInstructionsTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryInstructions") CurrentStatusTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CurrentStatus") OrderDateTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("OrderDate") InvoiceDateTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("InvoiceDate") SellingPrice1CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice1CB") SellingPrice2CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice2CB") SellingPrice3CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice3CB") SellingPrice4CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice4CB") SellingPrice5CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice5CB") OrderPaidCB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("OrderPaid") DatePaidTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DatePaid") SalespersonIDTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("SalespersonID") If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If Else MsgBox("You don't have an order with this order number '" & SelectedOrderTB.Text & "'") End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ChangeCustomer() Try 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If 'Get the information about the customer for this order from the customer's file SQL.RunQuery("SELECT * FROM Sales.Customers Where FilingName = '" & CustomerCBX.Text & "' ") Me.CustomerIDTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CustomerID") SocietyTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Society") CustomerCBX.Text = SQL.DBDS.Tables(0).Rows(0).Item("MailingName") SocietyCBX.Text = SQL.DBDS.Tables(0).Rows(0).Item("Society") AddressTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Address1") Address2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Address2") CityTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("City") StateProvinceTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("StateProvince") ZipCodeTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("ZipCode") CountryTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Country") OrderNoteTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("OrderNote") AttentionOfTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("AttentionOf") CustomerEmailTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CustomerEmail") NotesTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Notes") DeliveryToCustomerCB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryToCustomer") DeliveryToSocietyCB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryToSociety") CustomerTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("MailingName") SocietyTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Society") DeliveryAddress1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryAddress1") DeliveryAddress2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryAddress2") DeliveryCityTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryCity") DeliveryStateProvinceTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryStateProvince") DeliveryZipCodeTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryZipCode") DeliveryCountryTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryCountry") DeliveryInstructionsTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryNotes") DeliveryPhoneNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryPhone") DeliveryCellPhoneTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryCell") SellingPrice1CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice1CB") SellingPrice2CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice2CB") SellingPrice3CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice3CB") SellingPrice4CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice4CB") SellingPrice5CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice5CB") PhoneNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("PhoneNumber") CellNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CellNumber") DeliveryPhoneNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryPhone") DeliveryCellPhoneTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryCell") If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CheckOpenOrders() Try 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.ExecQuery("SELECT * FROM Sales.OpenOrders Where CashierID = '" & CashierIDTB.Text & "' ORDER BY OrderNo ASC") OpenOrdersDGV.DataSource = SQL.DBDT Me.OpenOrdersDGV.Columns("CashierID").Width = 0 Me.OpenOrdersDGV.Columns("OrderPaid").Width = 0 Me.OpenOrdersDGV.Columns("StationID").Width = 0 Me.OpenOrdersDGV.RowTemplate.Height = 35 Me.OpenOrdersDGV.Columns(1).HeaderCell.Style.Font = New Font(OpenOrdersDGV.Font, FontStyle.Bold) Me.OpenOrdersDGV.RefreshEdit() 'Scroll to the last row. Me.OpenOrdersDGV.FirstDisplayedScrollingRowIndex = Me.OpenOrdersDGV.RowCount - 1 'Select the last row. Me.OpenOrdersDGV.Rows(Me.OpenOrdersDGV.RowCount - 1).Selected = True If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CreateNewOrder() Try If CustomerCBX.Text = String.Empty Or SocietyCBX.Text = String.Empty Then MessageBox.Show("You must have a customer or a society when you choose product, your business is by default." & vbCrLf & vbCrLf & "To choose a new customer select it from the dropdown list!.", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Return End If SQL.AddParam("@OrderNo", OrderNoTempTB.Text) SQL.AddParam("@CustomerID", CustomerIDTB.Text) SQL.AddParam("@StationID", StationNumberTB.Text) SQL.AddParam("@CashierID", CashierIDTB.Text) SQL.AddParam("@CashierName", CashierNameTB.Text) SQL.AddParam("@InvoiceNumber", InvoiceNumberTB.Text) SQL.AddParam("@CustomerName", CustomerCBX.Text) SQL.AddParam("@SocietyName", SocietyCBX.Text) SQL.AddParam("@Address1", AddressTB.Text) SQL.AddParam("@Address2", Address2TB.Text) SQL.AddParam("@City", CityTB.Text) SQL.AddParam("@StateProvince", StateProvinceTB.Text) SQL.AddParam("@ZipCode", ZipCodeTB.Text) SQL.AddParam("@Country", CountryTB.Text) SQL.AddParam("@Phone", PhoneNumberTB.Text) SQL.AddParam("@Extension", ExtensionTB.Text) SQL.AddParam("@Cell", CellNumberTB.Text) SQL.AddParam("@OrderNote", OrderNoteTB.Text) SQL.AddParam("@CustomerPO", CustomerPOTB.Text) SQL.AddParam("@AttentionOf", AttentionOfTB.Text) SQL.AddParam("@CustomerEmail", CustomerEmailTB.Text) SQL.AddParam("@CustomerNotes", NotesTB.Text) SQL.AddParam("@BackOrderID", BackOrderIDTB.Text) SQL.AddParam("@DeliveryToSociety", SocietyTB.Text) SQL.AddParam("@DeliveryToCustomer", CustomerTB.Text) SQL.AddParam("@DeliveryAddress1", DeliveryAddress1TB.Text) SQL.AddParam("@DeliveryAddress2", DeliveryAddress2TB.Text) SQL.AddParam("@DeliveryCity", DeliveryCityTB.Text) SQL.AddParam("@DeliveryStateProvince", DeliveryStateProvinceTB.Text) SQL.AddParam("@DeliveryZipCode", DeliveryZipCodeTB.Text) SQL.AddParam("@DeliveryCountry", DeliveryCountryTB.Text) SQL.AddParam("@DeliveryDateExpected", DeliveryDateExpectedTB.Text) SQL.AddParam("@DeliveryInstructions", DeliveryInstructionsTB.Text) SQL.AddParam("@DeliveryPhone", DeliveryPhoneNumberTB.Text) SQL.AddParam("@DeliveryCell", DeliveryCellPhoneTB.Text) SQL.AddParam("@CurrentStatus", CurrentStatusTB.Text) SQL.AddParam("@SubTotal", SubTotalTB.Text) SQL.AddParam("@TaxTotal1", TaxTotal1TB.Text) SQL.AddParam("@TaxTotal2", TaxTotal2TB.Text) SQL.AddParam("@TaxTotal3", TaxTotal3TB.Text) SQL.AddParam("@OrderDate", OrderDateTB.Text) SQL.AddParam("@InvoiceDate", InvoiceDateTB.Text) SQL.AddParam("@SellingPrice1CB", SellingPrice1CB.Checked) SQL.AddParam("@SellingPrice2CB", SellingPrice2CB.Checked) SQL.AddParam("@SellingPrice3CB", SellingPrice3CB.Checked) SQL.AddParam("@SellingPrice4CB", SellingPrice4CB.Checked) SQL.AddParam("@SellingPrice5CB", SellingPrice5CB.Checked) SQL.AddParam("@OrderPaid", OrderPaidCB.Checked) SQL.AddParam("@DatePaid", DatePaidTB.Text) SQL.ExecQuery("INSERT INTO Sales.Orders(OrderNo,CustomerID,StationID,CashierID,CashierName,InvoiceNumber, " & "CustomerName,SocietyName,Address1,Address2,City,StateProvince,ZipCode,Country,Phone,Extension,Cell,OrderNote,CustomerPO,AttentionOf,CustomerEmail,CustomerNotes,BackOrderID,DeliveryToCustomer,DeliveryToSociety, " & "DeliveryAddress1,DeliveryAddress2,DeliveryCity,DeliveryStateProvince,DeliveryZipCode,DeliveryCountry,DeliveryDateExpected,DeliveryInstructions,DeliveryPhone,DeliveryCell, " & "CurrentStatus,SubTotal,TaxTotal1,TaxTotal2,TaxTotal3,OrderDate,InvoiceDate,SellingPrice1CB,SellingPrice2CB,SellingPrice3CB,SellingPrice4CB,SellingPrice5CB,OrderPaid,DatePaid) " & "VALUES (@OrderNo,@CustomerID,@StationID,@CashierID,@CashierName,@InvoiceNumber, " & "@CustomerName,@SocietyName,@Address1,@Address2,@City,@StateProvince,@ZipCode,@Country,@Phone,@Extension,@Cell,@OrderNote,@CustomerPO,@AttentionOf,@CustomerEmail,@CustomerNotes,@BackOrderID,@DeliveryToCustomer, " & "@DeliveryToSociety,@DeliveryAddress1,@DeliveryAddress2,@DeliveryCity,@DeliveryStateProvince,@DeliveryZipCode,@DeliveryCountry,@DeliveryDateExpected, " & "@DeliveryInstructions,@DeliveryPhone,@DeliveryCell,@CurrentStatus,@SubTotal,@TaxTotal1,@TaxTotal2,@TaxTotal3,@OrderDate,@InvoiceDate,@SellingPrice1CB,@SellingPrice2CB,@SellingPrice3CB,@SellingPrice4CB,@SellingPrice5CB,@OrderPaid,@DatePaid) ", True) If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Sub LoadNewRecord() Try 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT * FROM Sales.Customers Where DefaultInvoicingCustomer = 1") If SQL.DBDS.Tables(0).Rows.Count = 0 Then MessageBox.Show("You must setup a default customer in the invoicing module, to do so, open the business setup from the administration menu!.") Exit Sub End If If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 Then Me.CustomerIDTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CustomerID") Me.SocietyCBX.Text = SQL.DBDS.Tables(0).Rows(0).Item("Society") Me.CustomerCBX.Text = SQL.DBDS.Tables(0).Rows(0).Item("MailingName") Me.AddressTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Address1") Me.Address2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Address2") Me.CityTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("City") Me.StateProvinceTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("StateProvince") Me.CountryTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Country") Me.ZipCodeTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("ZipCode") Me.PhoneNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("PhoneNumber") Me.ExtensionTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Extension") Me.CellNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CellNumber") Me.SocietyTB.Text = Me.SocietyCBX.Text Me.CustomerTB.Text = Me.CustomerCBX.Text Me.DeliveryAddress1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryAddress1") Me.DeliveryAddress2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryAddress2") Me.DeliveryCityTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryCity") Me.DeliveryStateProvinceTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryStateProvince") Me.DeliveryCountryTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryCountry") Me.DeliveryZipCodeTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryZipCode") Me.AttentionOfTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("MailingName") Me.CustomerEmailTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CustomerEmail") Me.NotesTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Notes") Me.DeliveryInstructionsTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryNotes") Me.DeliveryPhoneNumberTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryPhone") Me.DeliveryCellPhoneTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DeliveryCell") Me.OrderNoteTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("OrderNote") Me.SellingPrice1CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice1CB") Me.SellingPrice2CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice2CB") Me.SellingPrice3CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice3CB") Me.SellingPrice4CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice4CB") Me.SellingPrice5CB.Checked = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice5CB") Else SQL.RunQuery("SELECT * FROM Application.employees Where EmployeeID = Me.CashierID.Text and IsAManager = 1") If SQL.DBDS.Tables(0).Rows(0).Item(0) = 0 Then MessageBox.Show("You don't have the permission to set up a default customer, please ask a manager.", "Set default customer : Auto-Cash Register", MessageBoxButtons.OK, MessageBoxIcon.Information) Exit Sub Else Dim result As New DialogResult MessageBox.Show("No default invoicing customer has been setup." & vbNewLine & "If you are a manager you can set it up by clicking Yes below or ask a manager.", "Set default customer : Auto-Cash Register", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If result = DialogResult.Yes Then Dim FormCorporation As New FrmCorporation FrmCorporation.ShowDialog() End If End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Sub FormatAll() Try Dim NumberExtendedPrice As Double = ExtendedPriceTB.Text Me.ExtendedPriceTB.Text = NumberExtendedPrice.ToString("$###,###,###.00") Dim NumberDiscountRate As Decimal = DiscountRateTB.Text Me.DiscountRateTB.Text = NumberDiscountRate.ToString("###.00000") Dim NumberDiscountAmount As Double = DiscountAmountTB.Text Me.DiscountAmountTB.Text = NumberDiscountAmount.ToString("$###,###,###.00") Dim NumberLineTotal As Double = LineTotalTB.Text Me.LineTotalTB.Text = NumberLineTotal.ToString("$###,###,###.00") OrderLinesDGV.Columns("UnitPrice").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter OrderLinesDGV.Columns("ExtendedPrice").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter OrderLinesDGV.Columns("DiscountRate").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter OrderLinesDGV.Columns("DiscountAmount").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter OrderLinesDGV.Columns("LineTotal").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ProductCBX_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ProductCBX.SelectedIndexChanged Try Me.ProductDateSoldTB.Text = Now() 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If ProductCBX.Text = "- Barcode not found -" Then Exit Sub Else SQL.RunQuery("SELECT * FROM Warehouse.ProductsActivated Where ProductName = '" & ProductCBX.Text & "' ") If SQL.DBDS.Tables(0).Rows.Count = 0 Then MsgBox("There is no record for this query, please try again.") Exit Sub End If CheckIfForceToSelectCustomer() CheckIfForceToSelectSalesperson() UpdateOrderlinesDGVWithProduct() FormatAll() BtnLastAddedRow.PerformClick() End If Exit Sub If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CheckIfForceToSelectCustomer() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT ProductID, ProductName, ForceToSelectCustomer FROM Warehouse.ProductsActivated Where ProductName = '" & ProductCBX.Text & "' And ForceToSelectCustomer = 1") If SQL.DBDS.Tables(0).Rows.Count = 0 Then Exit Sub End If If SQL.DBDS.Tables(0).Rows.Count > 0 Then Dim FormSearchACustomer As New FrmSearchACustomer FormSearchACustomer.ShowDialog() End If If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CheckIfForceToSelectSalesperson() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT ProductID, ProductName, ForceToSelectSalesperson FROM Warehouse.ProductsActivated Where ProductName = '" & ProductCBX.Text & "' And ForceToSelectSalesperson = 1") If SQL.DBDS.Tables(0).Rows.Count = 0 Then Exit Sub End If If SQL.DBDS.Tables(0).Rows.Count > 0 Then Dim FormSalesperson As New FrmSalespersons FormSalesperson.ShowDialog() End If If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnChangeDiscountAmount_Click(sender As Object, e As EventArgs) Try Dim FormACCalculator As New FrmACCalculator FormACCalculator.Show() FormACCalculator.BtnEqual.Text = "CHANGE DISCOUNT AMOUNT" If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Sub LoadOrderRecords() Try SQL.ExecQuery("SELECT * FROM Sales.OrderLinesQuery Where OrderNo = '" & SelectedOrderTB.Text & "' ") OrderLinesDGV.DataSource = SQL.DBDT Me.ProductCBX.Select() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Function RecordsCounted() As DataTable Dim query As String = "SELECT * FROM Sales.OrderLinesQuery WHERE OrderNo = '" & SelectedOrderTB.Text & "'" Dim constr As String = "Data Source=ACSERVER\ACRSERVER;Initial Catalog=ACData;Integrated Security=SSPI;" Using DBCon As New SqlConnection(constr) Using DBCmd As New SqlCommand(query, DBCon) Using DBDA As New SqlDataAdapter(DBCmd) Dim DBDT As New DataTable() DBDA.Fill(DBDT) Me.RecordsCountTB.Text = DBDT.Rows.Count.ToString OrderLinesDGV.DataSource = DBDT OrderLinesDGV.Sort(OrderLinesDGV.Columns(2), ListSortDirection.Ascending) 'FormatPaymentsALL() Return DBDT End Using End Using End Using End Function Private Sub CheckValidDiscountDates() Try Dim QuestionableDate As Date = Me.ProductDateSoldTB.Text If (ValidFromTB.Text <= QuestionableDate) AndAlso (QuestionableDate <= ValidToTB.Text) Then OrderLinesDGV.Rows(Me.OrderLinesDGV.Rows.Count - 1).Selected = True Dim FormValidDiscountFound As New FrmValidDiscountFound FrmValidDiscountFound.ShowDialog() Else Exit Sub 'DiscountNotValid() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub DiscountNotValid() Try 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT * FROM Sales.OrderLinesQuery Where OrderLineID = '" & Me.OrderLineIDTB.Text & "' ") Dim dgv As DataGridView = Me.OrderLinesDGV If Me.OrderLinesDGV.CurrentRow IsNot Nothing Then DiscountRateTB.Text = 0 DiscountAmountTB.Text = 0 FormatAll() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub UpdateOrderlinesDGVWithProduct() Try 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If Me.ProductCBX.Visible = True Then SQL.RunQuery("SELECT * FROM Warehouse.ProductsActivated Where ProductName = '" & ProductCBX.Text & "' ") If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 Then Me.InvoicedQuantityTB.Text = 0 Me.BackOrderYesNoCB.Checked = False Me.BackorderQuantityTB.Text = 0 Me.ExtendedPriceTB.Text = QtyTB.Text * UnitPriceTB.Text Me.SelectedProductID.Text = SQL.DBDS.Tables(0).Rows(0).Item("ProductID") Me.ValidFromTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("ValidFrom") Me.ValidToTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("ValidTo") Me.ProductNameTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("ProductNameOnly") Me.DiscountRateTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DiscountRate") Me.DeliveryDateExpectedTB.Text = Now() Me.SellingPrice1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice1") Me.SellingPrice2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice2") Me.SellingPrice3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice3") Me.SellingPrice4TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice4") Me.SellingPrice5TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice5") Me.TaxRate1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("TaxRate1") Me.TaxRate2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("TaxRate2") Me.TaxRate3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("TaxRate3") SQL.AddParam("@OrderNo", Me.SelectedOrderTB.Text) SQL.AddParam("@ProductID", SQL.DBDS.Tables(0).Rows(0).Item("ProductID")) SQL.AddParam("@ProductName", SQL.DBDS.Tables(0).Rows(0).Item("ProductNameOnly")) SQL.AddParam("@Quantity", QtyTB.Text) If Me.SellingPrice1CB.Checked = True Then SQL.AddParam("@UnitPrice", SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice1")) Me.UnitPriceTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice1") Me.DiscountAmountTB.Text = Math.Round(QtyTB.Text * UnitPriceTB.Text) * DiscountRateTB.Text / 100 Me.LineTotalTB.Text = QtyTB.Text * UnitPriceTB.Text - DiscountAmountTB.Text ElseIf SellingPrice2CB.Checked = True Then SQL.AddParam("@UnitPrice", SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice2")) Me.UnitPriceTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice2") Me.DiscountAmountTB.Text = Math.Round(QtyTB.Text * UnitPriceTB.Text) * DiscountRateTB.Text / 100 Me.LineTotalTB.Text = QtyTB.Text * UnitPriceTB.Text - DiscountAmountTB.Text ElseIf SellingPrice3CB.Checked = True Then SQL.AddParam("@UnitPrice", SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice3")) Me.UnitPriceTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice3") Me.DiscountAmountTB.Text = Math.Round(QtyTB.Text * UnitPriceTB.Text) * DiscountRateTB.Text / 100 Me.LineTotalTB.Text = QtyTB.Text * UnitPriceTB.Text - DiscountAmountTB.Text ElseIf SellingPrice4CB.Checked = True Then SQL.AddParam("@UnitPrice", SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice4")) Me.UnitPriceTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice4") Me.DiscountAmountTB.Text = Math.Round(QtyTB.Text * UnitPriceTB.Text) * DiscountRateTB.Text / 100 Me.LineTotalTB.Text = QtyTB.Text * UnitPriceTB.Text - DiscountAmountTB.Text ElseIf SellingPrice5CB.Checked = True Then SQL.AddParam("@UnitPrice", SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice5")) Me.UnitPriceTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("SellingPrice5") Me.DiscountAmountTB.Text = Math.Round(QtyTB.Text * UnitPriceTB.Text) * DiscountRateTB.Text / 100 Me.LineTotalTB.Text = QtyTB.Text * UnitPriceTB.Text - DiscountAmountTB.Text End If SQL.AddParam("@TaxRate1", Me.TaxRate1TB.Text) SQL.AddParam("@TaxRate2", Me.TaxRate2TB.Text) SQL.AddParam("@TaxRate3", Me.TaxRate3TB.Text) SQL.AddParam("@ExtendedPrice", Me.QtyTB.Text * Me.UnitPriceTB.Text) SQL.AddParam("@DiscountRate", SQL.DBDS.Tables(0).Rows(0).Item("DiscountRate")) SQL.AddParam("@DiscountAmount", Me.DiscountAmountTB.Text) SQL.AddParam("@ValidFrom", Me.ValidFromTB.Text) SQL.AddParam("@ValidTo", Me.ValidToTB.Text) SQL.AddParam("@InvoicedQuantity", Me.InvoicedQuantityTB.Text) SQL.AddParam("@BackOrderYesNo", Me.BackOrderYesNoCB.Checked) SQL.AddParam("@BackorderQuantity", Me.BackorderQuantityTB.Text) SQL.AddParam("@TaxAmount1", (Me.QtyTB.Text * Me.UnitPriceTB.Text - DiscountAmountTB.Text) * TaxRate1TB.Text) SQL.AddParam("@TaxAmount2", (Me.QtyTB.Text * Me.UnitPriceTB.Text - DiscountAmountTB.Text) * TaxRate2TB.Text) SQL.AddParam("@TaxAmount3", (Me.QtyTB.Text * Me.UnitPriceTB.Text - DiscountAmountTB.Text) * TaxRate3TB.Text) SQL.AddParam("@LineTotal", Me.QtyTB.Text * Me.UnitPriceTB.Text - DiscountAmountTB.Text) SQL.AddParam("@DeliveryDate", Me.DeliveryDateExpectedTB.Text) SQL.AddParam("@OrderPaid", 0) SQL.AddParam("@CommissionPaid", 0) SQL.ExecQuery("INSERT INTO Sales.OrderLines(OrderNo,ProductID,ProductName,Quantity,UnitPrice,ExtendedPrice,DiscountRate,DiscountAmount,ValidFrom,ValidTo,InvoicedQuantity,BackOrderYesNo, " & "BackOrderQuantity,LineTotal,DeliveryDate,TaxRate1,TaxRate2,TaxRate3,TaxAmount1,TaxAmount2,TaxAmount3,OrderPaid,CommissionPaid) " & "VALUES (@OrderNo,@ProductID,@ProductName,@Quantity,@UnitPrice,@ExtendedPrice,@DiscountRate,@DiscountAmount,@ValidFrom,@ValidTo,@InvoicedQuantity,@BackOrderYesNo, " & "@BackorderQuantity,@LineTotal,@DeliveryDate,@TaxRate1,@TaxRate2,@TaxRate3,@TaxAmount1,@TaxAmount2,@TaxAmount3,@OrderPaid,@CommissionPaid) ", True) RecordsCounted() Me.QtyTB.Text = 1 If Me.RecordsCountTB.Text >= 1 Then Dim i As Integer i = OrderLinesDGV.CurrentRow.Index Me.OrderLineIDTB.Text = OrderLinesDGV.Item(2, i).Value Me.LastProductIDTB.Text = OrderLinesDGV.Item(3, i).Value End If End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Sub DisplayDatagrid() Try SQL.ExecQuery("SELECT * FROM Sales.OrderLinesQuery WHERE OrderNo like '%" + OrderNoSelectedTB.Text + "%' ORDER BY OrderLineID ASC") OrderLinesDGV.DataSource = SQL.DBDT If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CmdSearch_Click(sender As Object, e As EventArgs) Handles CmdSearch.Click Try Me.ProductCBX.DroppedDown = True If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub OrderLinesDGV_KeyDown(sender As Object, e As KeyEventArgs) Handles OrderLinesDGV.KeyDown Try If e.KeyData = System.Windows.Forms.Keys.Delete Then MessageBox.Show("To delete a row you must use the button in the datagridview!") e.Handled = True End If If e.KeyCode = Keys.Enter Then e.Handled = True e.SuppressKeyPress = True End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub OrderLinesDGV_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles OrderLinesDGV.CellContentClick Try If e.ColumnIndex = 1 Then Dim i As Integer i = OrderLinesDGV.CurrentRow.Index 'i = OrderLinesDGV.NewRowIndex Me.OrderLineIDTB.Text = OrderLinesDGV.Item(2, i).Value Dim FormEditOrderLine As New FrmEditOrderLine() FrmEditOrderLine.OrderLineIDTB.Text = OrderLinesDGV.Item(2, i).Value FrmEditOrderLine.ShowDialog() End If If e.ColumnIndex = 0 Then Dim i As Integer i = OrderLinesDGV.CurrentRow.Index Me.OrderLineIDTB.Text = OrderLinesDGV.Item(2, i).Value If MessageBox.Show("Are you sure you want to delete that row?", "DELETE", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.OK Then SQL.ExecQuery("DELETE FROM Sales.OrderLines Where OrderLineID = '" & OrderLineIDTB.Text & "' ") OrderLinesDGV.Rows.RemoveAt(OrderLinesDGV.SelectedRows(0).Index) DeleteGiftCertificate() RecordsCounted() BtnLastAddedRow.PerformClick() Else MessageBox.Show("The deletion has been aborted!.", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub DeleteGiftCertificate() Try 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If Me.CertificateNumberTB.Text <> "" And Me.LastProductIDTB.Text = "4904" Then SQL.ExecQuery("DELETE FROM Application.GiftCertificates Where CertificateNumber = '" & CertificateNumberTB.Text & "' ") 'Me.CertificateNumberTB.Text = "" End If 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If Me.CertificateNumberTB.Text <> "" And Me.LastProductIDTB.Text = "4904" Then SQL.ExecQuery("DELETE FROM Application.GiftCertificatesMovements Where CertificateNumber = '" & CertificateNumberTB.Text & "' ") Me.CertificateNumberTB.Text = "" End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub OrderLinesDGV_RowsAdded(sender As Object, e As DataGridViewRowsAddedEventArgs) Handles OrderLinesDGV.RowsAdded Try SubTotal() Tax1Total() Tax2Total() Tax3Total() CalculateTotal() UpdateOrdersWithTotals() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub OrderLinesDGV_RowsRemoved(sender As Object, e As DataGridViewRowsRemovedEventArgs) Handles OrderLinesDGV.RowsRemoved Try SubTotal() Tax1Total() Tax2Total() Tax3Total() CalculateTotal() UpdateOrdersWithTotals() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ChangeDeliveryDTP_ValueChanged(sender As Object, e As EventArgs) Handles ChangeDeliveryDTP.ValueChanged Try Me.DeliveryDateExpectedTB.Text = ChangeDeliveryDTP.Value.ToString("M/d/yyyy") If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub RecordsCountTB_TextChanged(sender As Object, e As EventArgs) Handles RecordsCountTB.TextChanged Try If Me.RecordsCountTB.Text <> 0 Then Me.CustomerCBX.Enabled = False Me.CustomerCBX.ForeColor = Color.Red Me.LblCustomerStatus.Text = "Can't change customer when items are selected!" Me.LblCustomerStatus.ForeColor = Color.DarkRed Else Me.CustomerCBX.Enabled = True Me.CustomerCBX.ForeColor = Color.DarkGreen Me.LblCustomerStatus.Text = "This customer can be changed!" Me.LblCustomerStatus.ForeColor = Color.DarkGreen End If If Me.RecordsCountTB.Text = 0 Then Me.SubTotalTB.Text = "0.00" Me.TaxTotal1TB.Text = "0.00" Me.TaxTotal2TB.Text = "0.00" Me.TaxTotal3TB.Text = "0.00" Me.TotalTB.Text = "0.00" CalculateTotal() End If If Me.RecordsCountTB.Text >= 1 Then CalculateTotal() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub OrderNoSelectedTB_TextChanged(sender As Object, e As EventArgs) Handles OrderNoSelectedTB.TextChanged Try If Me.OrderNoSelectedTB.Text.Trim <> "" Then Me.ProductCBX.Enabled = True End If ProductCBX.Select() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub OrderLinesDGV_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles OrderLinesDGV.CellClick Try Dim i As Integer i = OrderLinesDGV.CurrentRow.Index 'Me.OrderLineIDTB.Text = OrderLinesDGV.Item(2, i).Value OrderLineIDTB.Text = Me.OrderLinesDGV.CurrentRow.Cells("OrderLineID").Value.ToString() LastProductIDTB.Text = Me.OrderLinesDGV.CurrentRow.Cells("ProductID").Value.ToString() CertificateNumberTB.Text = Me.OrderLinesDGV.CurrentRow.Cells("CertificateNumber").Value.ToString() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnPayment_Click(sender As Object, e As EventArgs) Handles BtnPayment.Click Try If String.IsNullOrEmpty(SelectedOrderTB.Text.Trim()) Then MessageBox.Show("You must create or select an order to open the payment section!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If Me.FunctionsGB.Visible = False ShowPayments1() Me.OriginalOrderTB.Text = Me.TotalTB.Text Dim NumberOriginalOrder As Double = OriginalOrderTB.Text Me.OriginalOrderTB.Text = NumberOriginalOrder.ToString("###,###,###.00") Me.OthersGB.Visible = True OthersTC.SelectedTab = PaymentsTP Me.BtnPayment.Visible = False Me.BtnClosePayments.Visible = True BtnPayment1.PerformClick() ShowSelectedOrderPayments() CalculateTotalPayments() GetOrderData() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnPreviewCoupon_Click(sender As Object, e As EventArgs) Handles BtnPreviewCoupon.Click Try Me.OthersGB.Visible = True OthersTC.SelectedTab = ReceiptTP If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnPayment1_Click(sender As Object, e As EventArgs) Handles BtnPayment1.Click Try ShowPayments1() Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnPayment2_Click(sender As Object, e As EventArgs) Handles BtnPayment2.Click Try If TotalPaidPayment1TB.Text = 0 Then MessageBox.Show("You must have an amount in payment 1 to use payment 2!.", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub Else ShowPayments2() Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT: " Me.PaymentNumberTB.Text = 2 End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnPayment3_Click(sender As Object, e As EventArgs) Handles BtnPayment3.Click Try If TotalPaidPayment2TB.Text = 0 Then MessageBox.Show("You must have an amount in payment 1 and payment 2 to use payment 3!.", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub Else ShowPayments3() Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT: " Me.PaymentNumberTB.Text = 3 End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnClosePayments_Click(sender As Object, e As EventArgs) Handles BtnClosePayments.Click Try Me.BtnPayment.Visible = True Me.BtnClosePayments.Visible = False Me.OthersGB.Visible = False If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnTips_Click(sender As Object, e As EventArgs) Handles BtnTips.Click Try Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = True Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the tip amount and click on the blue button above" OthersTC.SelectedTab = CalculatorTP LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnCashback_Click(sender As Object, e As EventArgs) Handles BtnCashback.Click Try Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = True Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the cashback amount asked by the customer and click on the blue button above" OthersTC.SelectedTab = CalculatorTP LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub Button_Click(sender As Object, e As EventArgs) Handles Btn9.Click, Btn8.Click, Btn7.Click, Btn6.Click, Btn5.Click, Btn4.Click, Btn3.Click, Btn2.Click, Btn1.Click, Btn0.Click 'Code for button 1 to 9,0,. Try Dim b As Button = sender If LblDisplay.Text = "0" Then LblDisplay.Text = b.Text Else LblDisplay.Text = LblDisplay.Text + b.Text End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ArithmeticFunction(sender As Object, e As EventArgs) Handles BtnMultiply.Click, BtnMinus.Click, BtnDivide.Click, BtnAdd.Click Try Dim ops As Button = sender Firstnum = LblDisplay.Text LblShowCal.Text = LblDisplay.Text LblDisplay.Text = "" op = ops.Text LblShowCal.Text = LblShowCal.Text + " " + op If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnClear_Click(sender As Object, e As EventArgs) Handles BtnClear.Click Try LblDisplay.Text = "0" LblShowCal.Text = "" If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnDot_Click(sender As Object, e As EventArgs) Handles BtnDot.Click Try If InStr(LblDisplay.Text, ".") = 0 Then LblDisplay.Text = LblDisplay.Text + "." End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnEqual_Click(sender As Object, e As EventArgs) Handles BtnEqual.Click Try Secondnum = LblDisplay.Text If op = "+" Then Answer = Firstnum + Secondnum LblDisplay.Text = Answer LblShowCal.Text = "" ElseIf op = "-" Then Answer = Firstnum - Secondnum LblDisplay.Text = Answer LblShowCal.Text = "" ElseIf op = "*" Then Answer = Firstnum * Secondnum LblDisplay.Text = Answer LblShowCal.Text = "" ElseIf op = "/" Then Answer = Firstnum / Secondnum LblDisplay.Text = Answer LblShowCal.Text = "" End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnBack_Click(sender As Object, e As EventArgs) Handles BtnBack.Click Try If LblDisplay.Text > 0 Then LblDisplay.Text = LblDisplay.Text.Remove(LblDisplay.Text.Length - 1, 1) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ShowPayments1() Try CashAmount1TB.Visible = True CashAmount2TB.Visible = False CashAmount3TB.Visible = False DebitAmount1TB.Visible = True DebitAmount2TB.Visible = False DebitAmount3TB.Visible = False VisaAmount1TB.Visible = True VisaAmount2TB.Visible = False VisaAmount3TB.Visible = False MastercardAmount1TB.Visible = True MastercardAmount2TB.Visible = False MastercardAmount3TB.Visible = False AmexAmount1TB.Visible = True AmexAmount2TB.Visible = False AmexAmount3TB.Visible = False DiscoverAmount1TB.Visible = True DiscoverAmount2TB.Visible = False DiscoverAmount3TB.Visible = False DinersClubAmount1TB.Visible = True DinersClubAmount2TB.Visible = False DinersClubAmount3TB.Visible = False CheckAmount1TB.Visible = True CheckAmount2TB.Visible = False CheckAmount3TB.Visible = False OtherPaymentAmount1TB.Visible = True OtherPaymentAmount2TB.Visible = False OtherPaymentAmount3TB.Visible = False GiftCertificateAmount1TB.Visible = True GiftCertificateNumber_1TB.Visible = True GiftCertificateAmount2TB.Visible = False GiftCertificateNumber_2TB.Visible = False GiftCertificateAmount3TB.Visible = False GiftCertificateNumber_3TB.Visible = False ChargeToClientAmount1TB.Visible = True ChargeToClientAmount2TB.Visible = False ChargeToClientAmount3TB.Visible = False If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ShowPayments2() Try CashAmount1TB.Visible = False CashAmount2TB.Visible = True CashAmount3TB.Visible = False DebitAmount1TB.Visible = False DebitAmount2TB.Visible = True DebitAmount3TB.Visible = False VisaAmount1TB.Visible = False VisaAmount2TB.Visible = True VisaAmount3TB.Visible = False MastercardAmount1TB.Visible = False MastercardAmount2TB.Visible = True MastercardAmount3TB.Visible = False AmexAmount1TB.Visible = False AmexAmount2TB.Visible = True AmexAmount3TB.Visible = False DiscoverAmount1TB.Visible = False DiscoverAmount2TB.Visible = True DiscoverAmount3TB.Visible = False DinersClubAmount1TB.Visible = False DinersClubAmount2TB.Visible = True DinersClubAmount3TB.Visible = False CheckAmount1TB.Visible = False CheckAmount2TB.Visible = True CheckAmount3TB.Visible = False OtherPaymentAmount1TB.Visible = False OtherPaymentAmount2TB.Visible = True OtherPaymentAmount3TB.Visible = False GiftCertificateAmount1TB.Visible = False GiftCertificateNumber_1TB.Visible = False GiftCertificateAmount2TB.Visible = True GiftCertificateNumber_2TB.Visible = True GiftCertificateAmount3TB.Visible = False GiftCertificateNumber_3TB.Visible = False ChargeToClientAmount1TB.Visible = False ChargeToClientAmount2TB.Visible = True ChargeToClientAmount3TB.Visible = False If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ShowPayments3() Try CashAmount1TB.Visible = False CashAmount2TB.Visible = False CashAmount3TB.Visible = True DebitAmount1TB.Visible = False DebitAmount2TB.Visible = False DebitAmount3TB.Visible = True VisaAmount1TB.Visible = False VisaAmount2TB.Visible = False VisaAmount3TB.Visible = True MastercardAmount1TB.Visible = False MastercardAmount2TB.Visible = False MastercardAmount3TB.Visible = True AmexAmount1TB.Visible = False AmexAmount2TB.Visible = False AmexAmount3TB.Visible = True DiscoverAmount1TB.Visible = False DiscoverAmount2TB.Visible = False DiscoverAmount3TB.Visible = True DinersClubAmount1TB.Visible = False DinersClubAmount2TB.Visible = False DinersClubAmount3TB.Visible = True CheckAmount1TB.Visible = False CheckAmount2TB.Visible = False CheckAmount3TB.Visible = True OtherPaymentAmount1TB.Visible = False OtherPaymentAmount2TB.Visible = False OtherPaymentAmount3TB.Visible = True GiftCertificateAmount1TB.Visible = False GiftCertificateNumber_1TB.Visible = False GiftCertificateAmount2TB.Visible = False GiftCertificateNumber_2TB.Visible = False GiftCertificateAmount3TB.Visible = True GiftCertificateNumber_3TB.Visible = True ChargeToClientAmount1TB.Visible = False ChargeToClientAmount2TB.Visible = False ChargeToClientAmount3TB.Visible = True If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ShowSelectedOrderPayments() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT * FROM Sales.OrdersQuery WHERE OrderNo = '" & SelectedOrderTB.Text & "'") If SQL.DBDS.Tables(0).Rows.Count = 0 Then MessageBox.Show("There were no open orders found for this cashier, click on the button NEW ORDER when the billing form opens!.") Exit Sub End If If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 Then CashAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CashAmount_1") CashAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CashAmount_2") CashAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CashAmount_3") DebitAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DebitAmount_1") DebitAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DebitAmount_2") DebitAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DebitAmount_3") VisaAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("VisaAmount_1") VisaAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("VisaAmount_2") VisaAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("VisaAmount_3") MastercardAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("MastercardAmount_1") MastercardAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("MastercardAmount_2") MastercardAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("MastercardAmount_3") AmexAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("AmexAmount_1") AmexAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("AmexAmount_2") AmexAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("AmexAmount_3") DiscoverAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DiscoverAmount_1") DiscoverAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DiscoverAmount_2") DiscoverAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DiscoverAmount_3") DinersClubAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DinersClubAmount_1") DinersClubAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DinersClubAmount_2") DinersClubAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DinersClubAmount_3") CheckAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CheckAmount_1") CheckAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CheckAmount_2") CheckAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CheckAmount_3") GiftCertificateAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("GiftCertificateAmount_1") GiftCertificateNumber_1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("GiftCertificateNumber_1") GiftCertificateAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("GiftCertificateAmount_2") GiftCertificateNumber_2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("GiftCertificateNumber_2") GiftCertificateAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("GiftCertificateAmount_3") GiftCertificateNumber_3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("GiftCertificateNumber_3") ChargeToClientAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("ChargeToClientAmount_1") OtherPaymentAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("OtherPaymentAmount_1") OtherPaymentAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("OtherPaymentAmount_2") OtherPaymentAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("OtherPaymentAmount_3") AddTipsAmountTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("AddTipsAmount") CashBackAmountTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CashBackAmount") TotalPaidPayment1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Payment1Total") TotalPaidPayment2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Payment2Total") TotalPaidPayment3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Payment3Total") TotalPaidTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("TotalPaid") BalancePayableTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("BalancePayable") End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CalculateTotalPayments() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT * FROM Sales.OrdersQuery WHERE OrderNo = '" & SelectedOrderTB.Text & "'") If SQL.DBDS.Tables(0).Rows.Count = 0 Then MessageBox.Show("There were no open orders found for this cashier, click on the button NEW ORDER when the billing form opens!.") Exit Sub End If If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 Then TotalPaidPayment1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Payment1Total") TotalPaidPayment2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Payment2Total") TotalPaidPayment3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Payment3Total") TotalPaidTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("TotalPaid") BalancePayableTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("BalancePayable") End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub UpdatePayments() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.AddParam("@OrderNo", OrderNoSelectedTB.Text) SQL.AddParam("@CashAmount_1", CashAmount1TB.Text) SQL.AddParam("@CashAmount_2", CashAmount2TB.Text) SQL.AddParam("@CashAmount_3", CashAmount3TB.Text) SQL.AddParam("@DebitAmount_1", DebitAmount1TB.Text) SQL.AddParam("@DebitAmount_2", DebitAmount2TB.Text) SQL.AddParam("@DebitAmount_3", DebitAmount3TB.Text) SQL.AddParam("@VisaAmount_1", VisaAmount1TB.Text) SQL.AddParam("@VisaAmount_2", VisaAmount2TB.Text) SQL.AddParam("@VisaAmount_3", VisaAmount3TB.Text) SQL.AddParam("@MastercardAmount_1", MastercardAmount1TB.Text) SQL.AddParam("@MastercardAmount_2", MastercardAmount2TB.Text) SQL.AddParam("@MastercardAmount_3", MastercardAmount3TB.Text) SQL.AddParam("@AmexAmount_1", AmexAmount1TB.Text) SQL.AddParam("@AmexAmount_2", AmexAmount2TB.Text) SQL.AddParam("@AmexAmount_3", AmexAmount3TB.Text) SQL.AddParam("@DiscoverAmount_1", DiscoverAmount1TB.Text) SQL.AddParam("@DiscoverAmount_2", DiscoverAmount2TB.Text) SQL.AddParam("@DiscoverAmount_3", DiscoverAmount3TB.Text) SQL.AddParam("@DinersClubAmount_1", DinersClubAmount1TB.Text) SQL.AddParam("@DinersClubAmount_2", DinersClubAmount2TB.Text) SQL.AddParam("@DinersClubAmount_3", DinersClubAmount3TB.Text) SQL.AddParam("@CheckAmount_1", CheckAmount1TB.Text) SQL.AddParam("@CheckAmount_2", CheckAmount2TB.Text) SQL.AddParam("@CheckAmount_3", CheckAmount3TB.Text) SQL.AddParam("@GiftCertificateAmount_1", GiftCertificateAmount1TB.Text) SQL.AddParam("@GiftCertificateAmount_2", GiftCertificateAmount2TB.Text) SQL.AddParam("@GiftCertificateAmount_3", GiftCertificateAmount3TB.Text) SQL.AddParam("@GiftCertificateNumber_1", GiftCertificateNumber_1TB.Text) SQL.AddParam("@GiftCertificateNumber_2", GiftCertificateNumber_2TB.Text) SQL.AddParam("@GiftCertificateNumber_3", GiftCertificateNumber_3TB.Text) SQL.AddParam("@ChargeToClientAmount_1", ChargeToClientAmount1TB.Text) SQL.AddParam("@ChargeToClientAmount_2", ChargeToClientAmount2TB.Text) SQL.AddParam("@ChargeToClientAmount_3", ChargeToClientAmount3TB.Text) SQL.AddParam("@OtherPaymentAmount_1", OtherPaymentAmount1TB.Text) SQL.AddParam("@OtherPaymentAmount_2", OtherPaymentAmount2TB.Text) SQL.AddParam("@OtherPaymentAmount_3", OtherPaymentAmount3TB.Text) SQL.AddParam("@AddTipsAmount", AddTipsAmountTB.Text) SQL.AddParam("@CashBackAmount", CashBackAmountTB.Text) SQL.ExecQuery("UPDATE Sales.Orders " & "Set CashAmount_1=@CashAmount_1,CashAmount_2=@CashAmount_2,CashAmount_3=@CashAmount_3," & "DebitAmount_1=@DebitAmount_1,DebitAmount_2=@DebitAmount_2,DebitAmount_3=@DebitAmount_3,VisaAmount_1=@VisaAmount_1," & "VisaAmount_2=@VisaAmount_2,VisaAmount_3=@VisaAmount_3,MastercardAmount_1=@MastercardAmount_1,MastercardAmount_2=@MastercardAmount_2,MastercardAmount_3=@MastercardAmount_3,AmexAmount_1=@AmexAmount_1," & "AmexAmount_2=@AmexAmount_2,AmexAmount_3=@AmexAmount_3,DiscoverAmount_1=@DiscoverAmount_1,DiscoverAmount_2=@DiscoverAmount_2,DiscoverAmount_3=@DiscoverAmount_3,DinersClubAmount_1=@DinersClubAmount_1," & "DinersClubAmount_2=@DinersClubAmount_2,DinersClubAmount_3=@DinersClubAmount_3,CheckAmount_1=@CheckAmount_1,CheckAmount_2=@CheckAmount_2,CheckAmount_3=@CheckAmount_3," & "GiftCertificateAmount_1=@GiftCertificateAmount_1,GiftCertificateAmount_2=@GiftCertificateAmount_2,GiftCertificateAmount_3=@GiftCertificateAmount_3,GiftCertificateNumber_1=@GiftCertificateNumber_1,GiftCertificateNumber_2=@GiftCertificateNumber_2," & "GiftCertificateNumber_3=@GiftCertificateNumber_3,ChargeToClientAmount_1=@ChargeToClientAmount_1,ChargeToClientAmount_2=@ChargeToClientAmount_2,ChargeToClientAmount_3=@ChargeToClientAmount_3,OtherPaymentAmount_1=@OtherPaymentAmount_1,OtherPaymentAmount_2=@OtherPaymentAmount_2," & "OtherPaymentAmount_3=@OtherPaymentAmount_3,AddTipsAmount=@AddTipsAmount,CashBackAmount=@CashBackAmount Where OrderNo=@OrderNo") If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub UpdateSalespersonID() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.AddParam("@OrderNo", OrderNoSelectedTB.Text) SQL.AddParam("@SalespersonID", SalespersonIDTB.Text) SQL.ExecQuery("UPDATE Sales.Orders " & "Set SalespersonID=@SalespersonID Where OrderNo=@OrderNo") If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub UpdateGiftCertificatesMovements() Try SQL.AddParam("@OrderNo", OrderNoSelectedTB.Text) If GiftCertificateAmount1TB.Text > 0 Then SQL.AddParam("@AmountUsed", GiftCertificateAmount1TB.Text) SQL.AddParam("@CertificateNumber", GiftCertificateNumber_1TB.Text) SQL.ExecQuery("INSERT INTO Application.GiftCertificatesMovements(OrderNo,AmountUsed,CertificateNumber) " & "VALUES (@OrderNo,@AmountUsed,@CertificateNumber) ", True) SQL.Params.Clear() End If SQL.AddParam("@OrderNo", OrderNoSelectedTB.Text) If GiftCertificateAmount2TB.Text > 0 Then SQL.AddParam("@AmountUsed", GiftCertificateAmount2TB.Text) SQL.AddParam("@CertificateNumber", GiftCertificateNumber_2TB.Text) SQL.ExecQuery("INSERT INTO Application.GiftCertificatesMovements(OrderNo,AmountUsed,CertificateNumber) " & "VALUES (@OrderNo,@AmountUsed,@CertificateNumber) ", True) SQL.Params.Clear() End If SQL.AddParam("@OrderNo", OrderNoSelectedTB.Text) If GiftCertificateAmount3TB.Text > 0 Then SQL.AddParam("@AmountUsed", GiftCertificateAmount3TB.Text) SQL.AddParam("@CertificateNumber", GiftCertificateNumber_3TB.Text) SQL.ExecQuery("INSERT INTO Application.GiftCertificatesMovements(OrderNo,AmountUsed,CertificateNumber) " & "VALUES (@OrderNo,@AmountUsed,@CertificateNumber) ", True) SQL.Params.Clear() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub SubTotal() Try Dim a As Double = 0 For Each r As DataGridViewRow In OrderLinesDGV.Rows If True Then a += Convert.ToDecimal(r.Cells("LineTotal").Value) Me.SubTotalTB.Text = a.ToString("n2") End If Next CalculateTotal() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub Tax1Total() Try Dim a As Double = 0 For Each r As DataGridViewRow In OrderLinesDGV.Rows If True Then a += Convert.ToDecimal(r.Cells("TaxAmount1").Value) Me.TaxTotal1TB.Text = a.ToString("n2") End If Next CalculateTotal() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub Tax2Total() Try Dim a As Double = 0 For Each r As DataGridViewRow In OrderLinesDGV.Rows If True Then a += Convert.ToDecimal(r.Cells("TaxAmount2").Value) Me.TaxTotal2TB.Text = a.ToString("n2") End If Next CalculateTotal() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub Tax3Total() Try Dim a As Double = 0 For Each r As DataGridViewRow In OrderLinesDGV.Rows If True Then a += Convert.ToDecimal(r.Cells("TaxAmount3").Value) Me.TaxTotal3TB.Text = a.ToString("n2") End If Next CalculateTotal() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CalculateTotal() Try Dim Num1 As Decimal Dim Num2 As Decimal Dim Num3 As Decimal Dim Num4 As Decimal Dim Num5 As Decimal Dim Num6 As Decimal Dim Num7 As Decimal Dim Num8 As Decimal Decimal.TryParse(SubTotalTB.Text, Num1) Decimal.TryParse(TaxTotal1TB.Text, Num2) Decimal.TryParse(TaxTotal2TB.Text, Num3) Decimal.TryParse(TaxTotal3TB.Text, Num4) Decimal.TryParse(TotalTB.Text, Num5) Decimal.TryParse(BalancePayableTB.Text, Num6) Decimal.TryParse(AddTipsAmountTB.Text, Num7) Decimal.TryParse(CashBackAmountTB.Text, Num8) Me.SubTotalTB.Text = (Num1) Me.TotalTB.Text = (Num1 + Num2 + Num3 + Num4) Me.BalancePayableTB.Text = (Num5 + Num7 + Num8) UpdateOrdersWithTotals() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub UpdateOrdersWithTotals() 'ADD SQL PARAMS & RUN THE COMMAND Try SQL.AddParam("@OrderNo", Me.OrderNoSelectedTB.Text) Dim intNum1 As Decimal Dim intNum2 As Decimal Dim intNum3 As Decimal Dim intNum4 As Decimal Dim intNum5 As Decimal Decimal.TryParse(SubTotalTB.Text, intNum1) Decimal.TryParse(TaxTotal1TB.Text, intNum2) Decimal.TryParse(TaxTotal2TB.Text, intNum3) Decimal.TryParse(TaxTotal3TB.Text, intNum4) Decimal.TryParse(TotalTB.Text, intNum5) SQL.AddParam("@SubTotal", intNum1) SQL.AddParam("@TaxTotal1", intNum2) SQL.AddParam("@TaxTotal2", intNum3) SQL.AddParam("@TaxTotal3", intNum4) SQL.ExecQuery("UPDATE Sales.Orders " & "SET SubTotal=@SubTotal,TaxTotal1=@TaxTotal1,TaxTotal2=@TaxTotal2,TaxTotal3=@TaxTotal3 WHERE OrderNo=@OrderNo;") If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub GetOrderData() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT * FROM Sales.OrdersQuery WHERE OrderNo = '" & SelectedOrderTB.Text & "'") If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 Then Me.CashAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CashAmount_1") Me.CashAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CashAmount_2") Me.CashAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CashAmount_3") Me.DebitAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DebitAmount_1") Me.DebitAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DebitAmount_2") Me.DebitAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DebitAmount_3") Me.VisaAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("VisaAmount_1") Me.VisaAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("VisaAmount_2") Me.VisaAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("VisaAmount_3") Me.MastercardAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("MastercardAmount_1") Me.MastercardAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("MastercardAmount_2") Me.MastercardAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("MastercardAmount_3") Me.AmexAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("AmexAmount_1") Me.AmexAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("AmexAmount_2") Me.AmexAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("AmexAmount_3") Me.DiscoverAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DiscoverAmount_1") Me.DiscoverAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DiscoverAmount_2") Me.DiscoverAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DiscoverAmount_3") Me.DinersClubAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DinersClubAmount_1") Me.DinersClubAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DinersClubAmount_2") Me.DinersClubAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("DinersClubAmount_3") Me.CheckAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CheckAmount_1") Me.CheckAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CheckAmount_2") Me.CheckAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CheckAmount_3") Me.GiftCertificateAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("GiftCertificateAmount_1") Me.GiftCertificateAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("GiftCertificateAmount_2") Me.GiftCertificateAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("GiftCertificateAmount_3") Me.GiftCertificateNumber_1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("GiftCertificateNumber_1") Me.GiftCertificateNumber_2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("GiftCertificateNumber_2") Me.GiftCertificateNumber_3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("GiftCertificateNumber_3") Me.ChargeToClientAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("ChargeToClientAmount_1") Me.OtherPaymentAmount1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("OtherPaymentAmount_1") Me.OtherPaymentAmount2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("OtherPaymentAmount_2") Me.OtherPaymentAmount3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("OtherPaymentAmount_3") Me.AddTipsAmountTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("AddTipsAmount") Me.CashBackAmountTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("CashBackAmount") Me.TotalPaidPayment1TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Payment1Total") Me.TotalPaidPayment2TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Payment2Total") Me.TotalPaidPayment3TB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Payment3Total") Me.TotalPaidTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("TotalPaid") Me.BalancePayableTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("BalancePayable") Else MsgBox("Error no data found for that order number!") End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnPayingCash_Click(sender As Object, e As EventArgs) Handles BtnPayingCash.Click Try 'PAYMENT 1 PAID CASH '==================== If Me.TotalPaidPayment1TB.Text > 0 And Me.CashAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 1, you can't have 2 amounts or types of payments in payment 1, use payment 2 or correct the previous payment 1 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.CashAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then Me.CashAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.CashAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then Me.CashAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.CashAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a cash amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text > 0 And Me.CashAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A cash amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace cash amount?") = vbYes Then Me.BtnAcceptCash.Visible = True Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by cash for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.CashAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A cash amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace cash amount?") = vbYes Then Me.BtnAcceptCash.Visible = True Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by cash for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.CashAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A cash amount has already been entered for payment 1 and the balance payable should not be negative for the type cash unless you give cash to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace cash amount?") = vbYes Then Me.BtnAcceptCash.Visible = True Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by cash for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 2 PAID CASH '==================== If Me.TotalPaidPayment2TB.Text > 0 And Me.CashAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 2, you can't have 2 amounts or types of payments in payment 2, use payment 3 or correct the previous payment 2 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.CashAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then Me.CashAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.CashAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then Me.CashAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.CashAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a cash amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text > 0 And Me.CashAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A cash amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace cash amount?") = vbYes Then Me.BtnAcceptCash.Visible = True Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by cash for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.CashAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A cash amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace cash amount?") = vbYes Then Me.BtnAcceptCash.Visible = True Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by cash for this order in payment 2!" Me.OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.CashAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-An amount in cash has already been entered for payment 2 and the balance payable should not be negative for the type debit unless you credit a debit card to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace debit amount?") = vbYes Then Me.BtnAcceptCash.Visible = True Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by cash for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 3 PAID CASH '==================== If Me.TotalPaidPayment3TB.Text > 0 And Me.CashAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 3, you can't have 2 amounts or types of payments in payment 3." & vbCrLf & "Payment 3 should put the balance payable to zero (0.00) use payment 3 to correct the payment 3 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.CashAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then Me.CashAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.CashAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then Me.CashAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.CashAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter cash amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text > 0 And Me.CashAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-An amount in cash has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace cash amount?") = vbYes Then Me.BtnAcceptCash.Visible = True Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by cash for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.CashAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-An amount in cash has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace cash amount?") = vbYes Then Me.BtnAcceptCash.Visible = True Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by cash for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.CashAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-An amount in cash has already been entered for payment 3 and the balance payable should not be negative for the type cash unless you give cash to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace cash amount?") = vbYes Then Me.BtnAcceptCash.Visible = True Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by cash for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BalancePayableTB_TextChanged(sender As Object, e As EventArgs) Handles BalancePayableTB.TextChanged Try Me.DistBalancePayableTB.Text = Me.BalancePayableTB.Text If Me.BalancePayableTB.Text = 0.00 Then Me.BalancePayableTB.BackColor = Color.Lime Me.BalancePayableTB.ForeColor = Color.Black Else Me.BalancePayableTB.BackColor = Color.White Me.BalancePayableTB.ForeColor = Color.Red End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CashAmount1TB_TextChanged(sender As Object, e As EventArgs) Handles CashAmount1TB.TextChanged Try If Me.CashAmount1TB.Text > 0 Then Me.DistCash1TB.Text = Me.CashAmount1TB.Text Me.DistCash1TB.BackColor = Color.Lime Me.DistLblCash1.Font = New Font(DistLblCash1.Font, FontStyle.Bold) Me.DistCash1TB.Font = New Font(DistCash1TB.Font, FontStyle.Bold) Else Me.DistCash1TB.Text = Me.CashAmount1TB.Text Me.DistCash1TB.BackColor = Color.White Me.DistLblCash1.Font = New Font(DistLblCash1.Font, FontStyle.Regular) Me.DistCash1TB.Font = New Font(DistCash1TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CashAmount2TB_TextChanged(sender As Object, e As EventArgs) Handles CashAmount2TB.TextChanged Try If Me.CashAmount2TB.Text > 0 Then Me.DistCash2TB.Text = Me.CashAmount2TB.Text Me.DistCash2TB.BackColor = Color.Lime Me.DistLblCash2.Font = New Font(DistLblCash2.Font, FontStyle.Bold) Me.DistCash2TB.Font = New Font(DistCash2TB.Font, FontStyle.Bold) Else Me.DistCash2TB.Text = Me.CashAmount2TB.Text Me.DistCash2TB.BackColor = Color.White Me.DistLblCash2.Font = New Font(DistLblCash2.Font, FontStyle.Regular) Me.DistCash2TB.Font = New Font(DistCash2TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CashAmount3TB_TextChanged(sender As Object, e As EventArgs) Handles CashAmount3TB.TextChanged Try If Me.CashAmount3TB.Text > 0 Then Me.CashAmount3TB.BackColor = Color.Lime Me.CashAmount3TB.Font = New Font(CashAmount3TB.Font, FontStyle.Bold) Me.CashAmount3TB.Font = New Font(CashAmount3TB.Font, FontStyle.Bold) Else Me.CashAmount3TB.Text = Me.CashAmount3TB.Text Me.CashAmount3TB.BackColor = Color.White Me.CashAmount3TB.Font = New Font(CashAmount3TB.Font, FontStyle.Regular) Me.CashAmount3TB.Font = New Font(CashAmount3TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnCloseThisControl_Click(sender As Object, e As EventArgs) Handles BtnCloseThisControl.Click Me.OthersGB.Visible = False Me.FunctionsGB.Visible = True Me.BtnClosePayments.Visible = False Me.BtnPayment.Visible = True End Sub Private Sub BtnPayingInterac_Click(sender As Object, e As EventArgs) Handles BtnPayingInterac.Click Try 'PAYMENT 1 DEBIT CARD '==================== If Me.TotalPaidPayment1TB.Text > 0 And Me.DebitAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 1, you can't have 2 amounts or types of payments in payment 1, use payment 2 or correct the previous payment 1 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.DebitAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then Me.DebitAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.DebitAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then Me.DebitAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.DebitAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a debit card amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text > 0 And Me.DebitAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-An amount of a debit card has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace debit amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = True Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount given on a debit card for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.DebitAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-An amount of a debit card has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace debit amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = True Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount given on a debit card for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.DebitAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A debit amount has already been entered for payment 1 and the balance payable should not be negative for the type debit unless you credit a debit card, do you want to replace it?", MsgBoxStyle.YesNo, "Replace debit amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = True Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount given by a debit card for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 2 DEBIT CARD '==================== If Me.TotalPaidPayment2TB.Text > 0 And Me.DebitAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 2, you can't have 2 amounts or types of payments in payment 2, use payment 3 or correct the previous payment 2 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.DebitAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then Me.DebitAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.DebitAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then Me.DebitAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.DebitAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a debit card amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text > 0 And Me.DebitAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A debit amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace debit amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = True Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount given with a debit card for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.DebitAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-An amount in debit has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace debit amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = True Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount given by a debit card for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.DebitAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A debit amount has already been entered for payment 2 and the balance payable should not be negative for the type debit unless you give a debit card refund to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace debit amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = True Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount given with a debit card for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 3 DEBIT CARD '==================== If Me.TotalPaidPayment3TB.Text > 0 And Me.DebitAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 3, you can't have 2 amounts or types of payments in payment 3." & vbCrLf & "Payment 3 should put the balance payable to zero (0.00) use payment 3 to correct the payment 3 amount!", "Auto Debit Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.DebitAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then Me.DebitAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.DebitAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then Me.DebitAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.DebitAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a debit card amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text > 0 And Me.DebitAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-An amount in Debit has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Debit amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = True Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount given in Debit for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.DebitAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-An amount in Debit has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Debit amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = True Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount given in Debit for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.DebitAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-An amount in Debit has already been entered for payment 3 and the balance payable should not be negative for the type Debit unless you give Debit to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Debit amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = True Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount given in Debit for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnPayingDinersClub_Click(sender As Object, e As EventArgs) Handles BtnPayingDinersClub.Click Try 'PAYMENT 1 DinersClub CARD '==================== If Me.TotalPaidPayment1TB.Text > 0 And Me.DinersClubAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 1, you can't have 2 amounts or types of payments in payment 1, use payment 2 or correct the previous payment 1 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.DinersClubAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then Me.DinersClubAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.DinersClubAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then Me.DinersClubAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.DinersClubAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a DinersClub card amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text > 0 And Me.DinersClubAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A DinersClub amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace DinersClub amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = True Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by DinersClub for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.DinersClubAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A DinersClub amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace DinersClub amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = True Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by DinersClub for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.DinersClubAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A DinersClub amount has already been entered for payment 1 and the balance payable should not be negative for the type DinersClub unless you credit a DinersClub card, do you want to replace it?", MsgBoxStyle.YesNo, "Replace DinersClub amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = True Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by DinersClub for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 2 DinersClub CARD '==================== If Me.TotalPaidPayment2TB.Text > 0 And Me.DinersClubAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 2, you can't have 2 amounts or types of payments in payment 2, use payment 3 or correct the previous payment 2 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.DinersClubAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then Me.DinersClubAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.DinersClubAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then Me.DinersClubAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.DinersClubAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a DinersClub amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text > 0 And Me.DinersClubAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A DinersClub amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace DinersClub amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = True Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by DinersClub for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.DinersClubAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A DinersClub amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace DinersClub amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = True Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by DinersClub for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.DinersClubAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A DinersClub amount has already been entered for payment 2 and the balance payable should not be negative for the type DinersClub unless you give a DinersClub card refund to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace DinersClub amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = True Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by DinersClub for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 3 DinersClub CARD '==================== If Me.TotalPaidPayment3TB.Text > 0 And Me.DinersClubAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 3, you can't have 2 amounts or types of payments in payment 3." & vbCrLf & "Payment 3 should put the balance payable to zero (0.00) use payment 3 to correct the payment 3 amount!", "Auto Debit Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.DinersClubAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then Me.DinersClubAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.DinersClubAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then Me.DinersClubAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.DinersClubAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a DinersClub card amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text > 0 And Me.DinersClubAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12aA DinersClub amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace DinersClub amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = True Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by DinersClub for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.DinersClubAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A DinersClub amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace DinersClub amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = True Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by DinersClub for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.DinersClubAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A DinersClub amount has already been entered for payment 3 and the balance payable should not be negative for the type DinersClub unless you give a credit to a DinersClub card to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace DinersClub amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = True Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by DinersClub for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptPayment_Click(sender As Object, e As EventArgs) Handles BtnAcceptPayment.Click Try If Me.BalancePayableTB.Text > 0 Then MessageBox.Show("The balance payable MUST be negative or zero to be accepted, please review your payments or clic on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.BalancePayableTB.Text = 0 Or Me.BalancePayableTB.Text < 0 Then Me.CurrentStatusTB.Text = "PAID" Me.OrderPaidCB.Checked = True End If UpdateGiftCertificatesMovements() OrderPaidInOrderLines() CommissionPaidInOrderLines() OrderPaidInOpenOrders() UpdateOrderPaid() FunctionsGB.Visible = True Me.Close() FrmMainForm.BtnInvoicing.PerformClick() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnResetAll_Click(sender As Object, e As EventArgs) Handles BtnResetAll.Click Try CashAmount1TB.Text = 0 Me.CashAmount1TB.Text = Format(Val(CashAmount1TB.Text), "0.00") CashAmount2TB.Text = 0 Me.CashAmount2TB.Text = Format(Val(CashAmount2TB.Text), "0.00") CashAmount3TB.Text = 0 Me.CashAmount3TB.Text = Format(Val(CashAmount3TB.Text), "0.00") DebitAmount1TB.Text = 0 Me.DebitAmount1TB.Text = Format(Val(DebitAmount1TB.Text), "0.00") DebitAmount2TB.Text = 0 Me.DebitAmount2TB.Text = Format(Val(DebitAmount2TB.Text), "0.00") DebitAmount3TB.Text = 0 Me.DebitAmount3TB.Text = Format(Val(DebitAmount3TB.Text), "0.00") VisaAmount1TB.Text = 0 Me.VisaAmount1TB.Text = Format(Val(VisaAmount1TB.Text), "0.00") VisaAmount2TB.Text = 0 Me.VisaAmount2TB.Text = Format(Val(VisaAmount2TB.Text), "0.00") VisaAmount3TB.Text = 0 Me.VisaAmount3TB.Text = Format(Val(VisaAmount3TB.Text), "0.00") MastercardAmount1TB.Text = 0 Me.MastercardAmount1TB.Text = Format(Val(MastercardAmount1TB.Text), "0.00") MastercardAmount2TB.Text = 0 Me.MastercardAmount2TB.Text = Format(Val(MastercardAmount2TB.Text), "0.00") MastercardAmount3TB.Text = 0 Me.MastercardAmount3TB.Text = Format(Val(MastercardAmount3TB.Text), "0.00") AmexAmount1TB.Text = 0 Me.AmexAmount1TB.Text = Format(Val(AmexAmount1TB.Text), "0.00") AmexAmount2TB.Text = 0 Me.AmexAmount2TB.Text = Format(Val(AmexAmount2TB.Text), "0.00") AmexAmount3TB.Text = 0 Me.AmexAmount3TB.Text = Format(Val(AmexAmount3TB.Text), "0.00") DiscoverAmount1TB.Text = 0 Me.DiscoverAmount1TB.Text = Format(Val(DiscoverAmount1TB.Text), "0.00") DiscoverAmount2TB.Text = 0 Me.DiscoverAmount2TB.Text = Format(Val(DiscoverAmount2TB.Text), "0.00") DiscoverAmount3TB.Text = 0 Me.DiscoverAmount3TB.Text = Format(Val(DiscoverAmount3TB.Text), "0.00") DinersClubAmount1TB.Text = 0 Me.DinersClubAmount1TB.Text = Format(Val(DinersClubAmount1TB.Text), "0.00") DinersClubAmount2TB.Text = 0 Me.DinersClubAmount2TB.Text = Format(Val(DinersClubAmount2TB.Text), "0.00") DinersClubAmount3TB.Text = 0 Me.DinersClubAmount3TB.Text = Format(Val(DinersClubAmount3TB.Text), "0.00") CheckAmount1TB.Text = 0 Me.CheckAmount1TB.Text = Format(Val(CheckAmount1TB.Text), "0.00") CheckAmount2TB.Text = 0 Me.CheckAmount2TB.Text = Format(Val(CheckAmount2TB.Text), "0.00") CheckAmount3TB.Text = 0 Me.CheckAmount3TB.Text = Format(Val(CheckAmount3TB.Text), "0.00") GiftCertificateAmount1TB.Text = 0 Me.GiftCertificateAmount1TB.Text = Format(Val(GiftCertificateAmount1TB.Text), "0.00") GiftCertificateAmount2TB.Text = 0 Me.GiftCertificateAmount2TB.Text = Format(Val(GiftCertificateAmount2TB.Text), "0.00") GiftCertificateAmount3TB.Text = 0 Me.GiftCertificateAmount3TB.Text = Format(Val(GiftCertificateAmount3TB.Text), "0.00") ChargeToClientAmount1TB.Text = 0 Me.ChargeToClientAmount1TB.Text = Format(Val(ChargeToClientAmount1TB.Text), "0.00") ChargeToClientAmount2TB.Text = 0 Me.ChargeToClientAmount2TB.Text = Format(Val(ChargeToClientAmount2TB.Text), "0.00") ChargeToClientAmount3TB.Text = 0 Me.ChargeToClientAmount3TB.Text = Format(Val(ChargeToClientAmount3TB.Text), "0.00") OtherPaymentAmount1TB.Text = 0 Me.OtherPaymentAmount1TB.Text = Format(Val(OtherPaymentAmount1TB.Text), "0.00") OtherPaymentAmount2TB.Text = 0 Me.OtherPaymentAmount2TB.Text = Format(Val(OtherPaymentAmount2TB.Text), "0.00") OtherPaymentAmount3TB.Text = 0 Me.OtherPaymentAmount3TB.Text = Format(Val(OtherPaymentAmount3TB.Text), "0.00") AddTipsAmountTB.Text = 0 Me.AddTipsAmountTB.Text = Format(Val(AddTipsAmountTB.Text), "0.00") CashBackAmountTB.Text = 0 Me.CashBackAmountTB.Text = Format(Val(CashBackAmountTB.Text), "0.00") OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() BtnPayment1.PerformClick() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub DebitAmount1TB_TextChanged(sender As Object, e As EventArgs) Handles DebitAmount1TB.TextChanged Try If Me.DebitAmount1TB.Text > 0 Then Me.DistDebit1TB.Text = Me.DebitAmount1TB.Text Me.DistDebit1TB.BackColor = Color.Lime Me.DistLblDebit1.Font = New Font(DistLblDebit1.Font, FontStyle.Bold) Me.DistDebit1TB.Font = New Font(DistDebit1TB.Font, FontStyle.Bold) Else Me.DistDebit1TB.Text = Me.DebitAmount1TB.Text Me.DistDebit1TB.BackColor = Color.White Me.DistLblDebit1.Font = New Font(DistLblDebit1.Font, FontStyle.Regular) Me.DistDebit1TB.Font = New Font(DistDebit1TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub DebitAmount2TB_TextChanged(sender As Object, e As EventArgs) Handles DebitAmount2TB.TextChanged Try If Me.DebitAmount2TB.Text > 0 Then Me.DistDebit2TB.Text = Me.DebitAmount2TB.Text Me.DistDebit2TB.BackColor = Color.Lime Me.DistLblDebit2.Font = New Font(DistLblDebit2.Font, FontStyle.Bold) Me.DistDebit2TB.Font = New Font(DistDebit2TB.Font, FontStyle.Bold) Else Me.DistDebit2TB.Text = Me.DebitAmount2TB.Text Me.DistDebit2TB.BackColor = Color.White Me.DistLblDebit2.Font = New Font(DistLblDebit2.Font, FontStyle.Regular) Me.DistDebit2TB.Font = New Font(DistDebit2TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub DebitAmount3TB_TextChanged(sender As Object, e As EventArgs) Handles DebitAmount3TB.TextChanged Try If Me.DebitAmount3TB.Text > 0 Then Me.DebitAmount3TB.BackColor = Color.Lime Me.DebitAmount3TB.Font = New Font(DebitAmount3TB.Font, FontStyle.Bold) Me.DebitAmount3TB.Font = New Font(DebitAmount3TB.Font, FontStyle.Bold) Else Me.DebitAmount3TB.Text = Me.DebitAmount3TB.Text Me.DebitAmount3TB.BackColor = Color.White Me.DebitAmount3TB.Font = New Font(DebitAmount3TB.Font, FontStyle.Regular) Me.DebitAmount3TB.Font = New Font(DebitAmount3TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub VisaAmount1TB_TextChanged(sender As Object, e As EventArgs) Handles VisaAmount1TB.TextChanged Try If Me.VisaAmount1TB.Text > 0 Then Me.DistVisa1TB.Text = Me.VisaAmount1TB.Text Me.DistVisa1TB.BackColor = Color.Lime Me.DistLblVisa1.Font = New Font(DistLblVisa1.Font, FontStyle.Bold) Me.DistVisa1TB.Font = New Font(DistVisa1TB.Font, FontStyle.Bold) Else Me.DistVisa1TB.Text = Me.VisaAmount1TB.Text Me.DistVisa1TB.BackColor = Color.White Me.DistLblVisa1.Font = New Font(DistLblVisa1.Font, FontStyle.Regular) Me.DistVisa1TB.Font = New Font(DistVisa1TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub VisaAmount2TB_TextChanged(sender As Object, e As EventArgs) Handles VisaAmount2TB.TextChanged Try If Me.VisaAmount2TB.Text > 0 Then Me.DistVisa2TB.Text = Me.VisaAmount2TB.Text Me.DistVisa2TB.BackColor = Color.Lime Me.DistLblVisa2.Font = New Font(DistLblVisa2.Font, FontStyle.Bold) Me.DistVisa2TB.Font = New Font(DistVisa2TB.Font, FontStyle.Bold) Else Me.DistVisa2TB.Text = Me.VisaAmount2TB.Text Me.DistVisa2TB.BackColor = Color.White Me.DistLblVisa2.Font = New Font(DistLblVisa2.Font, FontStyle.Regular) Me.DistVisa2TB.Font = New Font(DistVisa2TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub VisaAmount3TB_TextChanged(sender As Object, e As EventArgs) Handles VisaAmount3TB.TextChanged Try If Me.VisaAmount3TB.Text > 0 Then Me.VisaAmount3TB.BackColor = Color.Lime Me.VisaAmount3TB.Font = New Font(VisaAmount3TB.Font, FontStyle.Bold) Me.VisaAmount3TB.Font = New Font(VisaAmount3TB.Font, FontStyle.Bold) Else Me.VisaAmount3TB.Text = Me.VisaAmount3TB.Text Me.VisaAmount3TB.BackColor = Color.White Me.VisaAmount3TB.Font = New Font(VisaAmount3TB.Font, FontStyle.Regular) Me.VisaAmount3TB.Font = New Font(VisaAmount3TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub MastercardAmount1TB_TextChanged(sender As Object, e As EventArgs) Handles MastercardAmount1TB.TextChanged Try If Me.MastercardAmount1TB.Text > 0 Then Me.DistMastercard1TB.Text = Me.MastercardAmount1TB.Text Me.DistMastercard1TB.BackColor = Color.Lime Me.DistLblMastercard1.Font = New Font(DistLblMastercard1.Font, FontStyle.Bold) Me.DistMastercard1TB.Font = New Font(DistMastercard1TB.Font, FontStyle.Bold) Else Me.DistMastercard1TB.Text = Me.MastercardAmount1TB.Text Me.DistMastercard1TB.BackColor = Color.White Me.DistLblMastercard1.Font = New Font(DistLblMastercard1.Font, FontStyle.Regular) Me.DistMastercard1TB.Font = New Font(DistMastercard1TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub MastercardAmount2TB_TextChanged(sender As Object, e As EventArgs) Handles MastercardAmount2TB.TextChanged Try If Me.MastercardAmount2TB.Text > 0 Then Me.DistMastercard2TB.Text = Me.MastercardAmount2TB.Text Me.DistMastercard2TB.BackColor = Color.Lime Me.DistLblMastercard2.Font = New Font(DistLblMastercard2.Font, FontStyle.Bold) Me.DistMastercard2TB.Font = New Font(DistMastercard2TB.Font, FontStyle.Bold) Else Me.DistMastercard2TB.Text = Me.MastercardAmount2TB.Text Me.DistMastercard2TB.BackColor = Color.White Me.DistLblMastercard2.Font = New Font(DistLblMastercard2.Font, FontStyle.Regular) Me.DistMastercard2TB.Font = New Font(DistMastercard2TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub MastercardAmount3TB_TextChanged(sender As Object, e As EventArgs) Handles MastercardAmount3TB.TextChanged Try If Me.MastercardAmount3TB.Text > 0 Then Me.MastercardAmount3TB.BackColor = Color.Lime Me.MastercardAmount3TB.Font = New Font(MastercardAmount3TB.Font, FontStyle.Bold) Me.MastercardAmount3TB.Font = New Font(MastercardAmount3TB.Font, FontStyle.Bold) Else Me.MastercardAmount3TB.Text = Me.MastercardAmount3TB.Text Me.MastercardAmount3TB.BackColor = Color.White Me.MastercardAmount3TB.Font = New Font(MastercardAmount3TB.Font, FontStyle.Regular) Me.MastercardAmount3TB.Font = New Font(MastercardAmount3TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub AmexAmount1TB_TextChanged(sender As Object, e As EventArgs) Handles AmexAmount1TB.TextChanged Try If Me.AmexAmount1TB.Text > 0 Then Me.DistAmex1TB.Text = Me.AmexAmount1TB.Text Me.DistAmex1TB.BackColor = Color.Lime Me.DistLblAmex1.Font = New Font(DistLblAmex1.Font, FontStyle.Bold) Me.DistAmex1TB.Font = New Font(DistAmex1TB.Font, FontStyle.Bold) Else Me.DistAmex1TB.Text = Me.AmexAmount1TB.Text Me.DistAmex1TB.BackColor = Color.White Me.DistLblAmex1.Font = New Font(DistLblAmex1.Font, FontStyle.Regular) Me.DistAmex1TB.Font = New Font(DistAmex1TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub AmexAmount2TB_TextChanged(sender As Object, e As EventArgs) Handles AmexAmount2TB.TextChanged Try If Me.AmexAmount2TB.Text > 0 Then Me.DistAmex2TB.Text = Me.AmexAmount2TB.Text Me.DistAmex2TB.BackColor = Color.Lime Me.DistLblAmex2.Font = New Font(DistLblAmex2.Font, FontStyle.Bold) Me.DistAmex2TB.Font = New Font(DistAmex2TB.Font, FontStyle.Bold) Else Me.DistAmex2TB.Text = Me.AmexAmount2TB.Text Me.DistAmex2TB.BackColor = Color.White Me.DistLblAmex2.Font = New Font(DistLblAmex2.Font, FontStyle.Regular) Me.DistAmex2TB.Font = New Font(DistAmex2TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub AmexAmount3TB_TextChanged(sender As Object, e As EventArgs) Handles AmexAmount3TB.TextChanged Try If Me.AmexAmount3TB.Text > 0 Then Me.AmexAmount3TB.BackColor = Color.Lime Me.AmexAmount3TB.Font = New Font(AmexAmount3TB.Font, FontStyle.Bold) Me.AmexAmount3TB.Font = New Font(AmexAmount3TB.Font, FontStyle.Bold) Else Me.AmexAmount3TB.Text = Me.AmexAmount3TB.Text Me.AmexAmount3TB.BackColor = Color.White Me.AmexAmount3TB.Font = New Font(AmexAmount3TB.Font, FontStyle.Regular) Me.AmexAmount3TB.Font = New Font(AmexAmount3TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub DiscoverAmount1TB_TextChanged(sender As Object, e As EventArgs) Handles DiscoverAmount1TB.TextChanged Try If Me.DiscoverAmount1TB.Text > 0 Then Me.DistDiscover1TB.Text = Me.DiscoverAmount1TB.Text Me.DistDiscover1TB.BackColor = Color.Lime Me.DistLblDiscover1.Font = New Font(DistLblDiscover1.Font, FontStyle.Bold) Me.DistDiscover1TB.Font = New Font(DistDiscover1TB.Font, FontStyle.Bold) Else Me.DistDiscover1TB.Text = Me.DiscoverAmount1TB.Text Me.DistDiscover1TB.BackColor = Color.White Me.DistLblDiscover1.Font = New Font(DistLblDiscover1.Font, FontStyle.Regular) Me.DistDiscover1TB.Font = New Font(DistDiscover1TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub DiscoverAmount2TB_TextChanged(sender As Object, e As EventArgs) Handles DiscoverAmount2TB.TextChanged Try If Me.DiscoverAmount2TB.Text > 0 Then Me.DistDiscover2TB.Text = Me.DiscoverAmount2TB.Text Me.DistDiscover2TB.BackColor = Color.Lime Me.DistLblDiscover2.Font = New Font(DistLblDiscover2.Font, FontStyle.Bold) Me.DistDiscover2TB.Font = New Font(DistDiscover2TB.Font, FontStyle.Bold) Else Me.DistDiscover2TB.Text = Me.DiscoverAmount2TB.Text Me.DistDiscover2TB.BackColor = Color.White Me.DistLblDiscover2.Font = New Font(DistLblDiscover2.Font, FontStyle.Regular) Me.DistDiscover2TB.Font = New Font(DistDiscover2TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub DiscoverAmount3TB_TextChanged(sender As Object, e As EventArgs) Handles DiscoverAmount3TB.TextChanged Try If Me.DiscoverAmount3TB.Text > 0 Then Me.DiscoverAmount3TB.BackColor = Color.Lime Me.DiscoverAmount3TB.Font = New Font(DiscoverAmount3TB.Font, FontStyle.Bold) Me.DiscoverAmount3TB.Font = New Font(DiscoverAmount3TB.Font, FontStyle.Bold) Else Me.DiscoverAmount3TB.Text = Me.DiscoverAmount3TB.Text Me.DiscoverAmount3TB.BackColor = Color.White Me.DiscoverAmount3TB.Font = New Font(DiscoverAmount3TB.Font, FontStyle.Regular) Me.DiscoverAmount3TB.Font = New Font(DiscoverAmount3TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub DinersClubAmount1TB_TextChanged(sender As Object, e As EventArgs) Handles DinersClubAmount1TB.TextChanged Try If Me.DinersClubAmount1TB.Text > 0 Then Me.DistDinersClub1TB.Text = Me.DinersClubAmount1TB.Text Me.DistDinersClub1TB.BackColor = Color.Lime Me.DistLblDinersClub1.Font = New Font(DistLblDinersClub1.Font, FontStyle.Bold) Me.DistDinersClub1TB.Font = New Font(DistDinersClub1TB.Font, FontStyle.Bold) Else Me.DistDinersClub1TB.Text = Me.DinersClubAmount1TB.Text Me.DistDinersClub1TB.BackColor = Color.White Me.DistLblDinersClub1.Font = New Font(DistLblDinersClub1.Font, FontStyle.Regular) Me.DistDinersClub1TB.Font = New Font(DistDinersClub1TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub DinersClubAmount2TB_TextChanged(sender As Object, e As EventArgs) Handles DinersClubAmount2TB.TextChanged Try If Me.DinersClubAmount2TB.Text > 0 Then Me.DistDinersClub2TB.Text = Me.DinersClubAmount2TB.Text Me.DistDinersClub2TB.BackColor = Color.Lime Me.DistLblDinersClub2.Font = New Font(DistLblDinersClub2.Font, FontStyle.Bold) Me.DistDinersClub2TB.Font = New Font(DistDinersClub2TB.Font, FontStyle.Bold) Else Me.DistDinersClub2TB.Text = Me.DinersClubAmount2TB.Text Me.DistDinersClub2TB.BackColor = Color.White Me.DistLblDinersClub2.Font = New Font(DistLblDinersClub2.Font, FontStyle.Regular) Me.DistDinersClub2TB.Font = New Font(DistDinersClub2TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub DinersClubAmount3TB_TextChanged(sender As Object, e As EventArgs) Handles DinersClubAmount3TB.TextChanged Try If Me.DinersClubAmount3TB.Text > 0 Then Me.DinersClubAmount3TB.BackColor = Color.Lime Me.DinersClubAmount3TB.Font = New Font(DinersClubAmount3TB.Font, FontStyle.Bold) Me.DinersClubAmount3TB.Font = New Font(DinersClubAmount3TB.Font, FontStyle.Bold) Else Me.DinersClubAmount3TB.Text = Me.DinersClubAmount3TB.Text Me.DinersClubAmount3TB.BackColor = Color.White Me.DinersClubAmount3TB.Font = New Font(DinersClubAmount3TB.Font, FontStyle.Regular) Me.DinersClubAmount3TB.Font = New Font(DinersClubAmount3TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CheckAmount1TB_TextChanged(sender As Object, e As EventArgs) Handles CheckAmount1TB.TextChanged Try If Me.CheckAmount1TB.Text > 0 Then Me.DistCheck1TB.Text = Me.CheckAmount1TB.Text Me.DistCheck1TB.BackColor = Color.Lime Me.DistLblCheck1.Font = New Font(DistLblCheck1.Font, FontStyle.Bold) Me.DistCheck1TB.Font = New Font(DistCheck1TB.Font, FontStyle.Bold) Else Me.DistCheck1TB.Text = Me.CheckAmount1TB.Text Me.DistCheck1TB.BackColor = Color.White Me.DistLblCheck1.Font = New Font(DistLblCheck1.Font, FontStyle.Regular) Me.DistCheck1TB.Font = New Font(DistCheck1TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CheckAmount2TB_TextChanged(sender As Object, e As EventArgs) Handles CheckAmount2TB.TextChanged Try If Me.CheckAmount2TB.Text > 0 Then Me.DistCheck2TB.Text = Me.CheckAmount2TB.Text Me.DistCheck2TB.BackColor = Color.Lime Me.DistLblCheck2.Font = New Font(DistLblCheck2.Font, FontStyle.Bold) Me.DistCheck2TB.Font = New Font(DistCheck2TB.Font, FontStyle.Bold) Else Me.DistCheck2TB.Text = Me.CheckAmount2TB.Text Me.DistCheck2TB.BackColor = Color.White Me.DistLblCheck2.Font = New Font(DistLblCheck2.Font, FontStyle.Regular) Me.DistCheck2TB.Font = New Font(DistCheck2TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CheckAmount3TB_TextChanged(sender As Object, e As EventArgs) Handles CheckAmount3TB.TextChanged Try If Me.CheckAmount3TB.Text > 0 Then Me.CheckAmount3TB.BackColor = Color.Lime Me.CheckAmount3TB.Font = New Font(CheckAmount3TB.Font, FontStyle.Bold) Me.CheckAmount3TB.Font = New Font(CheckAmount3TB.Font, FontStyle.Bold) Else Me.CheckAmount3TB.Text = Me.CheckAmount3TB.Text Me.CheckAmount3TB.BackColor = Color.White Me.CheckAmount3TB.Font = New Font(CheckAmount3TB.Font, FontStyle.Regular) Me.CheckAmount3TB.Font = New Font(CheckAmount3TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub GiftCertificateAmount1TB_TextChanged(sender As Object, e As EventArgs) Handles GiftCertificateAmount1TB.TextChanged Try If Me.GiftCertificateAmount1TB.Text > 0 Then Me.DistGiftCert1TB.Text = Me.GiftCertificateAmount1TB.Text Me.DistGiftCert1TB.BackColor = Color.Lime Me.DistLblGiftCert1.Font = New Font(DistLblGiftCert1.Font, FontStyle.Bold) Me.DistGiftCert1TB.Font = New Font(DistGiftCert1TB.Font, FontStyle.Bold) Else Me.DistGiftCert1TB.Text = Me.GiftCertificateAmount1TB.Text Me.DistGiftCert1TB.BackColor = Color.White Me.DistLblGiftCert1.Font = New Font(DistLblGiftCert1.Font, FontStyle.Regular) Me.DistGiftCert1TB.Font = New Font(DistGiftCert1TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub GiftCertificateAmount2TB_TextChanged(sender As Object, e As EventArgs) Handles GiftCertificateAmount2TB.TextChanged Try If Me.GiftCertificateAmount2TB.Text > 0 Then Me.DistGiftCert2TB.Text = Me.GiftCertificateAmount2TB.Text Me.DistGiftCert2TB.BackColor = Color.Lime Me.DistLblGiftCert2.Font = New Font(DistLblGiftCert2.Font, FontStyle.Bold) Me.DistGiftCert2TB.Font = New Font(DistGiftCert2TB.Font, FontStyle.Bold) Else Me.DistGiftCert2TB.Text = Me.GiftCertificateAmount2TB.Text Me.DistGiftCert2TB.BackColor = Color.White Me.DistLblGiftCert2.Font = New Font(DistLblGiftCert2.Font, FontStyle.Regular) Me.DistGiftCert2TB.Font = New Font(DistGiftCert2TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub GiftCertificateAmount3TB_TextChanged(sender As Object, e As EventArgs) Handles GiftCertificateAmount3TB.TextChanged Try If Me.GiftCertificateAmount3TB.Text > 0 Then Me.GiftCertificateAmount3TB.BackColor = Color.Lime Me.GiftCertificateAmount3TB.Font = New Font(GiftCertificateAmount3TB.Font, FontStyle.Bold) Me.GiftCertificateAmount3TB.Font = New Font(GiftCertificateAmount3TB.Font, FontStyle.Bold) Else Me.GiftCertificateAmount3TB.Text = Me.GiftCertificateAmount3TB.Text Me.GiftCertificateAmount3TB.BackColor = Color.White Me.GiftCertificateAmount3TB.Font = New Font(GiftCertificateAmount3TB.Font, FontStyle.Regular) Me.GiftCertificateAmount3TB.Font = New Font(GiftCertificateAmount3TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ChargeToClientAmount1TB_TextChanged(sender As Object, e As EventArgs) Handles ChargeToClientAmount1TB.TextChanged Try If Me.ChargeToClientAmount1TB.Text > 0 Then Me.DistCharge1TB.Text = Me.ChargeToClientAmount1TB.Text Me.DistCharge1TB.BackColor = Color.Lime Me.DistLblCharge1.Font = New Font(DistLblCharge1.Font, FontStyle.Bold) Me.DistCharge1TB.Font = New Font(DistCharge1TB.Font, FontStyle.Bold) Else Me.DistCharge1TB.Text = Me.ChargeToClientAmount1TB.Text Me.DistCharge1TB.BackColor = Color.White Me.DistLblCharge1.Font = New Font(DistLblCharge1.Font, FontStyle.Regular) Me.DistCharge1TB.Font = New Font(DistCharge1TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ChargeToClientAmount2TB_TextChanged(sender As Object, e As EventArgs) Handles ChargeToClientAmount2TB.TextChanged Try If Me.ChargeToClientAmount2TB.Text > 0 Then Me.DistCharge2TB.Text = Me.ChargeToClientAmount2TB.Text Me.DistCharge2TB.BackColor = Color.Lime Me.DistLblCharge2.Font = New Font(DistLblCharge2.Font, FontStyle.Bold) Me.DistCharge2TB.Font = New Font(DistCharge2TB.Font, FontStyle.Bold) Else Me.DistCharge2TB.Text = Me.ChargeToClientAmount2TB.Text Me.DistCharge2TB.BackColor = Color.White Me.DistLblCharge2.Font = New Font(DistLblCharge2.Font, FontStyle.Regular) Me.DistCharge2TB.Font = New Font(DistCharge2TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ChargeToClientAmount3TB_TextChanged(sender As Object, e As EventArgs) Handles ChargeToClientAmount3TB.TextChanged Try If Me.ChargeToClientAmount3TB.Text > 0 Then Me.ChargeToClientAmount3TB.BackColor = Color.Lime Me.ChargeToClientAmount3TB.Font = New Font(ChargeToClientAmount3TB.Font, FontStyle.Bold) Me.ChargeToClientAmount3TB.Font = New Font(ChargeToClientAmount3TB.Font, FontStyle.Bold) Else Me.ChargeToClientAmount3TB.Text = Me.ChargeToClientAmount3TB.Text Me.ChargeToClientAmount3TB.BackColor = Color.White Me.ChargeToClientAmount3TB.Font = New Font(ChargeToClientAmount3TB.Font, FontStyle.Regular) Me.ChargeToClientAmount3TB.Font = New Font(ChargeToClientAmount3TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub OtherPaymentAmount1TB_TextChanged(sender As Object, e As EventArgs) Handles OtherPaymentAmount1TB.TextChanged Try If Me.OtherPaymentAmount1TB.Text > 0 Then Me.DistOther1TB.Text = Me.OtherPaymentAmount1TB.Text Me.DistOther1TB.BackColor = Color.Lime Me.DistLblOther1.Font = New Font(DistLblOther1.Font, FontStyle.Bold) Me.DistOther1TB.Font = New Font(DistOther1TB.Font, FontStyle.Bold) Else Me.DistOther1TB.Text = Me.OtherPaymentAmount1TB.Text Me.DistOther1TB.BackColor = Color.White Me.DistLblOther1.Font = New Font(DistLblOther1.Font, FontStyle.Regular) Me.DistOther1TB.Font = New Font(DistOther1TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub OtherPaymentAmount2TB_TextChanged(sender As Object, e As EventArgs) Handles OtherPaymentAmount2TB.TextChanged Try If Me.OtherPaymentAmount2TB.Text > 0 Then Me.DistOther2TB.Text = Me.OtherPaymentAmount2TB.Text Me.DistOther2TB.BackColor = Color.Lime Me.DistLblOther2.Font = New Font(DistLblOther2.Font, FontStyle.Bold) Me.DistOther2TB.Font = New Font(DistOther2TB.Font, FontStyle.Bold) Else Me.DistOther2TB.Text = Me.OtherPaymentAmount2TB.Text Me.DistOther2TB.BackColor = Color.White Me.DistLblOther2.Font = New Font(DistLblOther2.Font, FontStyle.Regular) Me.DistOther2TB.Font = New Font(DistOther2TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub OtherPaymentAmount3TB_TextChanged(sender As Object, e As EventArgs) Handles OtherPaymentAmount3TB.TextChanged Try If Me.OtherPaymentAmount3TB.Text > 0 Then Me.OtherPaymentAmount3TB.BackColor = Color.Lime Me.OtherPaymentAmount3TB.Font = New Font(OtherPaymentAmount3TB.Font, FontStyle.Bold) Me.OtherPaymentAmount3TB.Font = New Font(OtherPaymentAmount3TB.Font, FontStyle.Bold) Else Me.OtherPaymentAmount3TB.Text = Me.OtherPaymentAmount3TB.Text Me.OtherPaymentAmount3TB.BackColor = Color.White Me.OtherPaymentAmount3TB.Font = New Font(OtherPaymentAmount3TB.Font, FontStyle.Regular) Me.OtherPaymentAmount3TB.Font = New Font(OtherPaymentAmount3TB.Font, FontStyle.Regular) End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnPayingVISA_Click(sender As Object, e As EventArgs) Handles BtnPayingVISA.Click Try 'PAYMENT 1 VISA CARD '==================== If Me.TotalPaidPayment1TB.Text > 0 And Me.VisaAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 1, you can't have 2 amounts or types of payments in payment 1, use payment 2 or correct the previous payment 1 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.VisaAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then Me.VisaAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.VisaAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then Me.VisaAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.VisaAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a visa card amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text > 0 And Me.VisaAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A visa amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace visa amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = True Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by visa for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.VisaAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A visa amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace visa amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = True Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by visa for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.VisaAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A visa amount has already been entered for payment 1 and the balance payable should not be negative for the type visa unless you credit a visa card, do you want to replace it?", MsgBoxStyle.YesNo, "Replace visa amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = True Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by visa for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 2 VISA CARD '==================== If Me.TotalPaidPayment2TB.Text > 0 And Me.VisaAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 2, you can't have 2 amounts or types of payments in payment 2, use payment 3 or correct the previous payment 2 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.VisaAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then Me.VisaAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.VisaAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then Me.VisaAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.VisaAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a visa amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text > 0 And Me.VisaAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A visa amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace visa amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = True Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by visa for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.VisaAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A visa amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace visa amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = True Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by visa for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.VisaAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A visa amount has already been entered for payment 2 and the balance payable should not be negative for the type visa unless you give a visa card refund to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace visa amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = True Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by visa for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 3 VISA CARD '==================== If Me.TotalPaidPayment3TB.Text > 0 And Me.VisaAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 3, you can't have 2 amounts or types of payments in payment 3." & vbCrLf & "Payment 3 should put the balance payable to zero (0.00) use payment 3 to correct the payment 3 amount!", "Auto Debit Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.VisaAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then Me.VisaAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.VisaAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then Me.VisaAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.VisaAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a visa card amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text > 0 And Me.VisaAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12aA visa amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace visa amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = True Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by visa for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.VisaAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A visa amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace visa amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = True Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by visa for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.VisaAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A visa amount has already been entered for payment 3 and the balance payable should not be negative for the type visa unless you give a credit to a visa card to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace visa amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = True Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by visa for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptCash_Click(sender As Object, e As EventArgs) Handles BtnAcceptCash.Click Try Dim intNum1 As Decimal Decimal.TryParse(LblDisplay.Text, intNum1) If Me.PaymentNumberTB.Text = 1 Then Me.CashAmount1TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 2 Then Me.CashAmount2TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 3 Then Me.CashAmount3TB.Text = Format(Val(LblDisplay.Text), "0.00") End If OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() If Me.PaymentNumberTB.Text = 1 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text = 0 Then BtnPayment2.PerformClick() End If If Me.PaymentNumberTB.Text = 2 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text > 0 And TotalPaidPayment3TB.Text = 0 Then BtnPayment3.PerformClick() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptDebit_Click(sender As Object, e As EventArgs) Handles BtnAcceptDebit.Click Try Dim intNum1 As Decimal Decimal.TryParse(LblDisplay.Text, intNum1) If Me.PaymentNumberTB.Text = 1 Then Me.DebitAmount1TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 2 Then Me.DebitAmount2TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 3 Then Me.DebitAmount3TB.Text = Format(Val(LblDisplay.Text), "0.00") End If OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() If Me.PaymentNumberTB.Text = 1 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text = 0 Then BtnPayment2.PerformClick() End If If Me.PaymentNumberTB.Text = 2 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text > 0 And TotalPaidPayment3TB.Text = 0 Then BtnPayment3.PerformClick() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptVisa_Click(sender As Object, e As EventArgs) Handles BtnAcceptVisa.Click Try Dim intNum1 As Decimal Decimal.TryParse(LblDisplay.Text, intNum1) If Me.PaymentNumberTB.Text = 1 Then Me.VisaAmount1TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 2 Then Me.VisaAmount2TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 3 Then Me.VisaAmount3TB.Text = Format(Val(LblDisplay.Text), "0.00") End If OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() If Me.PaymentNumberTB.Text = 1 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text = 0 Then BtnPayment2.PerformClick() End If If Me.PaymentNumberTB.Text = 2 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text > 0 And TotalPaidPayment3TB.Text = 0 Then BtnPayment3.PerformClick() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptMastercard_Click(sender As Object, e As EventArgs) Handles BtnAcceptMastercard.Click Try Dim intNum1 As Decimal Decimal.TryParse(LblDisplay.Text, intNum1) If Me.PaymentNumberTB.Text = 1 Then Me.MastercardAmount1TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 2 Then Me.MastercardAmount2TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 3 Then Me.MastercardAmount3TB.Text = Format(Val(LblDisplay.Text), "0.00") End If OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() If Me.PaymentNumberTB.Text = 1 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text = 0 Then BtnPayment2.PerformClick() End If If Me.PaymentNumberTB.Text = 2 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text > 0 And TotalPaidPayment3TB.Text = 0 Then BtnPayment3.PerformClick() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoMastercardRegister\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptAmex_Click(sender As Object, e As EventArgs) Handles BtnAcceptAmex.Click Try Dim intNum1 As Decimal Decimal.TryParse(LblDisplay.Text, intNum1) If Me.PaymentNumberTB.Text = 1 Then Me.AmexAmount1TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 2 Then Me.AmexAmount2TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 3 Then Me.AmexAmount3TB.Text = Format(Val(LblDisplay.Text), "0.00") End If OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() If Me.PaymentNumberTB.Text = 1 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text = 0 Then BtnPayment2.PerformClick() End If If Me.PaymentNumberTB.Text = 2 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text > 0 And TotalPaidPayment3TB.Text = 0 Then BtnPayment3.PerformClick() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoAmexRegister\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptDiscover_Click(sender As Object, e As EventArgs) Handles BtnAcceptDiscover.Click Try Dim intNum1 As Decimal Decimal.TryParse(LblDisplay.Text, intNum1) If Me.PaymentNumberTB.Text = 1 Then Me.DiscoverAmount1TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 2 Then Me.DiscoverAmount2TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 3 Then Me.DiscoverAmount3TB.Text = Format(Val(LblDisplay.Text), "0.00") End If OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() If Me.PaymentNumberTB.Text = 1 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text = 0 Then BtnPayment2.PerformClick() End If If Me.PaymentNumberTB.Text = 2 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text > 0 And TotalPaidPayment3TB.Text = 0 Then BtnPayment3.PerformClick() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoDinersClubRegister\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptDinersClub_Click(sender As Object, e As EventArgs) Handles BtnAcceptDinersClub.Click Try Dim intNum1 As Decimal Decimal.TryParse(LblDisplay.Text, intNum1) If Me.PaymentNumberTB.Text = 1 Then Me.DinersClubAmount1TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 2 Then Me.DinersClubAmount2TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 3 Then Me.DinersClubAmount3TB.Text = Format(Val(LblDisplay.Text), "0.00") End If OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() If Me.PaymentNumberTB.Text = 1 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text = 0 Then BtnPayment2.PerformClick() End If If Me.PaymentNumberTB.Text = 2 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text > 0 And TotalPaidPayment3TB.Text = 0 Then BtnPayment3.PerformClick() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoDinersClubRegister\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptCheck_Click(sender As Object, e As EventArgs) Handles BtnAcceptCheck.Click Try Dim intNum1 As Decimal Decimal.TryParse(LblDisplay.Text, intNum1) If Me.PaymentNumberTB.Text = 1 Then Me.CheckAmount1TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 2 Then Me.CheckAmount2TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 3 Then Me.CheckAmount3TB.Text = Format(Val(LblDisplay.Text), "0.00") End If OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() If Me.PaymentNumberTB.Text = 1 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text = 0 Then BtnPayment2.PerformClick() End If If Me.PaymentNumberTB.Text = 2 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text > 0 And TotalPaidPayment3TB.Text = 0 Then BtnPayment3.PerformClick() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCheckRegister\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptGiftCertificate_Click(sender As Object, e As EventArgs) Handles BtnAcceptGiftCertificate.Click Try Dim intNum1 As Decimal Decimal.TryParse(LblDisplay.Text, intNum1) If Me.PaymentNumberTB.Text = 1 Then Me.GiftCertificateAmount1TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 2 Then Me.GiftCertificateAmount2TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 3 Then Me.GiftCertificateAmount3TB.Text = Format(Val(LblDisplay.Text), "0.00") End If OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() If Me.PaymentNumberTB.Text = 1 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text = 0 Then BtnPayment2.PerformClick() End If If Me.PaymentNumberTB.Text = 2 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text > 0 And TotalPaidPayment3TB.Text = 0 Then BtnPayment3.PerformClick() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptCharge_Click(sender As Object, e As EventArgs) Handles BtnAcceptCharge.Click Try Dim intNum1 As Decimal Decimal.TryParse(LblDisplay.Text, intNum1) If Me.PaymentNumberTB.Text = 1 Then Me.ChargeToClientAmount1TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 2 Then Me.ChargeToClientAmount2TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 3 Then Me.ChargeToClientAmount3TB.Text = Format(Val(LblDisplay.Text), "0.00") End If OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() If Me.PaymentNumberTB.Text = 1 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text = 0 Then BtnPayment2.PerformClick() End If If Me.PaymentNumberTB.Text = 2 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text > 0 And TotalPaidPayment3TB.Text = 0 Then BtnPayment3.PerformClick() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptOtherPayment_Click(sender As Object, e As EventArgs) Handles BtnAcceptOtherPayment.Click Try Dim intNum1 As Decimal Decimal.TryParse(LblDisplay.Text, intNum1) If Me.PaymentNumberTB.Text = 1 Then Me.OtherPaymentAmount1TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 2 Then Me.OtherPaymentAmount2TB.Text = Format(Val(LblDisplay.Text), "0.00") ElseIf Me.PaymentNumberTB.Text = 3 Then Me.OtherPaymentAmount3TB.Text = Format(Val(LblDisplay.Text), "0.00") End If OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() If Me.PaymentNumberTB.Text = 1 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text = 0 Then BtnPayment2.PerformClick() End If If Me.PaymentNumberTB.Text = 2 And TotalPaidPayment1TB.Text > 0 And TotalPaidPayment2TB.Text > 0 And TotalPaidPayment3TB.Text = 0 Then BtnPayment3.PerformClick() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptTip_Click(sender As Object, e As EventArgs) Handles BtnAcceptTip.Click Try Dim intNum1 As Decimal Decimal.TryParse(LblDisplay.Text, intNum1) AddTipsAmountTB.Text = Format(Val(LblDisplay.Text), "0.00") OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAcceptCashBack_Click(sender As Object, e As EventArgs) Handles BtnAcceptCashBack.Click Try Dim intNum1 As Decimal Decimal.TryParse(LblDisplay.Text, intNum1) CashBackAmountTB.Text = Format(Val(LblDisplay.Text), "0.00") OthersTC.SelectedTab = PaymentsTP OthersTC.Refresh() UpdatePayments() CalculateTotalPayments() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnPayingMastercard_Click(sender As Object, e As EventArgs) Handles BtnPayingMastercard.Click Try 'PAYMENT 1 Mastercard CARD '==================== If Me.TotalPaidPayment1TB.Text > 0 And Me.MastercardAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 1, you can't have 2 amounts or types of payments in payment 1, use payment 2 or correct the previous payment 1 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.MastercardAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then Me.MastercardAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.MastercardAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then Me.MastercardAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.MastercardAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a Mastercard card amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text > 0 And Me.MastercardAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A Mastercard amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Mastercard amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = True Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Mastercard for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.MastercardAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A Mastercard amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Mastercard amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = True Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Mastercard for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.MastercardAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A Mastercard amount has already been entered for payment 1 and the balance payable should not be negative for the type Mastercard unless you credit a Mastercard card, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Mastercard amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = True Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Mastercard for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 2 Mastercard CARD '==================== If Me.TotalPaidPayment2TB.Text > 0 And Me.MastercardAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 2, you can't have 2 amounts or types of payments in payment 2, use payment 3 or correct the previous payment 2 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.MastercardAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then Me.MastercardAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.MastercardAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then Me.MastercardAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.MastercardAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a Mastercard amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text > 0 And Me.MastercardAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A Mastercard amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Mastercard amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = True Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Mastercard for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.MastercardAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A Mastercard amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Mastercard amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = True Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Mastercard for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.MastercardAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A Mastercard amount has already been entered for payment 2 and the balance payable should not be negative for the type Mastercard unless you give a Mastercard card refund to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Mastercard amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = True Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Mastercard for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 3 Mastercard CARD '==================== If Me.TotalPaidPayment3TB.Text > 0 And Me.MastercardAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 3, you can't have 2 amounts or types of payments in payment 3." & vbCrLf & "Payment 3 should put the balance payable to zero (0.00) use payment 3 to correct the payment 3 amount!", "Auto Debit Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.MastercardAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then Me.MastercardAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.MastercardAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then Me.MastercardAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.MastercardAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a Mastercard card amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text > 0 And Me.MastercardAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12aA Mastercard amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Mastercard amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = True Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Mastercard for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.MastercardAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A Mastercard amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Mastercard amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = True Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Mastercard for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.MastercardAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A Mastercard amount has already been entered for payment 3 and the balance payable should not be negative for the type Mastercard unless you give a credit to a Mastercard card to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Mastercard amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = True Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Mastercard for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnPayingAmex_Click(sender As Object, e As EventArgs) Handles BtnPayingAMEX.Click Try 'PAYMENT 1 Amex CARD '==================== If Me.TotalPaidPayment1TB.Text > 0 And Me.AmexAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 1, you can't have 2 amounts or types of payments in payment 1, use payment 2 or correct the previous payment 1 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.AmexAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then Me.AmexAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.AmexAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then Me.AmexAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.AmexAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a Amex card amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text > 0 And Me.AmexAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A Amex amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Amex amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = True Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Amex for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.AmexAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A Amex amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Amex amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = True Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Amex for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.AmexAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A Amex amount has already been entered for payment 1 and the balance payable should not be negative for the type Amex unless you credit a Amex card, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Amex amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = True Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Amex for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 2 Amex CARD '==================== If Me.TotalPaidPayment2TB.Text > 0 And Me.AmexAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 2, you can't have 2 amounts or types of payments in payment 2, use payment 3 or correct the previous payment 2 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.AmexAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then Me.AmexAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.AmexAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then Me.AmexAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.AmexAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a Amex amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text > 0 And Me.AmexAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A Amex amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Amex amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = True Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Amex for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.AmexAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A Amex amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Amex amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = True Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Amex for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.AmexAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A Amex amount has already been entered for payment 2 and the balance payable should not be negative for the type Amex unless you give a Amex card refund to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Amex amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = True Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Amex for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 3 Amex CARD '==================== If Me.TotalPaidPayment3TB.Text > 0 And Me.AmexAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 3, you can't have 2 amounts or types of payments in payment 3." & vbCrLf & "Payment 3 should put the balance payable to zero (0.00) use payment 3 to correct the payment 3 amount!", "Auto Debit Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.AmexAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then Me.AmexAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.AmexAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then Me.AmexAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.AmexAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a Amex card amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text > 0 And Me.AmexAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12aA Amex amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Amex amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = True Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Amex for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.AmexAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A Amex amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Amex amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = True Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Amex for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.AmexAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A Amex amount has already been entered for payment 3 and the balance payable should not be negative for the type Amex unless you give a credit to a Amex card to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Amex amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = True Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Amex for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnOtherPayment_Click(sender As Object, e As EventArgs) Handles BtnOtherPayment.Click Try 'PAYMENT 1 OtherPayment '==================== If Me.TotalPaidPayment1TB.Text > 0 And Me.OtherPaymentAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 1, you can't have 2 amounts or types of payments in payment 1, use payment 2 or correct the previous payment 1 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.OtherPaymentAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then Me.OtherPaymentAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.OtherPaymentAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then Me.OtherPaymentAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.OtherPaymentAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a OtherPayment amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text > 0 And Me.OtherPaymentAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A OtherPayment amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace OtherPayment amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = True Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by OtherPayment for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.OtherPaymentAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A OtherPayment amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace OtherPayment amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = True Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by OtherPayment for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.OtherPaymentAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A OtherPayment amount has already been entered for payment 1 and the balance payable should not be negative for the type OtherPayment unless you credit a OtherPayment, do you want to replace it?", MsgBoxStyle.YesNo, "Replace OtherPayment amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = True Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by OtherPayment for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 2 OtherPayment '==================== If Me.TotalPaidPayment2TB.Text > 0 And Me.OtherPaymentAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 2, you can't have 2 amounts or types of payments in payment 2, use payment 3 or correct the previous payment 2 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.OtherPaymentAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then Me.OtherPaymentAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.OtherPaymentAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then Me.OtherPaymentAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.OtherPaymentAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a OtherPayment amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text > 0 And Me.OtherPaymentAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A OtherPayment amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace OtherPayment amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = True Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by OtherPayment for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.OtherPaymentAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A OtherPayment amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace OtherPayment amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = True Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by OtherPayment for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.OtherPaymentAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A OtherPayment amount has already been entered for payment 2 and the balance payable should not be negative for the type OtherPayment unless you give a OtherPayment refund to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace OtherPayment amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = True Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by OtherPayment for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 3 OtherPayment '==================== If Me.TotalPaidPayment3TB.Text > 0 And Me.OtherPaymentAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 3, you can't have 2 amounts or types of payments in payment 3." & vbCrLf & "Payment 3 should put the balance payable to zero (0.00) use payment 3 to correct the payment 3 amount!", "Auto Debit Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.OtherPaymentAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then Me.OtherPaymentAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.OtherPaymentAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then Me.OtherPaymentAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.OtherPaymentAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a OtherPayment amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text > 0 And Me.OtherPaymentAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12aA OtherPayment amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace OtherPayment amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = True Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by OtherPayment for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.OtherPaymentAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A OtherPayment amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace OtherPayment amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = True Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by OtherPayment for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.OtherPaymentAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A OtherPayment amount has already been entered for payment 3 and the balance payable should not be negative for the type OtherPayment unless you give a credit to a OtherPayment to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace OtherPayment amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = True Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by OtherPayment for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnPayingByCheck_Click(sender As Object, e As EventArgs) Handles BtnPayingByCheck.Click Try 'PAYMENT 1 Check '==================== If Me.TotalPaidPayment1TB.Text > 0 And Me.CheckAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 1, you can't have 2 amounts or types of payments in payment 1, use payment 2 or correct the previous payment 1 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.CheckAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then Me.CheckAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.CheckAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then Me.CheckAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.CheckAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a Check amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text > 0 And Me.CheckAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A Check amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = True Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Check for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.CheckAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A Check amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = True Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Check for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.CheckAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A Check amount has already been entered for payment 1 and the balance payable should not be negative for the type Check unless you credit a Check, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = True Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Check for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 2 Check '==================== If Me.TotalPaidPayment2TB.Text > 0 And Me.CheckAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 2, you can't have 2 amounts or types of payments in payment 2, use payment 3 or correct the previous payment 2 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.CheckAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then Me.CheckAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.CheckAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then Me.CheckAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.CheckAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a Check amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text > 0 And Me.CheckAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A Check amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = True Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Check for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.CheckAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A Check amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = True Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Check for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.CheckAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A Check amount has already been entered for payment 2 and the balance payable should not be negative for the type Check unless you give a Check refund to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = True Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Check for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 3 Check '==================== If Me.TotalPaidPayment3TB.Text > 0 And Me.CheckAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 3, you can't have 2 amounts or types of payments in payment 3." & vbCrLf & "Payment 3 should put the balance payable to zero (0.00) use payment 3 to correct the payment 3 amount!", "Auto Debit Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.CheckAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then Me.CheckAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.CheckAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then Me.CheckAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.CheckAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a Check amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text > 0 And Me.CheckAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12aA Check amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = True Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Check for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.CheckAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A Check amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = True Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Check for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.CheckAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A Check amount has already been entered for payment 3 and the balance payable should not be negative for the type Check unless you give a credit to a Check to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = True Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Check for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnChargeToClientAccount_Click(sender As Object, e As EventArgs) Handles BtnChargeToClientAccount.Click Try 'PAYMENT 1 ChargeToClient If Me.CustomerIDTB.Text = 1 Then If MsgBox("To be able to charge an amount to a customer, you must choose an eligible customer, do you want to replace the current customer?", MsgBoxStyle.YesNo, "Replace customer?") = vbYes Then Dim FormSearchACustomer As New FrmSearchACustomer FrmSearchACustomer.ShowDialog() End If MessageBox.Show("You MUST choose a customer account to be charge to!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If '==================== If Me.TotalPaidPayment1TB.Text > 0 And Me.ChargeToClientAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 1, you can't have 2 amounts or types of payments in payment 1, use payment 2 or correct the previous payment 1 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.ChargeToClientAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then Me.ChargeToClientAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.ChargeToClientAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then Me.ChargeToClientAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.ChargeToClientAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to charge an amount to the customer then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text > 0 And Me.ChargeToClientAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-An amount has already been charged to the customer for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = True Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount charge to the customer for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.ChargeToClientAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-An amount has already been charged for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = True Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid charged to the customer for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.ChargeToClientAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-An amount has already been charged for payment 1 and the balance payable should not be negative for the type Check unless you credit a Check, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = True Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount charged to the customer for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 2 ChargeToClient '==================== If Me.TotalPaidPayment2TB.Text > 0 And Me.ChargeToClientAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 2, you can't have 2 amounts or types of payments in payment 2, use payment 3 or correct the previous payment 2 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.ChargeToClientAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then Me.ChargeToClientAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.ChargeToClientAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then Me.ChargeToClientAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.ChargeToClientAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to charge an amount to the customer then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text > 0 And Me.ChargeToClientAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-An amount has already been charged for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = True Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount charged to the customer for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.ChargeToClientAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-An amount has already been charged for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = True Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount charged to the customer for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.ChargeToClientAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-An amount has already been charged for payment 2 and the balance payable should not be negative for the type Check unless you give a Check refund to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = True Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount charged to the customer for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 3 Check '==================== If Me.TotalPaidPayment3TB.Text > 0 And Me.ChargeToClientAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 3, you can't have 2 amounts or types of payments in payment 3." & vbCrLf & "Payment 3 should put the balance payable to zero (0.00) use payment 3 to correct the payment 3 amount!", "Auto Debit Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.ChargeToClientAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then Me.ChargeToClientAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.ChargeToClientAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then Me.ChargeToClientAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.ChargeToClientAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to charge an amount to the customer then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text > 0 And Me.ChargeToClientAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-An amount has already been charged for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = True Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount charged to the customer for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.ChargeToClientAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-An amount has already been charged for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = True Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount charged to the customer for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.ChargeToClientAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-An amount has already been entered for payment 3 and the balance payable should not be negative for the type Check unless you give a credit to a Check to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Check amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = True Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount charged to the customer for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub UpdateOrdersCustomerInfo() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.AddParam("@OrderNo", OrderNoSelectedTB.Text) SQL.AddParam("@CustomerID", CustomerIDTB.Text) SQL.AddParam("@SocietyID", SocietyTB.Text) SQL.AddParam("@SocietyName", SocietyCBX.Text) SQL.AddParam("@Address1", AddressTB.Text) SQL.AddParam("@Address2", Address2TB.Text) SQL.AddParam("@City", CityTB.Text) SQL.AddParam("@StateProvince", StateProvinceTB.Text) SQL.AddParam("@ZipCode", ZipCodeTB.Text) SQL.AddParam("@Country", CountryTB.Text) SQL.AddParam("@OrderNote", OrderNoteTB.Text) SQL.AddParam("@CustomerPO", CustomerPOTB.Text) SQL.AddParam("@AttentionOf", AttentionOfTB.Text) SQL.AddParam("@CustomerEmail", CustomerEmailTB.Text) SQL.AddParam("@CustomerNotes", NotesTB.Text) SQL.AddParam("@BackOrderID", BackOrderIDTB.Text) SQL.AddParam("@DeliveryToCustomer", CustomerTB.Text) SQL.AddParam("@DeliveryToSociety", SocietyTB.Text) SQL.AddParam("@CustomerName", CustomerTB.Text) SQL.AddParam("@DeliveryAddress1", DeliveryAddress1TB.Text) SQL.AddParam("@DeliveryAddress2", DeliveryAddress2TB.Text) SQL.AddParam("@DeliveryCity", DeliveryCityTB.Text) SQL.AddParam("@DeliveryStateProvince", DeliveryStateProvinceTB.Text) SQL.AddParam("@DeliveryZipCode", DeliveryZipCodeTB.Text) SQL.AddParam("@DeliveryCountry", DeliveryCountryTB.Text) SQL.AddParam("@DeliveryDateExpected", DeliveryDateExpectedTB.Text) SQL.AddParam("@DeliveryInstructions", DeliveryInstructionsTB.Text) SQL.AddParam("@SubTotal", SubTotalTB.Text) SQL.AddParam("@TaxTotal1", TaxTotal1TB.Text) SQL.AddParam("@TaxTotal2", TaxTotal2TB.Text) SQL.AddParam("@TaxTotal3", TaxTotal3TB.Text) SQL.AddParam("@SellingPrice1CB", SellingPrice1CB.Checked) SQL.AddParam("@SellingPrice2CB", SellingPrice2CB.Checked) SQL.AddParam("@SellingPrice3CB", SellingPrice3CB.Checked) SQL.AddParam("@SellingPrice4CB", SellingPrice4CB.Checked) SQL.AddParam("@SellingPrice5CB", SellingPrice5CB.Checked) SQL.AddParam("@Phone", PhoneNumberTB.Text) SQL.AddParam("@Cell", CellNumberTB.Text) SQL.AddParam("@DeliveryPhone", DeliveryPhoneNumberTB.Text) SQL.AddParam("@DeliveryCell", DeliveryCellPhoneTB.Text) SQL.AddParam("@CurrentStatus", CurrentStatusTB.Text) SQL.AddParam("@SalespersonID", SalespersonIDTB.Text) SQL.ExecQuery("UPDATE Sales.Orders " & "Set CustomerID=@CustomerID,CustomerName=@CustomerName,SalespersonID=@SalespersonID," & "SocietyName=@SocietyName,Address1=@Address1,Address2=@Address2,City=@City,StateProvince=@StateProvince,ZipCode=@ZipCode,Country=@Country," & "OrderNote=@OrderNote,CustomerPO=@CustomerPO,AttentionOf=@AttentionOf,CustomerEmail=@CustomerEmail,CustomerNotes=@CustomerNotes,BackOrderID=@BackOrderID,DeliveryToCustomer=DeliveryToCustomer," & "DeliveryToSociety=@DeliveryToSociety,DeliveryAddress1=@DeliveryAddress1 ,DeliveryAddress2=@DeliveryAddress2,DeliveryCity=@DeliveryCity,DeliveryStateProvince=@DeliveryStateProvince,DeliveryZipCode=@DeliveryZipCode," & "DeliveryCountry=@DeliveryCountry,DeliveryDateExpected=@DeliveryDateExpected,DeliveryInstructions=@DeliveryInstructions,SubTotal=@SubTotal," & "TaxTotal1=@TaxTotal1,TaxTotal2=@TaxTotal2,TaxTotal3=@TaxTotal3,SellingPrice1CB=@SellingPrice1CB,SellingPrice2CB=@SellingPrice2CB," & "SellingPrice3CB=@SellingPrice3CB,SellingPrice4CB=@SellingPrice4CB,SellingPrice5CB=@SellingPrice5CB,Phone=@Phone,Cell=@Cell,DeliveryPhone=@DeliveryPhone," & "DeliveryCell=@DeliveryCell Where OrderNo=@OrderNo") If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub SubTotalTB_TextChanged(sender As Object, e As EventArgs) Handles SubTotalTB.TextChanged Try UpdateOrdersWithTotals() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub DeliverToCustomerCB_CheckedChanged(sender As Object, e As EventArgs) Handles DeliveryToCustomerCB.CheckedChanged If DeliveryToCustomerCB.Checked = True Then Me.CustomerTB.Visible = True Me.SocietyTB.Visible = False End If End Sub Private Sub DeliverToSocietyCB_CheckedChanged(sender As Object, e As EventArgs) Handles DeliveryToSocietyCB.CheckedChanged If DeliveryToSocietyCB.Checked = True Then Me.CustomerTB.Visible = False Me.SocietyTB.Visible = True End If End Sub Private Sub TsmBilling1a_MouseEnter(sender As Object, e As EventArgs) Handles TsmBilling1a.MouseEnter TsmBilling1a.BackColor = Color.Lime End Sub Private Sub TsmBilling3b_Click(sender As Object, e As EventArgs) Try Me.SocietyCBX.Visible = False Me.CustomerCBX.Visible = True CustomerCBX.Select() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub TsmBilling3c_Click(sender As Object, e As EventArgs) Try Me.SocietyCBX.Visible = True Me.CustomerCBX.Visible = False SocietyCBX.Select() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnPrintInvoice_Click(sender As Object, e As EventArgs) Handles BtnPrintInvoice.Click End Sub Private Sub OrderPaidInOrderLines() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If For Each row As DataGridViewRow In OrderLinesDGV.Rows Dim constring As String = "Data Source=ACSERVER\ACRSERVER;Initial Catalog=ACData;Integrated Security=SSPI;" Using DBCon As New SqlConnection(constring) Using DBCmd As New SqlCommand("update Sales.OrderLines set [OrderPaid] = 1 WHERE OrderNo = '" & OrderNoSelectedTB.Text & "'", DBCon) DBCon.Open() DBCmd.ExecuteNonQuery() End Using End Using Next If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CommissionPaidInOrderLines() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If For Each row As DataGridViewRow In OrderLinesDGV.Rows Dim constring As String = "Data Source=ACSERVER\ACRSERVER;Initial Catalog=ACData;Integrated Security=SSPI;" Using DBCon As New SqlConnection(constring) Using DBCmd As New SqlCommand("update Sales.OrderLines set [CommissionPaid] = 0 WHERE OrderNo = '" & OrderNoSelectedTB.Text & "'", DBCon) DBCon.Open() DBCmd.ExecuteNonQuery() End Using End Using Next If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub OrderPaidInOpenOrders() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If Dim constring As String = "Data Source=ACSERVER\ACRSERVER;Initial Catalog=ACData;Integrated Security=SSPI;" Using DBCon As New SqlConnection(constring) Using DBCmd As New SqlCommand("update Sales.Orders set [OrderPaid] = 1 WHERE OrderNo = '" & OrderNoSelectedTB.Text & "'", DBCon) DBCon.Open() DBCmd.ExecuteNonQuery() End Using End Using If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub UpdateOrderPaid() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If Dim constring As String = "Data Source=ACSERVER\ACRSERVER;Initial Catalog=ACData;Integrated Security=SSPI;" Using DBCon As New SqlConnection(constring) Using DBCmd As New SqlCommand("update Sales.Orders set [CurrentStatus] = '" & "PAID" & "' WHERE OrderNo = '" & OrderNoSelectedTB.Text & "'", DBCon) DBCon.Open() DBCmd.ExecuteNonQuery() End Using End Using If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnGiftCertificate_Click(sender As Object, e As EventArgs) Handles BtnGiftCertificate.Click Try 'PAYMENT 1 GiftCertificate '========================= If Me.TotalPaidPayment1TB.Text > 0 And Me.GiftCertificateAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 1, you can't have 2 amounts or types of payments in payment 1, use payment 2 or correct the previous payment 1 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) FrmMsgEnterGCNumber.Close() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.GiftCertificateAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then Dim FormMsgEnterGCNumber As New FrmMsgEnterGCNumber FrmMsgEnterGCNumber.ShowDialog() UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.GiftCertificateAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then Me.GiftCertificateAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.GiftCertificateAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a GiftCertificate amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text > 0 And Me.GiftCertificateAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then If MsgBox("12a-A GiftCertificate amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace GiftCertificate amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = True Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by GiftCertificate for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.GiftCertificateAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then If MsgBox("12a-A GiftCertificate amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace GiftCertificate amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = True Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by GiftCertificate for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.GiftCertificateAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then If MsgBox("12a-A GiftCertificate amount has already been entered for payment 1 and the balance payable should not be negative for the type GiftCertificate unless you credit a GiftCertificate, do you want to replace it?", MsgBoxStyle.YesNo, "Replace GiftCertificate amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = True Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by GiftCertificate for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text End If End If 'PAYMENT 2 GiftCertificate '==================== If Me.TotalPaidPayment2TB.Text > 0 And Me.GiftCertificateAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 2, you can't have 2 amounts or types of payments in payment 2, use payment 3 or correct the previous payment 2 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.GiftCertificateAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then Dim FormMsgEnterGCNumber As New FrmMsgEnterGCNumber FrmMsgEnterGCNumber.ShowDialog() UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.GiftCertificateAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then Me.GiftCertificateAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.GiftCertificateAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a GiftCertificate amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text > 0 And Me.GiftCertificateAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then If MsgBox("12a-A GiftCertificate amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace GiftCertificate amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = True Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by GiftCertificate for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.GiftCertificateAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then If MsgBox("12a-A GiftCertificate amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace GiftCertificate amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = True Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by GiftCertificate for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.GiftCertificateAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then If MsgBox("12a-A GiftCertificate amount has already been entered for payment 2 and the balance payable should not be negative for the type GiftCertificate unless you give a GiftCertificate refund to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace GiftCertificate amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = True Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by GiftCertificate for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text End If End If 'PAYMENT 3 GiftCertificate '==================== If Me.TotalPaidPayment3TB.Text > 0 And Me.GiftCertificateAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 3, you can't have 2 amounts or types of payments in payment 3." & vbCrLf & "Payment 3 should put the balance payable to zero (0.00) use payment 3 to correct the payment 3 amount!", "Auto Debit Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.GiftCertificateAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then Dim FormMsgEnterGCNumber As New FrmMsgEnterGCNumber FrmMsgEnterGCNumber.ShowDialog() UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.GiftCertificateAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then Me.GiftCertificateAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.GiftCertificateAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a GiftCertificate amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text > 0 And Me.GiftCertificateAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then If MsgBox("12aA GiftCertificate amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace GiftCertificate amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = True Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by GiftCertificate for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.GiftCertificateAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then If MsgBox("12a-A GiftCertificate amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace GiftCertificate amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = True Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by GiftCertificate for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.GiftCertificateAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then If MsgBox("12a-A GiftCertificate amount has already been entered for payment 3 and the balance payable should not be negative for the type GiftCertificate unless you give a credit to a GiftCertificate to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace GiftCertificate amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = False Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = True Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by GiftCertificate for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnIssueAGiftCertificate_MouseEnter(sender As Object, e As EventArgs) Handles BtnIssueAGiftCertificate.MouseEnter Try Me.BtnIssueAGiftCertificate.BackColor = Color.Lime Me.BtnIssueAGiftCertificate.ForeColor = Color.Black If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnIssueAGiftCertificate_Click(sender As Object, e As EventArgs) Handles BtnIssueAGiftCertificate.Click Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If String.IsNullOrEmpty(OrderNoSelectedTB.Text.Trim()) Then MessageBox.Show("You must create or select an order to sell a gift certificate!") Exit Sub End If Dim FormGiftCertificate As New FrmIssueAGiftCertificate FrmIssueAGiftCertificate.Show() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnIssueAGiftCertificate_MouseLeave(sender As Object, e As EventArgs) Handles BtnIssueAGiftCertificate.MouseLeave Try Me.BtnIssueAGiftCertificate.BackColor = Color.FromArgb(64, 0, 64) Me.BtnIssueAGiftCertificate.ForeColor = Color.White If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ProductCBX_Enter(sender As Object, e As EventArgs) Handles ProductCBX.Enter Try ProductCBX.BackColor = Color.Lime ProductCBX.ForeColor = Color.Black If String.IsNullOrEmpty(OrderNoSelectedTB.Text.Trim()) Then Me.ProductCBX.Enabled = False Else Me.ProductCBX.Enabled = True ProductCBX.BackColor = Color.Lime ProductCBX.ForeColor = Color.Black End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Sub BtnLastAddedRow_Click(sender As Object, e As EventArgs) Handles BtnLastAddedRow.Click Try If OrderLinesDGV.Rows.Count >= 1 Then OrderLinesDGV.CurrentCell = Me.OrderLinesDGV.Rows(Me.OrderLinesDGV.Rows.Count - 1).Cells(0) OrderLinesDGV.Rows(Me.OrderLinesDGV.Rows.Count - 1).Selected = True OrderLineIDTB.Text = Me.OrderLinesDGV.CurrentRow.Cells("OrderLineID").Value.ToString() LastProductIDTB.Text = Me.OrderLinesDGV.CurrentRow.Cells("ProductID").Value.ToString() ProductDateSoldTB.Text = Me.OrderLinesDGV.CurrentRow.Cells("SellingDate").Value.ToString() ValidFromTB.Text = Me.OrderLinesDGV.CurrentRow.Cells("ValidFrom").Value.ToString() ValidToTB.Text = Me.OrderLinesDGV.CurrentRow.Cells("ValidTo").Value.ToString() Me.ProductCBX.Select() Else Exit Sub End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ShowFrmMsgEnterGCNumber() Try Dim SmallerMsg As New FrmMsgEnterGCNumber FrmMsgEnterGCNumber.Close() FrmMsgEnterGCNumber.DirectiveTB.Text = "" FrmMsgEnterGCNumber.DirectiveTB.Text = "ENTER OR SCAN THE GIFT CERTIFICATE NUMBER BELOW!" FrmMsgEnterGCNumber.Show() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub CheckIfExist() Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT ProductID, ProductName, Barcode FROM Warehouse.ProductsActivated WHERE Barcode = '" & ProductCBX.Text & "'") If SQL.DBDS.Tables(0).Rows.Count = 0 And Me.ProductCBX.Text <> "" Then Dim StandardMsg As New FrmMsgStandard FrmMsgStandard.Close() FrmMsgStandard.TextBox1.Text = "" FrmMsgStandard.TextBox2.Text = "" FrmMsgStandard.TextBox1.Text = "THERE IS NO PRODUCT FOUND WITH THIS ID OR BARCODE!" FrmMsgStandard.TextBox2.Text = "You can use the search section to search by name!" FrmMsgStandard.Show() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub 'Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click 'Try 'If SQL.DBDS IsNot Nothing Then ' SQL.DBDS.Clear() 'End If ' SQL.RunQuery("SELECT COUNT(*) FROM ACData.Warehouse.ProductsActivated WHERE Barcode = '" & ProductCBX.Text & "'") 'If SQL.DBDS.Tables(0).Rows.Count = 0 And Me.ProductCBX.Text <> "" Then 'Dim StandardMsg As New FrmMsgStandard ' FrmMsgStandard.Close() ' FrmMsgStandard.TextBox1.Text = "" ' FrmMsgStandard.TextBox2.Text = "" ' FrmMsgStandard.TextBox1.Text = "THERE IS NO PRODUCT FOUND WITH THIS ID OR BARCODE!" ' FrmMsgStandard.TextBox2.Text = "You can use the search section to search by name!" ' FrmMsgStandard.Show() ' End If 'If SQL.HasException(True) Then Exit Sub ' Catch ex As Exception ' MsgBox(ex.Message) ' System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) ' End Try ' End Sub Private Sub BtnViewCertificate_Click(sender As Object, e As EventArgs) Handles BtnViewCertificate.Click Me.ViewGiftCB.Checked = True Dim FormMsgEnterGCNumber As New FrmMsgEnterGCNumber FrmMsgEnterGCNumber.ShowDialog() End Sub Private Sub BtnPayingDiscover_Click(sender As Object, e As EventArgs) Handles BtnPayingDiscover.Click Try 'PAYMENT 1 Discover CARD '==================== If Me.TotalPaidPayment1TB.Text > 0 And Me.DiscoverAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 1, you can't have 2 amounts or types of payments in payment 1, use payment 2 or correct the previous payment 1 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.DiscoverAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then Me.DiscoverAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.DiscoverAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then Me.DiscoverAmount1TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment1TB.Text = 0 And Me.DiscoverAmount1TB.Text = 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a Discover card amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment1TB.Text > 0 And Me.DiscoverAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A Discover amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Discover amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = True Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Discover for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.DiscoverAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A Discover amount has already been entered for payment 1, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Discover amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = True Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Discover for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment1TB.Text > 0 And Me.DiscoverAmount1TB.Text > 0 And Me.PaymentNumberTB.Text = 1 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A Discover amount has already been entered for payment 1 and the balance payable should not be negative for the type Discover unless you credit a Discover card, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Mastercard amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = True Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Discover for this order in payment 1!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 1 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 2 Discover CARD '==================== If Me.TotalPaidPayment2TB.Text > 0 And Me.DiscoverAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 2, you can't have 2 amounts or types of payments in payment 2, use payment 3 or correct the previous payment 2 amount!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.DiscoverAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then Me.DiscoverAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.DiscoverAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then Me.DiscoverAmount2TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment2TB.Text = 0 And Me.DiscoverAmount2TB.Text = 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a Discover amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment2TB.Text > 0 And Me.DiscoverAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12a-A Discover amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Discover amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = True Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Discover for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.DiscoverAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A Discover amount has already been entered for payment 2, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Discover amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = True Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Discover for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment2TB.Text > 0 And Me.DiscoverAmount2TB.Text > 0 And Me.PaymentNumberTB.Text = 2 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A Discover amount has already been entered for payment 2 and the balance payable should not be negative for the type Discover unless you give a Discover card refund to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Discover amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = True Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Discover for this order in payment 2!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 2 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If 'PAYMENT 3 Discover CARD '==================== If Me.TotalPaidPayment3TB.Text > 0 And Me.DiscoverAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then MessageBox.Show("You have already an amount in payment 3, you can't have 2 amounts or types of payments in payment 3." & vbCrLf & "Payment 3 should put the balance payable to zero (0.00) use payment 3 to correct the payment 3 amount!", "Auto Debit Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.DiscoverAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then Me.DiscoverAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.DiscoverAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then Me.DiscoverAmount3TB.Text = Me.BalancePayableTB.Text UpdatePayments() CalculateTotalPayments() OthersTC.Refresh() Exit Sub End If If Me.TotalPaidPayment3TB.Text = 0 And Me.DiscoverAmount3TB.Text = 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then MessageBox.Show("The balance payable is zero, if you need to enter a Discover card amount then review the distribution or click on the RESET ALL button!", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Me.TotalPaidPayment3TB.Text > 0 And Me.DiscoverAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text > 0 Then 'If MsgBox("12aA Discover amount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Mastercard amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = True Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Discover for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.DiscoverAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text = 0 Then 'If MsgBox("12a-A Discoveramount has already been entered for payment 3, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Discover amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = True Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Discover for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If Me.TotalPaidPayment3TB.Text > 0 And Me.DiscoverAmount3TB.Text > 0 And Me.PaymentNumberTB.Text = 3 And Me.BalancePayableTB.Text < 0 Then 'If MsgBox("12a-A Discover amount has already been entered for payment 3 and the balance payable should not be negative for the type Mastercard unless you give a credit to a Mastercard card to the client, do you want to replace it?", MsgBoxStyle.YesNo, "Replace Mastercard amount?") = vbYes Then Me.BtnAcceptCash.Visible = False Me.BtnAcceptDebit.Visible = False Me.BtnAcceptVisa.Visible = False Me.BtnAcceptMastercard.Visible = False Me.BtnAcceptAmex.Visible = False Me.BtnAcceptDiscover.Visible = True Me.BtnAcceptDinersClub.Visible = False Me.BtnAcceptCheck.Visible = False Me.BtnAcceptGiftCertificate.Visible = False Me.BtnAcceptCharge.Visible = False Me.BtnAcceptOtherPayment.Visible = False Me.BtnAcceptTip.Visible = False Me.BtnAcceptCashBack.Visible = False Me.LblDisplay.Text = 0 Me.FunctionTB.Text = "Enter the amount paid by Discover for this order in payment 3!" OthersTC.SelectedTab = CalculatorTP Me.WhichPaymentTB.Text = "YOU ARE ACTUALLY IN PAYMENT:" Me.PaymentNumberTB.Text = 3 LblCalculatorPaymentNumber.Text = "YOU ARE ACTUALLY IN PAYMENT:" CalculatorPaymentNumberTB.Text = PaymentNumberTB.Text 'End If End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ProductCBX_MouseEnter(sender As Object, e As EventArgs) Handles ProductCBX.MouseEnter ProductCBX.BackColor = Color.Lime ProductCBX.ForeColor = Color.Black End Sub Private Sub ProductCBX_MouseLeave(sender As Object, e As EventArgs) Handles ProductCBX.MouseLeave ProductCBX.BackColor = Color.White ProductCBX.ForeColor = Color.Black End Sub Private Sub BtnAllCategories_Click(sender As Object, e As EventArgs) Handles BtnAllCategories.Click Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If String.IsNullOrEmpty(OrderNoSelectedTB.Text.Trim()) Then MessageBox.Show("You must create or select an order to choose a category!") Exit Sub End If Dim FormAllCategories As New FrmAllCategories FormAllCategories.Show() 'Me.Hide() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnAddCustomer_Click(sender As Object, e As EventArgs) Handles BtnAddCustomer.Click Try If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If String.IsNullOrEmpty(OrderNoSelectedTB.Text.Trim()) Then MessageBox.Show("You must create or select an order to select a customer!") Exit Sub End If Dim FormSearchACustomer As New FrmSearchACustomer FormSearchACustomer.ShowDialog() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub ProductsTouchTB_Enter(sender As Object, e As EventArgs) Handles ProductsTouchTB.Enter Try Me.ProductDateSoldTB.Text = Now() 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If Me.ProductCBX.Text = "- Barcode not found -" Then MsgBox("There is no record for this query, please try again.") ProductCBX.Text = "" ProductCBX.Select() Exit Sub Else ' SQL.RunQuery("SELECT * FROM Warehouse.ProductsActivated Where ProductName = '" & ProductCBX.Text & "' ") 'If SQL.DBDS.Tables(0).Rows.Count = 0 Then 'MsgBox("There is no record for this query, please try again.") 'Exit Sub 'End If UpdateOrderlinesDGVWithProduct() FormatAll() 'BtnLastAddedRow.PerformClick() ProductCBX.Text = "" ProductCBX.Select() Exit Sub End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Sub FrmBillingChangeLanguage_fr_FR() Resources.Language = CultureCodeName.fr_FR Me.BtnSelectStation.Text = Resources.GetValue(ResourceName.FrmBilling_BtnSelectStation) Me.LblStationChanged.Text = Resources.GetValue(ResourceName.FrmBilling_LblStationChanged) Me.LblOrderNo.Text = Resources.GetValue(ResourceName.FrmBilling_LblOrderNo) Me.BtnDeleteThisOrder.Text = Resources.GetValue(ResourceName.FrmBilling_BtnDeleteThisOrder) Me.TsmBilling1.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling1) Me.TsmBilling2.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling2) Me.TsmBilling3.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling3) Me.TsmBilling4.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling4) Me.TsmBilling5.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling5) Me.TsmBilling6.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling6) Me.TsmBilling7.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling7) Me.TsmBilling8.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling8) Me.TsmBilling9.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling9) End Sub Public Sub FrmBillingChangeLanguage_en_US() Resources.Language = CultureCodeName.en_US Me.BtnSelectStation.Text = Resources.GetValue(ResourceName.FrmBilling_BtnSelectStation) Me.LblStationChanged.Text = Resources.GetValue(ResourceName.FrmBilling_LblStationChanged) Me.LblOrderNo.Text = Resources.GetValue(ResourceName.FrmBilling_LblOrderNo) Me.BtnDeleteThisOrder.Text = Resources.GetValue(ResourceName.FrmBilling_BtnDeleteThisOrder) Me.TsmBilling1.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling1) Me.TsmBilling2.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling2) Me.TsmBilling3.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling3) Me.TsmBilling4.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling4) Me.TsmBilling5.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling5) Me.TsmBilling6.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling6) Me.TsmBilling7.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling7) Me.TsmBilling8.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling8) Me.TsmBilling9.Text = Resources.GetValue(ResourceName.FrmBilling_TsmBilling9) End Sub Private Sub ChooseAReasonForDeleteAnOrder() Try Dim FormReasons As New FrmReasons If Application.OpenForms().OfType(Of FrmBilling).Any Then FrmReasons.BtnAccept.Visible = True FrmReasons.LblInformation.Visible = True FrmReasons.LblReasonID.Visible = True FrmReasons.LblReasonDescription.Visible = True FrmReasons.ReasonIDTB.Visible = True FrmReasons.ReasonDescriptionTB.Visible = True FrmReasons.BtnAdd.Visible = False FrmReasons.BtnDelete.Visible = False FrmReasons.BtnSave.Visible = False FrmReasons.Show() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub LoadChosenID() Try 'CLEAR EXISTING RECORD If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If SQL.RunQuery("SELECT EmployeeID,Username FROM Application.Salespersons Where EmployeeID = '" & Me.SalespersonIDTB.Text & "' Order by EmployeeID ASC") If SQL.DBDS.Tables(0).Rows(0).Item(0) >= 1 Then Me.SalespersonNameTB.Text = SQL.DBDS.Tables(0).Rows(0).Item("Username") Else MessageBox.Show("There is no city with that ID, please check your database!.", "Auto Cash Register Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End If If SQL.DBDS IsNot Nothing Then SQL.DBDS.Clear() End If If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Private Sub BtnGlobalPayments_Click(sender As Object, e As EventArgs) Handles BtnGlobalPayments.Click Try Dim f As New FrmGlobalPayments Try If f.ShowDialog = DialogResult.OK Then ' OK selected Else ' Not Ok End If Finally f.Dispose() End Try If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Sub UpdateSalespersonIDInOrderLine() 'ADD SQL PARAMS & RUN THE COMMAND Try SQL.AddParam("@OrderLine", Me.OrderLineIDTB.Text) SQL.AddParam("@SalespersonID", Me.SalespersonIDTB.Text) SQL.ExecQuery("UPDATE Sales.OrderLines " & "SET SalespersonID=@SalespersonID WHERE OrderLineID=@OrderLine;") RecordsCounted() ProductCBX.Select() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub Public Sub BtnUpdateSalesperson_Click(sender As Object, e As EventArgs) Handles BtnUpdateSalesperson.Click Try UpdateSalespersonIDInOrderLine() If SQL.HasException(True) Then Exit Sub Catch ex As Exception MsgBox(ex.Message) System.IO.File.AppendAllText("C:\AutoCashRegister\Documents\log.txt", ex.ToString & vbNewLine & vbNewLine) End Try End Sub End Class