示例#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");
        }
示例#2
0
        private Int32 SaveRecord()
        {
            ProductUnitsMatrix        clsUnitMatrix = new ProductUnitsMatrix();
            ProductUnitsMatrixDetails clsDetails    = new ProductUnitsMatrixDetails();

            clsDetails.ProductID       = Convert.ToInt64(lblProductID.Text);
            clsDetails.BaseUnitID      = Convert.ToInt32(lblBaseUnitID.Text);
            clsDetails.BaseUnitValue   = Convert.ToDecimal(txtBaseUnitValue.Text);
            clsDetails.BottomUnitID    = Convert.ToInt32(cboBottomUnit.SelectedItem.Value);
            clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text);
            int id = clsUnitMatrix.Insert(clsDetails);

            ProductPackageDetails clsProductPackageDetails = new ProductPackageDetails();
            ProductPackage        clsProductPackage        = new ProductPackage(clsUnitMatrix.Connection, clsUnitMatrix.Transaction);

            clsProductPackageDetails = clsProductPackage.DetailsByProductIDAndUnitID(Convert.ToInt64(lblProductID.Text), Convert.ToInt32(cboBottomUnit.SelectedItem.Value));
            if (clsProductPackageDetails.PackageID == 0)
            {
                Products       clsProduct        = new Products(clsUnitMatrix.Connection, clsUnitMatrix.Transaction);
                ProductDetails clsProductDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));

                Terminal        clsTerminal        = new Terminal(clsUnitMatrix.Connection, clsUnitMatrix.Transaction);
                TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString());

                clsProductPackageDetails.ProductID     = Convert.ToInt64(lblProductID.Text);
                clsProductPackageDetails.UnitID        = Convert.ToInt32(cboBottomUnit.SelectedItem.Value);
                clsProductPackageDetails.Price         = clsProductDetails.Price * Convert.ToDecimal(txtBaseUnitValue.Text);
                clsProductPackageDetails.WSPrice       = clsProductDetails.WSPrice * Convert.ToDecimal(txtBaseUnitValue.Text);
                clsProductPackageDetails.PurchasePrice = clsProductDetails.PurchasePrice * Convert.ToDecimal(txtBaseUnitValue.Text);
                clsProductPackageDetails.Quantity      = 1;
                clsProductPackageDetails.VAT           = clsTerminalDetails.VAT;
                clsProductPackageDetails.EVAT          = clsTerminalDetails.EVAT;
                clsProductPackageDetails.LocalTax      = clsTerminalDetails.LocalTax;
                if (!string.IsNullOrEmpty(clsProductDetails.BarCode1))
                {
                    clsProductPackageDetails.BarCode1 = clsProductDetails.BarCode1 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString();
                }
                if (!string.IsNullOrEmpty(clsProductDetails.BarCode2))
                {
                    clsProductPackageDetails.BarCode2 = clsProductDetails.BarCode2 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString();
                }
                if (!string.IsNullOrEmpty(clsProductDetails.BarCode3))
                {
                    clsProductPackageDetails.BarCode3 = clsProductDetails.BarCode3 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString();
                }
                clsProductPackage.Insert(clsProductPackageDetails);
            }
            clsUnitMatrix.CommitAndDispose();

            return(id);
        }
示例#3
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");
        }