/// <summary> /// Calls corresponding voucher for updation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvSIReport_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex > -1 && e.ColumnIndex > -1) { if (dgvSIReport.CurrentRow != null) { inCurrenRowIndex = dgvSIReport.CurrentRow.Index; if (bool.Parse(dgvSIReport.CurrentRow.Cells["dgvtxtPOS"].Value.ToString())) { frmPOS objfrmpos; decimal dcRegister = Convert.ToDecimal(dgvSIReport.CurrentRow.Cells["dgvtxtSalesMasterId"].Value.ToString()); objfrmpos = Application.OpenForms["frmPOS"] as frmPOS; if (objfrmpos == null) { objfrmpos = new frmPOS(); objfrmpos.MdiParent = formMDI.MDIObj; objfrmpos.Show(); objfrmpos.CallFromSalesInvoiceReport(dcRegister, this); objfrmpos.WindowState = FormWindowState.Normal; } else { objfrmpos.CallFromSalesInvoiceReport(dcRegister, this); if (objfrmpos.WindowState == FormWindowState.Minimized) { objfrmpos.WindowState = FormWindowState.Normal; } } } else { frmSalesInvoice objfrmSalesInvoice = new frmSalesInvoice(); frmSalesInvoice open = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice; decimal dcRegister = Convert.ToDecimal(dgvSIReport.CurrentRow.Cells["dgvtxtSalesMasterId"].Value.ToString()); if (open == null) { objfrmSalesInvoice.WindowState = FormWindowState.Normal; objfrmSalesInvoice.MdiParent = formMDI.MDIObj; objfrmSalesInvoice.Show(); objfrmSalesInvoice.CallFromSalesInvoiceReport(this, dcRegister); } else { open.CallFromSalesInvoiceReport(this, dcRegister); if (open.WindowState == FormWindowState.Minimized) { open.WindowState = FormWindowState.Normal; } } } } } } catch (Exception ex) { MessageBox.Show("SIRPT: 17" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Calls corresponding voucher on ViewDetails button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnViewDetails_Click(object sender, EventArgs e) { try { if (dgvSiRegister.CurrentRow != null) { inCurrenRowIndex = dgvSiRegister.CurrentRow.Index; if (bool.Parse(dgvSiRegister.CurrentRow.Cells["dgvtxtPos"].Value.ToString())) { frmPOS objfrmpos = new frmPOS(); decimal dcRegister = Convert.ToDecimal(dgvSiRegister.CurrentRow.Cells["dgvtxtsalesMasterId"].Value.ToString()); frmPOS openpos = Application.OpenForms["frmPOS"] as frmPOS; if (openpos == null) { objfrmpos.WindowState = FormWindowState.Normal; objfrmpos.MdiParent = formMDI.MDIObj; objfrmpos.Show(); objfrmpos.CallFromSalesRegister(dcRegister, this); } else { openpos.MdiParent = formMDI.MDIObj; openpos.BringToFront(); openpos.CallFromSalesRegister(dcRegister, this); if (openpos.WindowState == FormWindowState.Minimized) { openpos.WindowState = FormWindowState.Normal; } } } else { frmSalesInvoice objfrmSalesInvoice = new frmSalesInvoice(); frmSalesInvoice open = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice; decimal dcRegister = Convert.ToDecimal(dgvSiRegister.CurrentRow.Cells["dgvtxtsalesMasterId"].Value.ToString()); if (open == null) { objfrmSalesInvoice.WindowState = FormWindowState.Normal; objfrmSalesInvoice.MdiParent = formMDI.MDIObj; objfrmSalesInvoice.Show(); objfrmSalesInvoice.CallFromSalesInvoiceRegister(this, dcRegister); } else { objfrmSalesInvoice.MdiParent = formMDI.MDIObj; open.BringToFront(); open.CallFromSalesInvoiceRegister(this, dcRegister); if (open.WindowState == FormWindowState.Minimized) { open.WindowState = FormWindowState.Normal; } } } } } catch (Exception ex) { formMDI.infoError.ErrorString = "SIREG13:" + ex.Message; } }