/// <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> /// Function to fill the pricelist details in datagridview /// </summary> public void PriceListPopupGridFill() { try { DataTable dtbl = new DataTable(); PriceListSP spPriceList = new PriceListSP(); dtbl = spPriceList.PriceListPopupGridFill(decPricingLevelMain, decProductMain); dgvProductGroup.DataSource = dtbl; } catch (Exception ex) { MessageBox.Show("PLP10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the pricelevel combobox /// </summary> public void PricelevelComboFill() { try { DataTable dtbl = new DataTable(); PriceListSP spPriceList = new PriceListSP(); dtbl = spPriceList.PricelistPricingLevelViewAllForComboBox(); cmbPricingLevel.DataSource = dtbl; cmbPricingLevel.ValueMember = "pricinglevelId"; cmbPricingLevel.DisplayMember = "pricinglevelName"; } catch (Exception ex) { MessageBox.Show("PCL3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On print button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvPriceList.Rows.Count > 0) { //frmReport frmReport = new frmReport(); //frmReport.MdiParent = formMDI.MDIObj; DataTable dtblOption = new DataTable(); dtblOption.Columns.Add("PurchaseRate", typeof(String)); dtblOption.Columns.Add("SalesRate", typeof(String)); dtblOption.Columns.Add("LastSalesRate", typeof(String)); dtblOption.Columns.Add("StandardRate", typeof(String)); dtblOption.Columns.Add("MRP", typeof(String)); dtblOption.Columns.Add("Price", typeof(String)); DataRow dr = dtblOption.NewRow(); dr["PurchaseRate"] = cbxPurchaseRate.Checked?"True":"False"; dr["SalesRate"] = cbxSalesRate.Checked ? "True" : "False"; dr["LastSalesRate"] = cbxlastSalesRate.Checked ? "True" : "False"; dr["StandardRate"] = CbxStandardRate.Checked ? "True" : "False"; dr["MRP"] = cbxMrp.Checked ? "True" : "False"; dr["Price"] = "True"; dtblOption.Rows.Add(dr); DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); PriceListSP spPriceList = new PriceListSP(); DataTable dtblPriceList = spPricingList.PriceListReportPrint(decGroupId, strProductName, decSizeId, decModelId, decPricingLevelId); DataTable dtblCompanyReport = spCompany.CompanyViewDataTable(1); DataTable dtblPriceListGridFill = dtblPriceListReport.Copy(); ds.Tables.Add(dtblCompanyReport); ds.Tables.Add(dtblPriceList); ds.Tables.Add(dtblOption); //frmReport.MdiParent = formMDI.MDIObj; //frmReport.PriceListReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show(" RPL17:" + 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(); 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); } }
/// <summary> /// Function to fill the ProductGroup comboBox /// </summary> public void ProductGroupComboFill() { try { DataTable dtbl = new DataTable(); PriceListSP spPriceList = new PriceListSP(); dtbl = spPriceList.PricelistProductGroupViewAllForComboBox(); DataRow dr = dtbl.NewRow(); dr[0] = 0; dr[1] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbProductGroup.DataSource = dtbl; cmbProductGroup.ValueMember = "groupId"; cmbProductGroup.DisplayMember = "groupName"; } catch (Exception ex) { MessageBox.Show("PCL2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the grid based on the /// </summary> public void GridFill() { try { { DataTable dtbl = new DataTable(); PriceListSP spPriceList = new PriceListSP(); if (cmbProductGroup.Text == "All") { cmbProductGroup.Text = "All"; } cmbPricingLevel.Text = cmbPricingLevel.Text; dtbl = spPriceList.ProductDetailsViewGridfill(Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString()), txtProductCode.Text, txtProductName.Text, cmbPricingLevel.Text); dgvPricingList.DataSource = dtbl; } } catch (Exception ex) { MessageBox.Show("PCL4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to delete the pricelist for the product /// </summary> public void DeleteFunction() { try { PriceListSP spPriceList = new PriceListSP(); if (spPriceList.PriceListCheckReferenceAndDelete(decPricingLevelId) <= 0) { Messages.ReferenceExistsMessage(); } else { spPriceList.PriceListDelete(decpriceListId); Messages.DeletedMessage(); Clear(); } } catch (Exception ex) { MessageBox.Show("PLP7:" + 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(); 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); } }