Ejemplo n.º 1
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"] = "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);
            }
        }
        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);
            }
        }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

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

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

            Session["currPage"] = "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 BtnDownload_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "btnDownload_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Sets path and file name to download report to
                string pathUser     = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
                string pathDownload = (pathUser + "\\Downloads\\");

                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]);

                DataTable stats = R.CallReturnStoreStats(startDate, endDate, timeFrame, locationID, objPageDetails);

                string   fileName = "Store Stats Report-" + LM.CallReturnLocationName(locationID, objPageDetails) + "_" + startDate.ToShortDateString() + " - " + endDate.ToShortDateString() + ".xlsx";
                FileInfo newFile  = new FileInfo(pathDownload + fileName);
                using (ExcelPackage xlPackage = new ExcelPackage(newFile))
                {
                    //Creates a seperate sheet for each data table
                    ExcelWorksheet statsExport = xlPackage.Workbook.Worksheets.Add("Stats");
                    // write to sheet
                    statsExport.Cells[1, 1].Value = lblDates.Text;
                    statsExport.Cells[2, 1].Value = "Grouped By";
                    statsExport.Cells[2, 2].Value = "Government Tax";
                    statsExport.Cells[2, 3].Value = "Provincial Tax";
                    statsExport.Cells[2, 4].Value = "Liquor Tax";
                    statsExport.Cells[2, 5].Value = "Cost of Goods";
                    statsExport.Cells[2, 6].Value = "Sales Pre-Tax";
                    statsExport.Cells[2, 7].Value = "Average Profit Margin";
                    statsExport.Cells[2, 8].Value = "Sales Dollars";
                    int recordIndex = 3;
                    foreach (DataRow row in stats.Rows)
                    {
                        //if (timeFrame == 3)
                        //{
                        statsExport.Cells[recordIndex, 1].Value = row[0].ToString();
                        //}
                        //else
                        //{
                        //statsExport.Cells[recordIndex, 1].Value = Convert.ToDateTime(row[0]).ToString("dd-MM-yyyy");
                        //}
                        statsExport.Cells[recordIndex, 2].Value = Convert.ToDouble(row[1]).ToString("C");
                        statsExport.Cells[recordIndex, 3].Value = Convert.ToDouble(row[2]).ToString("C");
                        statsExport.Cells[recordIndex, 4].Value = Convert.ToDouble(row[3]).ToString("C");
                        statsExport.Cells[recordIndex, 5].Value = Convert.ToDouble(row[4]).ToString("C");
                        statsExport.Cells[recordIndex, 6].Value = Convert.ToDouble(row[5]).ToString("C");
                        statsExport.Cells[recordIndex, 7].Value = Convert.ToDouble(row[6]).ToString("P");
                        statsExport.Cells[recordIndex, 8].Value = Convert.ToDouble(row[7]).ToString("C");

                        recordIndex++;
                    }
                    //Totals
                    statsExport.Cells[recordIndex + 1, 1].Value = "Totals:";
                    statsExport.Cells[recordIndex + 1, 2].Value = governmentTax.ToString("C");
                    statsExport.Cells[recordIndex + 1, 3].Value = provincialTax.ToString("C");
                    statsExport.Cells[recordIndex + 1, 4].Value = liquorTax.ToString("C");
                    statsExport.Cells[recordIndex + 1, 5].Value = costofGoods.ToString("C");
                    statsExport.Cells[recordIndex + 1, 6].Value = subTotal.ToString("C");
                    //statsExport.Cells[recordIndex + 1, 7].Value = (profitMargin / profitMarginCount).ToString("P");
                    statsExport.Cells[recordIndex + 1, 8].Value = salesDollars.ToString();

                    Response.Clear();
                    Response.AddHeader("content-disposition", "attachment; filename=\"" + fileName + "\"");
                    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                    Response.BinaryWrite(xlPackage.GetAsByteArray());
                    Response.End();
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]), 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);
            }
        }