/// <summary> /// From keydown for Showing curresponding popup and create Quick access in Keybord entrys /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmContraVoucher_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Escape) { if (PublicVariables.isMessageClose) { Messages.CloseMessage(this); } else { this.Close(); } } if (dgvContraVoucher.CurrentRow != null) { if (dgvContraVoucher.CurrentCell.ColumnIndex == dgvContraVoucher.Columns["dgvcmbBankorCashAccount"].Index) { if (dgvContraVoucher.CurrentCell == dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"]) { //--------------------For ledger Popup------------------------------------// if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control)//Ledger popup { frmLedgerPopup frmLedgerPopupObj = new frmLedgerPopup(); frmLedgerPopupObj.MdiParent = formMDI.MDIObj; btnSave.Focus(); dgvContraVoucher.Focus(); if (dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"].Value != null && dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"].Value.ToString() != "") { decimal decLedgerIdForPopUp = Convert.ToDecimal(dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"].Value.ToString()); btnSave.Focus(); dgvContraVoucher.Focus(); frmLedgerPopupObj.CallFromContraVoucher(this, decLedgerIdForPopUp, ""); } } } } if (dgvContraVoucher.CurrentCell == dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"]) { if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt)//Ledger creation { SendKeys.Send("{F10}"); if (dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"].Value != null) { strBankOrCashAccount = dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"].Value.ToString(); } else { strBankOrCashAccount = string.Empty; } frmAccountLedgerObj = new frmAccountLedger(); frmAccountLedgerObj.MdiParent = formMDI.MDIObj; frmAccountLedgerObj.CallFromContraVoucher(this, true); } } if (dgvContraVoucher.CurrentCell == dgvContraVoucher.CurrentRow.Cells["dgvcmbCurrency"]) { if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) //Pop Up { frmCurrencyObj = new frmCurrencyDetails(); frmCurrencyObj.MdiParent = formMDI.MDIObj; btnSave.Focus(); dgvContraVoucher.Focus(); if (dgvContraVoucher.CurrentRow.Cells["dgvcmbCurrency"].Value != null && dgvContraVoucher.CurrentRow.Cells["dgvcmbCurrency"].Value.ToString() != "") { btnSave.Focus(); dgvContraVoucher.Focus(); frmCurrencyObj.CallFromContraVoucher(this, Convert.ToDecimal(dgvContraVoucher.CurrentRow.Cells["dgvcmbCurrency"].Value.ToString())); } } } } if (e.KeyCode == Keys.S && Control.ModifierKeys == Keys.Control) //Save { btnSave.Focus(); if (dgvContraVoucher.Columns["dgvcmbBankorCashAccount"].Selected) { btnSave.Select(); } btnSave_Click(sender, e); } if (e.KeyCode == Keys.D && Control.ModifierKeys == Keys.Control) //Delete { if (btnDelete.Enabled) { btnDelete_Click(sender, e); } } } catch (Exception ex) { MessageBox.Show("CV:49" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Add button click,its for add a new bank account ledger from these form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBankAccountAdd_Click(object sender, EventArgs e) { try { if (cmbBankAccount.SelectedValue != null) { strBankOrCashAccount = cmbBankAccount.SelectedValue.ToString(); } else { strBankOrCashAccount = string.Empty; } frmAccountLedger frmAccountLedgerObj = new frmAccountLedger(); frmAccountLedgerObj.MdiParent = formMDI.MDIObj; frmAccountLedger open = Application.OpenForms["frmAccountLedger"] as frmAccountLedger; if (open == null) { frmAccountLedgerObj.WindowState = FormWindowState.Normal; frmAccountLedgerObj.MdiParent = formMDI.MDIObj; frmAccountLedgerObj.CallFromContraVoucher(this, false); } else { open.MdiParent = formMDI.MDIObj; open.BringToFront(); open.CallFromContraVoucher(this, false); if (open.WindowState == FormWindowState.Minimized) { open.WindowState = FormWindowState.Normal; } } this.Enabled = false; } catch (Exception ex) { MessageBox.Show("CV:36" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }