Example #1
0
        protected void cboProductUnit_SelectedIndexChanged(object sender, EventArgs e)
        {
            ProductPackage        clsProductPackage = new ProductPackage();
            ProductPackageDetails clsDetails        = clsProductPackage.DetailsByProductIDAndUnitID(long.Parse(cboProductCode.SelectedValue), long.Parse(cboProductUnit.SelectedValue));

            if (clsDetails.PackageID == 0)
            {
                ProductUnit    clsProductUnit    = new ProductUnit(clsProductPackage.Connection, clsProductPackage.Transaction);
                Products       clsProduct        = new Products(clsProductPackage.Connection, clsProductPackage.Transaction);
                ProductDetails clsProductDetails = clsProduct.Details(long.Parse(cboProductCode.SelectedItem.Value));
                decimal        decBaseUnitValue  = clsProductUnit.GetBaseUnitValue(long.Parse(cboProductCode.SelectedItem.Value), int.Parse(cboProductUnit.SelectedItem.Value), 1);

                clsDetails.Price         = decBaseUnitValue * clsProductDetails.Price;
                clsDetails.PurchasePrice = decBaseUnitValue * clsProductDetails.PurchasePrice;
            }
            clsProductPackage.CommitAndDispose();

            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");
        }
Example #2
0
        protected void cboProductUnit_SelectedIndexChanged(object sender, EventArgs e)
        {
            ProductPackage        clsProductPackage = new ProductPackage();
            ProductPackageDetails clsDetails        = clsProductPackage.DetailsByProductIDAndUnitID(long.Parse(cboProductCode.SelectedValue), long.Parse(cboProductUnit.SelectedValue));

            if (clsDetails.PackageID == 0)
            {
                ProductUnit    clsProductUnit    = new ProductUnit(clsProductPackage.Connection, clsProductPackage.Transaction);
                Products       clsProduct        = new Products(clsProductPackage.Connection, clsProductPackage.Transaction);
                ProductDetails clsProductDetails = clsProduct.Details(long.Parse(cboProductCode.SelectedItem.Value));
                decimal        decBaseUnitValue  = clsProductUnit.GetBaseUnitValue(long.Parse(cboProductCode.SelectedItem.Value), int.Parse(cboProductUnit.SelectedItem.Value), 1);

                clsDetails.Price         = decBaseUnitValue * clsProductDetails.Price;
                clsDetails.PurchasePrice = decBaseUnitValue * clsProductDetails.PurchasePrice;
            }
            clsProductPackage.CommitAndDispose();

            txtPurchasePrice.Text = clsDetails.PurchasePrice.ToString("#####0.##0");
        }