/// <summary>
 /// Function to fill the grid based on the
 /// </summary>
 public void GridFill()
 {
     try
     {
         PriceListBll BllPriceList = new PriceListBll();
         List<DataTable> listObj = new List<DataTable>();
         if (cmbProductGroup.Text == "All")
         {
             cmbProductGroup.Text = "All";
         }
         cmbPricingLevel.Text = cmbPricingLevel.Text;
         listObj = BllPriceList.ProductDetailsViewGridfill(Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString()), txtProductCode.Text, txtProductName.Text, cmbPricingLevel.Text);
         dgvPricingList.DataSource = listObj[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("PCL4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill the pricelevel combobox
 /// </summary>
 public void PricelevelComboFill()
 {
     try
     {
         PriceListBll BllPriceList = new PriceListBll();
         List<DataTable> listObj = new List<DataTable>();
         listObj = BllPriceList.PricelistPricingLevelViewAllForComboBox();
         cmbPricingLevel.DataSource = listObj[0];
         cmbPricingLevel.ValueMember = "pricinglevelId";
         cmbPricingLevel.DisplayMember = "pricinglevelName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("PCL3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill the ProductGroup comboBox
 /// </summary>
 public void ProductGroupComboFill()
 {
     try
     {
         PriceListBll BllPriceList = new PriceListBll();
         List<DataTable> listObj = new List<DataTable>();
         listObj = BllPriceList.PricelistProductGroupViewAllForComboBox();
         DataRow dr = listObj[0].NewRow();
         dr[0] = 0;
         dr[1] = "All";
         listObj[0].Rows.InsertAt(dr, 0);
         cmbProductGroup.DataSource = listObj[0];
         cmbProductGroup.ValueMember = "groupId";
         cmbProductGroup.DisplayMember = "groupName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("PCL2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to save the new pricelist for the product
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         PriceListBll BllPriceList = new PriceListBll();
         PriceListInfo infoPriceList = new PriceListInfo();
         infoPriceList.ProductId = decProductMain;
         infoPriceList.PricinglevelId = decPricingLevelMain;
         infoPriceList.UnitId = decUnitId;
         infoPriceList.BatchId = Convert.ToDecimal(cmbBatch.SelectedValue.ToString());
         infoPriceList.Rate = Convert.ToDecimal(txtRate.Text);
         infoPriceList.Extra1 = string.Empty;
         infoPriceList.Extra2 = string.Empty;
         if (BllPriceList.PriceListCheckExistence(0, decPricingLevelMain, Convert.ToDecimal(cmbBatch.SelectedValue.ToString()), decProductMain) == true)
         {
             BllPriceList.PriceListAdd(infoPriceList);
             Messages.SavedMessage();
             Clear();
         }
         else
         {
             Messages.InformationMessage("Price List already exist for selected product and batches");
             Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #5
0
        /// <summary>
        ///  Function to fil Controls based on the ProductName
        /// </summary>
        /// <param name="decProductId"></param>
        public void FillControlsByProductName(decimal decProductId)
        {
            try
            {
                PriceListInfo InfoPriceList = new PriceListInfo();
                ProductInfo infoProduct = new ProductInfo();
                ProductCreationBll BllProductCreation = new ProductCreationBll();
                PriceListBll BllPriceList = new PriceListBll();
                ProductBatchInfo infoProductBatch = new ProductBatchInfo();
                infoProduct = BllProductCreation.ProductView(decProductId);
                txtProductCode.Text = infoProduct.ProductCode;
                infoProductBatch = BllProductCreation.BarcodeViewByProductCode(txtProductCode.Text);
                decProductId = infoProductBatch.ProductId;
                decBatchId = infoProductBatch.BatchId;
                InfoPriceList = BllPriceList.PriceListViewByBatchIdORProduct(decBatchId);
                batchcombofill();
                txtBarcode.Text = infoProductBatch.Barcode;
                cmbItem.Text = infoProduct.ProductName;
                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();

                }
                TaxAmountCalculation();
                isAfterFillControls = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("POS:27" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Function to fill the pricelist details in datagridview 
 /// </summary>
 public void PriceListPopupGridFill()
 {
     try
     {
         List<DataTable> listObj = new List<DataTable>();
         PriceListBll BllPriceList = new PriceListBll();
         listObj = BllPriceList.PriceListPopupGridFill(decPricingLevelMain, decProductMain);
         dgvProductGroup.DataSource = listObj[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill the fields while user double click on the datagridview
 /// </summary>
 public void FillControls()
 {
     try
     {
         PriceListInfo infoPricelist = new PriceListInfo();
         PriceListBll BllPriceList = new PriceListBll();
         infoPricelist.PricelistId = decpriceListId;
         infoPricelist = BllPriceList.PriceListView(decpriceListId);
         txtRate.Text = infoPricelist.Rate.ToString();
         ProductInfo infoProduct = new ProductInfo();
         ProductCreationBll BllProductCreation = new ProductCreationBll();
         infoProduct = BllProductCreation.PriceListPopUpView(decProductId);
         txtProductCode.Text = infoProduct.ProductCode;
         txtProductName.Text = infoProduct.ProductName;
         BatchInfo infobatch = new BatchInfo();
        // BatchSP spBatch = new BatchSP();
         BatchBll BllBatch = new BatchBll();
         infobatch = BllBatch.BatchView(decBatchId);
         cmbBatch.SelectedValue = infobatch.BatchId;
         UnitInfo infoUnit = new UnitInfo();
         UnitBll bllUnit = new UnitBll();
         infoUnit = bllUnit.UnitView(decUnitId);
         txtUnitName.Text = infoUnit.UnitName;
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         PricingLevelBll BllPricingLevel = new PricingLevelBll();
         infoPricingLevel = BllPricingLevel.PricingLevelView(decPriceLevelId);
         txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         txtProductName.ReadOnly = true;
         txtProductCode.ReadOnly = true;
         txtUnitName.ReadOnly = true;
         txtPricingLevel.ReadOnly = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to edit the pricelist
 /// </summary>
 public void EditFunction()
 {
     try
     {
         if (txtRate.Text.Trim() == String.Empty)
         {
             Messages.InformationMessage("Enter rate");
             txtRate.Focus();
         }
         else if (Convert.ToDecimal(txtRate.Text) == 0)
         {
             PriceListBll BllPriceList = new PriceListBll();
             BllPriceList.PriceListDelete(deca);
             Messages.UpdatedMessage();
             if (frmPriceListobj != null)
             {
                 this.Close();
             }
         }
         else
         {
             PriceListBll BllPriceList = new PriceListBll();
             PriceListInfo infoPriceList = new PriceListInfo();
             infoPriceList.ProductId = decProductMain;
             infoPriceList.PricelistId = Convert.ToDecimal(dgvProductGroup.CurrentRow.Cells["dgvtxtPriceListId"].Value.ToString());
             infoPriceList.PricinglevelId = decPricingLevelMain;
             infoPriceList.UnitId = decUnitId;
             infoPriceList.BatchId = decBatchId;
             infoPriceList.Rate = Convert.ToDecimal(txtRate.Text);
             infoPriceList.Extra1 = string.Empty;
             infoPriceList.Extra2 = string.Empty;
             BllPriceList.PriceListEdit(infoPriceList);
             Messages.UpdatedMessage();
             Clear();
             if (frmPriceListobj != null)
             {
                 this.Close();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to delete the pricelist for the product 
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         PriceListBll BllPriceList = new PriceListBll();
         if (BllPriceList.PriceListCheckReferenceAndDelete(decPriceLevelId) <= 0)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             Messages.DeletedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to execute while calling from frmPriceList form to add new pricelist for the product
 /// </summary>
 /// <param name="decPricingLevel"></param>
 /// <param name="decProduct"></param>
 /// <param name="decPriceListId"></param>
 /// <param name="frmPriceList"></param>
 public void CallFromPriceListForPricingLevel(decimal decPricingLevel, decimal decProduct, decimal decPriceListId, frmPriceList frmPriceList)
 {
     try
     {
         ProductInfo infoProduct = new ProductInfo();
         ProductCreationBll BllProductCreation = new ProductCreationBll();
         UnitBll bllUnit = new UnitBll();
         UnitInfo infoUnit = new UnitInfo();
         PriceListBll BllPriceList = new PriceListBll();
         PriceListInfo infoPriceList = new PriceListInfo();
         PricingLevelBll BllPricingLevel = new PricingLevelBll();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoProduct = BllProductCreation.PriceListPopUpView(decProduct);
         txtProductCode.Text = infoProduct.ProductCode;
         txtProductName.Text = infoProduct.ProductName;
         decProduct = infoProduct.ProductId;
         decProductMain = infoProduct.ProductId;
         infoUnit = bllUnit.UnitViewForPriceListPopUp(decProduct);
         decUnitId = infoUnit.UnitId;
         txtUnitName.Text = infoUnit.UnitName;
         decPriceLevelId = infoPriceList.PricinglevelId;
         infoPricingLevel = BllPricingLevel.PricingLevelNameViewForPriceListPopUp(decPricingLevel, decProduct, decUnitId);
         decPriceLevelId = infoPricingLevel.PricinglevelId;
         txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         if (txtPricingLevel.Text == string.Empty)
         {
             infoPricingLevel = BllPricingLevel.PricingLevelView(decPricingLevel);
             txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         }
         decPricingLevelMain = infoPricingLevel.PricinglevelId;
         txtPricingLevel.ReadOnly = true;
         txtProductCode.ReadOnly = true;
         txtProductName.ReadOnly = true;
         txtUnitName.ReadOnly = true;
         txtRate.Focus();
         BatchUnderProductComboFill(decProduct);
         PriceListPopupGridFill();
         deca = decPriceListId;
         this.frmPriceListobj = frmPriceList;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }