/// <summary> /// Function to view the details of product /// </summary> /// <param name="decId"></param> public void view(decimal decId) { try { ProductCreationBll BllProductCreation = new ProductCreationBll(); List <DataTable> listObj = BllProductCreation.ProductDetailsForProductSearch(decId); foreach (DataRow dr in listObj[0].Rows) { lblProductCode.Text = dr["productCode"].ToString(); lblProductGroup.Text = dr["groupName"].ToString(); lblProductName.Text = dr["productName"].ToString(); lblBrand.Text = dr["brandName"].ToString(); lblCurrentStock.Text = dr["Currentstock"].ToString(); lblModelNo.Text = dr["modelNo"].ToString(); lblSize.Text = dr["size"].ToString(); lbltax.Text = dr["taxName"].ToString(); lblUnit.Text = dr["unitName"].ToString(); lblTaxApplicable.Text = dr["taxapplicableOn"].ToString(); } } catch (Exception ex) { MessageBox.Show("PD :01" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to add new standard rate for the purticular product /// </summary> /// <param name="decProductId"></param> /// <param name="frmStandardRate"></param> public void CallFromStandardRate(decimal decProductId, frmStandardRate frmStandardRate) { try { base.Show(); StandardrateObj = frmStandardRate; StandardrateObj.Enabled = false; ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); UnitBll bllUnit = new UnitBll(); UnitInfo infoUnit = new UnitInfo(); infoProduct = BllProductCreation.ProductViewForStandardRate(decProductId); txtProductCode.Text = infoProduct.ProductCode; txtProductName.Text = infoProduct.ProductName; decProduct = infoProduct.ProductId; infoUnit = bllUnit.unitVieWForStandardRate(decProductId); decUnitId = infoUnit.UnitId; txtUnitName.Text = infoUnit.UnitName; txtProductName.ReadOnly = true; txtProductCode.ReadOnly = true; txtUnitName.ReadOnly = true; BatchUnderProductComboFill(decProductId); GridFill(decProductId); } catch (Exception ex) { MessageBox.Show("SRP2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to save /// </summary> public void SaveFunction() { try { foreach (DataGridViewRow dgvRow in dgvChangeProductTax.Rows) { if (dgvRow.Cells["dgvtxtSelect"].Value != null) { if ((bool)(dgvRow.Cells["dgvtxtSelect"].Value)) { int inProductId = Convert.ToInt32(dgvChangeProductTax.Rows[dgvRow.Index].Cells["dgvtxtProductId"].Value.ToString()); ProductCreationBll BllProductCreation = new ProductCreationBll(); ProductInfo infoProduct = new ProductInfo(); infoProduct.TaxId = Convert.ToInt32(cmbNewTaxType.SelectedValue.ToString()); infoProduct.ProductId = inProductId; BllProductCreation.ChangeProductTaxSave(infoProduct); isDefault = false; } } } Messages.SavedMessage(); cmbSearchBy.Focus(); Clear(); } catch (Exception ex) { MessageBox.Show("CPT 2 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill datagridview /// </summary> public void GridFill() { try { ProductCreationBll BllProductCreation = new ProductCreationBll(); ProductInfo infoProduct = new ProductInfo(); int inSelect = 0; if (cmbSearchBy.SelectedIndex == 0) { infoProduct.GroupId = Convert.ToInt32(cmbProductGroupTax.SelectedValue.ToString()); } else { inSelect = 1; infoProduct.TaxId = Convert.ToInt32(cmbProductGroupTax.SelectedValue.ToString()); } infoProduct.ProductCode = txtProductCode.Text.Trim(); infoProduct.ProductName = txtProductName.Text.Trim(); List <DataTable> listObj = BllProductCreation.ChangeProductTaxSearch(infoProduct, inSelect); dgvChangeProductTax.DataSource = listObj[0]; } catch (Exception ex) { MessageBox.Show("CPT 6 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// RawMaterialComboFill function /// </summary> public void RawMaterialComboFill() { try { List<DataTable> listObj = new List<DataTable>(); ProductCreationBll BllProductCreation = new ProductCreationBll(); if (isCallFromProductCreation) { listObj = BllProductCreation.ProductViewAllWithoutOneProduct(decProductIdForEdit); dgvcmbRawMaterial.DataSource = listObj[0]; DataRow drow = listObj[0].NewRow(); drow["productName"] = string.Empty; drow["productId"] = 0; listObj[0].Rows.InsertAt(drow, 0); dgvcmbRawMaterial.DisplayMember = "productName"; dgvcmbRawMaterial.ValueMember = "productId"; } else { listObj = BllProductCreation.ProductViewAll(); DataRow drow = listObj[0].NewRow(); drow["productName"] = string.Empty; drow["productId"] = 0; listObj[0].Rows.InsertAt(drow, 0); dgvcmbRawMaterial.DataSource = listObj[0]; dgvcmbRawMaterial.DisplayMember = "productName"; dgvcmbRawMaterial.ValueMember = "productId"; } } catch (Exception ex) { MessageBox.Show("PB:3" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// To remove the selected product from the list in combo box /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvProductBOM_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { try { List<DataTable> listObj = new List<DataTable>(); ProductCreationBll BllProductCreation = new ProductCreationBll(); if (dgvProductBOM.CurrentCell.ColumnIndex == dgvProductBOM.Columns["dgvcmbRawMaterial"].Index) { if (isCallFromProductCreation) { listObj = BllProductCreation.ProductViewAllWithoutOneProduct(decProductIdForEdit); } else { listObj = BllProductCreation.ProductViewAll(); } if (listObj[0].Rows.Count > 0) { if (dgvProductBOM.RowCount > 1) { int inGridRowCount = dgvProductBOM.RowCount; for (int inI = 0; inI < inGridRowCount - 1; inI++) { if (inI != e.RowIndex) { int inTableRowcount = listObj[0].Rows.Count; for (int inJ = 0; inJ < inTableRowcount; inJ++) { if (dgvProductBOM.Rows[inI].Cells["dgvcmbRawMaterial"].Value != null && dgvProductBOM.Rows[inI].Cells["dgvcmbRawMaterial"].Value.ToString() != "") { if (listObj[0].Rows[inJ]["productId"].ToString() == dgvProductBOM.Rows[inI].Cells["dgvcmbRawMaterial"].Value.ToString()) { listObj[0].Rows.RemoveAt(inJ); break; } } } } } } DataGridViewComboBoxCell dgvccProductBom = (DataGridViewComboBoxCell)dgvProductBOM[dgvProductBOM.Columns["dgvcmbRawMaterial"].Index, e.RowIndex]; dgvccProductBom.DataSource = listObj[0]; DataRow drow = listObj[0].NewRow(); drow["productName"] = string.Empty; drow["productId"] = 0; listObj[0].Rows.InsertAt(drow, 0); dgvccProductBom.ValueMember = "productId"; dgvccProductBom.DisplayMember = "productName"; } } } catch (Exception ex) { MessageBox.Show("PB:28" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill ProductCode combobox /// </summary> public void ProductCodeComboFill() { try { ProductCreationBll BllProductCreation = new ProductCreationBll(); List <DataTable> listObj = BllProductCreation.ProductCodeViewAll(cmbProductCode, true); } catch (Exception ex) { MessageBox.Show("PSRT3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the grid /// </summary> public void GridFill() { try { ProductCreationBll BllProductCreation = new ProductCreationBll(); DateTime FromDate = this.dtpFromDate.Value; DateTime ToDate = this.dtpToDate.Value; listObj = BllProductCreation.ProductVsBatchReportGridFill(Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()), txtVoucherNo.Text, Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString()), cmbProductCode.Text, Convert.ToDecimal(cmbBatchNo.SelectedValue.ToString()), FromDate, ToDate); dgvProductBatch.DataSource = listObj[0]; } catch (Exception ex) { MessageBox.Show(" PVSBR:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Funtion to fill produdct combobox /// </summary> public void ProductComboFill() { try { ProductCreationBll BllProductCreation = new ProductCreationBll(); List <DataTable> listObjProduct = new List <DataTable>(); listObjProduct = BllProductCreation.ProductViewAllForComboBox(); cmbProduct.DataSource = listObjProduct[0]; cmbProduct.ValueMember = "productId"; cmbProduct.DisplayMember = "productName"; } catch (Exception ex) { MessageBox.Show("B4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the grid based on the search keys /// </summary> public void GridFill() { try { string strComboText = string.Empty; List <DataTable> listObj = new List <DataTable>(); ProductCreationBll BllProductCreation = new ProductCreationBll(); ProductInfo infoProduct = new ProductInfo(); if (cmbActive.Text == "Yes") { strComboText = "True"; } else if (cmbActive.Text == "No") { strComboText = "False"; } else { cmbActive.SelectedIndex = 0; strComboText = "All"; } if (txtSalesRateFrom.Text == string.Empty && txtSalesRateTo.Text == string.Empty) { txtSalesRateFrom.Text = "0"; txtSalesRateTo.Text = "0"; } decimal decProductGroup = Convert.ToDecimal(cmbProductGroup.SelectedValue); string strProductName = txtProductName.Text.Trim(); string strProductCode = txtProductCode.Text.Trim(); decimal decSize = Convert.ToDecimal(cmbSize.SelectedValue); decimal decModelNo = Convert.ToDecimal(cmbModelNo.SelectedValue); decimal decBrand = Convert.ToDecimal(cmbBrand.SelectedValue); decimal decTax = Convert.ToDecimal(cmbTax.SelectedValue); string strTaxApplicable = cmbTaxApplicableOn.Text.Trim(); decimal decSalesRateFrom = Convert.ToDecimal(txtSalesRateFrom.Text); decimal decSalesRateTo = Convert.ToDecimal(txtSalesRateTo.Text); listObj = BllProductCreation.ProductRegisterSearch(decProductGroup, strProductName, strProductCode, decSize, decModelNo, decBrand, decTax, strTaxApplicable, decSalesRateFrom, decSalesRateTo, strComboText); dgvProductRegister.DataSource = listObj[0]; } catch (Exception ex) { MessageBox.Show("PR7:" + 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); } }
/// <summary> /// Function to fill product combobox /// </summary> public void ProductNameComboFill() { try { ProductCreationBll BllProductCreation = new ProductCreationBll(); List <DataTable> listObjProductName = new List <DataTable>(); listObjProductName = BllProductCreation.ProductViewAllForBatchByAllowBatch(); DataRow dr = listObjProductName[0].NewRow(); dr[1] = "All"; listObjProductName[0].Rows.InsertAt(dr, 0); cmbProductName.DataSource = listObjProductName[0]; cmbProductName.ValueMember = "productId"; cmbProductName.DisplayMember = "productName"; } catch (Exception ex) { MessageBox.Show("B2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// fill Items into the purticular controls for Update or delete /// </summary> public void FillControls() { try { StandardRateInfo infoStandardRate = new StandardRateInfo(); standardRateBll BllStandaredRate = new standardRateBll(); infoStandardRate = BllStandaredRate.StandardRateView(decStandardRate); dtpFromDate.Value = Convert.ToDateTime(infoStandardRate.ApplicableFrom.ToString()); dtpToDate.Value = Convert.ToDateTime(infoStandardRate.ApplicableTo.ToString()); dtpFromDate.Text = infoStandardRate.ApplicableFrom.ToString(); dtpToDate.Text = infoStandardRate.ApplicableTo.ToString(); txtRate.Text = infoStandardRate.Rate.ToString(); decProduct = infoStandardRate.ProductId; decUnitId = infoStandardRate.UnitId; ProductCreationBll BllProductCreation = new ProductCreationBll(); ProductInfo infoProduct = new ProductInfo(); infoProduct = BllProductCreation.ProductViewForStandardRate(decProductId); txtProductCode.Text = infoProduct.ProductCode; txtProductName.Text = infoProduct.ProductName; decStandardRateId = infoStandardRate.StandardRateId; UnitInfo infoUnit = new UnitInfo(); UnitBll bllUnit = new UnitBll(); infoUnit = bllUnit.UnitView(decUnit); txtUnitName.Text = infoUnit.UnitName; txtProductName.ReadOnly = true; txtProductCode.ReadOnly = true; txtUnitName.ReadOnly = true; BatchInfo infoBatch = new BatchInfo(); BatchBll BllBatch = new BatchBll(); decBatchId = infoStandardRate.BatchId; infoBatch = BllBatch.BatchView(decBatchId); cmbBatch.SelectedValue = infoBatch.BatchId; } catch (Exception ex) { MessageBox.Show("SRP5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// grid CellValueChanged for do the basic calculation and unit selection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvProductBOM_CellValueChanged(object sender, DataGridViewCellEventArgs e) { try { CheckInvalidEntries(e); ProductCreationBll BllProductCreation = new ProductCreationBll(); TransactionsGeneralFillBll trstGnFill = new TransactionsGeneralFillBll(); if (e.RowIndex > -1) { if (e.ColumnIndex == dgvProductBOM.Columns["dgvcmbRawMaterial"].Index) { if (dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbRawMaterial"] != null) { dgvProductBOM.Rows[e.RowIndex].Cells["dgvtxtUnit"].Value = BllProductCreation.ProductUnit(Convert.ToDecimal(dgvProductBOM.Rows[e.RowIndex].Cells[1].Value)); List<DataTable> listObj = new List<DataTable>(); decimal decProductId = Convert.ToDecimal(dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbRawMaterial"].Value); listObj = trstGnFill.UnitViewAllByProductId(dgvProductBOM, decProductId.ToString(), e.RowIndex); DataRow drow = listObj[0].NewRow(); drow["unitName"] = string.Empty; drow["unitId"] = 0; listObj[0].Rows.InsertAt(drow, 0); DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)(dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbUnit"]); cell.DataSource = listObj[0]; cell.ValueMember = "unitId"; cell.DisplayMember = "unitName"; if (listObj[0].Rows[0][4] != null && listObj[0].Rows[0][4] != DBNull.Value) { dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(listObj[0].Rows[0][4].ToString()); } } } } } catch (Exception ex) { MessageBox.Show("PB:21" + ex.Message, "Open Miracle", 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 fill the grid based on the search conditions /// </summary> public void FillGrid() { try { decimal decProdGroup = 0; decimal decLedgerId = 0; decimal decVoucherTypeId = 0; string strProductName = string.Empty; string strProductCode = string.Empty; string strVoucherNo = string.Empty; if (cmbCashOrParty.SelectedIndex > -1) { if (cmbCashOrParty.SelectedIndex == 0 || cmbCashOrParty.SelectedIndex == -1) { decLedgerId = 0; } else { decLedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()); } } if (cmbProductGroup.SelectedIndex > -1) { if (cmbProductGroup.SelectedIndex == 0 || cmbProductGroup.SelectedIndex == -1) { decProdGroup = 0; } else { decProdGroup = Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString()); } } if (cmbVoucherType.SelectedIndex > -1) { if (cmbVoucherType.SelectedValue.ToString() != "System.Data.DataRowView" && cmbVoucherType.Text != "System.Data.DataRowView") { if (cmbVoucherType.SelectedIndex == 0 || cmbVoucherType.SelectedIndex == -1) { decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()); } else { decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()); } } } if (txtVoucherNo.Text == string.Empty) { strVoucherNo = string.Empty; } else { strVoucherNo = txtVoucherNo.Text; } if (txtProductCode.Text == string.Empty) { strProductCode = string.Empty; } else { strProductCode = txtProductCode.Text; } if (txtProductName.Text == string.Empty) { strProductName = string.Empty; } else { strProductName = txtProductName.Text; } List <DataTable> listobj = new List <DataTable>(); ProductCreationBll BllProductCreation = new ProductCreationBll(); listobj = BllProductCreation.VoucherWiseProductSearch(decVoucherTypeId, strVoucherNo, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text), decProdGroup, strProductCode, decLedgerId, strProductName); dgvVoucherwiseProductSearch.DataSource = listobj[0]; decimal dcTotalInward = 0; decimal dcTotalOutward = 0; try { dcTotalInward = Math.Round((Convert.ToDecimal(listobj[0].Compute("Sum([InwardQty])", string.Empty).ToString())), 2); } catch { } try { dcTotalOutward = Math.Round((Convert.ToDecimal(listobj[0].Compute("Sum([OutwardQty])", string.Empty).ToString())), 2); } catch { } decimal dcBalance = Math.Round((dcTotalInward - dcTotalOutward), 2); lblTotalInqty.Text = "Total Inward : " + dcTotalInward.ToString(); lblTotalOutQty.Text = "Total Outward : " + dcTotalOutward.ToString(); lblBalanceQty.Text = "Balance : " + dcBalance.ToString(); if (inCurrenRowIndex >= 0 && dgvVoucherwiseProductSearch.Rows.Count > 0 && inCurrenRowIndex < dgvVoucherwiseProductSearch.Rows.Count) { if (dgvVoucherwiseProductSearch.Columns.Contains("outwardQty")) { dgvVoucherwiseProductSearch.CurrentCell = dgvVoucherwiseProductSearch.Rows[inCurrenRowIndex].Cells["dgvtxtOutwardQty"]; } else { } } inCurrenRowIndex = 0; dgvVoucherwiseProductSearch.Columns["dgvtxtrate"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } catch (Exception ex) { MessageBox.Show("VPS :04" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }