/// <summary> /// Function to call PurchaseReturn voucher on menu click /// </summary> public void PurchaseReturnClick() { try { bool IsActivate = false; foreach (Form form in Application.OpenForms) { if (form.GetType() == typeof(frmPurchaseReturn)) { form.Activate(); IsActivate = true; if (form.WindowState == FormWindowState.Minimized) { form.WindowState = FormWindowState.Normal; } } } if (IsActivate == false) { frmVoucherTypeSelection frm = new frmVoucherTypeSelection(); frmVoucherTypeSelection open = Application.OpenForms["frmVoucherTypeSelection"] as frmVoucherTypeSelection; if (open == null) { frm.MdiParent = this; frm.Show(); } else { frm = open; frm.Activate(); if (frm.WindowState == FormWindowState.Minimized) { frm.WindowState = FormWindowState.Normal; } } string strDailyVoucherType = "Purchase Return"; frm.CallFromVoucherMenu(strDailyVoucherType); } } catch (Exception ex) { MessageBox.Show("MDI 23:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Calls frmDailySalaryVoucher form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DailySalaryVouchertoolStripMenuItem1_Click(object sender, EventArgs e) { try { bool IsActivate = false; foreach (Form frm in Application.OpenForms) { if (frm.GetType() == typeof(frmDailySalaryVoucher)) { frm.Activate(); IsActivate = true; if (frm.WindowState == FormWindowState.Minimized) { frm.WindowState = FormWindowState.Normal; } } } if (IsActivate == false) { string strVoucherType = "Daily Salary Voucher"; frmVoucherTypeSelection frm = new frmVoucherTypeSelection(); frmVoucherTypeSelection open = Application.OpenForms["frmVoucherTypeSelection"] as frmVoucherTypeSelection; if (open == null) { frm.MdiParent = this; frm.CallFromVoucherMenu(strVoucherType); } else { open.CallFromVoucherMenu(strVoucherType); } } } catch (Exception ex) { MessageBox.Show("MDI 82 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }