/// <summary> /// Function to fill datagridview /// </summary> public void GridFill() { try { ProductSP spProduct = new ProductSP(); 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(); DataTable dtbl = spProduct.ChangeProductTaxSearch(infoProduct, inSelect); dgvChangeProductTax.DataSource = dtbl; } catch (Exception ex) { formMDI.infoError.ErrorString = "CPT 6 : " + ex.Message; } }
/// <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 { DataTable dtbl = new DataTable(); ProductSP spProduct = new ProductSP(); if (dgvProductBOM.CurrentCell.ColumnIndex == dgvProductBOM.Columns["dgvcmbRawMaterial"].Index) { if (isCallFromProductCreation) { dtbl = spProduct.ProductViewAllWithoutOneProduct(decProductIdForEdit); } else { dtbl = spProduct.ProductViewAll(); } if (dtbl.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 = dtbl.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 (dtbl.Rows[inJ]["productId"].ToString() == dgvProductBOM.Rows[inI].Cells["dgvcmbRawMaterial"].Value.ToString()) { dtbl.Rows.RemoveAt(inJ); break; } } } } } } DataGridViewComboBoxCell dgvccProductBom = (DataGridViewComboBoxCell)dgvProductBOM[dgvProductBOM.Columns["dgvcmbRawMaterial"].Index, e.RowIndex]; dgvccProductBom.DataSource = dtbl; DataRow drow = dtbl.NewRow(); drow["productName"] = string.Empty; drow["productId"] = 0; dtbl.Rows.InsertAt(drow, 0); dgvccProductBom.ValueMember = "productId"; dgvccProductBom.DisplayMember = "productName"; } } } catch (Exception ex) { formMDI.infoError.ErrorString = "PB:28" + ex.Message; } }
/// <summary> /// Function to fill ProductCode combobox /// </summary> public void ProductCodeComboFill() { try { ProductSP spProduct = new ProductSP(); DataTable dtbl = spProduct.ProductCodeViewAll(cmbProductCode, true); } catch (Exception ex) { MessageBox.Show("PSRT3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill ProductCode combobox /// </summary> public void ProductCodeComboFill() { try { ProductSP spProduct = new ProductSP(); DataTable dtbl = spProduct.ProductCodeViewAll(cmbProductCode, true); } catch (Exception ex) { formMDI.infoError.ErrorString = "PSRT3:" + ex.Message; } }
/// <summary> /// Function to fill the grid /// </summary> public void GridFill() { try { ProductSP spProduct = new ProductSP(); DateTime FromDate = this.dtpFromDate.Value; DateTime ToDate = this.dtpToDate.Value; dtbl = spProduct.ProductVsBatchReportGridFill(Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()), txtVoucherNo.Text, Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString()), cmbProductCode.Text, Convert.ToDecimal(cmbBatchNo.SelectedValue.ToString()), FromDate, ToDate); dgvProductBatch.DataSource = dtbl; } catch (Exception ex) { formMDI.infoError.ErrorString = "PVSBR2:" + ex.Message; } }
/// <summary> /// Function to fill the grid /// </summary> public void GridFill() { try { ProductSP spProduct = new ProductSP(); DateTime FromDate = this.dtpFromDate.Value; DateTime ToDate = this.dtpToDate.Value; dtbl = spProduct.ProductVsBatchReportGridFill(Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()), txtVoucherNo.Text, Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString()), cmbProductCode.Text, Convert.ToDecimal(cmbBatchNo.SelectedValue.ToString()), FromDate, ToDate); dgvProductBatch.DataSource = dtbl; } catch (Exception ex) { MessageBox.Show(" PVSBR:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Funtion to fill produdct combobox /// </summary> public void ProductViewAllForBatchByAllowBatch() { try { ProductSP spproduct = new ProductSP(); DataTable dtblProductName = new DataTable(); dtblProductName = spproduct.ProductViewAllForBatchByAllowBatch(); cmbProduct.DataSource = dtblProductName; cmbProduct.ValueMember = "productId"; cmbProduct.DisplayMember = "productName"; } catch (Exception ex) { formMDI.infoError.ErrorString = "B3:" + ex.Message; } }
/// <summary> /// Funtion to fill produdct combobox /// </summary> public void ProductComboFill() { try { ProductSP spProduct = new ProductSP(); DataTable dtblProduct = new DataTable(); dtblProduct = spProduct.ProductViewAllForComboBox(); cmbProduct.DataSource = dtblProduct; cmbProduct.ValueMember = "productId"; cmbProduct.DisplayMember = "productName"; } catch (Exception ex) { MessageBox.Show("B4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Funtion to fill produdct combobox /// </summary> public void ProductComboFill() { try { ProductSP spProduct = new ProductSP(); DataTable dtblProduct = new DataTable(); dtblProduct = spProduct.ProductViewAllForComboBox(); cmbProduct.DataSource = dtblProduct; cmbProduct.ValueMember = "productId"; cmbProduct.DisplayMember = "productName"; } catch (Exception ex) { formMDI.infoError.ErrorString = "B4:" + ex.Message; } }
/// <summary> /// Function to fill the grid based on the search keys /// </summary> public void GridFill() { try { string strComboText = string.Empty; DataTable dtbl = new DataTable(); ProductSP spProduct = new ProductSP(); 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); dtbl = spProduct.ProductRegisterSearch(decProductGroup, strProductName, strProductCode, decSize, decModelNo, decBrand, decTax, strTaxApplicable, decSalesRateFrom, decSalesRateTo, strComboText); dgvProductRegister.DataSource = dtbl; } catch (Exception ex) { formMDI.infoError.ErrorString = "PR7:" + ex.Message; } }
/// <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 fill product combobox /// </summary> public void ProductNameComboFill() { try { ProductSP spproduct = new ProductSP(); DataTable dtblProductName = new DataTable(); dtblProductName = spproduct.ProductViewAllForBatchByAllowBatch(); DataRow dr = dtblProductName.NewRow(); dr[1] = "All"; dtblProductName.Rows.InsertAt(dr, 0); cmbProductName.DataSource = dtblProductName; cmbProductName.ValueMember = "productId"; cmbProductName.DisplayMember = "productName"; } catch (Exception ex) { MessageBox.Show("B2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill product combobox /// </summary> public void ProductNameComboFill() { try { ProductSP spproduct = new ProductSP(); DataTable dtblProductName = new DataTable(); dtblProductName = spproduct.ProductViewAllForBatchByAllowBatch(); DataRow dr = dtblProductName.NewRow(); dr[1] = "All"; dtblProductName.Rows.InsertAt(dr, 0); cmbProductName.DataSource = dtblProductName; cmbProductName.ValueMember = "productId"; cmbProductName.DisplayMember = "productName"; } catch (Exception ex) { formMDI.infoError.ErrorString = "B2:" + ex.Message; } }
/// <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); ProductSP spProduct = new ProductSP(); TransactionsGeneralFill trstGnFill = new TransactionsGeneralFill(); 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 = spProduct.ProductUnit(Convert.ToDecimal(dgvProductBOM.Rows[e.RowIndex].Cells[1].Value)); DataTable dtblunitconversionViewAll = new DataTable(); decimal decProductId = Convert.ToDecimal(dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbRawMaterial"].Value); dtblunitconversionViewAll = trstGnFill.UnitViewAllByProductId(dgvProductBOM, decProductId.ToString(), e.RowIndex); DataRow drow = dtblunitconversionViewAll.NewRow(); drow["unitName"] = string.Empty; drow["unitId"] = 0; dtblunitconversionViewAll.Rows.InsertAt(drow, 0); DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)(dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbUnit"]); cell.DataSource = dtblunitconversionViewAll; cell.ValueMember = "unitId"; cell.DisplayMember = "unitName"; if (dtblunitconversionViewAll.Rows[0][4] != null && dtblunitconversionViewAll.Rows[0][4] != DBNull.Value) { dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(dtblunitconversionViewAll.Rows[0][4].ToString()); } } } } } catch (Exception ex) { formMDI.infoError.ErrorString = "PB:21" + ex.Message; } }
/// <summary> /// fill Items into the purticular controls for Update or delete /// </summary> public void FillControls() { try { StandardRateInfo infoStandardRate = new StandardRateInfo(); StandardRateSP spStandardRate = new StandardRateSP(); infoStandardRate = spStandardRate.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; ProductSP spProduct = new ProductSP(); ProductInfo infoProduct = new ProductInfo(); infoProduct = spProduct.ProductViewForStandardRate(decProductId); txtProductCode.Text = infoProduct.ProductCode; txtProductName.Text = infoProduct.ProductName; decStandardRateId = infoStandardRate.StandardRateId; UnitInfo infoUnit = new UnitInfo(); UnitSP spUnit = new UnitSP(); infoUnit = spUnit.UnitView(decUnit); txtUnitName.Text = infoUnit.UnitName; txtProductName.ReadOnly = true; txtProductCode.ReadOnly = true; txtUnitName.ReadOnly = true; BatchInfo infoBatch = new BatchInfo(); BatchSP spBatch = new BatchSP(); decBatchId = infoStandardRate.BatchId; infoBatch = spBatch.BatchView(decBatchId); cmbBatch.SelectedValue = infoBatch.BatchId; } catch (Exception ex) { MessageBox.Show("SRP5:" + 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); } }
/// <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) { formMDI.infoError.ErrorString = "PLP10" + ex.Message + ex.Message; } }
/// <summary> /// Function to fill the grid based on the search conditions /// </summary> public void FillGrid() { try { ProductSP spProduct = new ProductSP(); 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; } DataTable dtbl = new DataTable(); dtbl = spProduct.VoucherWiseProductSearch(decVoucherTypeId, strVoucherNo, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text), decProdGroup, strProductCode, decLedgerId, strProductName); dgvVoucherwiseProductSearch.DataSource = dtbl; decimal dcTotalInward = 0; decimal dcTotalOutward = 0; try { dcTotalInward = Math.Round((Convert.ToDecimal(dtbl.Compute("Sum([InwardQty])", string.Empty).ToString())), 2); } catch { } try { dcTotalOutward = Math.Round((Convert.ToDecimal(dtbl.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) { formMDI.infoError.ErrorString = "VPS :4" + ex.Message; } }