/// <summary> /// Enterkey and backspace navigation of dgvProduct /// For shortcut keys /// ctrl+f for productsearchpopup /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvProduct_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { if (dgvProduct.CurrentCell == dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvtxtAmount"]) { txtNarration.Focus(); dgvProduct.ClearSelection(); e.Handled = true; } } if (e.KeyCode == Keys.Back) { if (dgvProduct.CurrentCell == dgvProduct.Rows[0].Cells["dgvtxtSlNo"]) { if (cmbCurrency.Enabled) { cmbCurrency.Focus(); dgvProduct.ClearSelection(); } else { cmbSalesman.Focus(); cmbSalesman.SelectionLength = 0; cmbSalesman.SelectionStart = 0; } } } if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) //Pop Up { if (dgvProduct.Columns[dgvProduct.CurrentCell.ColumnIndex].Name == "dgvtxtProductName" || dgvProduct.Columns[dgvProduct.CurrentCell.ColumnIndex].Name == "dgvtxtProductCode") { frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup(); frmProductSearchPopupObj.MdiParent = formMDI.MDIObj; if (dgvProduct.CurrentRow.Cells["dgvtxtProductCode"].Value != null || dgvProduct.CurrentRow.Cells["dgvtxtProductName"].Value != null) { frmProductSearchPopupObj.CallFromSalesQuotation(this, dgvProduct.CurrentRow.Index, dgvProduct.CurrentRow.Cells["dgvtxtProductCode"].Value.ToString()); } else { frmProductSearchPopupObj.CallFromSalesQuotation(this, dgvProduct.CurrentRow.Index, string.Empty); } } } } catch (Exception ex) { MessageBox.Show("SQ:67" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearchPopup form to select and view Products /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { try { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); this.frmProductSearchPopupObj = frmProductSearchPopup; infoProduct = BllProductCreation.ProductView(decproductId); dgvPurchaseOrder.CurrentRow.Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode; dgvPurchaseOrder.CurrentRow.Cells["dgvtxtProductName"].Value = infoProduct.ProductName; dgvPurchaseOrder.CurrentRow.Cells["dgvtxtRate"].Value = infoProduct.PurchaseRate; UnitComboFill(decproductId, dgvPurchaseOrder.CurrentRow.Index, dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].ColumnIndex); dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].Value = infoProduct.UnitId; UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); List<DataTable> list = new List<DataTable>(); list = bllUnitConvertion.UnitConversionIdAndConRateViewallByProductId(infoProduct.ProductCode); foreach (DataRow drUnitByProduct in list[0].Rows) { if (dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString()) { dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionId"].Value = drUnitByProduct.ItemArray[2].ToString(); dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionRate"].Value = drUnitByProduct.ItemArray[3].ToString(); } } decCurrentConversionRate = Convert.ToDecimal(dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionRate"].Value.ToString()); decCurrentRate = Convert.ToDecimal(dgvPurchaseOrder.CurrentRow.Cells["dgvtxtRate"].Value.ToString()); NewAmountCalculation("dgvtxtQty", dgvPurchaseOrder.CurrentRow.Index); CalculateTotalAmount(); frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; this.Enabled = true; this.BringToFront(); } catch (Exception ex) { MessageBox.Show("PO24:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Enterkey and backspace navigation of dgvProductDetails /// ctrl+f for productsearch popup /// alt+c for productcreation /// Esc for form close /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvProductDetails_KeyDown(object sender, KeyEventArgs e) { try { int inRowCount = dgvProductDetails.Rows.Count; if (e.KeyCode == Keys.Enter) { if (dgvProductDetails.CurrentCell == dgvProductDetails.Rows[inRowCount - 1].Cells["dgvtxtAmount"]) { dgvAdditionalCost.Focus(); dgvProductDetails.ClearSelection(); } } if (e.KeyCode == Keys.Back) { if (dgvProductDetails.CurrentCell == dgvProductDetails.Rows[0].Cells["dgvtxtSlNo"]) { cmbCurrency.Focus(); dgvProductDetails.ClearSelection(); } } if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) //Product Search Pop Up { if (dgvProductDetails.Columns[dgvProductDetails.CurrentCell.ColumnIndex].Name == "dgvtxtProductName" || dgvProductDetails.Columns[dgvProductDetails.CurrentCell.ColumnIndex].Name == "dgvtxtProductCode") { frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup(); frmProductSearchPopupObj.MdiParent = formMDI.MDIObj; if (dgvProductDetails.CurrentRow.Cells["dgvtxtProductCode"].Value != null || dgvProductDetails.CurrentRow.Cells["dgvtxtProductName"].Value != null) { frmProductSearchPopupObj.CallFromPurchaseInvoice(this, dgvProductDetails.CurrentRow.Index, dgvProductDetails.CurrentRow.Cells["dgvtxtProductCode"].Value.ToString()); } else { frmProductSearchPopupObj.CallFromPurchaseInvoice(this, dgvProductDetails.CurrentRow.Index, string.Empty); } } } if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt) //Product Creation { SendKeys.Send("{f10}"); if (dgvProductDetails.Columns[dgvProductDetails.CurrentCell.ColumnIndex].Name == "dgvtxtProductName" || dgvProductDetails.Columns[dgvProductDetails.CurrentCell.ColumnIndex].Name == "dgvtxtProductCode") { frmProductCreation frmProductCreationObj = new frmProductCreation(); frmProductCreationObj.MdiParent = formMDI.MDIObj; frmProductCreationObj.CallFromPurchaseInvoice(this); } } if (e.KeyCode == Keys.Escape) { btnClose_Click(sender, e); } } catch (Exception ex) { MessageBox.Show("PI119:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearchPopup form to select and view product /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { ProductSP SpProduct = new ProductSP(); ProductInfo infoProduct = new ProductInfo(); try { this.Enabled = true; this.BringToFront(); this.frmProductSearchPopupObj = frmProductSearchPopup; int inCurrentRowIndex = dgvProduct.CurrentRow.Index; dgvProduct.Rows.Add(); if (decproductId != 0) { infoProduct = SpProduct.ProductView(decproductId); TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); SalesQuotationMasterSP SpSalesQuotationMaster = new SalesQuotationMasterSP(); dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtProductName"].Value = infoProduct.ProductName; dgvProduct.Rows[inCurrentRowIndex].Cells["ProductId"].Value = infoProduct.ProductId; dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode; dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = Math.Round(infoProduct.SalesRate, PublicVariables._inNoOfDecimalPlaces); DefaultRate = Math.Round(infoProduct.PurchaseRate, PublicVariables._inNoOfDecimalPlaces); dtblUnitViewAll = transactionGeneralFillObj.UnitViewAllByProductId(dgvProduct, infoProduct.ProductId.ToString(), inCurrentRowIndex); dtblbatchViewAll = SpSalesQuotationMaster.SalesQuotationMasterBatchFill(dgvProduct, infoProduct.ProductId, inCurrentRowIndex); BatchSP spBatch = new BatchSP(); decimal decBatchId = spBatch.BatchIdViewByProductId(infoProduct.ProductId); dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbBatch"].Value = decBatchId; dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbUnit"].Value = infoProduct.UnitId; if (infoProduct.PartNo != string.Empty) { dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtBarcode"].Value = infoProduct.PartNo; } else { if (dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbBatch"].Value != null && dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbBatch"].Value.ToString() != string.Empty) { decBatchId = Convert.ToDecimal(dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbBatch"].Value); dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtBarcode"].Value = SpProduct.BarcodeViewByBatchId(decBatchId); } } IsDoAfterFill = true; UnitConvertionSP SpUnitConvertion = new UnitConvertionSP(); DataTable dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[inCurrentRowIndex].Cells["ProductId"].Value.ToString()); if (dtblUnitByProduct.Rows.Count > 0) { foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows) { if (dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString()) { dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString()); dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString()); if (IsDoAfterFill) { decimal decNewConversionRate = Convert.ToDecimal(dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value.ToString()); decimal decNewRate = (decCurrentRate * decCurrentConversionRate) / decNewConversionRate; dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = Math.Round(decNewRate, PublicVariables._inNoOfDecimalPlaces); } } } } decimal decStandardRate = SpProduct.SalesInvoiceProductRateForSales(infoProduct.ProductId, PublicVariables._dtCurrentDate, decBatchId, Convert.ToDecimal(cmbPricinglevel.SelectedValue), PublicVariables._inNoOfDecimalPlaces); if (dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value != null && dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value.ToString() != string.Empty) { if (decStandardRate != 0 && Convert.ToDecimal(dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value) != 0) { dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = Math.Round(decStandardRate / Convert.ToDecimal(dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value), PublicVariables._inNoOfDecimalPlaces); } } dgvProduct.Rows[inCurrentRowIndex].HeaderCell.Value = "X"; dgvProduct.Rows[inCurrentRowIndex].HeaderCell.Style.ForeColor = Color.Red; } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("SQ:42" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Get the Product details from the Product Search form /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { ProductInfo infoProduct = new ProductInfo(); ProductSP spProduct = new ProductSP(); BatchSP spBatch = new BatchSP(); DataTable dtbl = new DataTable(); UnitConvertionSP spUnitConversion = new UnitConvertionSP(); try { base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; infoProduct = spProduct.ProductView(decproductId); if (IsdgvConsuption) { int inRowcount = dgvConsumption.Rows.Count; dgvConsumption.Rows.Add(); for (int i = 0; i < inRowcount; i++) { if (i == decCurrentRowIndex) { dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductCode"].Value = infoProduct.ProductCode; strProductCode = infoProduct.ProductCode; ProductDetailsFillConsumption(strProductCode, i, "ProductCode"); } } } else { int inRowcount = dgvProduction.Rows.Count; dgvProduction.Rows.Add(); for (int i = 0; i < inRowcount; i++) { if (i == decCurrentRowIndex) { dgvProduction.Rows[i].Cells["dgvtxtProductionProductCode"].Value = infoProduct.ProductCode; strProductCode = infoProduct.ProductCode; ProductDetailsFillProduction(strProductCode, i, "ProductCode"); } } } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("SJ:92" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearchPopup form to select and view Product created /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { try { base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; List<DataTable> list = new List<DataTable>(); UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); ProductInfo infoProduct = new ProductInfo(); BatchBll BllBatch = new BatchBll(); infoProduct = new ProductCreationBll().ProductView(decproductId); dgvProduct.Rows.Add(); dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode; dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtProductId"].Value = decproductId.ToString(); dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtProductName"].Value = infoProduct.ProductName; UnitComboFill1(decproductId, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Index, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbUnit"].ColumnIndex); dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbUnit"].Value = infoProduct.UnitId; GridGodownComboFill(decproductId, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Index, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbGodown"].ColumnIndex); dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbGodown"].Value = infoProduct.GodownId; RackComboFill1(infoProduct.GodownId, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Index, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbRack"].ColumnIndex); dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbRack"].Value = infoProduct.RackId; BatchComboFill(decproductId, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Index, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbBatch"].ColumnIndex); dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbBatch"].Value = BllBatch.BatchIdViewByProductId(decproductId); dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtBarcode"].Value = BllBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbBatch"].Value.ToString())); list = bllUnitConvertion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName); dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtUnitConversionId"].Value = list[0].Rows[0]["unitconversionId"].ToString(); dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtConversionRate"].Value = list[0].Rows[0]["conversionRate"].ToString(); decCurrentConversionRate = Convert.ToDecimal(dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtConversionRate"].Value.ToString()); AmountCalculation("dgvtxtQty", dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Index); dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtRate"].Value = infoProduct.SalesRate.ToString(); dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].HeaderCell.Value = "X"; dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].HeaderCell.Style.ForeColor = Color.Red; TotalAmountCalculation(); frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("DN12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearchPopup form to select and view a product /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); try { base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; infoProduct = BllProductCreation.ProductView(decproductId); int inRowcount = dgvPhysicalStock.Rows.Count; for (int i = 0; i < inRowcount; i++) { if (i == decCurrentRowIndex) { strProductCode = infoProduct.ProductCode; productDetailsFill(strProductCode, i, "ProductCode"); } } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("SI: 59" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearchPopup form to select and view a product /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { ProductInfo infoProduct = new ProductInfo(); ProductSP spProduct = new ProductSP(); try { base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; infoProduct = spProduct.ProductView(decproductId); int inRowcount = dgvSalesInvoice.Rows.Count; for (int i = 0; i < inRowcount; i++) { if (i == decCurrentRowIndex) { dgvSalesInvoice.Rows.Add(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductCode"].Value = infoProduct.ProductCode; strProductCode = infoProduct.ProductCode; ProductDetailsFill(strProductCode, i, "ProductCode"); } } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("SI: 59" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// For enter key and backspace navigation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvSalesOrder_KeyDown(object sender, KeyEventArgs e) { try { int indgvSalesOrderRowCount = dgvSalesOrder.Rows.Count; if (e.KeyCode == Keys.Enter) { if (dgvSalesOrder.CurrentCell == dgvSalesOrder.Rows[indgvSalesOrderRowCount - 1].Cells["dgvtxtAmount"]) { e.Handled = true; SendKeys.Send("{tab}"); dgvSalesOrder.ClearSelection(); } } if (e.KeyCode == Keys.Back) { if (dgvSalesOrder.CurrentCell == dgvSalesOrder.Rows[0].Cells["dgvtxtSlNo"]) { if (cmbCurrency.Enabled) { cmbCurrency.Focus(); } else if (cmbPricingLevel.Enabled) { cmbPricingLevel.Focus(); } } } if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) //Pop Up { if (dgvSalesOrder.Columns[dgvSalesOrder.CurrentCell.ColumnIndex].Name == "dgvtxtProductName" || dgvSalesOrder.Columns[dgvSalesOrder.CurrentCell.ColumnIndex].Name == "dgvtxtProductCode") { frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup(); frmProductSearchPopupObj.MdiParent = formMDI.MDIObj; if (dgvSalesOrder.CurrentRow.Cells["dgvtxtProductCode"].Value != null || dgvSalesOrder.CurrentRow.Cells["dgvtxtProductName"].Value != null) { frmProductSearchPopupObj.CallFromSalesOrder(this, dgvSalesOrder.CurrentRow.Index, dgvSalesOrder.CurrentRow.Cells["dgvtxtProductCode"].Value.ToString()); } else { frmProductSearchPopupObj.CallFromSalesOrder(this, dgvSalesOrder.CurrentRow.Index, string.Empty); } } } } catch (Exception ex) { MessageBox.Show("SO95:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// For Enter key and Backspace navigation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvPhysicalStock_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { if (dgvPhysicalStock.CurrentCell == dgvPhysicalStock.Rows[dgvPhysicalStock.Rows.Count - 1].Cells["dgvtxtAmount"]) { txtNarration.Focus(); txtNarration.SelectionStart = 0; txtNarration.SelectionLength = 0; dgvPhysicalStock.ClearSelection(); } } if (e.KeyCode == Keys.Back) { if (dgvPhysicalStock.CurrentCell == dgvPhysicalStock.Rows[0].Cells["dgvtxtSlNo"]) { txtDate.Focus(); txtDate.SelectionStart = 0; txtDate.SelectionLength = 0; dgvPhysicalStock.ClearSelection(); } } if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) { if (dgvPhysicalStock.Columns[dgvPhysicalStock.CurrentCell.ColumnIndex].Name == "dgvtxtProductName" || dgvPhysicalStock.Columns[dgvPhysicalStock.CurrentCell.ColumnIndex].Name == "dgvtxtProductCode") { frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup(); frmProductSearchPopupObj.MdiParent = formMDI.MDIObj; if (dgvPhysicalStock.CurrentRow.Cells["dgvtxtProductCode"].Value != null || dgvPhysicalStock.CurrentRow.Cells["dgvtxtProductName"].Value != null) { frmProductSearchPopupObj.CallFromPhysicalStock(this, dgvPhysicalStock.CurrentRow.Index, dgvPhysicalStock.CurrentRow.Cells["dgvSitxtProductCode"].Value.ToString()); } else { frmProductSearchPopupObj.CallFromPhysicalStock(this, dgvPhysicalStock.CurrentRow.Index, string.Empty); } } } if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt) { if (dgvPhysicalStock.CurrentCell != null) { if (dgvPhysicalStock.CurrentCell == dgvPhysicalStock.CurrentRow.Cells["dgvtxtProductName"] || dgvPhysicalStock.CurrentCell == dgvPhysicalStock.CurrentRow.Cells["dgvtxtProductCode"]) { SendKeys.Send("{F10}"); if (dgvPhysicalStock.Columns[dgvPhysicalStock.CurrentCell.ColumnIndex].Name == "dgvtxtProductName" || dgvPhysicalStock.Columns[dgvPhysicalStock.CurrentCell.ColumnIndex].Name == "dgvtxtProductCode") { frmProductCreation frmProductCreationObj = new frmProductCreation(); frmProductCreationObj.MdiParent = formMDI.MDIObj; } } } } } catch (Exception ex) { MessageBox.Show("PS:54" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearchPopup form to select and view Product /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { UnitConvertionSP spUnitConversion = new UnitConvertionSP(); try { this.frmProductSearchPopupObj = frmProductSearchPopup; DataTable dtbl = new DataTable(); BatchSP spBatch = new BatchSP(); ProductSP spProduct = new ProductSP(); if (decproductId != 0) { infoProduct = spProduct.ProductView(decproductId); dgvSalesOrder.CurrentRow.Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode.ToString(); dgvSalesOrder.CurrentRow.Cells["dgvtxtProductId"].Value = decproductId.ToString(); dgvSalesOrder.CurrentRow.Cells["dgvtxtProductName"].Value = infoProduct.ProductName; dgvSalesOrder.CurrentRow.Cells["dgvtxtRate"].Value = infoProduct.SalesRate.ToString(); UnitComboFill(decproductId, dgvSalesOrder.CurrentRow.Index, dgvSalesOrder.CurrentRow.Cells["dgvcmbUnit"].ColumnIndex); dgvSalesOrder.CurrentRow.Cells["dgvcmbUnit"].Value = infoProduct.UnitId; BatchComboFill(decproductId, dgvSalesOrder.CurrentRow.Index, dgvSalesOrder.CurrentRow.Cells["dgvcmbBatch"].ColumnIndex); dgvSalesOrder.CurrentRow.Cells["dgvcmbBatch"].Value = spBatch.BatchIdViewByProductId(decproductId); dgvSalesOrder.CurrentRow.Cells["dgvtxtBarcode"].Value = spBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvSalesOrder.CurrentRow.Cells["dgvcmbBatch"].Value.ToString())); dtbl = spUnitConversion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName); dgvSalesOrder.CurrentRow.Cells["dgvtxtUnitConversionId"].Value = dtbl.Rows[0]["unitconversionId"].ToString(); dgvSalesOrder.CurrentRow.Cells["dgvtxtConversionRate"].Value = dtbl.Rows[0]["conversionRate"].ToString(); decCurrentConversionRate = Convert.ToDecimal(dgvSalesOrder.CurrentRow.Cells["dgvtxtConversionRate"].Value.ToString()); decCurrentRate = Convert.ToDecimal(dgvSalesOrder.CurrentRow.Cells["dgvtxtRate"].Value.ToString()); AmountCalculation("dgvtxtQty", dgvSalesOrder.CurrentRow.Index); TotalAmountCalculation(); } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; this.Enabled = true; this.BringToFront(); } catch (Exception ex) { MessageBox.Show("S10:" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearchPopup form to select and view Products /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { try { ProductCreationBll BllProductCreation = new ProductCreationBll(); ProductInfo infoProduct = new ProductInfo(); base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; infoProduct = BllProductCreation.ProductView(decproductId); int inRowcount = dgvSalesReturn.Rows.Count; if (dgvSalesReturn.CurrentRow.Index == dgvSalesReturn.Rows.Count - 1) { dgvSalesReturn.Rows.Add(); } for (int i = 0; i < inRowcount; i++) { if (i == decCurrentRowIndex) { dgvSalesReturn.Rows[i].Cells["dgvTextProductCode"].Value = infoProduct.ProductCode; strProductCode = infoProduct.ProductCode; ProductDetailsFill(strProductCode, i, "dgvTextProductCode"); } } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("SR24:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// To select the product from ProductSearchPopup /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); BatchBll BllBatch = new BatchBll(); try { base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; infoProduct = BllProductCreation.ProductView(decproductId); int inRowcount = dgvProduct.Rows.Count; for (int i = 0; i < inRowcount; i++) { if (i == inRowcount - 1) { dgvProduct.Rows.Add(); } if (i == decCurrentRowIndex) { SerialNo(); dgvProduct.Rows[i].Cells["dgvtxtproductCode"].Value = infoProduct.ProductCode; dgvProduct.Rows[i].Cells["productId"].Value = decproductId.ToString(); dgvProduct.Rows[i].Cells["dgvtxtProductName"].Value = infoProduct.ProductName; dgvProduct.Rows[i].Cells["dgvcmbGodown"].Value = infoProduct.GodownId; dgvProduct.Rows[i].Cells["dgvCmbRack"].Value = infoProduct.RackId; UnitComboFill(decproductId, i, dgvProduct.Rows[i].Cells["dgvcmbUnit"].ColumnIndex); dgvProduct.Rows[i].Cells["dgvcmbUnit"].Value = infoProduct.UnitId; List<DataTable> list = new List<DataTable>(); list = bllUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[i].Cells["productId"].Value.ToString()); dgvProduct.Rows[i].Cells["dgvtxtRate"].Value = Math.Round(infoProduct.PurchaseRate, PublicVariables._inNoOfDecimalPlaces); dgvProduct.Rows[i].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(new UnitConvertionBll().UnitconversionIdViewByUnitIdAndProductId(infoProduct.UnitId, infoProduct.ProductId)); dgvProduct.CurrentRow.Cells["dgvtxtConversionRate"].Value = bllUnitConvertion.UnitConversionRateByUnitConversionId(Convert.ToDecimal(dgvProduct.Rows[i].Cells["dgvtxtUnitConversionId"].Value.ToString())); BatchComboFill(decproductId, i, dgvProduct.Rows[i].Cells["dgvcmbBatch"].ColumnIndex); dgvProduct.Rows[i].Cells["dgvcmbBatch"].Value = BllBatch.BatchIdViewByProductId(decproductId); RackComboFill(infoProduct.GodownId, i, dgvProduct.Rows[i].Cells["dgvCmbRack"].ColumnIndex); dgvProduct.Rows[i].Cells["dgvtxtBarcode"].Value = BllBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvProduct.Rows[i].Cells["dgvcmbBatch"].Value.ToString())); list= bllUnitConvertion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName); dgvProduct.Rows[i].Cells["dgvtxtConversionRate"].Value = list[0].Rows[0]["conversionRate"].ToString(); decCurrentConversionRate = Convert.ToDecimal(dgvProduct.CurrentRow.Cells["dgvtxtConversionRate"].Value.ToString()); NewAmountCalculation("dgvtxtQty", i); CalculateTotalAmount(); } } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("MR4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Clear button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnClear_Click(object sender, EventArgs e) { try { Clear(); if (frmDayBookObj != null) { frmDayBookObj.Close(); frmDayBookObj = null; } if (frmLedgerPopupObj != null) { frmLedgerPopupObj.Close(); frmLedgerPopupObj = null; } if (frmProductSearchPopupObj != null) { frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } if (frmPurchaseOrderRegisterObj != null) { frmPurchaseOrderRegisterObj.Close(); frmPurchaseOrderRegisterObj = null; } if (frmPurchaseOrderReportObj != null) { frmPurchaseOrderReportObj.Close(); frmPurchaseOrderReportObj = null; } if (objVoucherSearch != null) { objVoucherSearch.Close(); objVoucherSearch = null; } } catch (Exception ex) { MessageBox.Show("PO50:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// For enter key and backspace navigation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmbItem_KeyDown(object sender, KeyEventArgs e) { string strProductName; try { SettingsBll BllSettings = new SettingsBll(); if (e.KeyCode == Keys.Enter) { if (BllSettings.SettingsStatusCheck("AllowGodown") == "Yes") { cmbGodown.Focus(); cmbGodown.SelectionStart = 0; } else if (BllSettings.SettingsStatusCheck("AllowBatch") == "Yes") { cmbBatch.Focus(); } else { txtQuantity.Focus(); txtQuantity.Select(); } } else if (e.KeyCode == Keys.Back) { if (txtProductCode.Visible) { if (txtProductCode.Text.Trim() != string.Empty || txtProductCode.SelectionLength == 0) { txtProductCode.SelectionStart = 0; txtProductCode.Focus(); } } else { txtBarcode.Focus(); txtBarcode.Select(); } } else if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) //Pop Up { if (cmbItem.Focused) { cmbItem.DropDownStyle = ComboBoxStyle.DropDown; } else { cmbItem.DropDownStyle = ComboBoxStyle.DropDownList; } if (cmbItem.SelectedIndex != -1) { frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup(); frmProductSearchPopupObj.MdiParent = formMDI.MDIObj; frmProductSearchPopupObj.CallFromPOS(this, cmbItem.SelectedIndex, txtProductCode.Text); } else { frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup(); frmProductSearchPopupObj.MdiParent = formMDI.MDIObj; frmProductSearchPopupObj.CallFromPOS(this, cmbItem.SelectedIndex, string.Empty); } } else if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt) //Creation { frmProductCreation frmProductCreationObj = new frmProductCreation(); bool isFromItemCombo = true; if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmProductCreation", "Save")) { if (cmbItem.SelectedValue != null) { strProductName = cmbItem.SelectedValue.ToString(); } else { strProductName = string.Empty; } frmProductCreationObj.MdiParent = formMDI.MDIObj; frmProductCreationObj.CallFromPOSForProductCreation(this, isFromItemCombo); } else { MessageBox.Show("You don’t have privilege", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { MessageBox.Show("POS: 116" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// For enter key, backspace navigation and Find and search a new product /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvPurchaseOrder_KeyDown(object sender, KeyEventArgs e) { try { int indgvdgvPurchaseOrderRowCount = dgvPurchaseOrder.Rows.Count; if (e.KeyCode == Keys.Enter) { if (dgvPurchaseOrder.CurrentCell == dgvPurchaseOrder.Rows[indgvdgvPurchaseOrderRowCount - 1].Cells["dgvtxtAmount"]) { dgvPurchaseOrder.ClearSelection(); txtNarration.Focus(); txtNarration.SelectionStart = 0; txtNarration.SelectionLength = 0; } } if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) //Pop Up { if (dgvPurchaseOrder.Columns[dgvPurchaseOrder.CurrentCell.ColumnIndex].Name == "dgvtxtProductName" || dgvPurchaseOrder.Columns[dgvPurchaseOrder.CurrentCell.ColumnIndex].Name == "dgvtxtProductCode") { frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup(); frmProductSearchPopupObj.MdiParent = formMDI.MDIObj; if (dgvPurchaseOrder.CurrentRow.Cells["dgvtxtProductCode"].Value != null || dgvPurchaseOrder.CurrentRow.Cells["dgvtxtProductName"].Value != null) { frmProductSearchPopupObj.CallFromPurchaseOrder(this, dgvPurchaseOrder.CurrentRow.Index, dgvPurchaseOrder.CurrentRow.Cells["dgvtxtProductCode"].Value.ToString()); } else { frmProductSearchPopupObj.CallFromPurchaseOrder(this, dgvPurchaseOrder.CurrentRow.Index, string.Empty); } } } if (dgvPurchaseOrder.RowCount > 0) { } } catch (Exception ex) { MessageBox.Show("PO68:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearchPopup form to select and view a product /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); try { base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; cmbItem.SelectedValue = decproductId; frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("POS: 63" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// For enter key and backspace navigation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvSalesInvoice_KeyDown(object sender, KeyEventArgs e) { try { int inDgvSalesRowCount = dgvSalesInvoice.Rows.Count; if (e.KeyCode == Keys.Enter) { if (dgvSalesInvoice.CurrentCell == dgvSalesInvoice.Rows[inDgvSalesRowCount - 1].Cells["dgvtxtSalesInvoiceAmount"]) { cmbDrorCr.Focus(); dgvSalesInvoice.ClearSelection(); } } if (e.KeyCode == Keys.Back) { if (dgvSalesInvoice.CurrentCell == dgvSalesInvoice.Rows[0].Cells["dgvtxtSalesInvoiceSlno"]) { if (cmbCurrency.Enabled == false) { cmbSalesMan.Focus(); } else { cmbCurrency.Focus(); } dgvSalesInvoice.ClearSelection(); } } if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) { if (dgvSalesInvoice.Columns[dgvSalesInvoice.CurrentCell.ColumnIndex].Name == "dgvtxtSalesInvoiceProductName" || dgvSalesInvoice.Columns[dgvSalesInvoice.CurrentCell.ColumnIndex].Name == "dgvtxtSalesInvoiceProductCode") { frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup(); frmProductSearchPopupObj.MdiParent = formMDI.MDIObj; if (dgvSalesInvoice.CurrentRow.Cells["dgvtxtSalesInvoiceProductCode"].Value != null || dgvSalesInvoice.CurrentRow.Cells["dgvtxtSalesInvoiceProductName"].Value != null) { frmProductSearchPopupObj.CallFromSalesInvoice(this, dgvSalesInvoice.CurrentRow.Index, dgvSalesInvoice.CurrentRow.Cells["dgvtxtSalesInvoiceProductCode"].Value.ToString()); } else { frmProductSearchPopupObj.CallFromSalesInvoice(this, dgvSalesInvoice.CurrentRow.Index, string.Empty); } } } } catch (Exception ex) { MessageBox.Show("SI: 143" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// For shortcut keys /// Esc for close /// Ctrl+s for save /// Ctrl+D for delete /// Alt+c for productcreation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmPurchaseReturn_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Escape) { if (PublicVariables.isMessageClose) { Messages.CloseMessage(this); } else { btnClose_Click(sender, e); } } else if (e.KeyCode == Keys.S && Control.ModifierKeys == Keys.Control) { cmbCashOrParty.DropDownStyle = (cmbCashOrParty.Focused) ? ComboBoxStyle.DropDown : ComboBoxStyle.DropDownList; btnSave.Focus(); btnSave_Click(sender, e); } else if (e.KeyCode == Keys.D && Control.ModifierKeys == Keys.Control) { if (btnDelete.Enabled) { btnDelete_Click(sender, e); } } else if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt) { if (dgvPurchaseReturn.CurrentCell != null) { if (dgvPurchaseReturn.CurrentCell == dgvPurchaseReturn.CurrentRow.Cells["dgvtxtproductName"] || dgvPurchaseReturn.CurrentCell == dgvPurchaseReturn.CurrentRow.Cells["dgvtxtproductCode"]) { if (cmbInvoiceNo.Visible == false) { SendKeys.Send("{F10}"); frmProductCreation frmProductCreationObj = new frmProductCreation(); frmProductCreationObj.MdiParent = formMDI.MDIObj; frmProductCreationObj.CallFromPurcahseReturn(this); } } } } else if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) { if (dgvPurchaseReturn.CurrentCell != null) { if (dgvPurchaseReturn.Columns[dgvPurchaseReturn.CurrentCell.ColumnIndex].Name == "dgvtxtproductName" || dgvPurchaseReturn.Columns[dgvPurchaseReturn.CurrentCell.ColumnIndex].Name == "dgvtxtproductCode") { if (cmbInvoiceNo.Visible == false) { SendKeys.Send("{F10}"); frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup(); frmProductSearchPopupObj.MdiParent = formMDI.MDIObj; if (dgvPurchaseReturn.CurrentRow.Cells["dgvtxtproductName"].Value != null || dgvPurchaseReturn.CurrentRow.Cells["dgvtxtproductCode"].Value != null) { frmProductSearchPopupObj.CallFromPurchaseReturn(this, dgvPurchaseReturn.CurrentRow.Index, dgvPurchaseReturn.CurrentRow.Cells["dgvtxtproductCode"].Value.ToString()); } else { frmProductSearchPopupObj.CallFromPurchaseReturn(this, dgvPurchaseReturn.CurrentRow.Index, string.Empty); } } } } } } catch (Exception ex) { MessageBox.Show("PR:102" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Enterkey and backspace navigation of dgvConsumption /// Alt+c for dgvConsumption /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvConsumption_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { if (dgvConsumption.CurrentCell == dgvConsumption.Rows[dgvConsumption.RowCount - 1].Cells["dgvtxtConsumptionAmount"]) { if (rbtnManufacturing.Checked) { dgvProduction.Focus(); } else if (rbtnTransfer.Checked) { btnTransfer.Enabled = true; btnTransfer.Focus(); } else { txtNarration.Focus(); } } } if (e.KeyCode == Keys.Back) { if (dgvConsumption.CurrentCell == dgvConsumption.Rows[0].Cells["dgvtxtConsumptionSlNo"]) { if (rbtnManufacturing.Checked) { btnAdd.Focus(); } else { cmbCurrency.Focus(); } } } if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) { if (IsdgvConsuption) { if (dgvConsumption.Columns[dgvConsumption.CurrentCell.ColumnIndex].Name == "dgvtxtConsumptionProductCode" || dgvConsumption.Columns[dgvConsumption.CurrentCell.ColumnIndex].Name == "dgvtxtConsumptionProductName") { frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup(); frmProductSearchPopupObj.MdiParent = formMDI.MDIObj; if (dgvConsumption.CurrentRow.Cells["dgvtxtConsumptionProductCode"].Value != null || dgvConsumption.CurrentRow.Cells["dgvtxtConsumptionProductName"].Value != null) { frmProductSearchPopupObj.CallFromStockJournal(this, dgvConsumption.CurrentRow.Index, dgvConsumption.CurrentRow.Cells["dgvtxtConsumptionProductCode"].Value.ToString()); } else { frmProductSearchPopupObj.CallFromStockJournal(this, dgvConsumption.CurrentRow.Index, string.Empty); } } } } } catch (Exception ex) { MessageBox.Show("SJ:98" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the dataGridView from productSearchPopup when Cntrl+F navigation key used /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { try { ProductInfo infoProduct = new ProductInfo(); ProductSP spProduct = new ProductSP(); base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; UnitConvertionSP SPUnitConversion = new UnitConvertionSP(); infoProduct = spProduct.ProductView(decproductId); int inRowcount = dgvPurchaseReturn.Rows.Count; if (decCurrentRowIndex == inRowcount - 1) { dgvPurchaseReturn.Rows.Add(); } for (int i = 0; i < inRowcount; i++) { if (i == decCurrentRowIndex) { dgvPurchaseReturn.Rows[i].Cells["dgvtxtproductCode"].Value = infoProduct.ProductCode; FillProductDetails(infoProduct.ProductCode.ToString(), i); } } frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } catch (Exception ex) { MessageBox.Show("PR:23" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// For Enter Key Navigation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvProduct_KeyDown(object sender, KeyEventArgs e) { try { int indgvProductRowCount = dgvProduct.Rows.Count; if (e.KeyCode == Keys.Enter) { if (dgvProduct.CurrentCell == dgvProduct.Rows[indgvProductRowCount - 1].Cells["dgvtxtAmount"]) { txtTraspotationCompany.Focus(); txtTraspotationCompany.SelectionStart = 0; dgvProduct.ClearSelection(); } } if (e.KeyCode == Keys.Back) { if (dgvProduct.CurrentCell == dgvProduct.Rows[0].Cells["Col"]) { if (cmbSalesMan.Enabled) { cmbSalesMan.Focus(); } else if (cmbCurrency.Enabled) { cmbCurrency.Focus(); } } } if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt) { if (dgvProduct.CurrentCell != null) { if (dgvProduct.CurrentCell == dgvProduct.CurrentRow.Cells["dgvtxtProductName"] || dgvProduct.CurrentCell == dgvProduct.CurrentRow.Cells["dgvtxtProductCode"]) { SendKeys.Send("{F10}"); if (dgvProduct.Columns[dgvProduct.CurrentCell.ColumnIndex].Name == "dgvtxtProductName" || dgvProduct.Columns[dgvProduct.CurrentCell.ColumnIndex].Name == "dgvtxtProductCode") { frmProductCreation frmProductCreationObj = new frmProductCreation(); frmProductCreationObj.MdiParent = formMDI.MDIObj; frmProductCreationObj.CallFromDeliveryNote(this); } } } } if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) //Product Search Pop Up { if (dgvProduct.Columns[dgvProduct.CurrentCell.ColumnIndex].Name == "dgvtxtProductName" || dgvProduct.Columns[dgvProduct.CurrentCell.ColumnIndex].Name == "dgvtxtProductCode") { frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup(); frmProductSearchPopupObj.MdiParent = formMDI.MDIObj; if (dgvProduct.CurrentRow.Cells["dgvtxtProductCode"].Value != null || dgvProduct.CurrentRow.Cells["dgvtxtProductName"].Value != null) { frmProductSearchPopupObj.CallFromDeliveryNote(this, dgvProduct.CurrentRow.Index, dgvProduct.CurrentRow.Cells["dgvtxtProductCode"].Value.ToString()); } else { frmProductSearchPopupObj.CallFromDeliveryNote(this, dgvProduct.CurrentRow.Index, string.Empty); } } } } catch (Exception ex) { MessageBox.Show("DN:90" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmProductSearch form to select and view product /// </summary> /// <param name="frmProductSearchPopup"></param> /// <param name="decproductId"></param> /// <param name="decCurrentRowIndex"></param> public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex) { ProductSP spProduct = new ProductSP(); ProductInfo infoProduct = new ProductInfo(); try { base.Show(); this.frmProductSearchPopupObj = frmProductSearchPopup; if (decproductId != 0) { int inCurrentRowIndex = dgvProductDetails.CurrentRow.Index; dgvProductDetails.Rows.Add(); infoProduct = spProduct.ProductView(decproductId); strProductCode = infoProduct.ProductCode; ProductDetailsFill(strProductCode, inCurrentRowIndex, "ProductCode"); SerialNo(); frmProductSearchPopupObj.Close(); frmProductSearchPopupObj = null; } } catch (Exception ex) { MessageBox.Show("PI48:" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }