Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string method = "Page_Load";

            Session["currPage"] = "TradeINEntry.aspx";
            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                CU = (CurrentUser)Session["currentUser"];
                if (!IsPostBack)
                {
                    invoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"]), CU.location.intProvinceID, objPageDetails)[0];

                    string[] inventoryInfo = ItM.CallReserveTradeInSKU(CU, objPageDetails);
                    inventoryID = Convert.ToInt32(inventoryInfo[1]);

                    lblSKUDisplay.Text  = inventoryInfo[0].ToString();
                    ddlBrand.DataSource = ItM.CallReturnDropDownForBrand(objPageDetails);
                    ddlBrand.DataBind();

                    ddlModel.DataSource = ItM.CallReturnDropDownForModel(objPageDetails);
                    ddlModel.DataBind();
                    ddlModel.SelectedValue = "2624"; //"2426"; // is the testing value for 'Customer Trade'
                }
            }
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //string prevPage = Convert.ToString(Session["prevPage"]);
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "CustomerHomePage";
            //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"];
                }
            }
            //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"] = "ReportsSales";
            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];
                    int        locationID  = (int)passing[1];

                    //Calendar calStartDate = (Calendar)Master.FindControl("form1").FindControl("SPMaster").FindControl("tblReportCriteriaSelection").FindControl("calStartDate");
                    //calStartDate.SelectedDate = startDate;

                    //Calendar calEndDate = (Calendar)CustomExtensions.CallFindControlRecursive(Master, "calEndDate");
                    //calEndDate.SelectedDate = endDate;

                    //Builds string to display in label
                    if (startDate == endDate)
                    {
                        lblDates.Text = "Items sold on: " + startDate.ToString("dd/MMM/yy") + " for " + LM.CallReturnLocationName(locationID, objPageDetails);
                    }
                    else
                    {
                        lblDates.Text = "Items sold on: " + startDate.ToString("dd/MMM/yy") + " to " + endDate.ToString("dd/MMM/yy") + " for " + LM.CallReturnLocationName(locationID, objPageDetails);
                    }
                    DataTable dt = R.CallReturnSalesForSelectedDate(passing, objPageDetails);
                    GrdSalesByDate.DataSource = dt;
                    GrdSalesByDate.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);
            }
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "ReportsMostSold";
            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];
                    int        locationID  = (int)passing[1];
                    //Builds string to display in label
                    if (startDate == endDate)
                    {
                        lblDates.Text = "Items sold for: " + startDate.ToString("dd/MMM/yy") + " for " + LM.CallReturnLocationName(locationID, objPageDetails);
                    }
                    else
                    {
                        lblDates.Text = "Items sold for: " + startDate.ToString("dd/MMM/yy") + " to " + endDate.ToString("dd/MMM/yy") + " for " + LM.CallReturnLocationName(locationID, objPageDetails);
                    }
                    //Binding the gridview
                    items  = R.CallMostSoldItemsReport(startDate, endDate, locationID, objPageDetails);
                    brands = R.CallMostSoldBrandsReport(startDate, endDate, locationID, objPageDetails);
                    models = R.CallMostSoldModelsReport(startDate, endDate, locationID, objPageDetails);
                    grdItems.DataSource = items;
                    grdItems.DataBind();
                    grdBrands.DataSource = brands;
                    grdBrands.DataBind();
                    grdModels.DataSource = models;
                    grdModels.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"] = "ReportsExtensiveInvoice.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[]   repInfo     = (object[])Session["reportInfo"];
                    DateTime[] reportDates = (DateTime[])repInfo[0];
                    DateTime   startDate   = reportDates[0];
                    DateTime   endDate     = reportDates[1];
                    int        locationID  = Convert.ToInt32(repInfo[1]);
                    //Builds string to display in label
                    if (startDate == endDate)
                    {
                        lblDates.Text = "Extensive Invoice Report on: " + startDate.ToString("dd/MMM/yy") + " for " + LM.CallReturnLocationName(locationID, objPageDetails);
                    }
                    else
                    {
                        lblDates.Text = "Extensive Invoice Report on: " + startDate.ToString("dd/MMM/yy") + " to " + endDate.ToString("dd/MMM/yy") + " for " + LM.CallReturnLocationName(locationID, objPageDetails);
                    }
                    //DataTable invoices = R.returnExtensiveInvoices(startDate, endDate, locationID, objPageDetails);

                    DataTable invoices2 = R.CallReturnExtensiveInvoices2(startDate, endDate, locationID, objPageDetails);
                    GrdInvoices.DataSource = invoices2;
                    GrdInvoices.DataBind();
                }
            }
            //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);
            }
        }
        //List<Purchases> purch = new List<Purchases>();

        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "ReportsPurchasesMade.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[]   repInfo     = (object[])Session["reportInfo"];
                    DateTime[] reportDates = (DateTime[])repInfo[0];
                    DateTime   startDate   = reportDates[0];
                    DateTime   endDate     = reportDates[1];
                    int        locationID  = (int)repInfo[1];
                    //Builds string to display in label
                    lblPurchasesMadeDate.Text = "Purchases Made Between: " + startDate.ToString("dd/MMM/yy") + " to " + endDate.ToString("dd/MMM/yy") + " for " + LM.CallReturnLocationName(locationID, objPageDetails);
                    //Creating a cashout list and calling a method that grabs all mops and amounts paid
                    //purch = R.returnPurchasesDuringDates(startDate, endDate, locationID, objPageDetails);
                    //grdPurchasesMade.DataSource = purch;
                    //grdPurchasesMade.DataBind();
                    //foreach (GridViewRow row in grdPurchasesMade.Rows)
                    //{
                    //    foreach (TableCell cell in row.Cells)
                    //    {
                    //        cell.Attributes.CssStyle["text-align"] = "center";
                    //    }
                    //}
                }
            }
            //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"] = "HomePage.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)
                    {
                        ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails);
                        ddlLocation.DataBind();
                        ddlLocation.SelectedValue = CU.location.intLocationID.ToString();
                    }
                    //Checks user for admin status
                    if (CU.employee.intJobID == 0)
                    {
                        lbluser.Visible     = true;
                        ddlLocation.Enabled = true;
                    }
                    //populate gridview with todays sales
                    GrdSameDaySales.DataSource = R.CallGetInvoiceBySaleDate(DateTime.Today, DateTime.Today, Convert.ToInt32(ddlLocation.SelectedValue), objPageDetails);
                    GrdSameDaySales.DataBind();
                    MergeRows(GrdSameDaySales);
                }
            }
            //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);
            }
        }
Esempio n. 8
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);
            }
        }
Esempio n. 9
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);
            }
        }
Esempio 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);
            }
        }
        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 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);
            }
        }
Esempio n. 13
0
        //private static Invoice receipt;

        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "PurchasesCart.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
                {
                    Invoice receipt = new Invoice();
                    CU = (CurrentUser)Session["currentUser"];
                    if (!Page.IsPostBack)
                    {
                        if (!IM.CallReturnBolInvoiceExists(Convert.ToInt32(Request.QueryString["receipt"].ToString()), objPageDetails))
                        {
                            receipt.varInvoiceNumber       = IM.CallReturnNextReceiptNumber(CU, objPageDetails);
                            receipt.intInvoiceSubNumber    = 1;
                            receipt.customer               = CM.CallReturnCustomer(Convert.ToInt32(Request.QueryString["customer"].ToString()), objPageDetails)[0];
                            receipt.employee               = CU.employee;
                            receipt.location               = CU.location;
                            receipt.fltGovernmentTaxAmount = 0;
                            receipt.fltProvincialTaxAmount = 0;
                            receipt.intTransactionTypeID   = 5;
                            //receipt.bitChargeGST = false;
                            //receipt.bitChargePST = false;
                            IM.CallCreateInitialTotalsForTable(receipt, objPageDetails);
                        }
                        else
                        {
                            receipt = IM.CallReturnCurrentPurchaseInvoice(Convert.ToInt32(Request.QueryString["receipt"]), CU.location.intProvinceID, objPageDetails)[0];
                        }

                        //Checks if there is a Customer Number stored in the Session

                        //Set name in text box
                        txtCustomer.Text = receipt.customer.varFirstName + " " + receipt.customer.varLastName;
                        //display system time in Sales Page
                        DateTime today = DateTime.Today;
                        lblDateDisplay.Text          = today.ToString("dd/MMM/yy");
                        lblReceiptNumberDisplay.Text = receipt.varInvoiceNumber.ToString();
                        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);
            }
        }
Esempio n. 14
0
        //Still need to account for a duplicate item being added
        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "SalesCart.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"];
                    lblInvalidQty.Visible = false;
                    if (!Page.IsPostBack)
                    {
                        txtSearch.Focus();
                        //Set name in text box
                        Invoice invoice = new Invoice();
                        if (Request.QueryString["invoice"].ToString() == "-10")
                        {
                            Invoice newInvoice = new Invoice
                            {
                                varInvoiceNumber       = IM.CallReturnNextInvoiceNumberForNewInvoice(CU, objPageDetails),
                                intInvoiceSubNumber    = 1,
                                customer               = CM.CallReturnCustomer(Convert.ToInt32(Request.QueryString["customer"].ToString()), objPageDetails)[0],
                                employee               = CU.employee,
                                location               = CU.location,
                                fltGovernmentTaxAmount = 0,
                                fltProvincialTaxAmount = 0,
                                fltLiquorTaxAmount     = 0,
                                bitIsShipping          = false,
                                //newInvoice.bitChargeGST = true;
                                //newInvoice.bitChargePST = true;
                                //newInvoice.bitChargeLCT = true;
                                intTransactionTypeID     = 1,
                                varAdditionalInformation = ""
                            };
                            invoice = IM.CallCreateInitialTotalsForTable(newInvoice, objPageDetails)[0];

                            var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
                            nameValues.Set("customer", invoice.customer.intCustomerID.ToString());
                            nameValues.Set("invoice", invoice.intInvoiceID.ToString());
                            Response.Redirect(Request.Url.AbsolutePath + "?" + nameValues, false);
                        }
                        else
                        {
                            invoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails)[0];
                        }

                        DdlShippingProvince.DataSource    = LM.CallReturnProvinceDropDown(invoice.location.intCountryID, objPageDetails);
                        DdlShippingProvince.SelectedValue = invoice.intShippingProvinceID.ToString();
                        DdlShippingProvince.DataBind();

                        txtCustomer.Text             = invoice.customer.varFirstName + " " + invoice.customer.varLastName;
                        lblDateDisplay.Text          = DateTime.Today.ToString("dd/MMM/yy");
                        lblInvoiceNumberDisplay.Text = invoice.varInvoiceNumber + "-" + invoice.intInvoiceSubNumber;
                        //change to gather the items from table
                        GrdCartItems.DataSource = invoice.invoiceItems;
                        GrdCartItems.DataBind();
                        if (invoice.bitIsShipping)
                        {
                            RdbShipping.Checked         = true;
                            DdlShippingProvince.Visible = true;
                            DdlShippingProvince.Enabled = true;
                        }
                        else
                        {
                            RdbInStorePurchase.Checked  = true;
                            DdlShippingProvince.Visible = false;
                            DdlShippingProvince.Enabled = false;
                        }
                        txtShippingAmount.Text    = invoice.fltShippingCharges.ToString();
                        lblSubtotalDisplay.Text   = invoice.fltSubTotal.ToString("C");
                        Session["currentInvoice"] = invoice;
                    }
                }
            }
            //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"] = "InventoryAddNew.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 (CU.employee.intJobID != 0)
                    {
                        //If user is not an admin then disable the edit item button
                        BtnEditItem.Enabled = false;
                    }
                    //Check to see if an item was selected
                    if (Convert.ToInt32(Request.QueryString["inventory"].ToString()) != -10)
                    {
                        if (!IsPostBack)
                        {
                            ItemChangeTracking tempItem = new ItemChangeTracking();
                            //Grabs a list of objects that match the sku in query string. There should only ever be 1 that is returned
                            List <Object> o = IDU.CallReturnListOfObjectsFromThreeTablesForInventoryAddNew(Convert.ToInt32(Request.QueryString["inventory"].ToString()), objPageDetails, DateTime.Now, CU.location.intProvinceID);
                            ddlBrand.DataSource = IM.CallReturnDropDownForBrand(objPageDetails);
                            ddlBrand.DataBind();
                            ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails);
                            ddlLocation.DataBind();
                            ddlType.DataSource = IM.CallReturnDropDownForItemType(objPageDetails);
                            ddlType.DataBind();
                            ddlModel.DataSource = IM.CallReturnDropDownForModel(objPageDetails);
                            ddlModel.DataBind();
                            if (o[0] is Clubs)
                            {
                                //When a club, pass class and populate DropDowns and TextBoxes
                                Clubs club = o[0] as Clubs;
                                ddlType.SelectedValue     = club.intItemTypeID.ToString();
                                lblSKUDisplay.Text        = club.varSku.ToString();
                                txtCost.Text              = club.fltCost.ToString();
                                ddlBrand.SelectedValue    = club.intBrandID.ToString();
                                txtPrice.Text             = club.fltPrice.ToString();
                                txtQuantity.Text          = club.intQuantity.ToString();
                                ddlLocation.SelectedValue = club.intLocationID.ToString();

                                txtClubType.Text       = club.varTypeOfClub.ToString();
                                ddlModel.SelectedValue = club.intModelID.ToString();
                                txtShaft.Text          = club.varShaftType.ToString();
                                txtNumberofClubs.Text  = club.varNumberOfClubs.ToString();
                                txtClubSpec.Text       = club.varClubSpecification.ToString();
                                txtShaftSpec.Text      = club.varShaftSpecification.ToString();
                                txtShaftFlex.Text      = club.varShaftFlexability.ToString();
                                txtDexterity.Text      = club.varClubDexterity.ToString();
                                chkUsed.Checked        = club.bitIsUsedProduct;
                                txtComments.Text       = club.varAdditionalInformation.ToString();

                                GrdInventoryTaxes.DataSource = club.lstTaxTypePerInventoryItem;
                                GrdInventoryTaxes.DataBind();

                                tempItem.intInventoryID         = club.intInventoryID;
                                tempItem.fltOriginalCost        = club.fltCost;
                                tempItem.fltOriginalPrice       = club.fltPrice;
                                tempItem.intOriginalQuantity    = club.intQuantity;
                                tempItem.varOriginalDescription = "Location ID: " + club.intLocationID.ToString() + "; Brand ID: " + club.intBrandID.ToString()
                                                                  + "; Model ID: " + club.intModelID.ToString() + "; Club Type: " + club.varTypeOfClub.ToString() + "; Shaft: " + club.varShaftType.ToString()
                                                                  + "; Number of Clubs: " + club.varNumberOfClubs.ToString() + "; Club Spec: " + club.varClubSpecification.ToString() + "; Shaft Spec: "
                                                                  + club.varShaftSpecification.ToString() + "; Shaft Flex: " + club.varShaftFlexability.ToString() + "; Dexterity: " + club.varClubDexterity.ToString()
                                                                  + "; Used: " + club.bitIsUsedProduct.ToString() + "; Comments: " + club.varAdditionalInformation.ToString();
                            }
                            else if (o[0] is Accessories)
                            {
                                //When accessories, pass class and populate DropDowns and TextBoxes
                                Accessories accessory = o[0] as Accessories;
                                ddlType.SelectedValue     = accessory.intItemTypeID.ToString();
                                lblSKUDisplay.Text        = accessory.varSku.ToString();
                                txtCost.Text              = accessory.fltCost.ToString();
                                ddlBrand.SelectedValue    = accessory.intBrandID.ToString();
                                txtPrice.Text             = accessory.fltPrice.ToString();
                                txtQuantity.Text          = accessory.intQuantity.ToString();
                                ddlLocation.SelectedValue = accessory.intLocationID.ToString();
                                lblClubType.Text          = "Accessory Type:";
                                txtClubType.Text          = accessory.varTypeOfAccessory.ToString();

                                lblNumberofClubs.Text  = "Size:";
                                txtNumberofClubs.Text  = accessory.varSize.ToString();
                                ddlModel.SelectedValue = accessory.intModelID.ToString();
                                lblShaft.Text          = "Colour:";
                                txtShaft.Text          = accessory.varColour.ToString();
                                txtComments.Text       = accessory.varAdditionalInformation.ToString();

                                lblClubSpec.Visible  = false;
                                txtClubSpec.Visible  = false;
                                lblShaftSpec.Visible = false;
                                txtShaftSpec.Visible = false;
                                lblShaftFlex.Visible = false;
                                txtShaftFlex.Visible = false;
                                lblDexterity.Visible = false;
                                txtDexterity.Visible = false;
                                chkUsed.Visible      = false;

                                GrdInventoryTaxes.DataSource = accessory.lstTaxTypePerInventoryItem;
                                GrdInventoryTaxes.DataBind();

                                tempItem.intInventoryID         = accessory.intInventoryID;
                                tempItem.fltOriginalCost        = accessory.fltCost;
                                tempItem.fltOriginalPrice       = accessory.fltPrice;
                                tempItem.intOriginalQuantity    = accessory.intQuantity;
                                tempItem.varOriginalDescription = "Location ID: " + accessory.intLocationID.ToString() + "; Brand ID: " + accessory.intBrandID.ToString()
                                                                  + "; Model ID: " + accessory.intModelID.ToString() + "; Size: " + accessory.varSize.ToString() + "; Colour: " + accessory.varColour.ToString()
                                                                  + "; Accessory Type: " + accessory.varTypeOfAccessory.ToString() + "; Comments: " + accessory.varAdditionalInformation.ToString();
                            }
                            else if (o[0] is Clothing)
                            {
                                //When clothing, pass class and populate DropDowns and TextBoxes
                                Clothing clothing = o[0] as Clothing;
                                ddlType.SelectedValue     = clothing.intItemTypeID.ToString();
                                lblSKUDisplay.Text        = clothing.varSku.ToString();
                                txtCost.Text              = clothing.fltCost.ToString();
                                ddlBrand.SelectedValue    = clothing.intBrandID.ToString();
                                txtPrice.Text             = clothing.fltPrice.ToString();
                                txtQuantity.Text          = clothing.intQuantity.ToString();
                                ddlLocation.SelectedValue = clothing.intLocationID.ToString();
                                txtComments.Text          = clothing.varAdditionalInformation.ToString();

                                lblNumberofClubs.Text = "Size:";
                                txtNumberofClubs.Text = clothing.varSize.ToString();
                                lblModel.Visible      = false;
                                ddlModel.Visible      = false;
                                lblShaft.Text         = "Colour:";
                                txtShaft.Text         = clothing.varColour.ToString();
                                lblShaftFlex.Visible  = false;
                                txtShaftFlex.Visible  = false;
                                lblClubSpec.Text      = "Gender:";
                                txtClubSpec.Text      = clothing.varGender.ToString();
                                lblClubType.Text      = "Style:";
                                txtClubType.Text      = clothing.varStyle.ToString();
                                lblShaftSpec.Visible  = false;
                                txtShaftSpec.Visible  = false;
                                lblDexterity.Visible  = false;
                                txtDexterity.Visible  = false;
                                chkUsed.Visible       = false;

                                GrdInventoryTaxes.DataSource = clothing.lstTaxTypePerInventoryItem;
                                GrdInventoryTaxes.DataBind();

                                tempItem.intInventoryID         = clothing.intInventoryID;
                                tempItem.fltOriginalCost        = clothing.fltCost;
                                tempItem.fltOriginalPrice       = clothing.fltPrice;
                                tempItem.intOriginalQuantity    = clothing.intQuantity;
                                tempItem.varOriginalDescription = "Location ID: " + clothing.intLocationID.ToString() + "; Brand ID: " + clothing.intBrandID.ToString()
                                                                  + "; Size: " + clothing.varSize.ToString() + "; Colour: " + clothing.varColour.ToString() + "; Gender: " + clothing.varGender.ToString()
                                                                  + "; Style: " + clothing.varStyle.ToString() + "; Comments: " + clothing.varAdditionalInformation.ToString();
                            }
                            BtnCreateSimilar.Visible = true;
                            changeItem         = tempItem;
                            Session["changer"] = changeItem;
                        }
                    }
                    else
                    {
                        //When no item was selected display drop downs and text boxes
                        ddlType.Enabled     = true;
                        txtCost.Enabled     = true;
                        ddlBrand.Enabled    = true;
                        txtPrice.Enabled    = true;
                        txtQuantity.Enabled = true;
                        ddlLocation.Enabled = true;

                        txtClubType.Enabled = true;
                        txtShaft.Enabled    = true;
                        txtComments.Enabled = true;

                        BtnCreateSimilar.Visible = false;
                        if (!IsPostBack)
                        {
                            ddlBrand.DataSource = IM.CallReturnDropDownForBrand(objPageDetails);
                            ddlBrand.DataBind();
                            ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails);
                            ddlLocation.DataBind();
                            ddlType.DataSource = IM.CallReturnDropDownForItemType(objPageDetails);
                            ddlType.DataBind();
                            ddlModel.DataSource = IM.CallReturnDropDownForModel(objPageDetails);
                            ddlModel.DataBind();
                            ddlLocation.SelectedValue = CU.location.intLocationID.ToString();
                            ddlType.SelectedValue     = "1";
                            ddlModel.Enabled          = true;
                            txtNumberofClubs.Enabled  = true;
                            txtClubSpec.Enabled       = true;
                            txtShaftSpec.Enabled      = true;
                            txtShaftFlex.Enabled      = true;
                            txtDexterity.Enabled      = true;
                            chkUsed.Enabled           = true;
                        }
                        else
                        {
                            //Clubs
                            if (Convert.ToInt32(ddlType.SelectedValue) == 1)
                            {
                                //adjust labels displaying for clubs
                                lblClubType.Text = "Club Type:";

                                lblModel.Visible = true;
                                ddlModel.Visible = true;
                                ddlModel.Enabled = true;

                                lblShaft.Text = "Shaft:";

                                lblNumberofClubs.Text    = "Number of Clubs:";
                                lblNumberofClubs.Visible = true;
                                txtNumberofClubs.Visible = true;
                                txtNumberofClubs.Enabled = true;

                                lblClubSpec.Text    = "Club Spec:";
                                lblClubSpec.Visible = true;
                                txtClubSpec.Visible = true;
                                txtClubSpec.Enabled = true;

                                lblShaftSpec.Visible = true;
                                txtShaftSpec.Visible = true;
                                txtShaftSpec.Enabled = true;

                                lblShaftFlex.Text    = "Shaft Flex:";
                                lblShaftFlex.Visible = true;
                                txtShaftFlex.Visible = true;
                                txtShaftFlex.Enabled = true;

                                lblDexterity.Visible = true;
                                txtDexterity.Visible = true;
                                txtDexterity.Enabled = true;

                                chkUsed.Visible = true;
                                chkUsed.Enabled = true;
                            }
                            //Accessories
                            else if (Convert.ToInt32(ddlType.SelectedValue) == 2)
                            {
                                //adjust labels displaying for accessories
                                lblNumberofClubs.Text = "Size:";

                                lblModel.Visible = true;
                                ddlModel.Visible = true;
                                ddlModel.Enabled = true;

                                lblShaft.Text = "Colour:";

                                lblClubType.Text         = "Accessory Type:";
                                lblNumberofClubs.Visible = true;
                                txtNumberofClubs.Visible = true;
                                txtNumberofClubs.Enabled = true;

                                lblClubSpec.Visible = false;
                                txtClubSpec.Visible = false;
                                txtClubSpec.Enabled = false;

                                lblShaftSpec.Visible = false;
                                txtShaftSpec.Visible = false;
                                txtShaftSpec.Enabled = false;

                                lblShaftFlex.Visible = false;
                                txtShaftFlex.Visible = false;
                                txtShaftFlex.Enabled = false;

                                lblDexterity.Visible = false;
                                txtDexterity.Visible = false;
                                txtDexterity.Enabled = false;

                                chkUsed.Visible = false;
                                chkUsed.Enabled = false;
                            }
                            //Clothing
                            else if (Convert.ToInt32(ddlType.SelectedValue) == 3)
                            {
                                //adjust labels displaying for clubs
                                lblNumberofClubs.Text = "Size:";

                                lblModel.Visible = false;
                                ddlModel.Visible = false;
                                ddlModel.Enabled = false;

                                lblShaft.Text = "Colour:";

                                lblNumberofClubs.Visible = true;
                                txtNumberofClubs.Visible = true;
                                txtNumberofClubs.Enabled = true;

                                lblClubSpec.Text    = "Gender:";
                                lblClubSpec.Visible = true;
                                txtClubSpec.Visible = true;
                                txtClubSpec.Enabled = true;

                                lblShaftSpec.Visible = false;
                                txtShaftSpec.Visible = false;
                                txtShaftSpec.Enabled = false;

                                lblClubType.Text     = "Style:";
                                lblShaftFlex.Visible = false;
                                txtShaftFlex.Visible = false;
                                txtShaftFlex.Enabled = false;

                                lblDexterity.Visible = false;
                                txtDexterity.Visible = false;
                                txtDexterity.Enabled = false;

                                chkUsed.Visible = false;
                                chkUsed.Enabled = false;
                            }
                        }
                        //hides and displays the proper buttons for access
                        BtnSaveItem.Visible            = false;
                        BtnAddItem.Visible             = true;
                        pnlDefaultButton.DefaultButton = "btnAddItem";
                        BtnEditItem.Visible            = false;
                        BtnCancel.Visible       = false;
                        BtnBackToSearch.Visible = 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);
            }
        }
Esempio n. 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "SalesCashOut.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"];
                    if (!IsPostBack)
                    {
                        Cashout cashout = new Cashout();
                        //Gathering the start and end dates
                        DateTime selectedDate = DateTime.Parse(Request.QueryString["selectedDate"].ToString());
                        int      locationID   = Convert.ToInt32(Request.QueryString["location"].ToString());
                        object[] args         = { selectedDate, locationID };
                        lblCashoutDate.Text = "Cashout on: " + selectedDate.ToString("dd/MMM/yy") + " for " + LM.CallReturnLocationName(locationID, objPageDetails);
                        if (R.CallCashoutExists(args, objPageDetails))
                        {
                            cashout = R.CallSelectedCashoutToReturn(args, objPageDetails);

                            lblTradeInDisplay.Text    = cashout.fltSystemCountedBasedOnSystemTradeIn.ToString("C");
                            lblGiftCardDisplay.Text   = cashout.fltSystemCountedBasedOnSystemGiftCard.ToString("C");
                            lblCashDisplay.Text       = cashout.fltSystemCountedBasedOnSystemCash.ToString("C");
                            lblDebitDisplay.Text      = cashout.fltSystemCountedBasedOnSystemDebit.ToString("C");
                            lblMasterCardDisplay.Text = cashout.fltSystemCountedBasedOnSystemMastercard.ToString("C");
                            lblVisaDisplay.Text       = cashout.fltSystemCountedBasedOnSystemVisa.ToString("C");

                            lblPreTaxDisplay.Text = (cashout.fltSalesSubTotal + cashout.fltSystemCountedBasedOnSystemTradeIn).ToString("C");
                            lblGSTDisplay.Text    = cashout.fltGovernmentTaxAmount.ToString("C");
                            lblPSTDisplay.Text    = cashout.fltProvincialTaxAmount.ToString("C");
                            lblLCTDisplay.Text    = cashout.fltLiquorTaxAmount.ToString("C");

                            lblTotalDisplay.Text = (cashout.fltSystemCountedBasedOnSystemTradeIn + cashout.fltSystemCountedBasedOnSystemGiftCard + cashout.fltSystemCountedBasedOnSystemCash
                                                    + cashout.fltSystemCountedBasedOnSystemDebit + cashout.fltSystemCountedBasedOnSystemMastercard + cashout.fltSystemCountedBasedOnSystemVisa).ToString("C");

                            txtTradeIn.Text    = cashout.fltManuallyCountedBasedOnReceiptsTradeIn.ToString("#0.00");
                            txtGiftCard.Text   = cashout.fltManuallyCountedBasedOnReceiptsGiftCard.ToString("#0.00");
                            txtCash.Text       = cashout.fltManuallyCountedBasedOnReceiptsCash.ToString("#0.00");
                            txtDebit.Text      = cashout.fltManuallyCountedBasedOnReceiptsDebit.ToString("#0.00");
                            txtMasterCard.Text = cashout.fltManuallyCountedBasedOnReceiptsMastercard.ToString("#0.00");
                            txtVisa.Text       = cashout.fltManuallyCountedBasedOnReceiptsVisa.ToString("#0.00");

                            lblReceiptsFinal.Text = (cashout.fltManuallyCountedBasedOnReceiptsTradeIn + cashout.fltManuallyCountedBasedOnReceiptsGiftCard + cashout.fltManuallyCountedBasedOnReceiptsCash
                                                     + cashout.fltManuallyCountedBasedOnReceiptsDebit + cashout.fltManuallyCountedBasedOnReceiptsMastercard + cashout.fltManuallyCountedBasedOnReceiptsVisa).ToString("C");
                            lblTotalFinal.Text = (cashout.fltSystemCountedBasedOnSystemTradeIn + cashout.fltSystemCountedBasedOnSystemGiftCard + cashout.fltSystemCountedBasedOnSystemCash
                                                  + cashout.fltSystemCountedBasedOnSystemDebit + cashout.fltSystemCountedBasedOnSystemMastercard + cashout.fltSystemCountedBasedOnSystemVisa).ToString("C");
                            lblOverShortFinal.Text = cashout.fltCashDrawerOverShort.ToString("C");
                        }
                        else
                        {
                            //Creating a cashout list and calling a method that grabs all mops and amounts paid
                            cashout                   = R.CreateNewCashout(selectedDate, locationID, objPageDetails);
                            lblVisaDisplay.Text       = cashout.fltSystemCountedBasedOnSystemVisa.ToString("C");
                            lblMasterCardDisplay.Text = cashout.fltSystemCountedBasedOnSystemMastercard.ToString("C");
                            lblCashDisplay.Text       = cashout.fltSystemCountedBasedOnSystemCash.ToString("C");
                            lblGiftCardDisplay.Text   = cashout.fltSystemCountedBasedOnSystemGiftCard.ToString("C");
                            lblDebitDisplay.Text      = cashout.fltSystemCountedBasedOnSystemDebit.ToString("C");
                            lblTradeInDisplay.Text    = cashout.fltSystemCountedBasedOnSystemTradeIn.ToString("C");
                            lblTotalDisplay.Text      = (cashout.fltSystemCountedBasedOnSystemVisa + cashout.fltSystemCountedBasedOnSystemMastercard + cashout.fltSystemCountedBasedOnSystemCash
                                                         + cashout.fltSystemCountedBasedOnSystemGiftCard + cashout.fltSystemCountedBasedOnSystemDebit + (cashout.fltSystemCountedBasedOnSystemTradeIn)).ToString("C");
                            lblGSTDisplay.Text    = cashout.fltGovernmentTaxAmount.ToString("C");
                            lblPSTDisplay.Text    = cashout.fltProvincialTaxAmount.ToString("C");
                            lblLCTDisplay.Text    = cashout.fltLiquorTaxAmount.ToString("C");
                            lblPreTaxDisplay.Text = (cashout.fltSalesSubTotal + cashout.fltSystemCountedBasedOnSystemTradeIn).ToString("C");

                            cashout.fltManuallyCountedBasedOnReceiptsTradeIn    = 0;
                            cashout.fltManuallyCountedBasedOnReceiptsGiftCard   = 0;
                            cashout.fltManuallyCountedBasedOnReceiptsCash       = 0;
                            cashout.fltManuallyCountedBasedOnReceiptsDebit      = 0;
                            cashout.fltManuallyCountedBasedOnReceiptsMastercard = 0;
                            cashout.fltManuallyCountedBasedOnReceiptsVisa       = 0;
                            cashout.fltCashDrawerOverShort = 0;
                            R.CallInsertCashout(cashout, objPageDetails);
                        }
                    }
                }
            }
            //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 btnRerunReport_Click(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "btnRerunReport_Click";

            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"];
                    object[] repInfo = new object[] { GetDateRange(), Convert.ToInt32(ddlLocation.SelectedValue), Convert.ToInt32(ddlDatePeriod.SelectedValue) };
                    Session["reportInfo"] = repInfo;

                    if (Session["currPage"].ToString() == "ReportsStoreStats")
                    {
                        StoreStatsReRun(repInfo, objPageDetails);
                    }
                    else if (Session["currPage"].ToString() == "ReportsTaxes")
                    {
                        TaxesReRun(repInfo, objPageDetails);
                    }
                    else if (Session["currPage"].ToString() == "ReportsDiscounts")
                    {
                        DiscountsReRun(repInfo, objPageDetails);
                    }
                    else if (Session["currPage"].ToString() == "ReportsSales")
                    {
                        SalesReRun(repInfo, objPageDetails);
                    }
                    else if (Session["currPage"].ToString() == "ReportsExtensiveInvoice")
                    {
                        ExtensiveInvoiceReRun(repInfo, objPageDetails);
                    }
                    else if (Session["currPage"].ToString() == "ReportsCostOfInventory")
                    {
                        CostOfInventoryReRun(repInfo, objPageDetails);
                    }
                    else if (Session["currPage"].ToString() == "ReportsInventoryChange")
                    {
                        InventoryChangeReRun(repInfo, objPageDetails);
                    }
                    else if (Session["currPage"].ToString() == "ReportsSpecificApparel")
                    {
                        SpecificApparelReRun(repInfo, objPageDetails);
                    }
                    else if (Session["currPage"].ToString() == "ReportsSpecificgrip")
                    {
                        SpecificgripReRun(repInfo, objPageDetails);
                    }
                    else if (Session["currPage"].ToString() == "ReportsCashOut")
                    {
                        CashOutReRun(repInfo, objPageDetails);
                    }
                }
            }
            //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.Page);
                //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.Page);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "SettingsHomePage.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"];
                    lblCurrentDate.Text = DateTime.Today.ToString("dd/MMM/yy");
                    if (txtDate.Text == "")
                    {
                        txtDate.Text = DateTime.Today.ToString("dd/MMM/yy");
                    }
                    //Checks if the user is an Admin
                    if (CU.employee.intJobID != 0)
                    {
                        BtnAddNewEmployee.Enabled = false;
                        BtnLoadItems.Enabled      = false;
                    }
                    if (!IsPostBack)
                    {
                        DdlProvince.DataSource = LM.CallReturnProvinceDropDown(0, objPageDetails);
                        DdlProvince.DataBind();
                        DdlProvince.SelectedValue = CU.location.intProvinceID.ToString();
                        DdlTax.DataSource         = TM.GatherTaxListFromDateAndProvince(CU.location.intProvinceID, Convert.ToDateTime(lblCurrentDate.Text), objPageDetails);
                        DdlTax.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);
            }
        }
Esempio n. 19
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);
            }
        }
Esempio n. 20
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"] = "PrintableReceipt.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)
                    {
                        //Store in Customer class
                        Invoice invoice = IM.CallReturnPurchaseInvoice(Convert.ToInt32(Request.QueryString["receipt"].ToString()), objPageDetails)[0];
                        //display information on receipt
                        lblCustomerName.Text  = invoice.customer.varFirstName.ToString() + " " + invoice.customer.varLastName.ToString();
                        lblStreetAddress.Text = invoice.customer.varAddress.ToString();
                        lblPostalAddress.Text = invoice.customer.varCityName.ToString() + ", " + LM.CallReturnProvinceName(invoice.customer.intProvinceID, objPageDetails) + " " + invoice.customer.varPostalCode.ToString();
                        lblPhone.Text         = invoice.customer.varContactNumber.ToString();
                        lblinvoiceNum.Text    = invoice.varInvoiceNumber.ToString();
                        lblDate.Text          = invoice.dtmInvoiceDate.ToString("dd/MMM/yy");
                        //Gather transaction type from Session
                        //Display the location information
                        lblSweetShopName.Text          = invoice.location.varLocationName.ToString();
                        lblSweetShopStreetAddress.Text = invoice.location.varAddress.ToString();
                        lblSweetShopPostalAddress.Text = invoice.location.varCityName.ToString() + ", " + LM.CallReturnProvinceName(invoice.location.intProvinceID, objPageDetails) + " " + invoice.location.varPostalCode.ToString();
                        lblSweetShopPhone.Text         = invoice.location.varContactNumber.ToString();

                        //Binds the cart to the grid view
                        grdItemsBoughtList.DataSource = invoice.invoiceItems;
                        grdItemsBoughtList.DataBind();

                        //Displays the total amount ppaid
                        lblSubtotalDisplay.Text  = invoice.fltSubTotal.ToString("#0.00");
                        lblTotalPaidDisplay.Text = invoice.fltSubTotal.ToString("#0.00");
                        //Binds the payment methods to a gridview
                        grdMOPS.DataSource = invoice.invoiceMops;
                        grdMOPS.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"]), 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);
            }
        }
        //double profitMargin;
        //int profitMarginCount = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "ReportsStoreStats";
            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
                {
                    if (!Page.IsPostBack)
                    {
                        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];
                        int        locationID  = Convert.ToInt32(passing[1]);
                        int        timeFrame   = Convert.ToInt32(passing[2]);

                        Calendar calStartDate = (Calendar)CustomExtensions.CallFindControlRecursive(Master, "CalStartDate");
                        calStartDate.SelectedDate = startDate;
                        Calendar calEndDate = (Calendar)CustomExtensions.CallFindControlRecursive(Master, "CalEndDate");
                        calEndDate.SelectedDate = endDate;
                        DropDownList ddlDatePeriod = (DropDownList)CustomExtensions.CallFindControlRecursive(Master, "ddlDatePeriod");
                        ddlDatePeriod.SelectedValue = timeFrame.ToString();
                        DropDownList ddlLocation = (DropDownList)CustomExtensions.CallFindControlRecursive(Master, "ddlLocation");
                        DataTable    dt          = LM.CallReturnLocationDropDown(objPageDetails);
                        dt.Rows.Add(99, "All Locations");
                        ddlLocation.DataSource = dt;
                        ddlLocation.DataBind();
                        ddlLocation.SelectedValue = locationID.ToString();

                        //Builds string to display in label
                        if (startDate == endDate)
                        {
                            lblDates.Text = "Store stats on: " + startDate.ToString("dd/MMM/yy"); //+ " for " + LM.ReturnLocationName(locationID, objPageDetails);
                        }
                        else
                        {
                            lblDates.Text = "Store stats on: " + startDate.ToString("dd/MMM/yy") + " to " + endDate.ToString("dd/MMM/yy"); //+ " for " + LM.ReturnLocationName(locationID, objPageDetails);
                        }
                        //Binding the gridview
                        DataTable stats = R.CallReturnStoreStats(startDate, endDate, timeFrame, locationID, objPageDetails);

                        GrdStats.DataSource = stats;
                        GrdStats.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);
            }
        }
Esempio n. 22
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"] = "PrintableInvoice.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)
                    {
                        Invoice invoice = IM.CallReturnInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails)[0];

                        //display information on receipt
                        lblCustomerName.Text  = invoice.customer.varFirstName.ToString() + " " + invoice.customer.varLastName.ToString();
                        lblStreetAddress.Text = invoice.customer.varAddress.ToString();
                        lblPostalAddress.Text = invoice.customer.varCityName.ToString() + ", " + LM.CallReturnProvinceName(invoice.customer.intProvinceID, objPageDetails) + " " + invoice.customer.varPostalCode.ToString();
                        lblPhone.Text         = invoice.customer.varContactNumber.ToString();
                        lblinvoiceNum.Text    = invoice.varInvoiceNumber.ToString() + "-" + invoice.intInvoiceSubNumber.ToString();
                        lblDate.Text          = invoice.dtmInvoiceDate.ToString("dd/MMM/yy");
                        lblTime.Text          = invoice.dtmInvoiceTime.ToString("h:mm tt");

                        //Display the location information
                        lblSweetShopName.Text          = invoice.location.varLocationName.ToString();
                        lblSweetShopStreetAddress.Text = invoice.location.varAddress.ToString();
                        lblSweetShopPostalAddress.Text = invoice.location.varCityName.ToString() + ", " + LM.CallReturnProvinceName(invoice.location.intProvinceID, objPageDetails) + " " + invoice.location.varPostalCode.ToString();
                        lblSweetShopPhone.Text         = invoice.location.varContactNumber.ToString();
                        lblTaxNum.Text = invoice.location.varTaxNumber.ToString();

                        double governmentTax = 0;
                        double provincialTax = 0;
                        double liquorTax     = 0;

                        foreach (var invoiceItem in invoice.invoiceItems)
                        {
                            foreach (var invoiceItemTax in invoiceItem.invoiceItemTaxes)
                            {
                                if (invoiceItemTax.intTaxTypeID == 1 || invoiceItemTax.intTaxTypeID == 3)
                                {
                                    if (invoiceItemTax.bitIsTaxCharged)
                                    {
                                        governmentTax        += invoiceItemTax.fltTaxAmount;
                                        lblGST.Visible        = true;
                                        lblGST.Text           = invoiceItemTax.varTaxName;
                                        lblGSTDisplay.Visible = true;
                                    }
                                }
                                else if (invoiceItemTax.intTaxTypeID == 2 || invoiceItemTax.intTaxTypeID == 4 || invoiceItemTax.intTaxTypeID == 5)
                                {
                                    if (invoiceItemTax.bitIsTaxCharged)
                                    {
                                        provincialTax        += invoiceItemTax.fltTaxAmount;
                                        lblPST.Visible        = true;
                                        lblPST.Text           = invoiceItemTax.varTaxName;
                                        lblPSTDisplay.Visible = true;
                                    }
                                }
                                else if (invoiceItemTax.intTaxTypeID == 6)
                                {
                                    if (invoiceItemTax.bitIsTaxCharged)
                                    {
                                        liquorTax            += invoiceItemTax.fltTaxAmount;
                                        lblLCT.Visible        = true;
                                        lblLCT.Text           = invoiceItemTax.varTaxName;
                                        lblLCTDisplay.Visible = true;
                                    }
                                }
                            }
                        }

                        lblGSTDisplay.Text = governmentTax.ToString("C");
                        lblPSTDisplay.Text = provincialTax.ToString("C");
                        lblLCTDisplay.Text = liquorTax.ToString("C");

                        double taxAmount = governmentTax + provincialTax + liquorTax;

                        //Display the totals
                        lblDiscountsDisplay.Text = invoice.fltTotalDiscount.ToString("C");
                        lblTradeInsDisplay.Text  = invoice.fltTotalTradeIn.ToString("C");
                        lblShippingDisplay.Text  = invoice.fltShippingCharges.ToString("C");

                        lblSubtotalDisplay.Text  = (invoice.fltSubTotal + invoice.fltShippingCharges).ToString("C");
                        lblTotalPaidDisplay.Text = (invoice.fltBalanceDue + taxAmount).ToString("C");

                        object[] amounts = IM.ReturnTotalsForTenderAndChange(invoice);
                        lblTenderDisplay.Text = Convert.ToDouble(amounts[0]).ToString("C");
                        lblChangeDisplay.Text = Convert.ToDouble(amounts[1]).ToString("C");

                        if (invoice.intInvoiceSubNumber > 1)
                        {
                            //    //Changes headers if the invoice is return
                            grdItemsSoldList.Columns[2].HeaderText = "Sold At";
                            grdItemsSoldList.Columns[3].HeaderText = "Non Refundable";
                            grdItemsSoldList.Columns[5].HeaderText = "Returned At";
                        }

                        //Binds the cart to the grid view
                        grdItemsSoldList.DataSource = invoice.invoiceItems;
                        grdItemsSoldList.DataBind();

                        //Displays the total amount ppaid
                        //Binds the payment methods to a gridview
                        grdMOPS.DataSource = invoice.invoiceMops;
                        grdMOPS.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"] = "CustomerAddNew.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"];
                    //Checks for a Customer Key
                    if (Convert.ToInt32(Request.QueryString["customer"].ToString()) != -10)
                    {
                        if (!IsPostBack)
                        {
                            //Create customer class and fill page with all info based in the customer number
                            Customer customer = CM.CallReturnCustomerWithInvoiceList(Convert.ToInt32(Request.QueryString["customer"].ToString()), objPageDetails)[0];

                            txtFirstName.Text            = customer.varFirstName.ToString();
                            txtLastName.Text             = customer.varLastName.ToString();
                            txtPrimaryAddress.Text       = customer.varAddress.ToString();
                            txtSecondaryAddress.Text     = customer.secondaryAddress.ToString();
                            txtPrimaryPhoneNumber.Text   = customer.varContactNumber.ToString();
                            txtSecondaryPhoneNumber.Text = customer.secondaryPhoneNumber.ToString();
                            txtEmail.Text = customer.varEmailAddress.ToString();
                            txtCity.Text  = customer.varCityName.ToString();

                            DdlCountry.DataSource = LM.CallReturnCountryDropDown(objPageDetails);
                            DdlCountry.DataBind();
                            DdlCountry.SelectedValue  = customer.intCountryID.ToString();
                            ddlProvince.DataSource    = LM.CallReturnProvinceDropDown(customer.intCountryID, objPageDetails);
                            ddlProvince.SelectedValue = customer.intProvinceID.ToString();
                            ddlProvince.DataBind();

                            txtPostalCode.Text   = customer.varPostalCode.ToString();
                            chkEmailList.Checked = customer.bitSendMarketing;

                            //Binds invoice list to the grid view
                            GrdInvoiceSelection.DataSource = customer.invoices;
                            GrdInvoiceSelection.DataBind();
                        }
                    }
                    else
                    {
                        //no cust number
                        if (!IsPostBack)
                        {
                            DdlCountry.DataSource = LM.CallReturnCountryDropDown(objPageDetails);
                            DdlCountry.DataBind();
                            DdlCountry.SelectedValue = CU.location.intCountryID.ToString();

                            ddlProvince.DataSource = LM.CallReturnProvinceDropDown(0, objPageDetails);
                            ddlProvince.DataBind();
                        }
                        //Displays text boxes instead of label for customer creation info
                        txtFirstName.Enabled            = true;
                        txtLastName.Enabled             = true;
                        txtPrimaryAddress.Enabled       = true;
                        txtSecondaryAddress.Enabled     = true;
                        txtPrimaryPhoneNumber.Enabled   = true;
                        txtSecondaryPhoneNumber.Enabled = true;
                        txtEmail.Enabled      = true;
                        txtCity.Enabled       = true;
                        ddlProvince.Enabled   = true;
                        DdlCountry.Enabled    = true;
                        chkEmailList.Enabled  = true;
                        txtPostalCode.Enabled = true;
                        //hides and displays the proper buttons for access
                        BtnSaveCustomer.Visible        = false;
                        BtnAddCustomer.Visible         = true;
                        pnlDefaultButton.DefaultButton = "btnAddCustomer";
                        BtnEditCustomer.Visible        = false;
                        BtnStartSale.Visible           = false;
                        BtnCancel.Visible       = false;
                        BtnBackToSearch.Visible = 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);
            }
        }
