Exemplo n.º 1
0
        private void LoadOptions()
        {
            lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"], Session.SessionID);
            lblMatrixID.Text  = Common.Decrypt(Request.QueryString["id"], Session.SessionID);

            ProductVariations clsProductVariation = new ProductVariations();

            lstItem.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
            lstItem.DataBind();

            ProductUnitsMatrix clsUnit = new ProductUnitsMatrix(clsProductVariation.Connection, clsProductVariation.Transaction);

            cboUnit.DataTextField  = "BottomUnitName";
            cboUnit.DataValueField = "BottomUnitID";
            cboUnit.DataSource     = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
            cboUnit.DataBind();

            Products       clsProduct = new Products(clsProductVariation.Connection, clsProductVariation.Transaction);
            ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));

            cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString()));
            clsProductVariation.CommitAndDispose();

            cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
        }
Exemplo n.º 2
0
        private void LoadOptions()
        {
            lblMatrixID.Text  = Common.Decrypt((string)Request.QueryString["matrixid"], Session.SessionID);
            lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"], Session.SessionID);

            ProductUnitsMatrix clsUnit = new ProductUnitsMatrix();

            cboUnit.DataTextField  = "BottomUnitName";
            cboUnit.DataValueField = "BottomUnitID";
            cboUnit.DataSource     = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
            cboUnit.DataBind();
            cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
            clsUnit.CommitAndDispose();

            Products       clsProduct = new Products();
            ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));

            cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString()));
            cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsDetails.BaseUnitID.ToString()));
            txtProductPrice.Text  = clsDetails.Price.ToString("#,##0.#0");
            txtPurchasePrice.Text = clsDetails.PurchasePrice.ToString("#,##0.#0");
            txtVAT.Text           = clsDetails.VAT.ToString("#,##0.#0");
            txtEVAT.Text          = clsDetails.EVAT.ToString("#,##0.#0");
            txtLocalTax.Text      = clsDetails.LocalTax.ToString("#,##0.#0");
            clsProduct.CommitAndDispose();
        }
Exemplo n.º 3
0
        private void LoadOptions()
        {
            DataClass clsDataClass = new DataClass();

            lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"], Session.SessionID);
            lblMatrixID.Text  = Common.Decrypt(Request.QueryString["id"], Session.SessionID);

            ProductVariations clsProductVariation = new ProductVariations();

            lstItem.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
            lstItem.DataBind();
            clsProductVariation.CommitAndDispose();

            ProductUnitsMatrix clsProductUnitsMatrix = new ProductUnitsMatrix();

            cboUnit.DataTextField  = "BottomUnitName";
            cboUnit.DataValueField = "BottomUnitID";
            cboUnit.DataSource     = clsProductUnitsMatrix.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
            cboUnit.DataBind();
            cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
            clsProductUnitsMatrix.CommitAndDispose();

            Products       clsProduct = new Products();
            ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));

            cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString()));
            clsProduct.CommitAndDispose();
            cboUnit.SelectedIndex = cboUnit.Items.Count - 1;

            lblProductSubGroupID.Text = clsDetails.ProductSubGroupID.ToString();

            string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&prodid=" + Common.Encrypt(lblProductID.Text, Session.SessionID);

            lnkVariations.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_Variations/Default.aspx" + stParam;
        }
Exemplo n.º 4
0
        protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (cboProductCode.Items.Count == 0)
            {
                return;
            }

            if (cboProductCode.Items.Count == 1 && cboProductCode.SelectedValue == Constants.ZERO_STRING)
            {
                return;
            }

            DataClass clsDataClass = new DataClass();
            long      ProductID    = Convert.ToInt64(cboProductCode.SelectedItem.Value);

            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix();

            cboVariation.DataTextField  = "MatrixDescription";
            cboVariation.DataValueField = "MatrixID";
            cboVariation.DataSource     = clsProductVariationsMatrix.BaseListSimpleAsDataTable(ProductID, SortField: "VariationDesc").DefaultView;
            cboVariation.DataBind();

            if (cboVariation.Items.Count == 0)
            {
                cboVariation.Items.Add(new ListItem("No Variation", Constants.ZERO_STRING));
            }
            cboVariation.SelectedIndex = cboVariation.Items.Count - 1;

            ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);

            cboProductUnit.DataTextField  = "BottomUnitCode";
            cboProductUnit.DataValueField = "BottomUnitID";
            cboProductUnit.DataSource     = clsUnitMatrix.ListAsDataTable(ProductID, "a.MatrixID", SortOption.Ascending).DefaultView;
            cboProductUnit.DataBind();

            Products       clsProduct = new Products(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);
            ProductDetails clsDetails = clsProduct.Details(ProductID);
            ProductPurchasePriceHistory clsProductPurchasePriceHistory = new ProductPurchasePriceHistory(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);

            System.Data.DataTable dtProductPurchasePriceHistory = clsProductPurchasePriceHistory.ListAsDataTable(ProductID, DateTime.Now.AddMonths(-6), "PurchasePrice", SortOption.Ascending);

            clsProductVariationsMatrix.CommitAndDispose();

            cboProductUnit.Items.Insert(0, new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));

            cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf(new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));
            txtPurchasePrice.Text        = clsDetails.PurchasePrice.ToString("#####0.##0");

            if (cboProductUnit.Items.Count == 0)
            {
                cboProductUnit.Items.Add(new ListItem("No Unit", "0"));
            }
            cboVariation.SelectedIndex = cboVariation.Items.Count - 1;

            ComputeAmount();
            cboVariation_SelectedIndexChanged(null, null);
        }
Exemplo n.º 5
0
        private void LoadOptions()
        {
            lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"], Session.SessionID);

            ProductVariations clsProductVariation = new ProductVariations();

            lstItem.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
            lstItem.DataBind();
            clsProductVariation.CommitAndDispose();

            ProductUnitsMatrix clsUnit = new ProductUnitsMatrix();

            cboUnit.DataTextField  = "BottomUnitName";
            cboUnit.DataValueField = "BottomUnitID";
            cboUnit.DataSource     = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
            cboUnit.DataBind();
            cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
            clsUnit.CommitAndDispose();

            Products       clsProduct        = new Products();
            ProductDetails clsProductDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));

            lblProductSubGroupID.Text = clsProductDetails.ProductSubGroupID.ToString();

            cboUnit.Items.Add(new ListItem(clsProductDetails.BaseUnitName, clsProductDetails.BaseUnitID.ToString()));
            cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsProductDetails.BaseUnitID.ToString()));
            txtProductPrice.Text  = clsProductDetails.Price.ToString("#,##0.#0");
            txtPrice1.Text        = clsProductDetails.Price1.ToString("#,##0.#0");
            txtPrice2.Text        = clsProductDetails.Price2.ToString("#,##0.#0");
            txtPrice3.Text        = clsProductDetails.Price3.ToString("#,##0.#0");
            txtPrice4.Text        = clsProductDetails.Price4.ToString("#,##0.#0");
            txtPrice5.Text        = clsProductDetails.Price5.ToString("#,##0.#0");
            txtWSPrice.Text       = clsProductDetails.WSPrice.ToString("#,##0.#0");
            txtPurchasePrice.Text = clsProductDetails.PurchasePrice.ToString("#,##0.#0");
            decimal decMargin = clsProductDetails.Price - clsProductDetails.PurchasePrice;

            try { decMargin = decMargin / clsProductDetails.PurchasePrice; }
            catch { decMargin = 1; }
            decMargin      = decMargin * 100;
            txtMargin.Text = decMargin.ToString("#,##0.##0");

            decMargin = clsProductDetails.WSPrice - clsProductDetails.PurchasePrice;
            try { decMargin = decMargin / clsProductDetails.PurchasePrice; }
            catch { decMargin = 1; }
            decMargin             = decMargin * 100;
            txtWSPriceMarkUp.Text = decMargin.ToString("#,##0.##0");

            chkIncludeInSubtotalDiscount.Checked = clsProductDetails.IncludeInSubtotalDiscount;
            txtVAT.Text  = clsProductDetails.VAT.ToString("#,##0.#0");
            txtEVAT.Text = clsProductDetails.EVAT.ToString("#,##0.#0");
            clsProduct.CommitAndDispose();

            string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&prodid=" + Common.Encrypt(lblProductID.Text, Session.SessionID);

            lnkVariations.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_Variations/Default.aspx" + stParam;
        }
Exemplo n.º 6
0
        private void LoadList()
        {
            try
            {
                string SortField = "a.MatrixID";
                if (Request.QueryString["sortfield"] != null)
                {
                    SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID);
                }

                SortOption sortoption = SortOption.Ascending;
                if (Request.QueryString["sortoption"] != null)
                {
                    sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true);
                }

                ProductUnitsMatrix clsProductUnitsMatrix = new ProductUnitsMatrix();
                PageData.DataSource = clsProductUnitsMatrix.ListAsDataTable(Convert.ToInt64(lblProductID.Text), SortField, sortoption).DefaultView;
                clsProductUnitsMatrix.CommitAndDispose();

                int iPageSize = Convert.ToInt16(Session["PageSize"]);

                PageData.AllowPaging = true;
                PageData.PageSize    = iPageSize;
                try
                {
                    PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;
                    lstItem.DataSource        = PageData;
                    lstItem.DataBind();
                }
                catch
                {
                    PageData.CurrentPageIndex = 1;
                    lstItem.DataSource        = PageData;
                    lstItem.DataBind();
                }

                cboCurrentPage.Items.Clear();
                for (int i = 0; i < PageData.PageCount; i++)
                {
                    int iValue = i + 1;
                    cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString()));
                    if (PageData.CurrentPageIndex == i)
                    {
                        cboCurrentPage.Items[i].Selected = true;
                    }
                    else
                    {
                        cboCurrentPage.Items[i].Selected = false;
                    }
                }
                lblDataCount.Text = " of " + " " + PageData.PageCount;
            }
            catch  { }
        }
Exemplo n.º 7
0
        protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (cboProductCode.Items.Count == 0)
            {
                return;
            }

            DataClass clsDataClass = new DataClass();
            long      ProductID    = Convert.ToInt64(cboProductCode.SelectedItem.Value);

            if (ProductID == 0)
            {
                cboVariation.Items.Clear();
                cboVariation.Items.Add(new ListItem("No Variation", "0"));
                return;
            }

            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix();

            cboVariation.DataTextField  = "VariationDesc";
            cboVariation.DataValueField = "MatrixID";
            cboVariation.DataSource     = clsProductVariationsMatrix.BaseListSimpleAsDataTable(ProductID, SortField: "VariationDesc").DefaultView;
            cboVariation.DataBind();

            if (cboVariation.Items.Count == 0)
            {
                cboVariation.Items.Add(new ListItem("No Variation", "0"));
            }
            cboVariation.SelectedIndex = cboVariation.Items.Count - 1;
            clsProductVariationsMatrix.CommitAndDispose();

            ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix();

            cboProductUnit.DataTextField  = "BottomUnitCode";
            cboProductUnit.DataValueField = "BottomUnitID";
            cboProductUnit.DataSource     = clsUnitMatrix.ListAsDataTable(ProductID, "a.MatrixID", SortOption.Ascending).DefaultView;
            cboProductUnit.DataBind();
            clsUnitMatrix.CommitAndDispose();

            Products       clsProduct = new Products();
            ProductDetails clsDetails = new ProductDetails();

            clsDetails = clsProduct.Details(ProductID);
            clsProduct.CommitAndDispose();
            cboProductUnit.Items.Add(new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));

            cboProductUnit.SelectedIndex = cboProductUnit.Items.Count - 1;

            cboVariation_SelectedIndexChanged(null, null);
        }
Exemplo n.º 8
0
        protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (cboProductCode.Items.Count == 0)
            {
                return;
            }

            DataClass clsDataClass = new DataClass();
            long      ProductID    = Convert.ToInt64(cboProductCode.SelectedItem.Value);

            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix();

            cboVariation.DataTextField  = "MatrixDescription";
            cboVariation.DataValueField = "MatrixID";
            cboVariation.DataSource     = clsProductVariationsMatrix.BaseListSimpleAsDataTable(ProductID, SortField: "VariationDesc").DefaultView;
            cboVariation.DataBind();

            if (cboVariation.Items.Count == 0)
            {
                cboVariation.Items.Add(new ListItem("No Variation", "0"));
            }
            cboVariation.SelectedIndex = cboVariation.Items.Count - 1;

            ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);

            cboProductUnit.DataTextField  = "BottomUnitCode";
            cboProductUnit.DataValueField = "BottomUnitID";
            cboProductUnit.DataSource     = clsUnitMatrix.ListAsDataTable(ProductID, "a.MatrixID", SortOption.Ascending).DefaultView;
            cboProductUnit.DataBind();

            Products       clsProduct = new Products(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);
            ProductDetails clsDetails = clsProduct.Details(ProductID);

            clsProductVariationsMatrix.CommitAndDispose();
            cboProductUnit.Items.Insert(0, new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));
            cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf(new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));

            txtPrice.Text = clsDetails.WSPrice.ToString("#####0.#0");
            if (clsDetails.VAT > 0)
            {
                chkIsTaxable.Checked = true;
            }
            else
            {
                chkIsTaxable.Checked = false;
            }

            ComputeItemAmount();
            cboVariation_SelectedIndexChanged(null, null);
        }
Exemplo n.º 9
0
        private void LoadOptions()
        {
            DataClass clsDataClass = new DataClass();

            lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"], Session.SessionID);
            lblPackageID.Text = Common.Decrypt(Request.QueryString["id"], Session.SessionID);

            ProductUnitsMatrix clsUnit = new ProductUnitsMatrix();

            cboUnit.DataTextField  = "BottomUnitName";
            cboUnit.DataValueField = "BottomUnitID";
            cboUnit.DataSource     = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text), "MatrixID", SortOption.Ascending).DefaultView;
            cboUnit.DataBind();

            Products       clsProduct = new Products(clsUnit.Connection, clsUnit.Transaction);
            ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));

            clsUnit.CommitAndDispose();

            cboUnit.Items.Insert(0, new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString()));
            cboUnit.SelectedIndex = 0;
        }
Exemplo n.º 10
0
		private void LoadOptions()
		{
			lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"],Session.SessionID);
			lblMatrixID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID);

			ProductVariations clsProductVariation = new ProductVariations();
			lstItem.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
			lstItem.DataBind();

			ProductUnitsMatrix clsUnit = new ProductUnitsMatrix(clsProductVariation.Connection, clsProductVariation.Transaction);
			cboUnit.DataTextField = "BottomUnitName";
			cboUnit.DataValueField = "BottomUnitID";
			cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
			cboUnit.DataBind();

			Products clsProduct = new Products(clsProductVariation.Connection, clsProductVariation.Transaction);
            ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));
			cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString()));
			clsProductVariation.CommitAndDispose();

			cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
		}
Exemplo n.º 11
0
		private void LoadOptions()
		{
			lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"],Session.SessionID);

			ProductVariations clsProductVariation = new ProductVariations();
			lstItem.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
			lstItem.DataBind();
			clsProductVariation.CommitAndDispose();
			
			ProductUnitsMatrix clsUnit = new ProductUnitsMatrix();
			cboUnit.DataTextField = "BottomUnitName";
			cboUnit.DataValueField = "BottomUnitID";
			cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
			cboUnit.DataBind();
			cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
			clsUnit.CommitAndDispose();	

			Products clsProduct = new Products();
            ProductDetails clsProductDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));
            lblProductSubGroupID.Text = clsProductDetails.ProductSubGroupID.ToString();

			cboUnit.Items.Add(new ListItem(clsProductDetails.BaseUnitName, clsProductDetails.BaseUnitID.ToString()));
			cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsProductDetails.BaseUnitID.ToString()));
			txtProductPrice.Text = clsProductDetails.Price.ToString("#,##0.#0");
            txtPrice1.Text = clsProductDetails.Price1.ToString("#,##0.#0");
            txtPrice2.Text = clsProductDetails.Price2.ToString("#,##0.#0");
            txtPrice3.Text = clsProductDetails.Price3.ToString("#,##0.#0");
            txtPrice4.Text = clsProductDetails.Price4.ToString("#,##0.#0");
            txtPrice5.Text = clsProductDetails.Price5.ToString("#,##0.#0");
            txtWSPrice.Text = clsProductDetails.WSPrice.ToString("#,##0.#0");
			txtPurchasePrice.Text = clsProductDetails.PurchasePrice.ToString("#,##0.#0");
            decimal decMargin = clsProductDetails.Price - clsProductDetails.PurchasePrice;
            try { decMargin = decMargin / clsProductDetails.PurchasePrice; }
            catch { decMargin = 1; }
            decMargin = decMargin * 100;
            txtMargin.Text = decMargin.ToString("#,##0.##0");

            decMargin = clsProductDetails.WSPrice - clsProductDetails.PurchasePrice;
            try { decMargin = decMargin / clsProductDetails.PurchasePrice; }
            catch { decMargin = 1; }
            decMargin = decMargin * 100;
            txtWSPriceMarkUp.Text = decMargin.ToString("#,##0.##0");

            chkIncludeInSubtotalDiscount.Checked = clsProductDetails.IncludeInSubtotalDiscount;
			txtVAT.Text = clsProductDetails.VAT.ToString("#,##0.#0");
			txtEVAT.Text = clsProductDetails.EVAT.ToString("#,##0.#0");
			clsProduct.CommitAndDispose();

            string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&prodid=" + Common.Encrypt(lblProductID.Text, Session.SessionID);
            lnkVariations.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_Variations/Default.aspx" + stParam;

		}
Exemplo n.º 12
0
        protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (cboProductCode.Items.Count == 0)
            {
                return;
            }

            if (cboProductCode.Items.Count == 1 && cboProductCode.SelectedValue == Constants.ZERO_STRING)
            {
                return;
            }

            DataClass clsDataClass = new DataClass();
            long      ProductID    = Convert.ToInt64(cboProductCode.SelectedItem.Value);

            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix();

            cboVariation.DataTextField  = "MatrixDescription";
            cboVariation.DataValueField = "MatrixID";
            cboVariation.DataSource     = clsProductVariationsMatrix.BaseListSimpleAsDataTable(ProductID, SortField: "VariationDesc").DefaultView;
            cboVariation.DataBind();

            if (cboVariation.Items.Count == 0)
            {
                cboVariation.Items.Add(new ListItem("No Variation", "0"));
            }
            cboVariation.SelectedIndex = cboVariation.Items.Count - 1;

            ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);

            cboProductUnit.DataTextField  = "BottomUnitCode";
            cboProductUnit.DataValueField = "BottomUnitID";
            cboProductUnit.DataSource     = clsUnitMatrix.ListAsDataTable(ProductID, "a.MatrixID", SortOption.Ascending).DefaultView;
            cboProductUnit.DataBind();

            Products       clsProduct = new Products(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);
            ProductDetails clsDetails = clsProduct.Details(ProductID);
            ProductPurchasePriceHistory clsProductPurchasePriceHistory = new ProductPurchasePriceHistory(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);

            System.Data.DataTable dtProductPurchasePriceHistory = clsProductPurchasePriceHistory.ListAsDataTable(ProductID, DateTime.Now.AddMonths(-6), "PurchasePrice", SortOption.Ascending);
            clsProductVariationsMatrix.CommitAndDispose();

            string strPurchasePriceHistory = string.Empty;

            foreach (System.Data.DataRow dr in dtProductPurchasePriceHistory.Rows)
            {
                DateTime dtePurchaseDate  = DateTime.Parse(dr["PurchaseDate"].ToString());
                decimal  decPurchasePrice = decimal.Parse(dr["PurchasePrice"].ToString());
                long     lngSupplierID    = long.Parse(dr["SupplierID"].ToString());
                string   strSupplierName  = "" + dr["SupplierName"].ToString();

                strPurchasePriceHistory += dtePurchaseDate.ToString("ddMMMyyyy HH:mm") + ": " + decPurchasePrice.ToString("#,##0.#0").PadLeft(10) + " " + strSupplierName + "\r\n<br />" + Environment.NewLine;
            }
            lblPurchasePriceHistory.Text = "<br />" + strPurchasePriceHistory;
            cboProductUnit.Items.Insert(0, new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));
            cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf(new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));

            txtPrice.Text           = clsDetails.PurchasePrice.ToString("#####0.#0");
            txtSellingPrice.Text    = clsDetails.Price.ToString("#####0.#0");
            txtOldSellingPrice.Text = clsDetails.Price.ToString("#####0.#0");
            decimal decMargin = clsDetails.Price - clsDetails.PurchasePrice;

            try { decMargin = decMargin / clsDetails.PurchasePrice; }
            catch { decMargin = 1; }
            decMargin        = decMargin * 100;
            txtMargin.Text   = decMargin.ToString("#,##0.##0");
            txtVAT.Text      = clsDetails.VAT.ToString("#,##0.#0");
            txtEVAT.Text     = clsDetails.EVAT.ToString("#,##0.#0");
            txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0");

            if (clsDetails.VAT > 0)
            {
                chkIsTaxable.Checked = true;
            }
            else
            {
                chkIsTaxable.Checked = false;
            }

            ComputeItemAmount();
            cboVariation_SelectedIndexChanged(null, null);
        }
Exemplo n.º 13
0
        protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (cboProductCode.Items.Count == 0)
            {
                return;
            }

            DataClass clsDataClass = new DataClass();
            long      ProductID    = Convert.ToInt64(cboProductCode.SelectedItem.Value);

            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix();

            cboVariation.DataTextField  = "MatrixDescription";
            cboVariation.DataValueField = "MatrixID";
            cboVariation.DataSource     = clsProductVariationsMatrix.BaseListSimpleAsDataTable(ProductID, SortField: "VariationDesc").DefaultView;
            cboVariation.DataBind();

            if (cboVariation.Items.Count == 0)
            {
                cboVariation.Items.Add(new ListItem("No Variation", "0"));
            }
            cboVariation.SelectedIndex = cboVariation.Items.Count - 1;

            ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);

            cboProductUnit.DataTextField  = "BottomUnitCode";
            cboProductUnit.DataValueField = "BottomUnitID";
            cboProductUnit.DataSource     = clsUnitMatrix.ListAsDataTable(ProductID, "a.MatrixID", SortOption.Ascending).DefaultView;
            cboProductUnit.DataBind();

            Products       clsProduct = new Products(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);
            ProductDetails clsDetails = clsProduct.Details(ProductID);

            clsProductVariationsMatrix.CommitAndDispose();
            cboProductUnit.Items.Insert(0, new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));
            cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf(new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));

            txtPrice.Text        = clsDetails.WSPrice.ToString("#####0.#0");
            txtSellingPrice.Text = clsDetails.Price.ToString("#####0.#0");
            decimal decMargin = clsDetails.Price - clsDetails.WSPrice;

            try { decMargin = decMargin / clsDetails.WSPrice; }
            catch { decMargin = 1; }
            decMargin        = decMargin * 100;
            txtMargin.Text   = decMargin.ToString("#,##0.##0");
            txtVAT.Text      = clsDetails.VAT.ToString("#,##0.#0");
            txtEVAT.Text     = clsDetails.EVAT.ToString("#,##0.#0");
            txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0");

            if (clsDetails.VAT > 0)
            {
                chkIsTaxable.Checked = true;
            }
            else
            {
                chkIsTaxable.Checked = false;
            }

            ComputeItemAmount();
            cboVariation_SelectedIndexChanged(null, null);

            //if (ProductID != 0)
            //{
            //    lnkVariationAdd.Visible = true;
            //    string stParam = "?task=" + Common.Encrypt("add", Session.SessionID) +
            //                "&prodid=" + Common.Encrypt(ProductID.ToString(), Session.SessionID);
            //    lnkVariationAdd.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_VariationsMatrix/Default.aspx" + stParam;
            //}
            //else { lnkVariationAdd.Visible = false; }
        }
Exemplo n.º 14
0
		private void LoadRecord()
		{
            Int64 prdID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"], Session.SessionID));
			Products clsProduct = new Products();
            ProductDetails clsDetails = clsProduct.Details(prdID);

            ProductUnitsMatrix clsProductUnitsMatrix = new ProductUnitsMatrix(clsProduct.Connection, clsProduct.Transaction);
            System.Data.DataTable dtUnits = clsProductUnitsMatrix.ListAsDataTable(clsDetails.ProductID);

			clsProduct.CommitAndDispose();

			lblProductID.Text = clsDetails.ProductID.ToString();
			txtProductCode.Text = clsDetails.ProductCode;
			txtBarcode.Text = clsDetails.BarCode;
            txtBarcode2.Text = clsDetails.BarCode2;
            txtBarcode3.Text = clsDetails.BarCode3;
			txtProductDesc.Text = clsDetails.ProductDesc;
			cboProductGroup.SelectedIndex = cboProductGroup.Items.IndexOf(cboProductGroup.Items.FindByValue(clsDetails.ProductGroupID.ToString()));
			cboProductSubGroup.SelectedIndex = cboProductSubGroup.Items.IndexOf(cboProductSubGroup.Items.FindByValue(clsDetails.ProductSubGroupID.ToString()));
			txtProductDesc.Text = clsDetails.ProductDesc;
			cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf(cboProductUnit.Items.FindByValue(clsDetails.BaseUnitID.ToString()));
			txtProductPrice.Text = clsDetails.Price.ToString("#,##0.#0");
            txtPrice1.Text = clsDetails.Price1.ToString("#,##0.#0");
            txtPrice2.Text = clsDetails.Price2.ToString("#,##0.#0");
            txtPrice3.Text = clsDetails.Price3.ToString("#,##0.#0");
            txtPrice4.Text = clsDetails.Price4.ToString("#,##0.#0");
            txtPrice5.Text = clsDetails.Price5.ToString("#,##0.#0");
            txtWSPrice.Text = clsDetails.WSPrice.ToString("#,##0.#0");
            txtPurchasePrice.Text = clsDetails.PurchasePrice.ToString("#,##0.#0");
            txtPercentageCommision.Text = clsDetails.PercentageCommision.ToString("#,##0.#0");
            decimal decMargin = clsDetails.Price - clsDetails.PurchasePrice;
            try { decMargin = decMargin / clsDetails.PurchasePrice; }
            catch { decMargin = 1; }
            decMargin = decMargin * 100;
            txtMargin.Text = decMargin.ToString("#,##0.##0");

            decMargin = clsDetails.WSPrice - clsDetails.PurchasePrice;
            try { decMargin = decMargin / clsDetails.PurchasePrice; }
            catch { decMargin = 1; }
            decMargin = decMargin * 100;
            txtWSPriceMarkUp.Text = decMargin.ToString("#,##0.##0");

            chkIncludeInSubtotalDiscount.Checked = clsDetails.IncludeInSubtotalDiscount;
			txtVAT.Text = clsDetails.VAT.ToString("#,##0.#0");
			txtEVAT.Text = clsDetails.EVAT.ToString("#,##0.#0");
			txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0");
			txtQuantity.Text = clsDetails.Quantity.ToString("#,##0.#0");
			txtMinThreshold.Text = clsDetails.MinThreshold.ToString("#,##0.#0");
			txtMaxThreshold.Text = clsDetails.MaxThreshold.ToString("#,##0.#0");
			cboSupplier.SelectedIndex = cboSupplier.Items.IndexOf(cboSupplier.Items.FindByValue(clsDetails.SupplierID.ToString()));
            chkIsItemSold.Checked = clsDetails.IsItemSold;
            chkWillPrintProductComposition.Checked = clsDetails.WillPrintProductComposition;

            txtRID.Text = clsDetails.RID.ToString("###0");
            txtSequenceNo.Text = clsDetails.SequenceNo.ToString("###0");

            cboProductUnit.Enabled = dtUnits.Rows.Count >= 1 ? false : true;

            cboProductGroup_SelectedIndexChanged(null, null);
		}
Exemplo n.º 15
0
		private void LoadList()
		{
            try
            {
                string SortField = "a.MatrixID";
                if (Request.QueryString["sortfield"] != null)
                { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); }

                SortOption sortoption = SortOption.Ascending;
                if (Request.QueryString["sortoption"] != null)
                { sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); }

                ProductUnitsMatrix clsProductUnitsMatrix = new ProductUnitsMatrix();
                PageData.DataSource = clsProductUnitsMatrix.ListAsDataTable(Convert.ToInt64(lblProductID.Text), SortField, sortoption).DefaultView;
                clsProductUnitsMatrix.CommitAndDispose();

                int iPageSize = Convert.ToInt16(Session["PageSize"]);

                PageData.AllowPaging = true;
                PageData.PageSize = iPageSize;
                try
                {
                    PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;
                    lstItem.DataSource = PageData;
                    lstItem.DataBind();
                }
                catch
                {
                    PageData.CurrentPageIndex = 1;
                    lstItem.DataSource = PageData;
                    lstItem.DataBind();
                }

                cboCurrentPage.Items.Clear();
                for (int i = 0; i < PageData.PageCount; i++)
                {
                    int iValue = i + 1;
                    cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString()));
                    if (PageData.CurrentPageIndex == i)
                    { cboCurrentPage.Items[i].Selected = true; }
                    else
                    { cboCurrentPage.Items[i].Selected = false; }
                }
                lblDataCount.Text = " of " + " " + PageData.PageCount;
            }
            catch  { }
		}
Exemplo n.º 16
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();

			lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"],Session.SessionID);
			lblPackageID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID);

			ProductUnitsMatrix clsUnit = new ProductUnitsMatrix();
			cboUnit.DataTextField = "BottomUnitName";
			cboUnit.DataValueField = "BottomUnitID";
			cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text),"MatrixID",SortOption.Ascending).DefaultView;
			cboUnit.DataBind();

            Products clsProduct = new Products(clsUnit.Connection, clsUnit.Transaction);
            ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));
            clsUnit.CommitAndDispose();

            cboUnit.Items.Insert(0, new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString()));
            cboUnit.SelectedIndex = 0;
		}
Exemplo n.º 17
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();

			lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"],Session.SessionID);
			lblMatrixID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID);

			ProductVariations clsProductVariation = new ProductVariations();
			lstItem.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
			lstItem.DataBind();
			clsProductVariation.CommitAndDispose();	

			ProductUnitsMatrix clsProductUnitsMatrix = new ProductUnitsMatrix();
			cboUnit.DataTextField = "BottomUnitName";
			cboUnit.DataValueField = "BottomUnitID";
			cboUnit.DataSource = clsProductUnitsMatrix.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
			cboUnit.DataBind();
			cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
			clsProductUnitsMatrix.CommitAndDispose();	

			Products clsProduct = new Products();
            ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));
			cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString()));
			clsProduct.CommitAndDispose();
			cboUnit.SelectedIndex = cboUnit.Items.Count - 1;

            lblProductSubGroupID.Text = clsDetails.ProductSubGroupID.ToString();

            string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&prodid=" + Common.Encrypt(lblProductID.Text, Session.SessionID);
            lnkVariations.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_Variations/Default.aspx" + stParam;

		}
Exemplo n.º 18
0
		private void LoadOptions()
		{
			lblMatrixID.Text = Common.Decrypt((string)Request.QueryString["matrixid"],Session.SessionID);
			lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"],Session.SessionID);

			ProductUnitsMatrix clsUnit = new ProductUnitsMatrix();
			cboUnit.DataTextField = "BottomUnitName";
			cboUnit.DataValueField = "BottomUnitID";
			cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
			cboUnit.DataBind();
			cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
			clsUnit.CommitAndDispose();	

			Products clsProduct = new Products();
            ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));
			cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString()));
			cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsDetails.BaseUnitID.ToString()));
			txtProductPrice.Text = clsDetails.Price.ToString("#,##0.#0");
			txtPurchasePrice.Text = clsDetails.PurchasePrice.ToString("#,##0.#0");
			txtVAT.Text = clsDetails.VAT.ToString("#,##0.#0");
			txtEVAT.Text = clsDetails.EVAT.ToString("#,##0.#0");
			txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0");
			clsProduct.CommitAndDispose();
			
		}
Exemplo n.º 19
0
        protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (cboProductCode.Items.Count == 0)
                return;

            if (cboProductCode.Items.Count == 1 && cboProductCode.SelectedValue == Constants.ZERO_STRING)
                return;

            DataClass clsDataClass = new DataClass();
            long ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value);

            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix();
            cboVariation.DataTextField = "MatrixDescription";
            cboVariation.DataValueField = "MatrixID";
            cboVariation.DataSource = clsProductVariationsMatrix.BaseListSimpleAsDataTable(ProductID, SortField: "VariationDesc").DefaultView;
            cboVariation.DataBind();

            if (cboVariation.Items.Count == 0)
            { cboVariation.Items.Add(new ListItem("No Variation", Constants.ZERO_STRING)); }
            cboVariation.SelectedIndex = cboVariation.Items.Count - 1;

            ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);
            cboProductUnit.DataTextField = "BottomUnitCode";
            cboProductUnit.DataValueField = "BottomUnitID";
            cboProductUnit.DataSource = clsUnitMatrix.ListAsDataTable(ProductID, "a.MatrixID", SortOption.Ascending).DefaultView;
            cboProductUnit.DataBind();

            Products clsProduct = new Products(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);
            ProductDetails clsDetails = clsProduct.Details(ProductID);
            ProductPurchasePriceHistory clsProductPurchasePriceHistory = new ProductPurchasePriceHistory(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);
            System.Data.DataTable dtProductPurchasePriceHistory = clsProductPurchasePriceHistory.ListAsDataTable(ProductID, DateTime.Now.AddMonths(-6), "PurchasePrice", SortOption.Ascending);

            clsProductVariationsMatrix.CommitAndDispose();

            string strPurchasePriceHistory = string.Empty;
            foreach (System.Data.DataRow dr in dtProductPurchasePriceHistory.Rows)
            {
                DateTime dtePurchaseDate = DateTime.Parse(dr["PurchaseDate"].ToString());
                decimal decPurchasePrice = decimal.Parse(dr["PurchasePrice"].ToString());
                long lngSupplierID = long.Parse(dr["SupplierID"].ToString());
                string strSupplierName = "" + dr["SupplierName"].ToString();
                if (lngSupplierID == long.Parse(lblSupplierID.Text))
                    clsDetails.PurchasePrice = decPurchasePrice;

                strPurchasePriceHistory += dtePurchaseDate.ToString("ddMMMyyyy HH:mm") + ": " + decPurchasePrice.ToString("#,##0.##0").PadLeft(10) + " " + strSupplierName + "\r\n<br />" + Environment.NewLine;
            }
            lblPurchasePriceHistory.Text = "<br />" + strPurchasePriceHistory;

            cboProductUnit.Items.Insert(0, new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));

            cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf(new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));
            txtPrice.Text = clsDetails.PurchasePrice.ToString("#####0.##0");
            txtSellingPrice.Text = clsDetails.Price.ToString("#####0.##0");
            txtOldSellingPrice.Text = clsDetails.Price.ToString("#####0.##0");
            decimal decMargin = clsDetails.Price - clsDetails.PurchasePrice;
            try { decMargin = decMargin / clsDetails.PurchasePrice; }
            catch { decMargin = 1; }
            decMargin = decMargin * 100;
            txtMargin.Text = decMargin.ToString("#,##0.##0");
            txtVAT.Text = clsDetails.VAT.ToString("#,##0.##0");
            txtEVAT.Text = clsDetails.EVAT.ToString("#,##0.##0");
            txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.##0");

            if (clsDetails.VAT > 0) chkIsTaxable.Checked = true;
            else chkIsTaxable.Checked = false;

            if (cboProductUnit.Items.Count == 0)
            { cboProductUnit.Items.Add(new ListItem("No Unit", "0")); }
            cboVariation.SelectedIndex = cboVariation.Items.Count - 1;

            ComputeItemAmount();
            cboVariation_SelectedIndexChanged(null, null);
            lstItemFixCssClass();
        }
Exemplo n.º 20
0
        protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (cboProductCode.Items.Count == 0)
                return;

            DataClass clsDataClass = new DataClass();
            long ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value);

            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix();
            cboVariation.DataTextField = "MatrixDescription";
            cboVariation.DataValueField = "MatrixID";
            cboVariation.DataSource = clsProductVariationsMatrix.BaseListSimpleAsDataTable(ProductID, SortField: "VariationDesc").DefaultView;
            cboVariation.DataBind();

            if (cboVariation.Items.Count == 0)
            { cboVariation.Items.Add(new ListItem("No Variation", "0"));}
            cboVariation.SelectedIndex = cboVariation.Items.Count - 1;

            ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);

            cboProductUnit.DataTextField = "BottomUnitCode";
            cboProductUnit.DataValueField = "BottomUnitID";
            cboProductUnit.DataSource = clsUnitMatrix.ListAsDataTable(ProductID, "a.MatrixID", SortOption.Ascending).DefaultView;
            cboProductUnit.DataBind();

            Products clsProduct = new Products(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);
            ProductDetails clsDetails = clsProduct.Details(ProductID);
            clsProductVariationsMatrix.CommitAndDispose();
            cboProductUnit.Items.Insert(0, new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));
            cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf(new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));

            txtPrice.Text = clsDetails.WSPrice.ToString("#####0.#0");
            txtSellingPrice.Text = clsDetails.Price.ToString("#####0.#0");
            decimal decMargin = clsDetails.Price - clsDetails.WSPrice;
            try { decMargin = decMargin / clsDetails.WSPrice; }
            catch { decMargin = 1; }
            decMargin = decMargin * 100;
            txtMargin.Text = decMargin.ToString("#,##0.##0");
            txtVAT.Text = clsDetails.VAT.ToString("#,##0.#0");
            txtEVAT.Text = clsDetails.EVAT.ToString("#,##0.#0");
            txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0");

            if (clsDetails.VAT > 0)
                chkIsTaxable.Checked = true;
            else
                chkIsTaxable.Checked = false;

            ComputeItemAmount();
            cboVariation_SelectedIndexChanged(null, null);

            //if (ProductID != 0)
            //{
            //    lnkVariationAdd.Visible = true;
            //    string stParam = "?task=" + Common.Encrypt("add", Session.SessionID) +
            //                "&prodid=" + Common.Encrypt(ProductID.ToString(), Session.SessionID);
            //    lnkVariationAdd.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_VariationsMatrix/Default.aspx" + stParam;
            //}
            //else { lnkVariationAdd.Visible = false; }
        }
Exemplo n.º 21
0
		protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if (cboProductCode.Items.Count == 0)
				return;

			DataClass clsDataClass = new DataClass();
			long ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value);

            if (ProductID == 0) {
                cboVariation.Items.Clear();
                cboVariation.Items.Add(new ListItem("No Variation", "0"));
                return; 
            }

			ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix();
			cboVariation.DataTextField = "VariationDesc";
			cboVariation.DataValueField = "MatrixID";
			cboVariation.DataSource = clsProductVariationsMatrix.BaseListSimpleAsDataTable(ProductID, SortField: "VariationDesc").DefaultView;
			cboVariation.DataBind();

			if (cboVariation.Items.Count == 0)
			{
				cboVariation.Items.Add(new ListItem("No Variation", "0"));
			}
			cboVariation.SelectedIndex = cboVariation.Items.Count - 1;
			clsProductVariationsMatrix.CommitAndDispose();

			ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix();

			cboProductUnit.DataTextField = "BottomUnitCode";
			cboProductUnit.DataValueField = "BottomUnitID";
			cboProductUnit.DataSource = clsUnitMatrix.ListAsDataTable(ProductID,"a.MatrixID",SortOption.Ascending).DefaultView;
			cboProductUnit.DataBind();
			clsUnitMatrix.CommitAndDispose();

			Products clsProduct = new Products();
			ProductDetails clsDetails = new ProductDetails();
			clsDetails = clsProduct.Details(ProductID);
			clsProduct.CommitAndDispose();
			cboProductUnit.Items.Add( new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));

			cboProductUnit.SelectedIndex = cboProductUnit.Items.Count - 1;

			cboVariation_SelectedIndexChanged(null, null);
		}
Exemplo n.º 22
0
        protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e)
		{
            if (cboProductCode.Items.Count == 0)
                return;

            if (cboProductCode.Items.Count == 1 && cboProductCode.SelectedValue == Constants.ZERO_STRING)
                return;

            DataClass clsDataClass = new DataClass();
            long ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value);

            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix();
            cboVariation.DataTextField = "MatrixDescription";
            cboVariation.DataValueField = "MatrixID";
            cboVariation.DataSource = clsProductVariationsMatrix.BaseListSimpleAsDataTable(ProductID, SortField: "VariationDesc").DefaultView;
            cboVariation.DataBind();

            if (cboVariation.Items.Count == 0)
            { cboVariation.Items.Add(new ListItem("No Variation", "0")); }
            cboVariation.SelectedIndex = cboVariation.Items.Count - 1;

            ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);

			cboProductUnit.DataTextField = "BottomUnitCode";
			cboProductUnit.DataValueField = "BottomUnitID";
			cboProductUnit.DataSource = clsUnitMatrix.ListAsDataTable(ProductID,"a.MatrixID",SortOption.Ascending).DefaultView;
			cboProductUnit.DataBind();

            Products clsProduct = new Products(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);
            ProductDetails clsDetails = clsProduct.Details(ProductID, MatrixID: Int64.Parse(cboVariation.SelectedItem.Value));
            clsProductVariationsMatrix.CommitAndDispose();

            cboProductUnit.Items.Insert(0, new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));

            cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf(new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));

            txtPrevPrice.Text = clsDetails.PurchasePrice.ToString("#####0.#0");
			txtPrice.Text = clsDetails.PurchasePrice.ToString("#####0.#0");
			if (clsDetails.VAT >0)
				chkIsTaxable.Checked = true;
			else
				chkIsTaxable.Checked = false;
			
			ComputeItemAmount();
			cboVariation_SelectedIndexChanged(null, null);
		}
Exemplo n.º 23
0
        private void LoadRecord()
        {
            Int64          prdID      = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"], Session.SessionID));
            Products       clsProduct = new Products();
            ProductDetails clsDetails = clsProduct.Details(prdID);

            ProductUnitsMatrix clsProductUnitsMatrix = new ProductUnitsMatrix(clsProduct.Connection, clsProduct.Transaction);

            System.Data.DataTable dtUnits = clsProductUnitsMatrix.ListAsDataTable(clsDetails.ProductID);

            clsProduct.CommitAndDispose();

            lblProductID.Text                = clsDetails.ProductID.ToString();
            txtProductCode.Text              = clsDetails.ProductCode;
            txtBarcode.Text                  = clsDetails.BarCode;
            txtBarcode2.Text                 = clsDetails.BarCode2;
            txtBarcode3.Text                 = clsDetails.BarCode3;
            txtProductDesc.Text              = clsDetails.ProductDesc;
            cboProductGroup.SelectedIndex    = cboProductGroup.Items.IndexOf(cboProductGroup.Items.FindByValue(clsDetails.ProductGroupID.ToString()));
            cboProductSubGroup.SelectedIndex = cboProductSubGroup.Items.IndexOf(cboProductSubGroup.Items.FindByValue(clsDetails.ProductSubGroupID.ToString()));
            txtProductDesc.Text              = clsDetails.ProductDesc;
            cboProductUnit.SelectedIndex     = cboProductUnit.Items.IndexOf(cboProductUnit.Items.FindByValue(clsDetails.BaseUnitID.ToString()));
            txtProductPrice.Text             = clsDetails.Price.ToString("#,##0.#0");
            txtPrice1.Text              = clsDetails.Price1.ToString("#,##0.#0");
            txtPrice2.Text              = clsDetails.Price2.ToString("#,##0.#0");
            txtPrice3.Text              = clsDetails.Price3.ToString("#,##0.#0");
            txtPrice4.Text              = clsDetails.Price4.ToString("#,##0.#0");
            txtPrice5.Text              = clsDetails.Price5.ToString("#,##0.#0");
            txtWSPrice.Text             = clsDetails.WSPrice.ToString("#,##0.#0");
            txtPurchasePrice.Text       = clsDetails.PurchasePrice.ToString("#,##0.#0");
            txtPercentageCommision.Text = clsDetails.PercentageCommision.ToString("#,##0.#0");
            decimal decMargin = clsDetails.Price - clsDetails.PurchasePrice;

            try { decMargin = decMargin / clsDetails.PurchasePrice; }
            catch { decMargin = 1; }
            decMargin      = decMargin * 100;
            txtMargin.Text = decMargin.ToString("#,##0.##0");

            decMargin = clsDetails.WSPrice - clsDetails.PurchasePrice;
            try { decMargin = decMargin / clsDetails.PurchasePrice; }
            catch { decMargin = 1; }
            decMargin             = decMargin * 100;
            txtWSPriceMarkUp.Text = decMargin.ToString("#,##0.##0");

            chkIncludeInSubtotalDiscount.Checked = clsDetails.IncludeInSubtotalDiscount;
            txtVAT.Text               = clsDetails.VAT.ToString("#,##0.#0");
            txtEVAT.Text              = clsDetails.EVAT.ToString("#,##0.#0");
            txtLocalTax.Text          = clsDetails.LocalTax.ToString("#,##0.#0");
            txtQuantity.Text          = clsDetails.Quantity.ToString("#,##0.#0");
            txtMinThreshold.Text      = clsDetails.MinThreshold.ToString("#,##0.#0");
            txtMaxThreshold.Text      = clsDetails.MaxThreshold.ToString("#,##0.#0");
            cboSupplier.SelectedIndex = cboSupplier.Items.IndexOf(cboSupplier.Items.FindByValue(clsDetails.SupplierID.ToString()));
            chkIsItemSold.Checked     = clsDetails.IsItemSold;
            chkWillPrintProductComposition.Checked = clsDetails.WillPrintProductComposition;

            txtRID.Text        = clsDetails.RID.ToString("###0");
            txtSequenceNo.Text = clsDetails.SequenceNo.ToString("###0");

            cboProductUnit.Enabled = dtUnits.Rows.Count >= 1 ? false : true;

            cboProductGroup_SelectedIndexChanged(null, null);
        }