Example #1
0
        protected void cboBranch_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            Data.Branch        clsBranch  = new Data.Branch();
            Data.BranchDetails clsDetails = clsBranch.Details(Convert.ToInt16(cboBranch.SelectedItem.Value));
            clsBranch.CommitAndDispose();

            txtBranchAddress.Text = clsDetails.Address;
        }
Example #2
0
        private void LoadOptions()
        {
            cmdBranchSelect.Text = "press to select";
            txtBarCode.Text      = "";
            txtQuantity.Text     = "0.00";
            lblProductDesc.Text  = "PLEASE SCAN AN ITEM.";
            dgvItems.DataSource  = null;
            txtBarCode.Focus();
            txtBarCode.Select();

            mclsBranchDetails = new Data.BranchDetails();
            mdtItems          = null;
        }
Example #3
0
        private void cmdBranchSelect_Click(object sender, EventArgs e)
        {
            try
            {
                BranchWnd clsBranchWnd = new BranchWnd();
                clsBranchWnd.ShowDialog(this);
                mclsBranchDetails = clsBranchWnd.BranchDetails;
                clsBranchWnd.Close();
                clsBranchWnd.Dispose();

                if (clsBranchWnd.Result == System.Windows.Forms.DialogResult.OK)
                {
                    cmdBranchSelect.Text = mclsBranchDetails.BranchCode;
                    LoadFile();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #4
0
        private void LoadFile()
        {
            Cursor.Current = Cursors.WaitCursor;

            string invfile = "invfiles/" + mclsBranchDetails.BranchCode + ".inv"; //mclsInvLog.LogFile;

            if (!System.IO.File.Exists(invfile))
            {
                Data.BranchDetails clsBranchDetails = mclsBranchDetails;
                mclsInvLog = new InvLog();
                LoadOptions();
                mclsBranchDetails = clsBranchDetails;
                cmdBranchSelect.Text = mclsBranchDetails.BranchCode;
            }
            else if (System.IO.File.Exists(invfile))
            {
                mdtItems = new System.Data.DataTable("tblInvItems");
                mdtItems.Columns.Add("BarCode");
                mdtItems.Columns.Add("Quantity");
                mdtItems.Columns.Add("Unit");
                mdtItems.Columns.Add("Description");

                using (var reader = new StreamReader(invfile))
                {
                    string line; int iCtr = 0; 
                    while ((line = reader.ReadLine()) != null)
                    {
                        if (iCtr >= 4)
                        {
                            string[] item = line.Split('|');
                            mdtItems.Rows.Add(item[0], item[1], item[2], item[3]);
                        }
                        iCtr++;
                    }
                }

                dgvItems.MultiSelect = false;
                dgvItems.AutoGenerateColumns = true;
                dgvItems.AutoSize = true;
                dgvItems.ScrollBars = ScrollBars.Vertical;
                dgvItems.DataSource = mdtItems.TableName;
                dgvItems.DataSource = mdtItems;

                dgvItems.Columns["BarCode"].Visible = true;
                dgvItems.Columns["Quantity"].Visible = true;
                dgvItems.Columns["Unit"].Visible = true;
                dgvItems.Columns["Description"].Visible = true;

                dgvItems.Columns["BarCode"].HeaderText = "BarCode";
                dgvItems.Columns["Quantity"].HeaderText = "Quantity";
                dgvItems.Columns["Unit"].HeaderText = "Unit";
                dgvItems.Columns["Description"].HeaderText = "Description";

                dgvItems.Columns["BarCode"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
                dgvItems.Columns["Quantity"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Unit"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
                dgvItems.Columns["Description"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;

                dgvItems.Columns["BarCode"].Width = 230;
                dgvItems.Columns["Quantity"].Width = 100;
                dgvItems.Columns["Unit"].Width = 100;
                dgvItems.Columns["Description"].Width = dgvItems.Width - 450;

                dgvItems.Rows[dgvItems.Rows.Count-1].Selected = true;
                dgvItems.FirstDisplayedScrollingRowIndex = dgvItems.Rows.Count - 1;

                mclsInvLog.LogFile = invfile;
            }
            Cursor.Current = Cursors.Default;
        }
Example #5
0
        private void LoadOptions()
        {
            cmdBranchSelect.Text = "press to select";
            txtBarCode.Text = "";
            txtQuantity.Text = "0.00";
            lblProductDesc.Text = "PLEASE SCAN AN ITEM.";
            dgvItems.DataSource = null;
            txtBarCode.Focus();
            txtBarCode.Select();

            mclsBranchDetails = new Data.BranchDetails();
            mdtItems = null;
        }
Example #6
0
        private void Main_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            switch (e.KeyData)
            {
                case Keys.F2:   // clear inventory file
                    if (mclsBranchDetails.BranchID == 0)
                    {
                        MessageBox.Show("Please select the branch to clear the inventory file.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        cmdBranchSelect.Focus();
                        return;
                    }
                    if (MessageBox.Show("Are you sure you want to clear the inventory file of branch " + mclsBranchDetails.BranchCode + "?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                    {
                        Data.BranchDetails clsBranchDetails = mclsBranchDetails;
                        if (!Directory.Exists("invfiles/backups/")) Directory.CreateDirectory("invfiles/backups/");
                        System.IO.File.Copy(mclsInvLog.LogFile, "invfiles/backups/" + mclsBranchDetails.BranchCode + "_" + DateTime.Now.ToString("yyyyddMMhhmmss") + ".inv");
                        System.IO.File.Delete(mclsInvLog.LogFile);
                        mclsInvLog = new InvLog();
                        LoadOptions();
                        LoadFile();
                        mclsBranchDetails = clsBranchDetails;
                        cmdBranchSelect.Text = mclsBranchDetails.BranchCode;
                    }
                    break;
                case Keys.F3:
                    LogInWnd login = new LogInWnd();

                    login.AccessType = AccessTypes.ZeroOutBranchInventory;
                    login.Header = "Zero Out Inventory of Branch: access validation";
                    login.ShowDialog(this);
                    DialogResult loginresult = login.Result;
                    login.Close();
                    login.Dispose();

                    if (loginresult == DialogResult.OK)
                    {
                        grpSaveToDB.Visible = false;
                        if (mclsBranchDetails.BranchID == 0)
                        {
                            MessageBox.Show("Please select the branch to zero out the inventory.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            cmdBranchSelect.Focus();
                            return;
                        }
                        if (MessageBox.Show("Are you sure you want to ZERO out the inventory of branch " + mclsBranchDetails.BranchCode + "?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                        {
                                grpSaveToDB.Visible = true;
                                Cursor.Current = Cursors.WaitCursor;

                                this.bgwZeroOutInv.RunWorkerAsync();

                                // Wait for the BackgroundWorker to finish the download.
                                while (this.bgwZeroOutInv.IsBusy)
                                {
                                    //prgBar.Increment(1);
                                    // Keep UI messages moving, so the form remains 
                                    // responsive during the asynchronous operation.
                                    Application.DoEvents();
                                }
                            }
                        }
                        break;
                    
                case Keys.F4:
                    grpSaveToDB.Visible = false;
                    if (mclsBranchDetails.BranchID == 0)
                    {
                        MessageBox.Show("Please select the branch to upload the inventory.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        cmdBranchSelect.Focus();
                        return;
                    }
                    if (mdtItems == null || mdtItems.Rows.Count == 0)
                    {
                        MessageBox.Show("No rows to upload, please make sure the inventory file is loaded.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (MessageBox.Show("Are you sure you want to UPLOAD the inventory of branch " + mclsBranchDetails.BranchCode + "?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                    {
                        grpSaveToDB.Visible = true;
                        Cursor.Current = Cursors.WaitCursor;

                        this.bgwSavetoDB.RunWorkerAsync();

                        // Wait for the BackgroundWorker to finish the download.
                        while (this.bgwSavetoDB.IsBusy)
                        {
                            //prgBar.Increment(1);
                            // Keep UI messages moving, so the form remains 
                            // responsive during the asynchronous operation.
                            Application.DoEvents();
                        }
                    }
                    break;
                case Keys.F5:
                    isLoadInReverse = false;
                    grpSaveToDB.Visible = false;
                    if (mclsBranchDetails.BranchID == 0)
                    {
                        MessageBox.Show("Please select the branch to zero out the NEGATIVE inventory.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        cmdBranchSelect.Focus();
                        return;
                    }
                    if (MessageBox.Show("Are you sure you want to ZERO out the NEGATIVE  inventory of branch " + mclsBranchDetails.BranchCode + "?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                    {
                        grpSaveToDB.Visible = true;
                        Cursor.Current = Cursors.WaitCursor;

                        this.bgwZeroOutInvNeg.RunWorkerAsync();

                        // Wait for the BackgroundWorker to finish the download.
                        while (this.bgwZeroOutInvNeg.IsBusy)
                        {
                            //prgBar.Increment(1);
                            // Keep UI messages moving, so the form remains 
                            // responsive during the asynchronous operation.
                            Application.DoEvents();
                        }
                    }
                    break;

                case Keys.F7:
                    isLoadInReverse = true;

                    grpSaveToDB.Visible = false;
                    if (mclsBranchDetails.BranchID == 0)
                    {
                        MessageBox.Show("Please select the branch to upload the inventory.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        cmdBranchSelect.Focus();
                        return;
                    }
                    if (mdtItems == null || mdtItems.Rows.Count == 0)
                    {
                        MessageBox.Show("No rows to upload, please make sure the inventory file is loaded.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (MessageBox.Show("Are you sure you want to UPLOAD the inventory of branch " + mclsBranchDetails.BranchCode + "?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                    {
                        grpSaveToDB.Visible = true;
                        Cursor.Current = Cursors.WaitCursor;

                        this.bgwSavetoDB.RunWorkerAsync();

                        // Wait for the BackgroundWorker to finish the download.
                        while (this.bgwSavetoDB.IsBusy)
                        {
                            //prgBar.Increment(1);
                            // Keep UI messages moving, so the form remains 
                            // responsive during the asynchronous operation.
                            Application.DoEvents();
                        }
                    }
                    break;
                case Keys.Escape:
                    if (MessageBox.Show("Are you sure you want to exit?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                    {
                        Application.Exit();
                    }
                    break;
            }
        }
Example #7
0
        private void cmdBranchSelect_Click(object sender, EventArgs e)
        {
            try
            {
                BranchWnd clsBranchWnd = new BranchWnd();
                clsBranchWnd.ShowDialog(this);
                mclsBranchDetails = clsBranchWnd.BranchDetails;
                clsBranchWnd.Close();
                clsBranchWnd.Dispose();

                if (clsBranchWnd.Result == System.Windows.Forms.DialogResult.OK)
                {
                    cmdBranchSelect.Text = mclsBranchDetails.BranchCode;
                    LoadFile();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #8
0
        protected void lstItem_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Header)
            {
                LoadSortFieldOptions(e);
            }
            else if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView dr = (DataRowView)e.Item.DataItem;

                HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");
                chkList.Value = dr["TerminalID"].ToString();

                HyperLink lnkTerminalNo = (HyperLink)e.Item.FindControl("lnkTerminalNo");
                lnkTerminalNo.Text = dr["TerminalNo"].ToString();

                Label lblBranchID = (Label)e.Item.FindControl("lblBranchID");
                lblBranchID.Text = dr["BranchID"].ToString();

                Data.Branch        clsBranch        = new Branch();
                Data.BranchDetails clsBranchDetails = clsBranch.Details(Int32.Parse(lblBranchID.Text));
                clsBranch.CommitAndDispose();
                lblBranchID.Text = clsBranchDetails.BranchCode;

                HyperLink lnkTerminalCode = (HyperLink)e.Item.FindControl("lnkTerminalCode");
                lnkTerminalCode.Text = dr["TerminalCode"].ToString();

                HyperLink lnkTerminalName = (HyperLink)e.Item.FindControl("lnkTerminalName");
                lnkTerminalName.Text = dr["TerminalName"].ToString();

                HyperLink lnkMachineSerialNo = (HyperLink)e.Item.FindControl("lnkMachineSerialNo");
                lnkMachineSerialNo.Text = dr["MachineSerialNo"].ToString();

                HyperLink lnkAccreditationNo = (HyperLink)e.Item.FindControl("lnkAccreditationNo");
                lnkAccreditationNo.Text = dr["AccreditationNo"].ToString();

                HyperLink      lnkStatus = (HyperLink)e.Item.FindControl("lnkStatus");
                TerminalStatus status    = (TerminalStatus)Enum.Parse(typeof(TerminalStatus), dr["Status"].ToString());
                lnkStatus.Text = status.ToString("G");

                Label lblDateCreated = (Label)e.Item.FindControl("lblDateCreated");
                lblDateCreated.Text = dr["DateCreated"].ToString();

                Label lblMaxReceiptWidth = (Label)e.Item.FindControl("lblMaxReceiptWidth");
                lblMaxReceiptWidth.Text = dr["MaxReceiptWidth"].ToString();

                CheckBox chkIsPrinterAutoCutter = (CheckBox)e.Item.FindControl("chkIsPrinterAutoCutter");
                chkIsPrinterAutoCutter.Checked = Convert.ToBoolean(dr["IsPrinterAutoCutter"]);

                CheckBox chkAutoPrint = (CheckBox)e.Item.FindControl("chkAutoPrint");
                chkAutoPrint.Checked = Convert.ToBoolean(Convert.ToInt16(dr["AutoPrint"].ToString()));

                Label lblPrinterName = (Label)e.Item.FindControl("lblPrinterName");
                lblPrinterName.Text = dr["PrinterName"].ToString();

                Label lblCashDrawerName = (Label)e.Item.FindControl("lblCashDrawerName");
                lblCashDrawerName.Text = dr["CashDrawerName"].ToString();

                CheckBox chkItemVoidConfirmation = (CheckBox)e.Item.FindControl("chkItemVoidConfirmation");
                chkItemVoidConfirmation.Checked = Convert.ToBoolean(dr["ItemVoidConfirmation"]);

                CheckBox chkEnableEVAT = (CheckBox)e.Item.FindControl("chkEnableEVAT");
                chkEnableEVAT.Checked = Convert.ToBoolean(dr["EnableEVAT"]);

                Label lblFormBehavior = (Label)e.Item.FindControl("lblFormBehavior");
                lblFormBehavior.Text = dr["Form_Behavior"].ToString();

                Label lblMarqueeMessage = (Label)e.Item.FindControl("lblMarqueeMessage");
                lblMarqueeMessage.Text = dr["MarqueeMessage"].ToString();

                //For anchor
                HtmlGenericControl divExpCollAsst = (HtmlGenericControl)e.Item.FindControl("divExpCollAsst");

                HtmlAnchor anchorDown = (HtmlAnchor)e.Item.FindControl("anchorDown");
                anchorDown.HRef = "javascript:ToggleDiv('" + divExpCollAsst.ClientID + "')";
            }
        }
Example #9
0
        private void LoadFile()
        {
            Cursor.Current = Cursors.WaitCursor;

            string invfile = "invfiles/" + mclsBranchDetails.BranchCode + ".inv"; //mclsInvLog.LogFile;

            if (!System.IO.File.Exists(invfile))
            {
                Data.BranchDetails clsBranchDetails = mclsBranchDetails;
                mclsInvLog = new InvLog();
                LoadOptions();
                mclsBranchDetails    = clsBranchDetails;
                cmdBranchSelect.Text = mclsBranchDetails.BranchCode;
            }
            else if (System.IO.File.Exists(invfile))
            {
                mdtItems = new System.Data.DataTable("tblInvItems");
                mdtItems.Columns.Add("BarCode");
                mdtItems.Columns.Add("Quantity");
                mdtItems.Columns.Add("Unit");
                mdtItems.Columns.Add("Description");

                using (var reader = new StreamReader(invfile))
                {
                    string line; int iCtr = 0;
                    while ((line = reader.ReadLine()) != null)
                    {
                        if (iCtr >= 4)
                        {
                            string[] item = line.Split('|');
                            mdtItems.Rows.Add(item[0], item[1], item[2], item[3]);
                        }
                        iCtr++;
                    }
                }

                dgvItems.MultiSelect         = false;
                dgvItems.AutoGenerateColumns = true;
                dgvItems.AutoSize            = true;
                dgvItems.ScrollBars          = ScrollBars.Vertical;
                dgvItems.DataSource          = mdtItems.TableName;
                dgvItems.DataSource          = mdtItems;

                dgvItems.Columns["BarCode"].Visible     = true;
                dgvItems.Columns["Quantity"].Visible    = true;
                dgvItems.Columns["Unit"].Visible        = true;
                dgvItems.Columns["Description"].Visible = true;

                dgvItems.Columns["BarCode"].HeaderText     = "BarCode";
                dgvItems.Columns["Quantity"].HeaderText    = "Quantity";
                dgvItems.Columns["Unit"].HeaderText        = "Unit";
                dgvItems.Columns["Description"].HeaderText = "Description";

                dgvItems.Columns["BarCode"].DefaultCellStyle.Alignment     = DataGridViewContentAlignment.MiddleLeft;
                dgvItems.Columns["Quantity"].DefaultCellStyle.Alignment    = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Unit"].DefaultCellStyle.Alignment        = DataGridViewContentAlignment.MiddleLeft;
                dgvItems.Columns["Description"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;

                dgvItems.Columns["BarCode"].Width     = 230;
                dgvItems.Columns["Quantity"].Width    = 100;
                dgvItems.Columns["Unit"].Width        = 100;
                dgvItems.Columns["Description"].Width = dgvItems.Width - 450;

                dgvItems.Rows[dgvItems.Rows.Count - 1].Selected = true;
                dgvItems.FirstDisplayedScrollingRowIndex        = dgvItems.Rows.Count - 1;

                mclsInvLog.LogFile = invfile;
            }
            Cursor.Current = Cursors.Default;
        }
Example #10
0
        private void Main_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            switch (e.KeyData)
            {
            case Keys.F2:       // clear inventory file
                if (mclsBranchDetails.BranchID == 0)
                {
                    MessageBox.Show("Please select the branch to clear the inventory file.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cmdBranchSelect.Focus();
                    return;
                }
                if (MessageBox.Show("Are you sure you want to clear the inventory file of branch " + mclsBranchDetails.BranchCode + "?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                {
                    Data.BranchDetails clsBranchDetails = mclsBranchDetails;
                    if (!Directory.Exists("invfiles/backups/"))
                    {
                        Directory.CreateDirectory("invfiles/backups/");
                    }
                    System.IO.File.Copy(mclsInvLog.LogFile, "invfiles/backups/" + mclsBranchDetails.BranchCode + "_" + DateTime.Now.ToString("yyyyddMMhhmmss") + ".inv");
                    System.IO.File.Delete(mclsInvLog.LogFile);
                    mclsInvLog = new InvLog();
                    LoadOptions();
                    LoadFile();
                    mclsBranchDetails    = clsBranchDetails;
                    cmdBranchSelect.Text = mclsBranchDetails.BranchCode;
                }
                break;

            case Keys.F3:
                LogInWnd login = new LogInWnd();

                login.AccessType = AccessTypes.ZeroOutBranchInventory;
                login.Header     = "Zero Out Inventory of Branch: access validation";
                login.ShowDialog(this);
                DialogResult loginresult = login.Result;
                login.Close();
                login.Dispose();

                if (loginresult == DialogResult.OK)
                {
                    grpSaveToDB.Visible = false;
                    if (mclsBranchDetails.BranchID == 0)
                    {
                        MessageBox.Show("Please select the branch to zero out the inventory.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        cmdBranchSelect.Focus();
                        return;
                    }
                    if (MessageBox.Show("Are you sure you want to ZERO out the inventory of branch " + mclsBranchDetails.BranchCode + "?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                    {
                        grpSaveToDB.Visible = true;
                        Cursor.Current      = Cursors.WaitCursor;

                        this.bgwZeroOutInv.RunWorkerAsync();

                        // Wait for the BackgroundWorker to finish the download.
                        while (this.bgwZeroOutInv.IsBusy)
                        {
                            //prgBar.Increment(1);
                            // Keep UI messages moving, so the form remains
                            // responsive during the asynchronous operation.
                            Application.DoEvents();
                        }
                    }
                }
                break;

            case Keys.F4:
                grpSaveToDB.Visible = false;
                if (mclsBranchDetails.BranchID == 0)
                {
                    MessageBox.Show("Please select the branch to upload the inventory.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cmdBranchSelect.Focus();
                    return;
                }
                if (mdtItems == null || mdtItems.Rows.Count == 0)
                {
                    MessageBox.Show("No rows to upload, please make sure the inventory file is loaded.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (MessageBox.Show("Are you sure you want to UPLOAD the inventory of branch " + mclsBranchDetails.BranchCode + "?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                {
                    grpSaveToDB.Visible = true;
                    Cursor.Current      = Cursors.WaitCursor;

                    this.bgwSavetoDB.RunWorkerAsync();

                    // Wait for the BackgroundWorker to finish the download.
                    while (this.bgwSavetoDB.IsBusy)
                    {
                        //prgBar.Increment(1);
                        // Keep UI messages moving, so the form remains
                        // responsive during the asynchronous operation.
                        Application.DoEvents();
                    }
                }
                break;

            case Keys.F5:
                isLoadInReverse     = false;
                grpSaveToDB.Visible = false;
                if (mclsBranchDetails.BranchID == 0)
                {
                    MessageBox.Show("Please select the branch to zero out the NEGATIVE inventory.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cmdBranchSelect.Focus();
                    return;
                }
                if (MessageBox.Show("Are you sure you want to ZERO out the NEGATIVE  inventory of branch " + mclsBranchDetails.BranchCode + "?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                {
                    grpSaveToDB.Visible = true;
                    Cursor.Current      = Cursors.WaitCursor;

                    this.bgwZeroOutInvNeg.RunWorkerAsync();

                    // Wait for the BackgroundWorker to finish the download.
                    while (this.bgwZeroOutInvNeg.IsBusy)
                    {
                        //prgBar.Increment(1);
                        // Keep UI messages moving, so the form remains
                        // responsive during the asynchronous operation.
                        Application.DoEvents();
                    }
                }
                break;

            case Keys.F7:
                isLoadInReverse = true;

                grpSaveToDB.Visible = false;
                if (mclsBranchDetails.BranchID == 0)
                {
                    MessageBox.Show("Please select the branch to upload the inventory.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cmdBranchSelect.Focus();
                    return;
                }
                if (mdtItems == null || mdtItems.Rows.Count == 0)
                {
                    MessageBox.Show("No rows to upload, please make sure the inventory file is loaded.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (MessageBox.Show("Are you sure you want to UPLOAD the inventory of branch " + mclsBranchDetails.BranchCode + "?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                {
                    grpSaveToDB.Visible = true;
                    Cursor.Current      = Cursors.WaitCursor;

                    this.bgwSavetoDB.RunWorkerAsync();

                    // Wait for the BackgroundWorker to finish the download.
                    while (this.bgwSavetoDB.IsBusy)
                    {
                        //prgBar.Increment(1);
                        // Keep UI messages moving, so the form remains
                        // responsive during the asynchronous operation.
                        Application.DoEvents();
                    }
                }
                break;

            case Keys.Escape:
                if (MessageBox.Show("Are you sure you want to exit?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                {
                    Application.Exit();
                }
                break;
            }
        }