Imports MetroFramework
Imports MetroFramework.Forms
Public Class frmCustomDialogX

    Private Sub btnOK_Click(sender As System.Object, e As System.EventArgs) Handles btnOK.Click
        If Len(Trim(txtReason.Text)) = 0 Then
            MetroMessageBox.Show(Me, "Please enter reason", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            txtReason.Focus()
            Exit Sub
        End If
        If lblSet.Text = "Dine In KOT" Then
            InvoiceDeleteFunc(frmPOS.lblTicketNo.Text, frmPOS.dtpBillDate.Value, Val(frmPOS.lblBalance.Text), frmPOS.lblUserVAL.Text, "", txtReason.Text, "Dine In KOT", "Deleted")
            frmPOS.DeleteRecord()
        End If
        If lblSet.Text = "Void KOT" Then
            InvoiceDeleteFunc(frmPOS.lblTicketNo.Text, frmPOS.dtpBillDate.Value, Val(frmPOS.lblBalance.Text), frmPOS.lblUserVAL.Text, "", txtReason.Text, "Dine In KOT", "Canceled")
            frmPOS.VoidBill()
        End If
        If lblSet.Text = "Void RKOT" Then
            InvoiceDeleteFunc(frmPOS.lblTicketNo.Text, frmPOS.dtpBillDate.Value, Val(frmPOS.lblBalance.Text), frmPOS.lblUserVAL.Text, "", txtReason.Text, "Dine In KOT", "Canceled")
            frmPOS.RollBackStock()
            frmPOS.VoidBill()
        End If
        If lblSet.Text = "KOT" Then
            InvoiceDeleteFunc(frmPOS.lblBillNo.Text, frmPOS.dtpBillDate.Value, Val(frmPOS.txtGrandTotal.Text), frmPOS.lblUserVAL.Text, frmPOS.lblPaymentMode.Text, txtReason.Text, "Dine In Billing", "Deleted")
            frmPOS.DeleteRecord1()
        End If
        If lblSet.Text = "TA" Then
            InvoiceDeleteFunc(frmPOS.lblBillNo1.Text, frmPOS.dtpBillDate.Value, Val(frmPOS.txtGrandTotal1.Text), frmPOS.lblUserVAL.Text, frmPOS.lblPaymentMode1.Text, txtReason.Text, "Take Away", "Deleted")
            frmPOS.DeleteRecord2()
        End If
        If lblSet.Text = "Void TA" Then
            InvoiceDeleteFunc(frmPOS.lblBillNo1.Text, frmPOS.dtpBillDate.Value, Val(frmPOS.txtGrandTotal1.Text), frmPOS.lblUserVAL.Text, frmPOS.lblPaymentMode1.Text, txtReason.Text, "Take Away", "Canceled")
            frmPOS.VoidBill1()
        End If
        If lblSet.Text = "Void RTA" Then
            InvoiceDeleteFunc(frmPOS.lblBillNo1.Text, frmPOS.dtpBillDate.Value, Val(frmPOS.txtGrandTotal1.Text), frmPOS.lblUserVAL.Text, frmPOS.lblPaymentMode1.Text, txtReason.Text, "Take Away", "Canceled")
            frmPOS.RollBackStock1()
            frmPOS.VoidBill1()
        End If
        If lblSet.Text = "HD" Then
            InvoiceDeleteFunc(frmPOS.lblBillNo2.Text, frmPOS.dtpBillDate.Value, Val(frmPOS.txtGrandTotal2.Text), frmPOS.lblUserVAL.Text, frmPOS.lblPaymentMode2.Text, txtReason.Text, "Home Delivery", "Deleted")
            frmPOS.DeleteRecord3()
        End If
        If lblSet.Text = "Void HD" Then
            InvoiceDeleteFunc(frmPOS.lblBillNo2.Text, frmPOS.dtpBillDate.Value, Val(frmPOS.txtGrandTotal2.Text), frmPOS.lblUserVAL.Text, frmPOS.lblPaymentMode2.Text, txtReason.Text, "Home Delivery", "Canceled")
            frmPOS.VoidBill2()
        End If
        If lblSet.Text = "Void RHD" Then
            InvoiceDeleteFunc(frmPOS.lblBillNo2.Text, frmPOS.dtpBillDate.Value, Val(frmPOS.txtGrandTotal2.Text), frmPOS.lblUserVAL.Text, frmPOS.lblPaymentMode2.Text, txtReason.Text, "Home Delivery", "Canceled")
            frmPOS.RollBackStock2()
            frmPOS.VoidBill2()
        End If
        If lblSet.Text = "EB" Then
            InvoiceDeleteFunc(frmPOS.lblBillNo3.Text, frmPOS.dtpBillDate.Value, Val(frmPOS.txtGrandTotal3.Text), frmPOS.lblUserVAL.Text, frmPOS.lblPaymentMode3.Text, txtReason.Text, "Express Billing", "Deleted")
            frmPOS.DeleteRecord4()
        End If
        If lblSet.Text = "Void EB" Then
            InvoiceDeleteFunc(frmPOS.lblBillNo3.Text, frmPOS.dtpBillDate.Value, Val(frmPOS.txtGrandTotal3.Text), frmPOS.lblUserVAL.Text, frmPOS.lblPaymentMode3.Text, txtReason.Text, "Express Billing", "Canceled")
            frmPOS.VoidBill3()
        End If
        If lblSet.Text = "Void REB" Then
            InvoiceDeleteFunc(frmPOS.lblBillNo3.Text, frmPOS.dtpBillDate.Value, Val(frmPOS.txtGrandTotal3.Text), frmPOS.lblUserVAL.Text, frmPOS.lblPaymentMode3.Text, txtReason.Text, "Express Billing", "Canceled")
            frmPOS.RollBackStock3()
            frmPOS.VoidBill3()
        End If
        lblSet.Text = ""
        Me.Close()
    End Sub

    Private Sub btnCancel_Click(sender As System.Object, e As System.EventArgs) Handles btnCancel.Click
        Me.Close()
    End Sub

    Private Sub frmCustomDialog19_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        txtReason.Text = ""
    End Sub
End Class