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