Exemplo n.º 1
0
        //These update the invoice
        protected void BtnAddCustomer_Click(object sender, EventArgs e)
        {
            string method = "BtnAddCustomer_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Invoice  invoice  = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails)[0];
                Customer customer = new Customer
                {
                    varFirstName         = ((TextBox)GrdCustomersSearched.FooterRow.FindControl("txtFirstName")).Text,
                    varLastName          = ((TextBox)GrdCustomersSearched.FooterRow.FindControl("txtLastName")).Text,
                    varAddress           = "",
                    secondaryAddress     = "",
                    varContactNumber     = ((TextBox)GrdCustomersSearched.FooterRow.FindControl("txtPhoneNumber")).Text,
                    secondaryPhoneNumber = "",
                    bitSendMarketing     = ((CheckBox)GrdCustomersSearched.FooterRow.FindControl("chkMarketingEnrollment")).Checked,
                    varEmailAddress      = ((TextBox)GrdCustomersSearched.FooterRow.FindControl("txtEmail")).Text,
                    billingAddress       = "",
                    varCityName          = "",
                    intProvinceID        = CU.location.intProvinceID,
                    intCountryID         = CU.location.intCountryID,
                    varPostalCode        = ""
                };
                int custNum = CM.CallAddCustomer(customer, objPageDetails);
                customer.intCustomerID = custNum;
                invoice.customer       = customer;
                IM.CallUpdateCurrentInvoice(invoice, objPageDetails);
                UpdateInvoiceTotals();
                Session["currentInvoice"] = invoice;
                var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
                nameValues.Set("invoice", invoice.intInvoiceID.ToString());
                nameValues.Set("customer", invoice.customer.intCustomerID.ToString());
                Response.Redirect(Request.Url.AbsolutePath + "?" + nameValues, false);
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 2
0
        protected void BtnRemoveLiqTax(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "btnRemoveLiqTax";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                TaxManager TM      = new TaxManager();
                Invoice    invoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails)[0];
                bool       chargeLCT;
                if (!BtnRemoveLiq.Text.Contains("Remove"))
                {
                    chargeLCT = true;
                }
                else
                {
                    chargeLCT = false;
                }
                foreach (InvoiceItems invoiceItem in invoice.invoiceItems)
                {
                    foreach (InvoiceItemTax invoiceItemTax in invoiceItem.invoiceItemTaxes)
                    {
                        if (invoiceItemTax.intTaxTypeID == TM.GatherTaxIDFromString("LCT", objPageDetails))
                        {
                            invoiceItemTax.bitIsTaxCharged = chargeLCT;
                        }
                    }
                    IIM.CallUpdateItemTaxesFromCurrentSalesTableActualQuery(invoiceItem, invoice.intTransactionTypeID, objPageDetails);
                }

                IM.CallUpdateCurrentInvoice(invoice, objPageDetails);
                UpdatePageTotals();
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void GrdReturningItems_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //Collects current method for error tracking
            string method = "GrdReturningItems_RowDeleting";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Invoice returnInvoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"]), CU.location.intProvinceID, objPageDetails)[0];
                lblInvalidQty.Visible = false;
                //Gathers index from selected line item
                int index = e.RowIndex;
                //Stores the info about the item in that index
                int          invoiceItemReturnID = Convert.ToInt32(((Label)GrdReturningItems.Rows[index].Cells[0].FindControl("lblInvoiceItemReturnID")).Text);
                InvoiceItems selectedSku         = IIM.ReturnSkuFromCurrentSalesUsingSKU(invoiceItemReturnID, returnInvoice.dtmInvoiceDate, CU.location.intProvinceID, objPageDetails);

                //add item to table and remove the added qty from current inventory
                IIM.DoNotReturnTheItemOnReturn(selectedSku, objPageDetails);
                IIM.CallRemoveQTYFromInventoryWithSKU(selectedSku.intInventoryID, selectedSku.intItemTypeID, (IIM.ReturnCurrentQuantityOfItem(selectedSku, objPageDetails) - selectedSku.intItemQuantity), objPageDetails);
                //deselect the indexed item
                GrdReturningItems.EditIndex = -1;
                //Check if the marked for returns cart has any items in it
                GrdInvoicedItems.DataSource = IIM.CallReturnInvoiceItemsFromProcessedSalesForReturn(returnInvoice.varInvoiceNumber, returnInvoice.dtmInvoiceDate, CU.location.intProvinceID, objPageDetails);
                GrdInvoicedItems.DataBind();

                returnInvoice = IM.CallReturnCurrentInvoice(returnInvoice.intInvoiceID, CU.location.intProvinceID, objPageDetails)[0];
                IM.CalculateNewInvoiceReturnTotalsToUpdate(returnInvoice, objPageDetails);

                GrdReturningItems.DataSource = returnInvoice.invoiceItems;
                GrdReturningItems.DataBind();

                //recalculate the return total
                lblReturnSubtotalDisplay.Text = "$ " + returnInvoice.fltSubTotal.ToString("#0.00");
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 4
0
        protected void GrdTaxList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            string method = "GrdTaxesOverall_RowDataBound";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                // check row type
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    colGST += Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltGovernmentTaxAmountCollected"));
                    colPST += Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltProvincialTaxAmountCollected"));
                    colLCT += Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltLiquorTaxAmountCollected"));
                    retGST += Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltGovernmentTaxAmountReturned"));
                    retPST += Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltProvincialTaxAmountReturned"));
                    retLCT += Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltLiquorTaxAmountReturned"));
                    ovrGST += Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltGovernmentTaxAmountCollected")) + Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltGovernmentTaxAmountReturned"));
                    ovrPST += Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltProvincialTaxAmountCollected")) + Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltProvincialTaxAmountReturned"));
                    ovrLCT += Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltLiquorTaxAmountCollected")) + Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltLiquorTaxAmountReturned"));
                }
                else if (e.Row.RowType == DataControlRowType.Footer)
                {
                    e.Row.Cells[1].Text = String.Format("{0:C}", colGST);
                    e.Row.Cells[2].Text = String.Format("{0:C}", colPST);
                    e.Row.Cells[3].Text = String.Format("{0:C}", colLCT);
                    e.Row.Cells[4].Text = String.Format("{0:C}", retGST);
                    e.Row.Cells[5].Text = String.Format("{0:C}", retPST);
                    e.Row.Cells[6].Text = String.Format("{0:C}", retLCT);
                    e.Row.Cells[7].Text = String.Format("{0:C}", ovrGST);
                    e.Row.Cells[8].Text = String.Format("{0:C}", ovrPST);
                    e.Row.Cells[9].Text = String.Format("{0:C}", ovrLCT);
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void BtnProcessCashOut_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "btnProcessCashOut_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Reports R         = new Reports();
                int     indicator = R.VerifyCashoutCanBeProcessed(CU.location.intLocationID, CalSearchDate.SelectedDate, objPageDetails);
                //Check to see if there are sales first
                if (indicator == 0)
                {
                    R.RemoveUnprocessedReturns(CU.location.intLocationID, CalSearchDate.SelectedDate, objPageDetails);
                    var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
                    nameValues.Set("selectedDate", CalSearchDate.SelectedDate.ToShortDateString());
                    nameValues.Set("location", CU.location.intLocationID.ToString());
                    //Changes to the Reports Cash Out page
                    Response.Redirect("SalesCashOut.aspx?" + nameValues, false);
                }
                else if (indicator == 1)
                {
                    MessageBoxCustom.ShowMessage("No transactions have been processed for selected date.", this);
                }
                else if (indicator == 2)
                {
                    MessageBoxCustom.ShowMessage("There are still open transactions that need to be processed or cancelled.", this);
                }
                else if (indicator == 3)
                {
                    MessageBoxCustom.ShowMessage("A cashout has already been completed for selected date.", this);
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "ReportsTaxes.aspx";
            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //checks if the user has logged in
                if (Session["currentUser"] == null)
                {
                    //Go back to Login to log in
                    Server.Transfer("LoginPage.aspx", false);
                }
                else
                {
                    CU = (CurrentUser)Session["currentUser"];
                    //Gathering the start and end dates
                    object[]   passing     = (object[])Session["reportInfo"];
                    DateTime[] reportDates = (DateTime[])passing[0];
                    DateTime   startDate   = reportDates[0];
                    DateTime   endDate     = reportDates[1];
                    //Builds string to display in label
                    lblTaxDate.Text = "Taxes Through: " + startDate.ToString("dd/MMM/yy") + " to " + endDate.ToString("dd/MMM/yy") + " for " + LM.CallReturnLocationName(Convert.ToInt32(passing[1]), objPageDetails);
                    //Creating a cashout list and calling a method that grabs all mops and amounts paid
                    List <TaxReport> taxReport = R.CallReturnTaxReportDetails(startDate, endDate, Convert.ToInt32(passing[1]), objPageDetails);

                    GrdTaxList.DataSource = taxReport;
                    GrdTaxList.DataBind();
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "ReportsCashOut";
            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //checks if the user has logged in
                if (Session["currentUser"] == null)
                {
                    //Go back to Login to log in
                    Server.Transfer("LoginPage.aspx", false);
                }
                else
                {
                    CU = (CurrentUser)Session["currentUser"];
                    if (!IsPostBack)
                    {
                        //Gathering the start and end dates
                        object[]   passing     = (object[])Session["reportInfo"];
                        DateTime[] reportDates = (DateTime[])passing[0];
                        DateTime   startDate   = reportDates[0];
                        DateTime   endDate     = reportDates[1];
                        lblDates.Text = "Cashout report for: " + startDate.ToString("dd/MMM/yy") + " to " + endDate.ToString("dd/MMM/yy") + " for " + LM.CallReturnLocationName(Convert.ToInt32(passing[1]), objPageDetails);
                        dt            = R.CallReturnCashoutsForSelectedDates(passing, objPageDetails);
                        GrdCashoutByDate.DataSource = dt;
                        GrdCashoutByDate.DataBind();
                    }
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 8
0
        private void ButtonDisable(double rb)
        {
            string method = "buttonDisable";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                if (rb >= -.001 && rb <= 0.001)
                {
                    if (IM.CallVerifyMOPHasBeenAdded(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails))
                    {
                        MopCash.Enabled = false;
                    }
                    else
                    {
                        MessageBoxCustom.ShowMessage("At least one method of payment "
                                                     + "is required even for a $0.00 sale.", this);
                    }
                    MopDebit.Enabled      = false;
                    MopGiftCard.Enabled   = false;
                    MopMasterCard.Enabled = false;
                    MopVisa.Enabled       = false;
                }
                else
                {
                    MopCash.Enabled       = true;
                    MopDebit.Enabled      = true;
                    MopGiftCard.Enabled   = true;
                    MopMasterCard.Enabled = true;
                    MopVisa.Enabled       = true;
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive the message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 9
0
        protected void BtnSavePassword_Click(object sender, EventArgs e)
        {
            string method = "BtnSavePassword_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Compare the 2 passwords entered to make sure they are identical
                if (Convert.ToInt32(txtNewPassword.Text) == Convert.ToInt32(txtNewPassword2.Text))
                {
                    //Call method to add the new password
                    bool bolAdded = EM.CallSaveNewPassword(Convert.ToInt32(Request.QueryString["employee"].ToString()), Convert.ToInt32(txtNewPassword.Text), objPageDetails);
                    //Check if the password was added or not
                    if (!bolAdded)
                    {
                        //The password was not added because it is already in use by employee
                        MessageBoxCustom.ShowMessage("The password supplied is not available. Please try another password.", this);
                    }
                    else
                    {
                        //The password was added, advise user and return to employee viewing
                        MessageBoxCustom.ShowMessage("New password for employee saved.", this);
                        BtnCancel_Click(sender, e);
                    }
                }
                else
                {
                    //Passwords do not match
                    MessageBoxCustom.ShowMessage("The passwords do not match. Please retype the passwords again.", this);
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "ReportsCostOfInventory";
            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //checks if the user has logged in
                if (Session["currentUser"] == null)
                {
                    //Go back to Login to log in
                    Server.Transfer("LoginPage.aspx", false);
                }
                else
                {
                    CU = (CurrentUser)Session["currentUser"];
                    //Binding the gridview
#pragma warning disable IDE0067 // Dispose objects before losing scope
                    DataTable list = new DataTable();
#pragma warning restore IDE0067 // Dispose objects before losing scope
                    list = R.CallCostOfInventoryReport(objPageDetails);
                    //Checking if there are any values
                    if (list.Rows.Count > 0)
                    {
                        grdCostOfInventory.DataSource = list;
                        grdCostOfInventory.DataBind();
                    }
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 11
0
        protected void CalEnd_SelectionChanged(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "calEnd_SelectionChanged";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try { }
            //Exception catch
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 12
0
        //Cancelling the trade-in item
        protected void BtnCancel_Click(object sender, EventArgs e)
        {
            string method = "BtnCancel_Click";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                string redirect = "<script>window.close('TradeINEntry.aspx');</script>";
                Response.Write(redirect);
            }
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void BtnEditCustomer_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnEditCustomer_Click";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //transfers data from label into textbox for editing
                txtFirstName.Enabled            = true;
                txtLastName.Enabled             = true;
                txtPrimaryAddress.Enabled       = true;
                txtSecondaryAddress.Enabled     = true;
                txtPrimaryPhoneNumber.Enabled   = true;
                txtSecondaryPhoneNumber.Enabled = true;
                txtEmail.Enabled      = true;
                chkEmailList.Enabled  = true;
                txtCity.Enabled       = true;
                DdlCountry.Enabled    = true;
                ddlProvince.Enabled   = true;
                txtPostalCode.Enabled = true;
                //hides and displays the proper buttons for access
                BtnSaveCustomer.Visible        = true;
                pnlDefaultButton.DefaultButton = "btnSaveCustomer";
                BtnEditCustomer.Visible        = false;
                BtnAddCustomer.Visible         = false;
                BtnStartSale.Visible           = false;
                BtnCancel.Visible       = true;
                BtnBackToSearch.Visible = false;
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 14
0
        protected void BtnProcessReport_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnProcessReport_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                CalculteMethod();
                object[] args    = { DateTime.Parse(Request.QueryString["selectedDate"].ToString()), Convert.ToInt32(Request.QueryString["location"].ToString()) };
                Cashout  cashout = R.CallSelectedCashoutToReturn(args, objPageDetails);

                //Creates new cashout
                cashout.fltManuallyCountedBasedOnReceiptsTradeIn    = Convert.ToDouble(txtTradeIn.Text);
                cashout.fltManuallyCountedBasedOnReceiptsGiftCard   = Convert.ToDouble(txtGiftCard.Text);
                cashout.fltManuallyCountedBasedOnReceiptsCash       = Convert.ToDouble(txtCash.Text);
                cashout.fltManuallyCountedBasedOnReceiptsDebit      = Convert.ToDouble(txtDebit.Text);
                cashout.fltManuallyCountedBasedOnReceiptsMastercard = Convert.ToDouble(txtMasterCard.Text);
                cashout.fltManuallyCountedBasedOnReceiptsVisa       = Convert.ToDouble(txtVisa.Text);
                cashout.fltCashDrawerOverShort = double.Parse(lblOverShortFinal.Text, NumberStyles.Currency);
                cashout.bitIsCashoutProcessed  = true;
                cashout.bitIsCashoutFinalized  = false;
                cashout.intEmployeeID          = CU.employee.intEmployeeID;

                R.CallUpdateCashout(cashout, objPageDetails);

                MessageBoxCustom.ShowMessage("Cashout has been processed", this);
                btnPrint.Enabled         = true;
                BtnProcessReport.Enabled = false;
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 15
0
        //private static Invoice invoice;
        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "SalesCheckout.aspx";
            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //checks if the user has logged in
                if (Session["currentUser"] == null)
                {
                    //Go back to Login to log in
                    Response.Redirect("LoginPage.aspx", false);
                }
                else
                {
                    CU = (CurrentUser)Session["currentUser"];
                    if (!Page.IsPostBack)
                    {
                        //List<Tax> t = new List<Tax>();
                        //TaxManager TM = new TaxManager();

                        //Checks if shipping was charged
                        //Invoice invoice = IM.ReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), CU.location.intProvinceID, objPageDetails)[0];
                        Invoice invoice = (Invoice)Session["currentInvoice"];
                        UpdatePageTotals();
                    }
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 16
0
        protected void BtnAddPurchase_Click(object sender, EventArgs e)
        {
            //Collects current method error tracking
            string method = "BtnAddPurchase_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Invoice      receipt       = IM.CallReturnCurrentPurchaseInvoice(Convert.ToInt32(Request.QueryString["receipt"]), CU.location.intProvinceID, objPageDetails)[0];
                string[]     inventoryInfo = ItM.CallReserveTradeInSKU(CU, objPageDetails);
                InvoiceItems purchItem     = new InvoiceItems
                {
                    intInventoryID       = Convert.ToInt32(inventoryInfo[1]),
                    varSku               = inventoryInfo[0].ToString(),
                    intItemQuantity      = 1,
                    varItemDescription   = "",
                    fltItemCost          = 0.00,
                    intInvoiceID         = receipt.intInvoiceID,
                    fltItemDiscount      = 0,
                    fltItemRefund        = 0,
                    fltItemPrice         = 0,
                    bitIsDiscountPercent = false,
                    bitIsClubTradeIn     = false,
                    intItemTypeID        = 1
                };

                IIM.CallInsertItemIntoSalesCart(purchItem, receipt.intTransactionTypeID, receipt.dtmInvoiceDate, CU.location.intProvinceID, objPageDetails);
                //Bind items in cart to grid view
                UpdateReceiptTotal();
            }
            //Exception catch
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]), method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 17
0
        protected void GrdCashoutByDate_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "GrdCashoutByDate_RowCommand";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                if (e.CommandName == "EditCashout")
                {
                    string arg        = e.CommandArgument.ToString();
                    var    nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
                    nameValues.Set("selectedDate", arg.Split(' ')[0]);
                    nameValues.Set("location", arg.Split(' ')[1]);
                    //Changes to the Reports Cash Out page
                    Response.Redirect("SalesCashOut.aspx?" + nameValues, false);
                }
                else if (e.CommandName == "FinalizeCashout")
                {
                    R.CallFinalizeCashout(e.CommandArgument.ToString(), objPageDetails);
                    object[]   passing     = (object[])Session["reportInfo"];
                    DateTime[] reportDates = (DateTime[])passing[0];
                    DateTime   startDate   = reportDates[0];
                    DateTime   endDate     = reportDates[1];
                    int        locationID  = Convert.ToInt32(passing[1]);
                    dt = R.CallReturnCashoutsForSelectedDates(passing, objPageDetails);
                    GrdCashoutByDate.DataSource = dt;
                    GrdCashoutByDate.DataBind();
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "InvoiceSearch.aspx";
            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //checks if the user has logged in
                if (Session["currentUser"] == null)
                {
                    //Go back to Login to log in
                    Response.Redirect("LoginPage.aspx", false);
                }
                else
                {
                    CU = (CurrentUser)Session["currentUser"];
                    if (!IsPostBack)
                    {
                        //Sets the calendar and text boxes start and end dates
                        CalStartDate.SelectedDate = DateTime.Today;
                        CalEndDate.SelectedDate   = DateTime.Today;
                        ddlLocation.DataSource    = LM.CallReturnLocationDropDown(objPageDetails);
                        ddlLocation.DataBind();
                        ddlLocation.SelectedValue = CU.location.intLocationID.ToString();
                    }
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void BtnAddCustomer_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnAddCustomer_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Collects new customer data to add to database
                Customer customer = new Customer
                {
                    varFirstName         = txtFirstName.Text,
                    varLastName          = txtLastName.Text,
                    varAddress           = txtPrimaryAddress.Text,
                    secondaryAddress     = txtSecondaryAddress.Text,
                    varContactNumber     = txtPrimaryPhoneNumber.Text,
                    secondaryPhoneNumber = txtSecondaryPhoneNumber.Text,
                    bitSendMarketing     = chkEmailList.Checked,
                    varEmailAddress      = txtEmail.Text,
                    varCityName          = txtCity.Text,
                    intProvinceID        = Convert.ToInt32(ddlProvince.SelectedValue),
                    intCountryID         = Convert.ToInt32(DdlCountry.SelectedValue),
                    varPostalCode        = txtPostalCode.Text
                };

                var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
                nameValues.Set("customer", CM.CallAddCustomer(customer, objPageDetails).ToString());
                Response.Redirect(Request.Url.AbsolutePath + "?" + nameValues, false);
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        //protected void BtnExportInvoices_Click(object sender, EventArgs e)
        //{
        //    //Collects current method for error tracking
        //    string method = "BtnExportInvoices_Click";
        //    //object[] objPageDetails = { Session["currPage"].ToString(), method };
        //    try
        //    {
        //        //Sets up database connection
        //        string connectionString = ConfigurationManager.ConnectionStrings["SweetSpotDevConnectionString"].ConnectionString;
        //        SqlConnection sqlCon = new SqlConnection(connectionString);
        //        //Selects everything form the invoice table
        //        DataTable dtim = new DataTable();
        //        using (var cmd = new SqlCommand("getInvoiceAll", sqlCon)) //Calling the SP
        //        using (var da = new SqlDataAdapter(cmd))
        //        {
        //            //Executing the SP
        //            cmd.CommandType = CommandType.StoredProcedure;
        //            da.Fill(dtim);
        //        }
        //        DataColumnCollection dcimHeaders = dtim.Columns;
        //        //Selects everything form the invoice item table
        //        DataTable dtii = new DataTable();
        //        using (var cmd = new SqlCommand("getInvoiceItemAll", sqlCon)) //Calling the SP
        //        using (var da = new SqlDataAdapter(cmd))
        //        {
        //            //Executing the SP
        //            cmd.CommandType = CommandType.StoredProcedure;
        //            da.Fill(dtii);
        //        }
        //        DataColumnCollection dciiHeaders = dtii.Columns;
        //        //Selects everything form the invoice mop table
        //        DataTable dtimo = new DataTable();
        //        using (var cmd = new SqlCommand("getInvoiceMOPAll", sqlCon)) //Calling the SP
        //        using (var da = new SqlDataAdapter(cmd))
        //        {
        //            //Executing the SP
        //            cmd.CommandType = CommandType.StoredProcedure;
        //            da.Fill(dtimo);
        //        }
        //        DataColumnCollection dcimoHeaders = dtimo.Columns;
        //        //Sets path and file name to download report to
        //        string pathUser = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
        //        string pathDownload = (pathUser + "\\Downloads\\");
        //        FileInfo newFile = new FileInfo(pathDownload + "InvoiceReport.xlsx");
        //        using (ExcelPackage xlPackage = new ExcelPackage(newFile))
        //        {
        //            //Creates a seperate sheet for each data table
        //            ExcelWorksheet invoiceMain = xlPackage.Workbook.Worksheets.Add("Invoice Main");
        //            ExcelWorksheet invoiceItems = xlPackage.Workbook.Worksheets.Add("Invoice Items");
        //            ExcelWorksheet invoiceMOPS = xlPackage.Workbook.Worksheets.Add("Invoice MOPS");
        //            // write to sheet

        //            //Export main invoice
        //            for (int i = 1; i <= dtim.Rows.Count; i++)
        //            {
        //                for (int j = 1; j < dtim.Columns.Count + 1; j++)
        //                {
        //                    if (i == 1)
        //                    {
        //                        invoiceMain.Cells[i, j].Value = dcimHeaders[j - 1].ToString();
        //                    }
        //                    else
        //                    {
        //                        invoiceMain.Cells[i, j].Value = dtim.Rows[i - 1][j - 1];
        //                    }
        //                }
        //            }
        //            //Export item invoice
        //            for (int i = 1; i <= dtii.Rows.Count; i++)
        //            {
        //                for (int j = 1; j < dtii.Columns.Count + 1; j++)
        //                {
        //                    if (i == 1)
        //                    {
        //                        invoiceItems.Cells[i, j].Value = dciiHeaders[j - 1].ToString();
        //                    }
        //                    else
        //                    {
        //                        invoiceItems.Cells[i, j].Value = dtii.Rows[i - 1][j - 1];
        //                    }
        //                }
        //            }
        //            //Export mop invoice
        //            for (int i = 1; i <= dtimo.Rows.Count; i++)
        //            {
        //                for (int j = 1; j < dtimo.Columns.Count + 1; j++)
        //                {
        //                    if (i == 1)
        //                    {
        //                        invoiceMOPS.Cells[i, j].Value = dcimoHeaders[j - 1].ToString();
        //                    }
        //                    else
        //                    {
        //                        invoiceMOPS.Cells[i, j].Value = dtimo.Rows[i - 1][j - 1];
        //                    }
        //                }
        //            }
        //            Response.Clear();
        //            Response.AddHeader("content-disposition", "attachment; filename=InvoiceReport.xlsx");
        //            Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
        //            Response.BinaryWrite(xlPackage.GetAsByteArray());
        //            Response.End();
        //        }
        //    }
        //    //Exception catch
        //    catch (ThreadAbortException tae) { }
        //    catch (Exception ex)
        //    {
        //        //Log all info into error table
        //        ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
        //        //Display message box
        //        MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
        //            + "If you continue to receive this message please contact "
        //            + "your system administrator.", this);
        //    }
        //}
        protected void DdlProvince_SelectedIndexChanged(object sender, EventArgs e)
        {
            string method = "DdlProvince_SelectedIndexChanged";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                DdlTax.DataSource = TM.GatherTaxListFromDateAndProvince(Convert.ToInt32(DdlProvince.SelectedValue), Convert.ToDateTime(lblCurrentDate.Text), objPageDetails);
                DdlTax.DataBind();
            }
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        public void CallJS()
        {
            string method = "CallJS";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "upl", "UpdateProgressLabel();", true);
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 22
0
        protected void BtnRefreshCart_Click(object sender, EventArgs e)
        {
            string method = "BtnRefreshCart_Click";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                BtnRefreshCart.Visible = false;
                UpdateInvoiceTotals();
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "SalesHomePage.aspx";
            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //checks if the user has logged in
                if (Session["currentUser"] == null)
                {
                    //Go back to Login to log in
                    Response.Redirect("LoginPage.aspx", false);
                }
                else
                {
                    CU = (CurrentUser)Session["currentUser"];
                    if (!IsPostBack)
                    {
                        CalSearchDate.SelectedDate = DateTime.Today;
                        //Binds invoice list to the grid view
                        GrdCurrentOpenSales.DataSource = IM.CallReturnCurrentOpenInvoices(CU.location.intLocationID, CU.location.intProvinceID, objPageDetails);
                        GrdCurrentOpenSales.DataBind();
                    }
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 24
0
        //Similar to the COGSvsPM report with a little more detail
        //only fixed download
        protected void BtnExtensiveInvoice_Click(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "btnExtensiveInvoice_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                object[] reportLog = { 11, CU.employee.intEmployeeID, CU.location.intLocationID };
                R.CallReportLogger(reportLog, objPageDetails);
                DateTime[] dtm       = GetDateRange();
                int        loc       = Convert.ToInt32(ddlLocation.SelectedValue);
                object[]   repInfo   = new object[] { dtm, loc };
                int        indicator = R.VerifySalesHaveBeenMade(repInfo, objPageDetails);
                //Check to see if there are sales first
                if (indicator == 0)
                {
                    Session["reportInfo"] = repInfo;
                    Response.Redirect("ReportsExtensiveInvoice.aspx", false);
                }
                else if (indicator == 1)
                {
                    MessageBoxCustom.ShowMessage("No sales have been processed for selected dates.", this);
                }
            }
            //Exception catch
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]), method, this);
                //string prevPage = Convert.ToString(Session["prevPage"]);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
                //Server.Transfer(prevPage, false);
            }
        }
Exemplo n.º 25
0
        protected void RdbInStorePurchase_CheckedChanged(object sender, EventArgs e)
        {
            string method = "RdbInStorePurchase_CheckedChanged";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                if (RdbShipping.Checked)
                {
                    DdlShippingProvince.Enabled = true;
                    DdlShippingProvince.Visible = true;
                }
                else
                {
                    DdlShippingProvince.Enabled = false;
                    DdlShippingProvince.Visible = false;

                    Invoice invoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails)[0];
                    invoice.intShippingProvinceID = CU.location.intProvinceID;
                    invoice.fltShippingCharges    = 0;
                    txtShippingAmount.Text        = invoice.fltShippingCharges.ToString();
                    TM.ChangeProvinceTaxesBasedOnShipping(Convert.ToInt32(Request.QueryString["invoice"].ToString()), invoice.intShippingProvinceID, objPageDetails);
                    //Session["currentInvoice"] = invoice;
                    DdlShippingProvince.SelectedValue = CU.location.intProvinceID.ToString();
                }
                UpdateInvoiceTotals();
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 26
0
        protected void BtnCustomerSelect_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnCustomerSelect_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                if (BtnCustomerSelect.Text == "Cancel")
                {
                    BtnCustomerSelect.Text       = "Change Customer";
                    GrdCustomersSearched.Visible = false;
                    Customer C = CM.CallReturnCustomer(Convert.ToInt32(Request.QueryString["customer"].ToString()), objPageDetails)[0];
                    //Set name in text box
                    txtCustomer.Text = C.varFirstName + " " + C.varLastName;
                }
                else
                {
                    GrdCustomersSearched.Visible    = true;
                    GrdCustomersSearched.DataSource = CM.CallReturnCustomerBasedOnText(txtCustomer.Text, objPageDetails);
                    GrdCustomersSearched.DataBind();
                    if (GrdCustomersSearched.Rows.Count > 0)
                    {
                        BtnCustomerSelect.Text = "Cancel";
                    }
                }
            }
            //Exception catch
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]), method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 27
0
        //protected void btnLayaway_Click(object sender, EventArgs e)
        //{
        //    //Collects current method for error tracking
        //    string method = "btnLayaway_Click";
        //    object[] objPageDetails = { Session["currPage"].ToString(), method };
        //    try
        //    {
        //        //TaxManager TM = new TaxManager();
        //        //Invoice I = IM.ReturnCurrentInvoice(Request.QueryString["inv"].ToString(), objPageDetails)[0];
        //        //object[] taxText = { "Remove GST", "Remove PST" };
        //        //object[] results = TM.ReturnChargedTaxForSale(I, taxText, objPageDetails);
        //        //I.transactionType = 6;
        //        //IM.UpdateCurrentInvoice(I, objPageDetails);
        //        //Response.Redirect("HomePage.aspx", false);
        //    }
        //    //Exception catch
        //    catch (ThreadAbortException tae) { }
        //    catch (Exception ex)
        //    {
        //        //Log all info into error table
        //        ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
        //        //Display message box
        //        MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
        //            + "If you continue to receive this message please contact "
        //            + "your system administrator.", this);
        //    }
        //}
        protected void BtnReturnToCart_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "btnReturnToCart_Click";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Invoice I = IM.ReturnCurrentInvoice(Request.QueryString["inv"].ToString(), objPageDetails)[0];
                //object[] taxText = { "Remove GST", "Remove PST" };
                //if ((btnRemoveGov.Text).Split(' ')[0] != "Remove")
                //{
                //    taxText[0] = "Do Nothing";
                //}
                //if ((btnRemoveProv.Text).Split(' ')[0] != "Remove")
                //{
                //    taxText[1] = "Do Nothing";
                //}
                //TaxManager TM = new TaxManager();
                //object[] results = TM.ReturnChargedTaxForSale(invoice, taxText, objPageDetails); //UPDATING THE CURRENT SALES TABLE
                //Sets session to true
                var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
                nameValues.Set("customer", Request.QueryString["customer"].ToString());
                nameValues.Set("invoice", Request.QueryString["invoice"].ToString());
                //Changes to Sales Cart page
                Response.Redirect("SalesCart.aspx?" + nameValues, false);
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void BtnBackToSearch_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnBackToSearch_Click";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Changes page to the inventory home page
                Response.Redirect("InventoryHomePage.aspx", false);
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        //Searches invoices and displays them
        //By date or customer
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnSearch_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                GrdInvoiceSelection.DataSource = IM.CallReturnInvoicesBasedOnSearchForReturns(txtInvoiceSearch.Text, CalSearchDate.SelectedDate, objPageDetails);
                GrdInvoiceSelection.DataBind();
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void BtnSaveTheTax_Click(object sender, EventArgs e)
        {
            string method = "BtnSaveTheTax_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                TM.CallInsertNewTaxRate(Convert.ToInt32(DdlProvince.SelectedValue), Convert.ToInt32(DdlTax.SelectedValue), Convert.ToDateTime(txtDate.Text), Convert.ToDouble(txtNewRate.Text), objPageDetails);
                txtDate.Text    = "";
                txtNewRate.Text = "";
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }