Esempio n. 1
0
        /// <summary>
        /// Function to fil Controls based on the barcode
        /// </summary>
        /// <param name="strBarcode"></param>
        public void FillControlsByBarcode(string strBarcode)
        {
            try
            {
                BatchInfo infoBatch = new BatchInfo();
                BatchBll BllBatch = new BatchBll();
                PriceListInfo InfoPriceList = new PriceListInfo();
                PriceListBll BllPriceList = new PriceListBll();
                infoBatch = BllBatch.BatchAndProductViewByBarcode(strBarcode);
                cmbBatch.Text = infoBatch.BatchNo;
                decProductId = infoBatch.ProductId;
                decBatchId = infoBatch.BatchId;
                InfoPriceList = BllPriceList.PriceListViewByBatchIdORProduct(decBatchId);
                ProductInfo infoProduct = new ProductInfo();
                ProductCreationBll BllProductCreation = new ProductCreationBll();
                infoProduct = BllProductCreation.ProductView(decProductId);
                txtProductCode.Text = infoProduct.ProductCode;
                string strProductCode = infoProduct.ProductCode;
                isFromBarcode = true;
                cmbItem.Text = infoProduct.ProductName;
                isFromBarcode = false;
                cmbGodown.SelectedValue = infoProduct.GodownId;
                cmbRack.SelectedValue = infoProduct.RackId;
                UnitComboFill();
                UnitInfo infoUnit = new UnitInfo();
                infoUnit = new UnitBll().unitVieWForStandardRate(decProductId);
                cmbUnit.SelectedValue = infoUnit.UnitId;
                if (InfoPriceList.PricinglevelId != 0)
                {
                    cmbPricingLevel.SelectedValue = InfoPriceList.PricinglevelId;
                }
                else
                {
                    cmbPricingLevel.SelectedIndex = 0;
                }
                ComboTaxFill();
                cmbTax.SelectedValue = infoProduct.TaxId;
                if (txtProductCode.Text.Trim() != string.Empty && cmbItem.SelectedIndex != -1)
                {
                    decimal decNodecplaces = PublicVariables._inNoOfDecimalPlaces;
                    decimal dcRate = BllProductCreation.ProductRateForSales(decProductId, Convert.ToDateTime(txtDate.Text), decBatchId, decNodecplaces);
                    txtRate.Text = dcRate.ToString();
                    try
                    {
                        if (decimal.Parse(txtQuantity.Text) == 0)
                            txtQuantity.Text = "1";
                    }
                    catch { txtQuantity.Text = "1"; }
                    txtQuantity.Focus();

                }
                else
                {
                    txtRate.Text = string.Empty;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("POS:25" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }