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