/// <summary> /// Function to save the new pricelist for the product /// </summary> public void SaveFunction() { try { PriceListSP spPriceList = new PriceListSP(); 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 (spPriceList.PriceListCheckExistence(0, decPricingLevelMain, Convert.ToDecimal(cmbBatch.SelectedValue.ToString()), decProductMain) == true) { spPriceList.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); } }
/// <summary> /// Price list get by batchid Or product /// </summary> /// <param name="dcBatchId"></param> /// <returns></returns> public PriceListInfo PriceListViewByBatchIdORProduct(decimal dcBatchId) { PriceListInfo infoPriceList = new PriceListInfo(); SqlDataReader sqldr = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sqlcmd = new SqlCommand("PriceListViewByBatchIdORProduct", sqlcon); sqlcmd.CommandType = CommandType.StoredProcedure; sqlcmd.Parameters.Add("@batchId", SqlDbType.Decimal).Value = dcBatchId; sqldr = sqlcmd.ExecuteReader(); while (sqldr.Read()) { infoPriceList.ProductId = Convert.ToDecimal(sqldr["productId"].ToString()); infoPriceList.BatchId = Convert.ToDecimal(sqldr["batchId"].ToString()); infoPriceList.PricinglevelId = Convert.ToDecimal(sqldr["pricinglevelId"].ToString()); infoPriceList.Rate = Convert.ToDecimal(sqldr["rate"].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sqlcon.Close(); sqldr.Close(); } return(infoPriceList); }
/// <summary> /// Function to Update values in PriceList Table /// </summary> /// <param name="pricelistinfo"></param> public void PriceListEdit(PriceListInfo pricelistinfo) { try { spPriceList.PriceListEdit(pricelistinfo); } catch (Exception ex) { MessageBox.Show("PL6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to get particular values from PriceList Table based on the parameter /// </summary> /// <param name="pricelistId"></param> /// <returns></returns> public PriceListInfo PriceListView(decimal pricelistId) { PriceListInfo pricelistinfo = new PriceListInfo(); try { pricelistinfo = spPriceList.PriceListView(pricelistId); } catch (Exception ex) { MessageBox.Show("PL6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(pricelistinfo); }
public PriceListInfo PriceListViewByBatchIdORProduct(decimal dcBatchId) { PriceListInfo infoPriceList = new PriceListInfo(); try { infoPriceList = spPriceList.PriceListViewByBatchIdORProduct(dcBatchId); } catch (Exception ex) { MessageBox.Show("PL6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(infoPriceList); }
/// <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(); ProductSP spProduct = new ProductSP(); UnitSP spunit = new UnitSP(); UnitInfo infoUnit = new UnitInfo(); PriceListSP spPriceList = new PriceListSP(); PriceListInfo infoPriceList = new PriceListInfo(); PricingLevelSP spPricingLevel = new PricingLevelSP(); PricingLevelInfo infoPricingLevel = new PricingLevelInfo(); infoProduct = spProduct.PriceListPopUpView(decProduct); txtProductCode.Text = infoProduct.ProductCode; txtProductName.Text = infoProduct.ProductName; decProduct = infoProduct.ProductId; decProductMain = infoProduct.ProductId; infoUnit = spunit.UnitViewForPriceListPopUp(decProduct); decUnitId = infoUnit.UnitId; txtUnitName.Text = infoUnit.UnitName; decPriceLevelId = infoPriceList.PricinglevelId; infoPricingLevel = spPricingLevel.PricingLevelNameViewForPriceListPopUp(decPricingLevel, decProduct, decUnitId); decPriceLevelId = infoPricingLevel.PricinglevelId; txtPricingLevel.Text = infoPricingLevel.PricinglevelName; if (txtPricingLevel.Text == string.Empty) { infoPricingLevel = spPricingLevel.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); } }
/// <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) { PriceListSP spPriceList = new PriceListSP(); spPriceList.PriceListDelete(deca); Messages.UpdatedMessage(); if (frmPriceListobj != null) { this.Close(); } } else { PriceListSP spPriceList = new PriceListSP(); 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; spPriceList.PriceListEdit(infoPriceList); Messages.UpdatedMessage(); Clear(); if (frmPriceListobj != null) { this.Close(); } } } catch (Exception ex) { MessageBox.Show("PLP3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private bool ExtraForPriceList(JsonPriceList jsonPriceList, PriceListInfo priceListInfo) { DateTime from; if (DateTime.TryParse(jsonPriceList.ValidFromString, out from)) { priceListInfo.ValidFrom = from; } DateTime to; if (DateTime.TryParse(jsonPriceList.ValidToString, out to)) { priceListInfo.ValidTo = to; } return(true); }
/// <summary> /// Function to get particular values from PriceList Table based on the parameter /// </summary> /// <param name="pricelistId"></param> /// <returns></returns> public PriceListInfo PriceListView(decimal pricelistId) { PriceListInfo pricelistinfo = new PriceListInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("PriceListView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@pricelistId", SqlDbType.Decimal); sprmparam.Value = pricelistId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { pricelistinfo.PricelistId = Convert.ToDecimal(sdrreader[0].ToString()); pricelistinfo.ProductId = Convert.ToDecimal(sdrreader[1].ToString()); pricelistinfo.PricinglevelId = Convert.ToDecimal(sdrreader[2].ToString()); pricelistinfo.UnitId = Convert.ToDecimal(sdrreader[3].ToString()); pricelistinfo.BatchId = Convert.ToDecimal(sdrreader[4].ToString()); pricelistinfo.Rate = Convert.ToDecimal(sdrreader[5].ToString()); pricelistinfo.ExtraDate = Convert.ToDateTime(sdrreader[6].ToString()); pricelistinfo.Extra1 = sdrreader[7].ToString(); pricelistinfo.Extra2 = sdrreader[8].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(pricelistinfo); }
/// <summary> /// Function to Update values in PriceList Table /// </summary> /// <param name="pricelistinfo"></param> public void PriceListEdit(PriceListInfo pricelistinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("PriceListEdit", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@pricelistId", SqlDbType.Decimal); sprmparam.Value = pricelistinfo.PricelistId; sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal); sprmparam.Value = pricelistinfo.ProductId; sprmparam = sccmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal); sprmparam.Value = pricelistinfo.PricinglevelId; sprmparam = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal); sprmparam.Value = pricelistinfo.UnitId; sprmparam = sccmd.Parameters.Add("@rate", SqlDbType.Decimal); sprmparam.Value = pricelistinfo.Rate; sprmparam = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal); sprmparam.Value = pricelistinfo.BatchId; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = pricelistinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = pricelistinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to fill the fields while user double click on the datagridview /// </summary> public void FillControls() { try { PriceListInfo infoPricelist = new PriceListInfo(); PriceListSP spPricelist = new PriceListSP(); infoPricelist.PricelistId = decpriceListId; infoPricelist = spPricelist.PriceListView(decpriceListId); txtRate.Text = infoPricelist.Rate.ToString(); ProductInfo infoProduct = new ProductInfo(); ProductSP spProduct = new ProductSP(); infoProduct = spProduct.PriceListPopUpView(decProductId); txtProductCode.Text = infoProduct.ProductCode; txtProductName.Text = infoProduct.ProductName; BatchInfo infobatch = new BatchInfo(); BatchSP spBatch = new BatchSP(); infobatch = spBatch.BatchView(decBatchId); cmbBatch.SelectedValue = infobatch.BatchId; UnitInfo infoUnit = new UnitInfo(); UnitSP spUnit = new UnitSP(); infoUnit = spUnit.UnitView(decUnitId); txtUnitName.Text = infoUnit.UnitName; PricingLevelInfo infoPricingLevel = new PricingLevelInfo(); PricingLevelSP spPricingLevel = new PricingLevelSP(); infoPricingLevel = spPricingLevel.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 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 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); } }
/// <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 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); } }