protected void GrdCustomersSearched_RowCommand(object sender, GridViewCommandEventArgs e) { //Collects current method and page for error tracking string method = "GrdCustomersSearched_RowCommand"; object[] objPageDetails = { Session["currPage"].ToString(), method }; try { Invoice receipt = IM.CallReturnCurrentPurchaseInvoice(Convert.ToInt32(Request.QueryString["receipt"]), CU.location.intProvinceID, objPageDetails)[0]; //grabs the command argument for the command pressed if (e.CommandName == "SwitchCustomer") { //if command argument is SwitchCustomer, set the new key receipt = IM.CallReturnCurrentInvoice(receipt.intInvoiceID, CU.location.intProvinceID, objPageDetails)[0]; receipt.customer = CM.CallReturnCustomer(Convert.ToInt32(e.CommandArgument.ToString()), objPageDetails)[0]; IM.CallUpdateCurrentInvoice(receipt, objPageDetails); var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString()); nameValues.Set("customer", receipt.customer.intCustomerID.ToString()); nameValues.Set("receipt", receipt.intInvoiceID.ToString()); Response.Redirect(Request.Url.AbsolutePath + "?" + nameValues, false); } BtnCustomerSelect.Text = "Change Customer"; } //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); } }
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); } }
public void ChangeProvinceTaxesBasedOnShipping(int invoiceID, int shippingProvinceID, object[] objPageDetails) { //string strQueryName = "ChangeProvinceTaxesBasedOnShipping"; InvoiceManager IM = new InvoiceManager(); Invoice invoice = IM.CallReturnCurrentInvoice(invoiceID, shippingProvinceID, objPageDetails)[0]; IM.CallRemoveInvoiceItemTaxesFromCurrentItemsTaxesTable(invoice.invoiceItems, objPageDetails); foreach (InvoiceItems invoiceItem in invoice.invoiceItems) { LoopThroughTaxesForEachItemAddingToCurrentInvoiceItemTaxes(invoiceItem, invoice.intTransactionTypeID, invoice.dtmInvoiceDate, shippingProvinceID, objPageDetails); } }
protected void BtnRemoveGovTax(object sender, EventArgs e) { //Collects current method for error tracking string method = "btnRemoveGovTax"; object[] objPageDetails = { Session["currPage"].ToString(), method }; try { TaxManager TM = new TaxManager(); Invoice invoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails)[0]; bool chargeGST; if (!BtnRemoveGov.Text.Contains("Remove")) { chargeGST = true; } else { chargeGST = false; } foreach (InvoiceItems invoiceItem in invoice.invoiceItems) { foreach (InvoiceItemTax invoiceItemTax in invoiceItem.invoiceItemTaxes) { if (invoiceItemTax.intTaxTypeID == TM.GatherTaxIDFromString("GST", objPageDetails) || invoiceItemTax.intTaxTypeID == TM.GatherTaxIDFromString("HST", objPageDetails)) { invoiceItemTax.bitIsTaxCharged = chargeGST; } } IIM.CallUpdateItemTaxesFromCurrentSalesTableActualQuery(invoiceItem, invoice.intTransactionTypeID, objPageDetails); } IM.CallUpdateCurrentInvoice(invoice, objPageDetails); UpdatePageTotals(); } //Exception catch catch (ThreadAbortException tae) { } catch (Exception ex) { //Log all info into error table ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this); //Display message box MessageBoxCustom.ShowMessage("An Error has occurred and been logged. " + "If you continue to receive this message please contact " + "your system administrator.", this); } }
//List<Tax> t = new List<Tax>(); //TaxManager TM = new TaxManager(); //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"] = "ReturnsCheckout.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) { Invoice returnInvoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), CU.location.intProvinceID, objPageDetails)[0]; UpdatePageTotals(); } } } //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); } }
//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); } }