Esempio n. 24
0
        //Add counter to record how many times each report gets viewed.

        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "ReportsHomePage";
            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();
                    }
                    if (CU.employee.intJobID != 0)
                    {
                        //User is not an admin
                        lblReport.Text      = "You are not authorized to view reports";
                        lblReport.Visible   = true;
                        lblReport.ForeColor = System.Drawing.Color.Red;
                        //Disables buttons
                        BtnCashOutReport.Visible = false;
                        pnlDefaultButton.Visible = false;
                    }
                }
            }
            //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);
            }
        }
        //private static Invoice returnInvoice;

        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "ReturnsCart.aspx";
            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                lblInvalidQty.Visible = false;
                //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 <Invoice> returnInvoicesCalled = IM.CallReturnInvoice(Convert.ToInt32(Request.QueryString["invoice"]), objPageDetails);
                        Invoice        returnInvoice        = new Invoice();
                        if (returnInvoicesCalled.Count > 0)
                        {
                            returnInvoice = returnInvoicesCalled[0];
                            returnInvoice.intInvoiceSubNumber  = IM.CallCalculateNextInvoiceSubNum(returnInvoice.varInvoiceNumber, objPageDetails);
                            returnInvoice.location             = CU.location;
                            returnInvoice.employee             = CU.employee;
                            returnInvoice.intTransactionTypeID = 2;
                            returnInvoice = IM.CallCreateInitialTotalsForTable(returnInvoice, objPageDetails)[0];

                            var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
                            nameValues.Set("invoice", returnInvoice.intInvoiceID.ToString());
                            Response.Redirect(Request.Url.AbsolutePath + "?" + nameValues, false);
                        }
                        else
                        {
                            returnInvoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"]), CU.location.intProvinceID, objPageDetails)[0];
                        }
                        lblCustomerDisplay.Text      = returnInvoice.customer.varFirstName.ToString() + " " + returnInvoice.customer.varLastName.ToString();
                        lblInvoiceNumberDisplay.Text = returnInvoice.varInvoiceNumber + "-" + returnInvoice.intInvoiceSubNumber;
                        lblDateDisplay.Text          = returnInvoice.dtmInvoiceDate.ToString("dd/MMM/yy");
                        //binds items in cart to gridview
                        GrdInvoicedItems.DataSource = IIM.CallReturnInvoiceItemsFromProcessedSalesForReturn(returnInvoice.varInvoiceNumber.ToString(), returnInvoice.dtmInvoiceDate, CU.location.intProvinceID, objPageDetails);
                        GrdInvoicedItems.DataBind();

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

                        //IM.CalculateNewInvoiceReturnTotalsToUpdate(returnInvoice, objPageDetails);
                        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);
            }
        }
Esempio n. 26
0
        //private static Employee employee;

        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "EmployeeAddNew.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 (CU.employee.intJobID != 0)
                    {
                        //If user is not an admin then disable the edit employee button
                        BtnEditEmployee.Enabled = false;
                    }
                    //Check to see if an employee was selected
                    if (Convert.ToInt32(Request.QueryString["employee"].ToString()) != -10)
                    {
                        if (!IsPostBack)
                        {
                            //Create an employee class
                            Employee employee = EM.CallReturnEmployee(Convert.ToInt32(Request.QueryString["employee"].ToString()), objPageDetails)[0];
                            //Fill asll lables with current selected employee info
                            txtFirstName.Text = employee.varFirstName.ToString();
                            txtLastName.Text  = employee.varLastName.ToString();

                            ddlJob.DataSource = EM.CallReturnJobPosition(objPageDetails);
                            ddlJob.DataBind();
                            ddlJob.SelectedValue = employee.intJobID.ToString();

                            ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails);
                            ddlLocation.DataBind();
                            ddlLocation.SelectedValue = employee.location.intLocationID.ToString();

                            txtEmail.Text = employee.varEmailAddress.ToString();
                            txtPrimaryPhoneNumber.Text   = employee.varContactNumber.ToString();
                            txtSecondaryPhoneNumber.Text = employee.secondaryContactNumber.ToString();
                            txtPrimaryAddress.Text       = employee.varAddress.ToString();
                            txtSecondaryAddress.Text     = employee.secondaryAddress.ToString();
                            txtCity.Text              = employee.varCityName.ToString();
                            txtPostalCode.Text        = employee.varPostalCode.ToString();
                            ddlProvince.SelectedValue = employee.intProvinceID.ToString();
                            DdlCountry.SelectedValue  = employee.intCountryID.ToString();
                            DdlCountry.DataSource     = LM.CallReturnCountryDropDown(objPageDetails);
                            DdlCountry.DataBind();
                            ddlProvince.DataSource = LM.CallReturnProvinceDropDown(employee.intCountryID, objPageDetails);
                            ddlProvince.DataBind();
                        }
                    }
                    else
                    {
                        if (!IsPostBack)
                        {
                            ddlJob.DataSource = EM.CallReturnJobPosition(objPageDetails);
                            ddlJob.DataBind();
                            ddlJob.SelectedValue = CU.employee.intJobID.ToString();

                            ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails);
                            ddlLocation.DataBind();
                            ddlLocation.SelectedValue = CU.location.intLocationID.ToString();

                            DdlCountry.DataSource = LM.CallReturnCountryDropDown(objPageDetails);
                            DdlCountry.DataBind();
                            DdlCountry.SelectedValue = CU.location.intCountryID.ToString();

                            ddlProvince.DataSource = LM.CallReturnProvinceDropDown(0, objPageDetails);
                            ddlProvince.DataBind();
                            ddlProvince.SelectedValue = CU.location.intProvinceID.ToString();
                        }
                        //With no employee selected display text boxes and drop downs to add employee
                        txtFirstName.Enabled = true;
                        txtLastName.Enabled  = true;
                        ddlJob.Enabled       = true;
                        ddlLocation.Enabled  = true;

                        txtEmail.Enabled = true;
                        txtPrimaryPhoneNumber.Enabled   = true;
                        txtSecondaryPhoneNumber.Enabled = true;
                        txtPrimaryAddress.Enabled       = true;
                        txtSecondaryAddress.Enabled     = true;
                        txtCity.Enabled       = true;
                        txtPostalCode.Enabled = true;
                        ddlProvince.Enabled   = true;
                        DdlCountry.Enabled    = true;

                        //hides and displays the proper buttons for access
                        BtnSaveEmployee.Visible        = false;
                        BtnAddEmployee.Visible         = true;
                        pnlDefaultButton.DefaultButton = "btnAddEmployee";
                        BtnEditEmployee.Visible        = false;
                        BtnCancel.Visible       = false;
                        BtnBackToSearch.Visible = 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);
            }
        }