Esempio n. 1
0
        protected void UpdateInvoiceTotals()
        {
            string method = "UpdateInvoiceTotal";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Invoice invoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails)[0];
                invoice.fltShippingCharges = Convert.ToDouble(txtShippingAmount.Text);
                bool bolShip = false;
                if (RdbShipping.Checked)
                {
                    bolShip = true;
                }
                invoice.bitIsShipping = bolShip;
                IM.CalculateNewInvoiceTotalsToUpdate(invoice, objPageDetails);
                invoice = IM.CallReturnCurrentInvoice(invoice.intInvoiceID, objPageDetails)[0];
                lblSubtotalDisplay.Text = invoice.fltSubTotal.ToString("C");
                GrdCartItems.DataSource = invoice.invoiceItems;
                GrdCartItems.DataBind();
                //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);
            }
        }
Esempio n. 2
0
        protected void ORowCanceling(object sender, GridViewCancelEditEventArgs e)
        {
            //Collects current method for error tracking
            string method = "ORowCanceling";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Invoice invoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails)[0];
                //lblInvalidQty.Visible = false;
                ((CheckBoxList)GrdCartItems.Rows[GrdCartItems.EditIndex].Cells[9].FindControl("cblTaxes")).Enabled = false;
                //Clears the indexed row
                GrdCartItems.EditIndex = -1;
                //Binds gridview to Session items in cart
                GrdCartItems.DataSource = invoice.invoiceItems;
                GrdCartItems.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. 3
0
        //These update the invoice total
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //Collects current method for error tracking
            string method = "OnRowDeleting";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Invoice invoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails)[0];
                lblInvalidQty.Visible = false;
                int currentInvoiceItemID = Convert.ToInt32(((Label)GrdCartItems.Rows[e.RowIndex].Cells[0].FindControl("lblInvoiceItemID")).Text);
                IIM.ReturnQTYToInventory(currentInvoiceItemID, invoice.dtmInvoiceDate, CU.location.intProvinceID, objPageDetails);
                //Remove the indexed pointer
                GrdCartItems.EditIndex = -1;
                IM.CalculateNewInvoiceTotalsToUpdate(IM.CallReturnCurrentInvoice(invoice.intInvoiceID, objPageDetails)[0], objPageDetails);
                invoice = IM.CallReturnCurrentInvoice(invoice.intInvoiceID, objPageDetails)[0];

                //bind items back to grid view
                GrdCartItems.DataSource = invoice.invoiceItems;
                GrdCartItems.DataBind();
                //Calculate new subtotal
                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);
            }
        }
Esempio n. 4
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);
            }
        }