Exemple #1
0
        /// <summary>
        /// Calls frmMonthlySalaryVoucher form when cell double click for updation
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvMonthlySalaryRegister_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    if (dgvMonthlySalaryRegister.CurrentRow.Index == e.RowIndex)
                    {
                        frmMonthlySalaryVoucher objfrmMonthlySalaryVoucher = new frmMonthlySalaryVoucher();;
                        objfrmMonthlySalaryVoucher.MdiParent = formMDI.MDIObj;
                        frmMonthlySalaryVoucher open = Application.OpenForms["frmMonthlySalaryVoucher"] as frmMonthlySalaryVoucher;

                        if (open == null)
                        {
                            objfrmMonthlySalaryVoucher.WindowState = FormWindowState.Normal;
                            objfrmMonthlySalaryVoucher.MdiParent   = formMDI.MDIObj;
                            objfrmMonthlySalaryVoucher.CallFromMonthlySalaryRegister(Convert.ToDecimal(dgvMonthlySalaryRegister.Rows[e.RowIndex].Cells["dgvtxtSalaryVoucherMasterID"].Value.ToString()), this);
                        }
                        else
                        {
                            open.CallFromMonthlySalaryRegister(Convert.ToDecimal(dgvMonthlySalaryRegister.Rows[e.RowIndex].Cells["dgvtxtSalaryVoucherMasterID"].Value.ToString()), this);
                            if (open.WindowState == FormWindowState.Minimized)
                            {
                                open.WindowState = FormWindowState.Normal;
                            }
                        }
                        inCurrenRowIndex = dgvMonthlySalaryRegister.CurrentRow.Index;
                    }
                    this.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("MSR12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #2
0
        /// <summary>
        /// Function to call corresponding form from ledger
        /// </summary>
        /// <param name="strTypeofVoucher"></param>
        /// <param name="decMasterId"></param>
        public void CallToCorrespondingForm(string strTypeofVoucher, decimal decMasterId)
        {
            try
            {
                switch (strTypeofVoucher)
                {
                case "Contra Voucher":
                    frmContraVoucher frmContraVoucherObj  = new frmContraVoucher();
                    frmContraVoucher frmContraVoucherOpen = Application.OpenForms["frmContraVoucher"] as frmContraVoucher;
                    if (frmContraVoucherOpen == null)
                    {
                        frmContraVoucherObj.MdiParent = this.MdiParent;
                        frmContraVoucherObj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmContraVoucherOpen.CallFromLedgerDetails(this, decMasterId);
                        if (frmContraVoucherOpen.WindowState == FormWindowState.Minimized)
                        {
                            frmContraVoucherOpen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "Payment Voucher":
                    frmPaymentVoucher frmPaymentVoucherObj  = new frmPaymentVoucher();
                    frmPaymentVoucher frmPaymentVoucherOpen = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher;
                    if (frmPaymentVoucherOpen == null)
                    {
                        frmPaymentVoucherObj.MdiParent = this.MdiParent;
                        frmPaymentVoucherObj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmPaymentVoucherOpen.CallFromLedgerDetails(this, decMasterId);
                        if (frmPaymentVoucherOpen.WindowState == FormWindowState.Minimized)
                        {
                            frmPaymentVoucherOpen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "Receipt Voucher":
                    frmReceiptVoucher frmReceiptVoucherObj  = new frmReceiptVoucher();
                    frmReceiptVoucher frmReceiptVoucherOpen = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher;
                    if (frmReceiptVoucherOpen == null)
                    {
                        frmReceiptVoucherObj.MdiParent = this.MdiParent;
                        frmReceiptVoucherObj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmReceiptVoucherOpen.CallFromLedgerDetails(this, decMasterId);
                        if (frmReceiptVoucherOpen.WindowState == FormWindowState.Minimized)
                        {
                            frmReceiptVoucherOpen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "Journal Voucher":
                    frmJournalVoucher frmJournalVoucherObj  = new frmJournalVoucher();
                    frmJournalVoucher frmJournalVoucherOpen = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                    if (frmJournalVoucherOpen == null)
                    {
                        frmJournalVoucherObj.MdiParent = this.MdiParent;
                        frmJournalVoucherObj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmJournalVoucherOpen.CallFromLedgerDetails(this, decMasterId);
                        if (frmJournalVoucherOpen.WindowState == FormWindowState.Minimized)
                        {
                            frmJournalVoucherOpen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "PDC Clearance":
                    frmPdcClearance frmPdcClearanceObj  = new frmPdcClearance();
                    frmPdcClearance frmPdcClearanceOpen = Application.OpenForms["frmPdcClearance"] as frmPdcClearance;
                    if (frmPdcClearanceOpen == null)
                    {
                        frmPdcClearanceObj.MdiParent = this.MdiParent;
                        frmPdcClearanceObj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmPdcClearanceOpen.CallFromLedgerDetails(this, decMasterId);
                        if (frmPdcClearanceOpen.WindowState == FormWindowState.Minimized)
                        {
                            frmPdcClearanceOpen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "PDC Payable":
                    frmPdcPayable frmPDCPayableObj  = new frmPdcPayable();
                    frmPdcPayable frmPDCPayableOpen = Application.OpenForms["frmPdcPayable"] as frmPdcPayable;
                    if (frmPDCPayableOpen == null)
                    {
                        frmPDCPayableObj.MdiParent = this.MdiParent;
                        frmPDCPayableObj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmPDCPayableOpen.CallFromLedgerDetails(this, decMasterId);
                        if (frmPDCPayableOpen.WindowState == FormWindowState.Minimized)
                        {
                            frmPDCPayableOpen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "PDC Receivable":
                    frmPdcReceivable frmPdcReceivableObj  = new frmPdcReceivable();
                    frmPdcReceivable frmPdcReceivableOpen = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable;
                    if (frmPdcReceivableOpen == null)
                    {
                        frmPdcReceivableObj.MdiParent = this.MdiParent;
                        frmPdcReceivableObj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmPdcReceivableOpen.CallFromLedgerDetails(this, decMasterId);
                        if (frmPdcReceivableOpen.WindowState == FormWindowState.Minimized)
                        {
                            frmPdcReceivableOpen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "Purchase Invoice":
                    frmPurchaseInvoice frmPurchaseInvoiceObj  = new frmPurchaseInvoice();
                    frmPurchaseInvoice frmPurchaseInvoiveOpen = Application.OpenForms["frmPurchaseInvoice"] as frmPurchaseInvoice;
                    if (frmPurchaseInvoiveOpen == null)
                    {
                        frmPurchaseInvoiceObj.MdiParent = this.MdiParent;
                        frmPurchaseInvoiceObj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmPurchaseInvoiveOpen.CallFromLedgerDetails(this, decMasterId);
                        if (frmPurchaseInvoiveOpen.WindowState == FormWindowState.Minimized)
                        {
                            frmPurchaseInvoiveOpen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "Purchase Return":
                    frmPurchaseReturn frmPurchaseReturnObj  = new frmPurchaseReturn();
                    frmPurchaseReturn frmPurchaseReturnOpen = Application.OpenForms["frmPurchaseReturn"] as frmPurchaseReturn;
                    if (frmPurchaseReturnOpen == null)
                    {
                        frmPurchaseReturnObj.MdiParent = this.MdiParent;
                        frmPurchaseReturnObj.CallFromLedgerDetails(this, decMasterId, true);
                    }
                    else
                    {
                        frmPurchaseReturnOpen.CallFromLedgerDetails(this, decMasterId, true);
                        if (frmPurchaseReturnOpen.WindowState == FormWindowState.Minimized)
                        {
                            frmPurchaseReturnOpen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "Sales Invoice":
                    if (dgvLedgerDetails.CurrentRow.Cells["dgvtxtpos"].Value.ToString() == "False")
                    {
                        frmSalesInvoice frmSalesInvoiceObj  = new frmSalesInvoice();
                        frmSalesInvoice frmSalesInvoiveOpen = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice;
                        if (frmSalesInvoiveOpen == null)
                        {
                            frmSalesInvoiceObj.MdiParent = this.MdiParent;
                            frmSalesInvoiceObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmSalesInvoiveOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmSalesInvoiveOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmSalesInvoiveOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                    }
                    else
                    {
                        frmPOS frmposObj  = new frmPOS();
                        frmPOS frmposOpen = Application.OpenForms["frmPOS"] as frmPOS;
                        if (frmposOpen == null)
                        {
                            frmposObj.MdiParent = this.MdiParent;
                            frmposObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmposOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmposOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmposOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                    }
                    break;

                case "Sales Return":
                    frmSalesReturn frmSalesReturnObj  = new frmSalesReturn();
                    frmSalesReturn frmSalesReturnOpen = Application.OpenForms["frmSalesReturn"] as frmSalesReturn;
                    if (frmSalesReturnOpen == null)
                    {
                        frmSalesReturnObj.MdiParent = this.MdiParent;
                        frmSalesReturnObj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmSalesReturnOpen.CallFromLedgerDetails(this, decMasterId);
                        if (frmSalesReturnOpen.WindowState == FormWindowState.Minimized)
                        {
                            frmSalesReturnOpen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "Service Voucher":
                    frmServiceVoucher frmServiceVoucherObj  = new frmServiceVoucher();
                    frmServiceVoucher frmServiceVoucherOpen = Application.OpenForms["frmServiceVoucher"] as frmServiceVoucher;
                    if (frmServiceVoucherOpen == null)
                    {
                        frmServiceVoucherObj.MdiParent = this.MdiParent;
                        frmServiceVoucherObj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmServiceVoucherOpen.CallFromLedgerDetails(this, decMasterId);
                        if (frmServiceVoucherOpen.WindowState == FormWindowState.Minimized)
                        {
                            frmServiceVoucherOpen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "Credit Note":
                    frmCreditNote frmCreditNoteobj  = new frmCreditNote();
                    frmCreditNote frmCreditNoteOpen = Application.OpenForms["frmCreditNote"] as frmCreditNote;
                    if (frmCreditNoteOpen == null)
                    {
                        frmCreditNoteobj.MdiParent = this.MdiParent;
                        frmCreditNoteobj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmCreditNoteOpen.CallFromLedgerDetails(this, decMasterId);
                        if (frmCreditNoteOpen.WindowState == FormWindowState.Minimized)
                        {
                            frmCreditNoteOpen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "Debit Note":
                    frmDebitNote frmDebitNoteObj  = new frmDebitNote();
                    frmDebitNote frmDebitNoteOpen = Application.OpenForms["frmDebitNote"] as frmDebitNote;
                    if (frmDebitNoteOpen == null)
                    {
                        frmDebitNoteObj.MdiParent = this.MdiParent;
                        frmDebitNoteObj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmDebitNoteOpen.CallFromLedgerDetails(this, decMasterId);
                        if (frmDebitNoteOpen.WindowState == FormWindowState.Minimized)
                        {
                            frmDebitNoteOpen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "Advance Payment":
                    frmAdvancePayment frmAdvancePaymentObj  = new frmAdvancePayment();
                    frmAdvancePayment frmAdvancePaymentopen = Application.OpenForms["frmAdvancePayment"] as frmAdvancePayment;
                    if (frmAdvancePaymentopen == null)
                    {
                        frmAdvancePaymentObj.MdiParent = this.MdiParent;
                        frmAdvancePaymentObj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmAdvancePaymentopen.CallFromLedgerDetails(this, decMasterId);
                        if (frmAdvancePaymentopen.WindowState == FormWindowState.Minimized)
                        {
                            frmAdvancePaymentopen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;

                case "Monthly Salary Voucher":
                    frmMonthlySalaryVoucher frmMonthlySalaryVoucherObj  = new frmMonthlySalaryVoucher();
                    frmMonthlySalaryVoucher frmMonthlySalaryVoucheropen = Application.OpenForms["frmMonthlySalaryVoucher"] as frmMonthlySalaryVoucher;
                    if (frmMonthlySalaryVoucheropen == null)
                    {
                        frmMonthlySalaryVoucherObj.MdiParent = this.MdiParent;
                        frmMonthlySalaryVoucherObj.CallFromLedgerDetails(this, decMasterId);
                    }
                    else
                    {
                        frmMonthlySalaryVoucheropen.CallFromLedgerDetails(this, decMasterId);
                        if (frmMonthlySalaryVoucheropen.WindowState == FormWindowState.Minimized)
                        {
                            frmMonthlySalaryVoucheropen.WindowState = FormWindowState.Normal;
                        }
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("LEDDET5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #3
0
 /// <summary>
 /// When doubleclicking on the grid
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvDayBook_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         string strVoucherType = string.Empty;
         decimal decMasterId = 0;
         SalesMasterSP spSalesMaster = new SalesMasterSP();
         if (dgvDayBook.CurrentRow.Index == e.RowIndex)
         {
             int inI = dgvDayBook.CurrentCell.RowIndex;
             int inCount = dgvDayBook.Rows.Count;
             if (dgvDayBook.CurrentCell.RowIndex < dgvDayBook.Rows[inCount - 3].Cells["Date"].RowIndex)
             {
                 foreach (DataGridViewRow dgv in dgvDayBook.Rows)
                 {
                     if (dgv.Cells["Date"].Value.ToString() != string.Empty)
                     {
                         strVoucherType = dgv.Cells["typeOfVoucher"].Value.ToString();
                         decMasterId = Convert.ToDecimal(dgv.Cells["MasterId"].Value.ToString());
                     }
                     if (dgv.Index == inI)
                     {
                         break;
                     }
                 }
                 if (strVoucherType == "Contra Voucher")
                 {
                     frmContraVoucher frmContraVoucher = new frmContraVoucher();
                     frmContraVoucher open = Application.OpenForms["frmContraVoucher"] as frmContraVoucher;
                     if (open == null)
                     {
                         frmContraVoucher.WindowState = FormWindowState.Normal;
                         frmContraVoucher.MdiParent = formMDI.MDIObj;
                         frmContraVoucher.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         open.callFromDayBook(this, decMasterId);
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                     }
                 }
                 else if (strVoucherType == "Payment Voucher")
                 {
                     frmPaymentVoucher frmPaymentVoucher = new frmPaymentVoucher();
                     frmPaymentVoucher open = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher;
                     if (open == null)
                     {
                         frmPaymentVoucher.WindowState = FormWindowState.Normal;
                         frmPaymentVoucher.MdiParent = formMDI.MDIObj;
                         frmPaymentVoucher.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         open.callFromDayBook(this, decMasterId);
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                     }
                 }
                 else if (strVoucherType == "Receipt Voucher")
                 {
                     frmReceiptVoucher frmReceiptVoucher = new frmReceiptVoucher();
                     frmReceiptVoucher open = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher;
                     if (open == null)
                     {
                         frmReceiptVoucher.WindowState = FormWindowState.Normal;
                         frmReceiptVoucher.MdiParent = formMDI.MDIObj;
                         frmReceiptVoucher.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Journal Voucher")
                 {
                     frmJournalVoucher frmJournalVoucher = new frmJournalVoucher();
                     frmJournalVoucher open = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                     if (open == null)
                     {
                         frmJournalVoucher.WindowState = FormWindowState.Normal;
                         frmJournalVoucher.MdiParent = formMDI.MDIObj;
                         frmJournalVoucher.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         open.callFromDayBook(this, decMasterId);
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                     }
                 }
                 else if (strVoucherType == "PDC Payable")
                 {
                     frmPdcPayable frmPdcPayable = new frmPdcPayable();
                     frmPdcPayable open = Application.OpenForms["frmPdcPayable"] as frmPdcPayable;
                     if (open == null)
                     {
                         frmPdcPayable.WindowState = FormWindowState.Normal;
                         frmPdcPayable.MdiParent = formMDI.MDIObj;
                         frmPdcPayable.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "PDC Receivable")
                 {
                     frmPdcReceivable frmPdcReceivable = new frmPdcReceivable();
                     frmPdcReceivable open = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable;
                     if (open == null)
                     {
                         frmPdcReceivable.WindowState = FormWindowState.Normal;
                         frmPdcReceivable.MdiParent = formMDI.MDIObj;
                         frmPdcReceivable.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Purchase Invoice")
                 {
                     frmPurchaseInvoice frmPurchaseInvoice = new frmPurchaseInvoice();
                     frmPurchaseInvoice open = Application.OpenForms["frmPurchaseInvoice"] as frmPurchaseInvoice;
                     if (open == null)
                     {
                         frmPurchaseInvoice.WindowState = FormWindowState.Normal;
                         frmPurchaseInvoice.MdiParent = formMDI.MDIObj;
                         frmPurchaseInvoice.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Purchase Return")
                 {
                     frmPurchaseReturn frmPurchaseReturn = new frmPurchaseReturn();
                     frmPurchaseReturn open = Application.OpenForms["frmPurchaseReturn"] as frmPurchaseReturn;
                     if (open == null)
                     {
                         frmPurchaseReturn.WindowState = FormWindowState.Normal;
                         frmPurchaseReturn.MdiParent = formMDI.MDIObj;
                         frmPurchaseReturn.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Sales Invoice")
                 {
                     decimal decSalesId = Convert.ToDecimal(dgvDayBook.CurrentRow.Cells["MasterId"].Value.ToString());
                     decimal decVoucherId = Convert.ToDecimal(dgvDayBook.CurrentRow.Cells["voucherTypeId"].Value.ToString());
                     bool isPOS = spSalesMaster.DayBookSalesInvoiceOrPOS(decSalesId, decVoucherId);
                     if (isPOS == true)
                     {
                         frmPOS frmPOSObj = new frmPOS();
                         frmPOS open = Application.OpenForms["frmPOS"] as frmPOS;
                         if (open == null)
                         {
                             frmPOSObj.WindowState = FormWindowState.Normal;
                             frmPOSObj.MdiParent = formMDI.MDIObj;
                             frmPOSObj.callFromDayBook(this, decMasterId);
                         }
                         else
                         {
                             if (open.WindowState == FormWindowState.Minimized)
                             {
                                 open.WindowState = FormWindowState.Normal;
                             }
                             open.callFromDayBook(this, decMasterId);
                         }
                     }
                     else
                     {
                         frmSalesInvoice frmSalesInvoiceObj = new frmSalesInvoice();
                         frmSalesInvoice open = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice;
                         if (open == null)
                         {
                             frmSalesInvoiceObj.WindowState = FormWindowState.Normal;
                             frmSalesInvoiceObj.MdiParent = formMDI.MDIObj;
                             frmSalesInvoiceObj.callFromDayBook(this, decMasterId);
                         }
                         else
                         {
                             if (open.WindowState == FormWindowState.Minimized)
                             {
                                 open.WindowState = FormWindowState.Normal;
                             }
                             open.callFromDayBook(this, decMasterId);
                         }
                     }
                 }
                 else if (strVoucherType == "Sales Return")
                 {
                     frmSalesReturn frmSalesReturn = new frmSalesReturn();
                     frmSalesReturn open = Application.OpenForms["frmSalesReturn"] as frmSalesReturn;
                     if (open == null)
                     {
                         frmSalesReturn.WindowState = FormWindowState.Normal;
                         frmSalesReturn.MdiParent = formMDI.MDIObj;
                         frmSalesReturn.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Service Voucher")
                 {
                     frmServiceVoucher frmServiceVoucher = new frmServiceVoucher();
                     frmServiceVoucher open = Application.OpenForms["frmServiceVoucher"] as frmServiceVoucher;
                     if (open == null)
                     {
                         frmServiceVoucher.WindowState = FormWindowState.Normal;
                         frmServiceVoucher.MdiParent = formMDI.MDIObj;
                         frmServiceVoucher.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Credit Note")
                 {
                     frmCreditNote frmCreditNote = new frmCreditNote();
                     frmCreditNote open = Application.OpenForms["frmCreditNote"] as frmCreditNote;
                     if (open == null)
                     {
                         frmCreditNote.WindowState = FormWindowState.Normal;
                         frmCreditNote.MdiParent = formMDI.MDIObj;
                         frmCreditNote.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Debit Note")
                 {
                     frmDebitNote frmDebitNote = new frmDebitNote();
                     frmDebitNote open = Application.OpenForms["frmDebitNote"] as frmDebitNote;
                     if (open == null)
                     {
                         frmDebitNote.WindowState = FormWindowState.Normal;
                         frmDebitNote.MdiParent = formMDI.MDIObj;
                         frmDebitNote.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Rejection In")
                 {
                     frmRejectionIn frmRejectionIn = new frmRejectionIn();
                     frmRejectionIn open = Application.OpenForms["frmRejectionIn"] as frmRejectionIn;
                     if (open == null)
                     {
                         frmRejectionIn.WindowState = FormWindowState.Normal;
                         frmRejectionIn.MdiParent = formMDI.MDIObj;
                         frmRejectionIn.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Rejection Out")
                 {
                     frmRejectionOut frmRejectionOut = new frmRejectionOut();
                     frmRejectionOut open = Application.OpenForms["frmRejectionOut"] as frmRejectionOut;
                     if (open == null)
                     {
                         frmRejectionOut.WindowState = FormWindowState.Normal;
                         frmRejectionOut.MdiParent = formMDI.MDIObj;
                         frmRejectionOut.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Delivery Note")
                 {
                     frmDeliveryNote frmDeliveryNote = new frmDeliveryNote();
                     frmDeliveryNote open = Application.OpenForms["frmDeliveryNote"] as frmDeliveryNote;
                     if (open == null)
                     {
                         frmDeliveryNote.WindowState = FormWindowState.Normal;
                         frmDeliveryNote.MdiParent = formMDI.MDIObj;
                         frmDeliveryNote.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Material Receipt")
                 {
                     frmMaterialReceipt frmMaterialReceipt = new frmMaterialReceipt();
                     frmMaterialReceipt open = Application.OpenForms["frmMaterialReceipt"] as frmMaterialReceipt;
                     if (open == null)
                     {
                         frmMaterialReceipt.WindowState = FormWindowState.Normal;
                         frmMaterialReceipt.MdiParent = formMDI.MDIObj;
                         frmMaterialReceipt.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "PDC Clearance")
                 {
                     frmPdcClearance frmPdcClearance = new frmPdcClearance();
                     frmPdcClearance open = Application.OpenForms["frmPdcClearance"] as frmPdcClearance;
                     if (open == null)
                     {
                         frmPdcClearance.WindowState = FormWindowState.Normal;
                         frmPdcClearance.MdiParent = formMDI.MDIObj;
                         frmPdcClearance.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Purchase Order")
                 {
                     frmPurchaseOrder frmPurchaseOrder = new frmPurchaseOrder();
                     frmPurchaseOrder open = Application.OpenForms["frmPurchaseOrder"] as frmPurchaseOrder;
                     if (open == null)
                     {
                         frmPurchaseOrder.WindowState = FormWindowState.Normal;
                         frmPurchaseOrder.MdiParent = formMDI.MDIObj;
                         frmPurchaseOrder.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Sales Order")
                 {
                     frmSalesOrder frmSalesOrder = new frmSalesOrder();
                     frmSalesOrder open = Application.OpenForms["frmSalesOrder"] as frmSalesOrder;
                     if (open == null)
                     {
                         frmSalesOrder.WindowState = FormWindowState.Normal;
                         frmSalesOrder.MdiParent = formMDI.MDIObj;
                         frmSalesOrder.callfromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callfromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Sales Quotation")
                 {
                     frmSalesQuotation frmSalesQuotation = new frmSalesQuotation();
                     frmSalesQuotation open = Application.OpenForms["frmSalesQuotation"] as frmSalesQuotation;
                     if (open == null)
                     {
                         frmSalesQuotation.WindowState = FormWindowState.Normal;
                         frmSalesQuotation.MdiParent = formMDI.MDIObj;
                         frmSalesQuotation.callfromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callfromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Physical Stock")
                 {
                     frmPhysicalStock frmPhysicalStock = new frmPhysicalStock();
                     frmPhysicalStock open = Application.OpenForms["frmPhysicalStock"] as frmPhysicalStock;
                     if (open == null)
                     {
                         frmPhysicalStock.WindowState = FormWindowState.Normal;
                         frmPhysicalStock.MdiParent = formMDI.MDIObj;
                         frmPhysicalStock.callFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.callFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Stock Journal")
                 {
                     frmStockJournal frmStockJournal = new frmStockJournal();
                     frmStockJournal open = Application.OpenForms["frmStockJournal"] as frmStockJournal;
                     if (open == null)
                     {
                         frmStockJournal.WindowState = FormWindowState.Normal;
                         frmStockJournal.MdiParent = formMDI.MDIObj;
                         frmStockJournal.CallFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.CallFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Daily Salary Voucher")
                 {
                     frmDailySalaryVoucher frmDailySalaryVoucher = new frmDailySalaryVoucher();
                     frmDailySalaryVoucher open = Application.OpenForms["frmDailySalaryVoucher"] as frmDailySalaryVoucher;
                     if (open == null)
                     {
                         frmDailySalaryVoucher.WindowState = FormWindowState.Normal;
                         frmDailySalaryVoucher.MdiParent = formMDI.MDIObj;
                         frmDailySalaryVoucher.CallFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.CallFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Monthly Salary Voucher")
                 {
                     frmMonthlySalaryVoucher frmMonthlySalaryVoucher = new frmMonthlySalaryVoucher();
                     frmMonthlySalaryVoucher open = Application.OpenForms["frmMonthlySalaryVoucher"] as frmMonthlySalaryVoucher;
                     if (open == null)
                     {
                         frmMonthlySalaryVoucher.WindowState = FormWindowState.Normal;
                         frmMonthlySalaryVoucher.MdiParent = formMDI.MDIObj;
                         frmMonthlySalaryVoucher.CallFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.CallFromDayBook(this, decMasterId);
                     }
                 }
                 else if (strVoucherType == "Advance Payment")
                 {
                     frmAdvancePayment frmAdvancePayment = new frmAdvancePayment();
                     frmAdvancePayment open = Application.OpenForms["frmAdvancePayment"] as frmAdvancePayment;
                     if (open == null)
                     {
                         frmAdvancePayment.WindowState = FormWindowState.Normal;
                         frmAdvancePayment.MdiParent = formMDI.MDIObj;
                         frmAdvancePayment.CallFromDayBook(this, decMasterId);
                     }
                     else
                     {
                         if (open.WindowState == FormWindowState.Minimized)
                         {
                             open.WindowState = FormWindowState.Normal;
                         }
                         open.CallFromDayBook(this, decMasterId);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DB18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Opens the corresponding Vouchers based on voucher type on Go button click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGo_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbVoucherType.SelectedIndex != -1)
                {
                    switch (VoucherType)
                    {
                        case "Monthly Salary Voucher":
                            decimal decVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strVoucherTypeName = cmbVoucherType.Text;
                            frmMonthlySalaryVoucher frm = new frmMonthlySalaryVoucher();
                            frmMonthlySalaryVoucher open = Application.OpenForms["frmMonthlySalaryVoucher"] as frmMonthlySalaryVoucher;
                            if (open == null)
                            {
                                frm.MdiParent = this.MdiParent;
                                frm.CallFromVoucherTypeSelection(decVoucherTypeId, strVoucherTypeName);
                            }
                            else
                            {
                                open.CallFromVoucherTypeSelection(decVoucherTypeId, strVoucherTypeName);
                            }

                            this.Close();
                            break;
                        case "Advance Payment":
                            decimal decVoucherTypeNo = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strVoucherTypeNames = cmbVoucherType.Text;

                            frmAdvancePayment abc = new frmAdvancePayment();
                            frmAdvancePayment opens = Application.OpenForms["frmAdvancePayment"] as frmAdvancePayment;
                            if (opens == null)
                            {
                                abc.MdiParent = this.MdiParent;
                                abc.CallFromVoucherTypeSelection(decVoucherTypeNo, strVoucherTypeNames);
                            }
                            else
                            {
                                opens.CallFromVoucherTypeSelection(decVoucherTypeNo, strVoucherTypeNames);
                            }

                            this.Close();
                            break;
                        case "Daily Salary Voucher":
                            decimal decDailyVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strDailySalaryVoucherTypeName = cmbVoucherType.Text.ToString();
                            frmDailySalaryVoucher frmobj = new frmDailySalaryVoucher();
                            frmDailySalaryVoucher DailyOpen = Application.OpenForms["frmDailySalaryVoucher"] as frmDailySalaryVoucher;
                            if (DailyOpen == null)
                            {
                                frmobj.MdiParent = this.MdiParent;
                                frmobj.CallFromVoucherTypeSelection(decDailyVoucherTypeId, strDailySalaryVoucherTypeName);
                            }
                            else
                            {
                                DailyOpen.CallFromVoucherTypeSelection(decDailyVoucherTypeId, strDailySalaryVoucherTypeName);
                            }

                            this.Close();
                            break;
                        case "Payment Voucher":
                            decimal decPaymentVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());
                            string strVoucherTypeNames2 = cmbVoucherType.Text.ToString();
                            frmPaymentVoucher frmPaymentObj = new frmPaymentVoucher();
                            frmPaymentVoucher PaymentOpen = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher;
                            if (PaymentOpen == null)
                            {
                                frmPaymentObj.MdiParent = this.MdiParent;
                                frmPaymentObj.CallFromVoucherTypeSelection(decPaymentVoucherTypeId, strVoucherTypeNames2);
                            }
                            else
                            {
                                PaymentOpen.CallFromVoucherTypeSelection(decPaymentVoucherTypeId, strVoucherTypeNames2);
                            }

                            this.Close();
                            break;
                        case "Contra Voucher":
                            decimal decContraVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strVoucherTypeNames3 = cmbVoucherType.Text.ToString();
                            frmContraVoucher frmcontraObj = new frmContraVoucher();
                            frmContraVoucher ContraOpen = Application.OpenForms["frmContraVoucher"] as frmContraVoucher;
                            if (ContraOpen == null)
                            {
                                frmcontraObj.MdiParent = this.MdiParent;
                                frmcontraObj.CallFromVoucherTypeSelection(decContraVoucherTypeId, strVoucherTypeNames3);
                            }
                            else
                            {
                                ContraOpen.CallFromVoucherTypeSelection(decContraVoucherTypeId, strVoucherTypeNames3);
                            }

                            this.Close();
                            break;
                        case "Journal Voucher":
                            decimal decJournalVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strVoucherTypeNames4 = cmbVoucherType.Text.ToString();
                            frmJournalVoucher frmJournalObj = new frmJournalVoucher();
                            frmJournalVoucher JournalOpen = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                            if (JournalOpen == null)
                            {
                                frmJournalObj.MdiParent = this.MdiParent;
                                frmJournalObj.CallFromVoucherTypeSelection(decJournalVoucherTypeId, strVoucherTypeNames4);
                            }
                            else
                            {
                                JournalOpen.CallFromVoucherTypeSelection(decJournalVoucherTypeId, strVoucherTypeNames4);
                            }

                            this.Close();
                            break;

                        case "Credit Note":

                            decimal decCreditNoteVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strCreditNoteVoucherTypeName = cmbVoucherType.Text.ToString();
                            frmCreditNote frmCreditNoteObj = new frmCreditNote();
                            frmCreditNote CreditNoteOpen = Application.OpenForms["frmCreditNote"] as frmCreditNote;
                            if (CreditNoteOpen == null)
                            {
                                frmCreditNoteObj.MdiParent = this.MdiParent;
                                frmCreditNoteObj.CallFromVoucherTypeSelection(decCreditNoteVoucherTypeId, strCreditNoteVoucherTypeName);
                            }
                            else
                            {
                                CreditNoteOpen.CallFromVoucherTypeSelection(decCreditNoteVoucherTypeId, strCreditNoteVoucherTypeName);
                            }

                            this.Close();
                            break;

                        case "Receipt Voucher":
                            decimal decReceiptVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strReceiptVoucherTypeName = cmbVoucherType.Text.ToString();
                            frmReceiptVoucher frmReceiptObj = new frmReceiptVoucher();
                            frmReceiptVoucher ReceiptOpen = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher;
                            if (ReceiptOpen == null)
                            {
                                frmReceiptObj.MdiParent = this.MdiParent;
                                frmReceiptObj.CallFromVoucherTypeSelection(decReceiptVoucherTypeId, strReceiptVoucherTypeName);
                            }
                            else
                            {
                                ReceiptOpen.CallFromVoucherTypeSelection(decReceiptVoucherTypeId, strReceiptVoucherTypeName);
                            }

                            this.Close();
                            break;

                        case "Service Voucher":
                            decimal decServiceVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strServiceVoucherTypeName = cmbVoucherType.Text.ToString();
                            frmServiceVoucher frmServiceVoucherObj = new frmServiceVoucher();
                            frmServiceVoucher ServiceVoucherOpen = Application.OpenForms["frmServiceVoucher"] as frmServiceVoucher;
                            if (ServiceVoucherOpen == null)
                            {
                                frmServiceVoucherObj.MdiParent = this.MdiParent;
                                frmServiceVoucherObj.CallFromVoucherTypeSelection(decServiceVoucherTypeId, strServiceVoucherTypeName);
                            }
                            else
                            {
                                ServiceVoucherOpen.CallFromVoucherTypeSelection(decServiceVoucherTypeId, strServiceVoucherTypeName);
                            }

                            this.Close();
                            break;
                        case "Purchase Order":
                            decimal decPurchaseOrderTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strPurchaseOrderTypeName = cmbVoucherType.Text.ToString();
                            frmPurchaseOrder frmPurchaseOrderObj = new frmPurchaseOrder();
                            frmPurchaseOrder OpenPurchaseOrder = Application.OpenForms["frmPurchaseOrder"] as frmPurchaseOrder;
                            if (OpenPurchaseOrder == null)
                            {
                                frmPurchaseOrderObj.MdiParent = this.MdiParent;
                                frmPurchaseOrderObj.CallFromVoucherTypeSelection(decPurchaseOrderTypeId, strPurchaseOrderTypeName);
                            }
                            else
                            {
                                OpenPurchaseOrder.CallFromVoucherTypeSelection(decPurchaseOrderTypeId, strPurchaseOrderTypeName);
                            }
                            this.Close();
                            break;
                        case "Debit Note":
                            decimal decDebitNoteVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strDebitNoteVoucherTypeName = cmbVoucherType.Text.ToString();
                            frmDebitNote frmDebitNoteObj = new frmDebitNote();
                            frmDebitNote DebitNoteOpen = Application.OpenForms["frmDebitNote"] as frmDebitNote;
                            if (DebitNoteOpen == null)
                            {
                                frmDebitNoteObj.MdiParent = this.MdiParent;
                                frmDebitNoteObj.CallFromVoucherTypeSelection(decDebitNoteVoucherTypeId, strDebitNoteVoucherTypeName);
                            }
                            else
                            {
                                DebitNoteOpen.CallFromVoucherTypeSelection(decDebitNoteVoucherTypeId, strDebitNoteVoucherTypeName);
                            }

                            this.Close();
                            break;

                        case "Sales Return":
                            decimal decSalesReturnVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strSalesReturnVoucheTypeName = cmbVoucherType.Text;
                            frmSalesReturn frmSalesReturnObj = new frmSalesReturn();
                            frmSalesReturn SalesReturnOpen = Application.OpenForms["frmSalesReturn"] as frmSalesReturn;
                            if (SalesReturnOpen == null)
                            {
                                frmSalesReturnObj.MdiParent = this.MdiParent;
                                frmSalesReturnObj.CallFromVoucherTypeSelection(decSalesReturnVoucherTypeId, strSalesReturnVoucheTypeName);
                            }
                            else
                            {
                                SalesReturnOpen.CallFromVoucherTypeSelection(decSalesReturnVoucherTypeId, strSalesReturnVoucheTypeName);
                            }

                            this.Close();
                            break;

                        case "Material Receipt":
                            decimal decMaterialReceiptVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strMaterialReceiptVoucheTypeName = cmbVoucherType.Text;

                            frmMaterialReceipt frmMaterialReceiptObj = new frmMaterialReceipt();
                            frmMaterialReceipt MaterialReceiptOpen = Application.OpenForms["frmMaterialReceipt"] as frmMaterialReceipt;
                            if (MaterialReceiptOpen == null)
                            {
                                frmMaterialReceiptObj.MdiParent = this.MdiParent;
                                frmMaterialReceiptObj.CallFromVoucherTypeSelection(decMaterialReceiptVoucherTypeId, strMaterialReceiptVoucheTypeName);
                            }
                            else
                            {
                                MaterialReceiptOpen.CallFromVoucherTypeSelection(decMaterialReceiptVoucherTypeId, strMaterialReceiptVoucheTypeName);
                            }

                            this.Close();
                            break;

                        case "Sales Order":
                            decimal decSalesOrderTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strSalesOrderVoucherTypeName = cmbVoucherType.Text;

                            frmSalesOrder frmSalesOrderObj = new frmSalesOrder();
                            frmSalesOrder SalesOrderOpen = Application.OpenForms["frmSalesOrder"] as frmSalesOrder;
                            if (SalesOrderOpen == null)
                            {
                                frmSalesOrderObj.MdiParent = this.MdiParent;
                                frmSalesOrderObj.CallFromVoucherTypeSelection(decSalesOrderTypeId, strSalesOrderVoucherTypeName);
                            }
                            else
                            {
                                SalesOrderOpen.CallFromVoucherTypeSelection(decSalesOrderTypeId, strSalesOrderVoucherTypeName);
                            }

                            this.Close();
                            break;

                        case "Rejection Out":
                            decimal decRejectionOutVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strRejectionOutVoucherTypeName = cmbVoucherType.Text.ToString();
                            frmRejectionOut frmRejectionOutObj = new frmRejectionOut();
                            frmRejectionOut RejectionOutOpen = Application.OpenForms["frmRejectionOut"] as frmRejectionOut;
                            if (RejectionOutOpen == null)
                            {
                                frmRejectionOutObj.MdiParent = this.MdiParent;
                                frmRejectionOutObj.CallFromVoucherTypeSelection(decRejectionOutVoucherTypeId, strRejectionOutVoucherTypeName);
                            }
                            else
                            {
                                RejectionOutOpen.CallFromVoucherTypeSelection(decRejectionOutVoucherTypeId, strRejectionOutVoucherTypeName);
                            }

                            this.Close();
                            break;

                        case "Rejection In":
                            decimal decRejectionInVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strRejectionInVoucherTypeName = cmbVoucherType.Text.ToString();
                            frmRejectionIn frmRejectionInObj = new frmRejectionIn();
                            frmRejectionIn RejectionInOpen = Application.OpenForms["frmRejectionIn"] as frmRejectionIn;
                            if (RejectionInOpen == null)
                            {
                                frmRejectionInObj.MdiParent = this.MdiParent;
                                frmRejectionInObj.CallFromVoucherTypeSelection(decRejectionInVoucherTypeId, strRejectionInVoucherTypeName);
                            }
                            else
                            {
                                RejectionInOpen.CallFromVoucherTypeSelection(decRejectionInVoucherTypeId, strRejectionInVoucherTypeName);
                            }

                            this.Close();
                            break;

                        case "Sales Quotation":
                            decimal decsalesQuotationTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strSalesQuotationName = cmbVoucherType.Text.ToString();
                            frmSalesQuotation frmsalesQuotationObj = new frmSalesQuotation();
                            frmSalesQuotation frmsalesQuotationOpen = Application.OpenForms["frmSalesQuotation"] as frmSalesQuotation;
                            if (frmsalesQuotationOpen == null)
                            {
                                frmsalesQuotationObj.MdiParent = this.MdiParent;
                                frmsalesQuotationObj.CallFromVoucherTypeSelection(decsalesQuotationTypeId, strSalesQuotationName);
                            }
                            else
                            {
                                frmsalesQuotationOpen.CallFromVoucherTypeSelection(decsalesQuotationTypeId, strSalesQuotationName);

                            }
                            this.Close();
                            break;

                        case "PDC Payable":
                            decimal decPDCpayableVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strPDCpayableVoucheTypeName = cmbVoucherType.Text.ToString();
                            frmPdcPayable frmPDCPayableOBj = new frmPdcPayable();
                            frmPdcPayable frmPDCPayableOpen = Application.OpenForms["frmPdcPayable"] as frmPdcPayable;

                            if (frmPDCPayableOpen == null)
                            {

                                frmPDCPayableOBj.MdiParent = this.MdiParent;
                                frmPDCPayableOBj.CallFromVoucherTypeSelection(decPDCpayableVoucherTypeId, strPDCpayableVoucheTypeName);
                            }
                            else
                            {
                                frmPDCPayableOpen.CallFromVoucherTypeSelection(decPDCpayableVoucherTypeId, strPDCpayableVoucheTypeName);
                            }

                            this.Close();
                            break;

                        case "Sales Invoice":
                            decimal decSalesInvoiceVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strSalesInvoiceVoucheTypeName = cmbVoucherType.Text.ToString();
                            frmSalesInvoice frmSalesInvoiceOBj = new frmSalesInvoice();
                            frmSalesInvoice frmSalesInvoiceOpen = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice;

                            if (frmSalesInvoiceOpen == null)
                            {

                                frmSalesInvoiceOBj.MdiParent = this.MdiParent;
                                frmSalesInvoiceOBj.CallFromVoucherTypeSelection(decSalesInvoiceVoucherTypeId, strSalesInvoiceVoucheTypeName);
                            }
                            else
                            {
                                frmSalesInvoiceOpen.CallFromVoucherTypeSelection(decSalesInvoiceVoucherTypeId, strSalesInvoiceVoucheTypeName);
                            }

                            this.Close();
                            break;

                        case "Purchase Invoice":
                            decimal decPurchaseInvoiceVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strPurchaseInvoiceVoucheTypeName = cmbVoucherType.Text.ToString();
                            frmPurchaseInvoice frmPurchaseInvoiceOBj = new frmPurchaseInvoice();
                            frmPurchaseInvoice frmPurchaseInvoiceOpen = Application.OpenForms["frmPurchaseInvoice"] as frmPurchaseInvoice;

                            if (frmPurchaseInvoiceOpen == null)
                            {

                                frmPurchaseInvoiceOBj.MdiParent = this.MdiParent;
                                frmPurchaseInvoiceOBj.CallFromVoucherTypeSelection(decPurchaseInvoiceVoucherTypeId, strPurchaseInvoiceVoucheTypeName);
                            }
                            else
                            {
                                frmPurchaseInvoiceOpen.CallFromVoucherTypeSelection(decPurchaseInvoiceVoucherTypeId, strPurchaseInvoiceVoucheTypeName);
                            }

                            this.Close();
                            break;

                        case "Delivery Note":
                            decimal decDeliveryVoucherTypeNo = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strDeliveryVoucherTypeNames = cmbVoucherType.Text;

                            frmDeliveryNote DeliveryNote = new frmDeliveryNote();
                            frmDeliveryNote openDeliveryNote = Application.OpenForms["frmDeliveryNote"] as frmDeliveryNote;
                            if (openDeliveryNote == null)
                            {
                                DeliveryNote.MdiParent = this.MdiParent;
                                DeliveryNote.CallFromVoucherTypeSelection(decDeliveryVoucherTypeNo, strDeliveryVoucherTypeNames);
                            }
                            else
                            {
                                openDeliveryNote.CallFromVoucherTypeSelection(decDeliveryVoucherTypeNo, strDeliveryVoucherTypeNames);
                            }

                            this.Close();
                            break;

                        case "Purchase Return":
                            decimal decPurchaseReturnVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strPurchaseReturnVoucherTypeNames = cmbVoucherType.Text.ToString();

                            frmPurchaseReturn frmPurchase = new frmPurchaseReturn();
                            frmPurchaseReturn FrmPurchaseOpens = Application.OpenForms["frmPurchaseReturn"] as frmPurchaseReturn;
                            if (FrmPurchaseOpens == null)
                            {
                                frmPurchase.MdiParent = this.MdiParent;
                                frmPurchase.CallFromVoucherTypeSelection(decPurchaseReturnVoucherTypeId, strPurchaseReturnVoucherTypeNames);
                            }
                            else
                            {
                                FrmPurchaseOpens.CallFromVoucherTypeSelection(decPurchaseReturnVoucherTypeId, strPurchaseReturnVoucherTypeNames);
                            }
                            this.Close();
                            break;

                        case "POS":
                            decimal decPOSVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());

                            string strPOSVoucheTypeName = "POS";
                            frmPOS frmPOSOBj = new frmPOS();
                            frmPOS frmPOSOpen = Application.OpenForms["frmPOS"] as frmPOS;

                            if (frmPOSOpen == null)
                            {

                                frmPOSOBj.MdiParent = this.MdiParent;
                                frmPOSOBj.CallFromVoucherTypeSelection(decPOSVoucherTypeId, strPOSVoucheTypeName);
                            }
                            else
                            {
                                frmPOSOpen.CallFromVoucherTypeSelection(decPOSVoucherTypeId, strPOSVoucheTypeName);
                            }

                            this.Close();

                            break;

                        case "Physical Stock":
                            decimal DecPhysicalStockVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strPhysicalStockVocherTypeNames = cmbVoucherType.Text;
                            frmPhysicalStock frmPhysicalStock = new frmPhysicalStock();
                            frmPhysicalStock frmPhysicalStockOpen = Application.OpenForms["frmPhysicalStock"] as frmPhysicalStock;
                            if (frmPhysicalStockOpen == null)
                            {
                                frmPhysicalStock.MdiParent = this.MdiParent;
                                frmPhysicalStock.CallFromVoucherTypeSelection(DecPhysicalStockVoucherTypeId, strPhysicalStockVocherTypeNames);
                            }
                            else
                            {
                                frmPhysicalStockOpen.CallFromVoucherTypeSelection(DecPhysicalStockVoucherTypeId, strPhysicalStockVocherTypeNames);
                            }
                            this.Close();
                            break;

                        case "PDC Receivable":
                            decimal decPDCReceivableVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strPDCReceivableVoucheTypeName = cmbVoucherType.Text.ToString();
                            frmPdcReceivable frmpdreceivableObj = new frmPdcReceivable();

                            frmPdcReceivable frmPDCReceivableOpen = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable;

                            if (frmPDCReceivableOpen == null)
                            {

                                frmpdreceivableObj.MdiParent = this.MdiParent;
                                frmpdreceivableObj.CallFromVoucherTypeSelection(decPDCReceivableVoucherTypeId, strPDCReceivableVoucheTypeName);
                            }
                            else
                            {
                                frmPDCReceivableOpen.CallFromVoucherTypeSelection(decPDCReceivableVoucherTypeId, strPDCReceivableVoucheTypeName);
                            }

                            this.Close();
                            break;

                        case "Stock Journal":
                            decimal decStockJournalVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strSockJournalVocherTypeName = cmbVoucherType.Text;
                            frmStockJournal frmStockJournalObj = new frmStockJournal();
                            frmStockJournal frmStockJournalOpen = Application.OpenForms["frmStockJournal"] as frmStockJournal;
                            if (frmStockJournalOpen == null)
                            {
                                frmStockJournalObj.MdiParent = this.MdiParent;
                                frmStockJournalObj.CallFromVoucherTypeSelection(decStockJournalVoucherTypeId, strSockJournalVocherTypeName);
                            }
                            else
                            {
                                frmStockJournalOpen.CallFromVoucherTypeSelection(decStockJournalVoucherTypeId, strSockJournalVocherTypeName);
                            }
                            this.Close();
                            break;

                        case "PDC Clearance":
                            decimal decPDCClearanceVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                            string strPDCClearanceVoucheTypeName = cmbVoucherType.Text.ToString();
                            frmPdcClearance frmpdcClearanceObj = new frmPdcClearance();
                            frmPdcClearance frmpdcclearanceOpen = Application.OpenForms["frmPdcClearance"] as frmPdcClearance;

                            if (frmpdcclearanceOpen == null)
                            {

                                frmpdcClearanceObj.MdiParent = this.MdiParent;
                                frmpdcClearanceObj.CallFromVoucherTypeSelection(decPDCClearanceVoucherTypeId, strPDCClearanceVoucheTypeName);
                            }
                            else
                            {
                                frmpdcclearanceOpen.CallFromVoucherTypeSelection(decPDCClearanceVoucherTypeId, strPDCClearanceVoucheTypeName);
                            }

                            this.Close();
                            break;
                    }
                }
                else
                {
                    Messages.InformationMessage("Select voucher type");
                    cmbVoucherType.Focus();
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("VTS2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Calls frmMonthlySalaryVoucher form when cell double click for updation
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvMonthlySalaryRegister_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    if (dgvMonthlySalaryRegister.CurrentRow.Index == e.RowIndex)
                    {
                        frmMonthlySalaryVoucher objfrmMonthlySalaryVoucher = new frmMonthlySalaryVoucher(); ;
                        objfrmMonthlySalaryVoucher.MdiParent = formMDI.MDIObj;
                        frmMonthlySalaryVoucher open = Application.OpenForms["frmMonthlySalaryVoucher"] as frmMonthlySalaryVoucher;

                        if (open == null)
                        {
                            objfrmMonthlySalaryVoucher.WindowState = FormWindowState.Normal;
                            objfrmMonthlySalaryVoucher.MdiParent = formMDI.MDIObj;
                            objfrmMonthlySalaryVoucher.CallFromMonthlySalaryRegister(Convert.ToDecimal(dgvMonthlySalaryRegister.Rows[e.RowIndex].Cells["dgvtxtSalaryVoucherMasterID"].Value.ToString()), this);
                        }
                        else
                        {
                            open.CallFromMonthlySalaryRegister(Convert.ToDecimal(dgvMonthlySalaryRegister.Rows[e.RowIndex].Cells["dgvtxtSalaryVoucherMasterID"].Value.ToString()), this);
                            if (open.WindowState == FormWindowState.Minimized)
                            {
                                open.WindowState = FormWindowState.Normal;
                            }
                        }
                        inCurrenRowIndex = dgvMonthlySalaryRegister.CurrentRow.Index;
                    }
                    this.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("MSR12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Function to call corresponding form from ledger
        /// </summary>
        /// <param name="strTypeofVoucher"></param>
        /// <param name="decMasterId"></param>
        public void CallToCorrespondingForm(string strTypeofVoucher, decimal decMasterId)
        {
            try
            {
                switch (strTypeofVoucher)
                {
                    case "Contra Voucher":
                        frmContraVoucher frmContraVoucherObj = new frmContraVoucher();
                        frmContraVoucher frmContraVoucherOpen = Application.OpenForms["frmContraVoucher"] as frmContraVoucher;
                        if (frmContraVoucherOpen == null)
                        {
                            frmContraVoucherObj.MdiParent = this.MdiParent;
                            frmContraVoucherObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmContraVoucherOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmContraVoucherOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmContraVoucherOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;
                    case "Payment Voucher":
                        frmPaymentVoucher frmPaymentVoucherObj = new frmPaymentVoucher();
                        frmPaymentVoucher frmPaymentVoucherOpen = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher;
                        if (frmPaymentVoucherOpen == null)
                        {

                            frmPaymentVoucherObj.MdiParent = this.MdiParent;
                            frmPaymentVoucherObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmPaymentVoucherOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmPaymentVoucherOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmPaymentVoucherOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;
                    case "Receipt Voucher":
                        frmReceiptVoucher frmReceiptVoucherObj = new frmReceiptVoucher();
                        frmReceiptVoucher frmReceiptVoucherOpen = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher;
                        if (frmReceiptVoucherOpen == null)
                        {
                            frmReceiptVoucherObj.MdiParent = this.MdiParent;
                            frmReceiptVoucherObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmReceiptVoucherOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmReceiptVoucherOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmReceiptVoucherOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;
                    case "Journal Voucher":
                        frmJournalVoucher frmJournalVoucherObj = new frmJournalVoucher();
                        frmJournalVoucher frmJournalVoucherOpen = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                        if (frmJournalVoucherOpen == null)
                        {
                            frmJournalVoucherObj.MdiParent = this.MdiParent;
                            frmJournalVoucherObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmJournalVoucherOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmJournalVoucherOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmJournalVoucherOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;
                    case "PDC Clearance":
                        frmPdcClearance frmPdcClearanceObj = new frmPdcClearance();
                        frmPdcClearance frmPdcClearanceOpen = Application.OpenForms["frmPdcClearance"] as frmPdcClearance;
                        if (frmPdcClearanceOpen == null)
                        {

                            frmPdcClearanceObj.MdiParent = this.MdiParent;
                            frmPdcClearanceObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmPdcClearanceOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmPdcClearanceOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmPdcClearanceOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;
                    case "PDC Payable":
                        frmPdcPayable frmPDCPayableObj = new frmPdcPayable();
                        frmPdcPayable frmPDCPayableOpen = Application.OpenForms["frmPdcPayable"] as frmPdcPayable;
                        if (frmPDCPayableOpen == null)
                        {

                            frmPDCPayableObj.MdiParent = this.MdiParent;
                            frmPDCPayableObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmPDCPayableOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmPDCPayableOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmPDCPayableOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;

                    case "PDC Receivable":
                        frmPdcReceivable frmPdcReceivableObj = new frmPdcReceivable();
                        frmPdcReceivable frmPdcReceivableOpen = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable;
                        if (frmPdcReceivableOpen == null)
                        {
                            frmPdcReceivableObj.MdiParent = this.MdiParent;
                            frmPdcReceivableObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmPdcReceivableOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmPdcReceivableOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmPdcReceivableOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;
                    case "Purchase Invoice":
                        frmPurchaseInvoice frmPurchaseInvoiceObj = new frmPurchaseInvoice();
                        frmPurchaseInvoice frmPurchaseInvoiveOpen = Application.OpenForms["frmPurchaseInvoice"] as frmPurchaseInvoice;
                        if (frmPurchaseInvoiveOpen == null)
                        {
                            frmPurchaseInvoiceObj.MdiParent = this.MdiParent;
                            frmPurchaseInvoiceObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmPurchaseInvoiveOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmPurchaseInvoiveOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmPurchaseInvoiveOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;
                    case "Purchase Return":
                        frmPurchaseReturn frmPurchaseReturnObj = new frmPurchaseReturn();
                        frmPurchaseReturn frmPurchaseReturnOpen = Application.OpenForms["frmPurchaseReturn"] as frmPurchaseReturn;
                        if (frmPurchaseReturnOpen == null)
                        {
                            frmPurchaseReturnObj.MdiParent = this.MdiParent;
                            frmPurchaseReturnObj.CallFromLedgerDetails(this, decMasterId, true);
                        }
                        else
                        {
                            frmPurchaseReturnOpen.CallFromLedgerDetails(this, decMasterId, true);
                            if (frmPurchaseReturnOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmPurchaseReturnOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;

                    case "Sales Invoice":
                        if (dgvLedgerDetails.CurrentRow.Cells["dgvtxtpos"].Value.ToString() == "False")
                        {

                            frmSalesInvoice frmSalesInvoiceObj = new frmSalesInvoice();
                            frmSalesInvoice frmSalesInvoiveOpen = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice;
                            if (frmSalesInvoiveOpen == null)
                            {
                                frmSalesInvoiceObj.MdiParent = this.MdiParent;
                                frmSalesInvoiceObj.CallFromLedgerDetails(this, decMasterId);
                            }
                            else
                            {
                                frmSalesInvoiveOpen.CallFromLedgerDetails(this, decMasterId);
                                if (frmSalesInvoiveOpen.WindowState == FormWindowState.Minimized)
                                {
                                    frmSalesInvoiveOpen.WindowState = FormWindowState.Normal;
                                }
                            }
                        }
                        else
                        {
                            frmPOS frmposObj = new frmPOS();
                            frmPOS frmposOpen = Application.OpenForms["frmPOS"] as frmPOS;
                            if (frmposOpen == null)
                            {
                                frmposObj.MdiParent = this.MdiParent;
                                frmposObj.CallFromLedgerDetails(this, decMasterId);
                            }
                            else
                            {
                                frmposOpen.CallFromLedgerDetails(this, decMasterId);
                                if (frmposOpen.WindowState == FormWindowState.Minimized)
                                {
                                    frmposOpen.WindowState = FormWindowState.Normal;
                                }
                            }
                        }
                        break;

                    case "Sales Return":
                        frmSalesReturn frmSalesReturnObj = new frmSalesReturn();
                        frmSalesReturn frmSalesReturnOpen = Application.OpenForms["frmSalesReturn"] as frmSalesReturn;
                        if (frmSalesReturnOpen == null)
                        {
                            frmSalesReturnObj.MdiParent = this.MdiParent;
                            frmSalesReturnObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmSalesReturnOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmSalesReturnOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmSalesReturnOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;

                    case "Service Voucher":
                        frmServiceVoucher frmServiceVoucherObj = new frmServiceVoucher();
                        frmServiceVoucher frmServiceVoucherOpen = Application.OpenForms["frmServiceVoucher"] as frmServiceVoucher;
                        if (frmServiceVoucherOpen == null)
                        {
                            frmServiceVoucherObj.MdiParent = this.MdiParent;
                            frmServiceVoucherObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmServiceVoucherOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmServiceVoucherOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmServiceVoucherOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;
                    case "Credit Note":
                        frmCreditNote frmCreditNoteobj = new frmCreditNote();
                        frmCreditNote frmCreditNoteOpen = Application.OpenForms["frmCreditNote"] as frmCreditNote;
                        if (frmCreditNoteOpen == null)
                        {
                            frmCreditNoteobj.MdiParent = this.MdiParent;
                            frmCreditNoteobj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmCreditNoteOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmCreditNoteOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmCreditNoteOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;
                    case "Debit Note":
                        frmDebitNote frmDebitNoteObj = new frmDebitNote();
                        frmDebitNote frmDebitNoteOpen = Application.OpenForms["frmDebitNote"] as frmDebitNote;
                        if (frmDebitNoteOpen == null)
                        {
                            frmDebitNoteObj.MdiParent = this.MdiParent;
                            frmDebitNoteObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmDebitNoteOpen.CallFromLedgerDetails(this, decMasterId);
                            if (frmDebitNoteOpen.WindowState == FormWindowState.Minimized)
                            {
                                frmDebitNoteOpen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;
                    case "Advance Payment":
                        frmAdvancePayment frmAdvancePaymentObj = new frmAdvancePayment();
                        frmAdvancePayment frmAdvancePaymentopen = Application.OpenForms["frmAdvancePayment"] as frmAdvancePayment;
                        if (frmAdvancePaymentopen == null)
                        {
                            frmAdvancePaymentObj.MdiParent = this.MdiParent;
                            frmAdvancePaymentObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmAdvancePaymentopen.CallFromLedgerDetails(this, decMasterId);
                            if (frmAdvancePaymentopen.WindowState == FormWindowState.Minimized)
                            {
                                frmAdvancePaymentopen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;
                    case "Monthly Salary Voucher":
                        frmMonthlySalaryVoucher frmMonthlySalaryVoucherObj = new frmMonthlySalaryVoucher();
                        frmMonthlySalaryVoucher frmMonthlySalaryVoucheropen = Application.OpenForms["frmMonthlySalaryVoucher"] as frmMonthlySalaryVoucher;
                        if (frmMonthlySalaryVoucheropen == null)
                        {
                            frmMonthlySalaryVoucherObj.MdiParent = this.MdiParent;
                            frmMonthlySalaryVoucherObj.CallFromLedgerDetails(this, decMasterId);
                        }
                        else
                        {
                            frmMonthlySalaryVoucheropen.CallFromLedgerDetails(this, decMasterId);
                            if (frmMonthlySalaryVoucheropen.WindowState == FormWindowState.Minimized)
                            {
                                frmMonthlySalaryVoucheropen.WindowState = FormWindowState.Normal;
                            }
                        }
                        break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("LEDDET5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Call Corresponding Voucher to View details for updation in edit mode
 /// </summary>
 public void GotoMonthlySalaryVoucher()
 {
     try
     {
       
         frmMonthlySalaryVoucher objForm = new frmMonthlySalaryVoucher();
         frmMonthlySalaryVoucher open = Application.OpenForms["frmMonthlySalaryVoucher"] as frmMonthlySalaryVoucher;
         if (open == null)
         {
             objForm.WindowState = FormWindowState.Normal;
             objForm.MdiParent = formMDI.MDIObj;
             objForm.Show();
             objForm.CallFromVoucherSerach(this, Convert.ToDecimal(dgvVoucherSearch.CurrentRow.Cells["Id"].Value.ToString()));
         }
         else
         {
             open.MdiParent = formMDI.MDIObj;
             if (open.WindowState == FormWindowState.Minimized)
             {
                 open.WindowState = FormWindowState.Normal;
             }
             else
             {
                 open.Activate();
             }
             open.CallFromVoucherSerach(this, Convert.ToDecimal(dgvVoucherSearch.CurrentRow.Cells["Id"].Value.ToString()));
             open.BringToFront();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("VS28:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Calls the corresponding voucher on click in Quick Launch menu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn1_Click(object sender, EventArgs e)
        {
            this.SendToBack();
            Form frmObj = null;
            Form open = null;
            SettingsBll BllSettings = new SettingsBll();
            try
            {
                string str = ((Button)sender).Text;
                btnFocus.Focus();
                switch (str)
                {
                    case "Contra Voucher":
                        formMDI.MDIObj.ContraVoucherClick();
                        break;
                    case "Payment Voucher":
                        formMDI.MDIObj.PaymentVoucherClick();
                        break;
                    case "Receipt Voucher":
                        formMDI.MDIObj.ReceiptVoucherClick();
                        break;
                    case "Journal Voucher":
                        formMDI.MDIObj.JournalVoucherClick();
                        break;
                    case "Sales Invoice":
                        formMDI.MDIObj.SalesInvoiceClick();
                        break;
                    case "Purchase Invoice":
                        formMDI.MDIObj.PurchaseInvoiceClick();
                        break;
                    case "POS":
                        formMDI.MDIObj.POSClick();
                        break;
                    case "PDC Payable":
                        formMDI.MDIObj.PDCPayableClick();
                        break;
                    case "PDC Receivable":
                        formMDI.MDIObj.PDCReceivableClick();
                        break;
                    case "PDC Clearance":
                        formMDI.MDIObj.PDCClearenceClick();
                        break;
                    case "Bank Reconciliation":
                        frmObj = new frmBankReconciliation();
                        open = Application.OpenForms["frmBankReconciliation"] as frmBankReconciliation;
                        break;
                    case "Purchase Order":
                        formMDI.MDIObj.PurchaseOrderClick();
                        break;
                    case "Material Reciept":
                        formMDI.MDIObj.MaterialReceiptClick();
                        break;
                    case "Rejection Out":
                        formMDI.MDIObj.RejectionOutClick();
                        break;
                    case "Purchase Return":
                        formMDI.MDIObj.PurchaseReturnClick();
                        break;
                    case "Sales Quotation":
                        formMDI.MDIObj.SalesQuotationClick();
                        break;
                    case "Sales Order":
                        formMDI.MDIObj.SalesOrderClick();
                        break;
                    case "Delivery Note":
                        formMDI.MDIObj.DeliveryNoteClick();
                        break;
                    case "Rejection In":
                        formMDI.MDIObj.RejectionInClick();
                        break;
                    case "Sales Return":
                        formMDI.MDIObj.SalesReturnClick();
                        break;
                    case "Physical Stock":
                        formMDI.MDIObj.PhysicalStockClick();
                        break;
                    case "Service Voucher":
                        formMDI.MDIObj.ServiceVoucherClick();
                        break;
                    case "Credit Note":
                        formMDI.MDIObj.CreditNoteClick();
                        break;
                    case "Debit Note":
                        formMDI.MDIObj.DebitNoteClick();
                        break;
                    case "Stock Journal":
                        //frmObj = new frmStockJournal();
                        //open = Application.OpenForms["frmStockJournal"] as frmStockJournal;
                        formMDI.MDIObj.StockJournalClick();
                        break;
                    case "Bill Allocation":
                        frmObj = new frmBillallocation();
                        open = Application.OpenForms["frmBillallocation"] as frmBillallocation;
                        break;
                    case "Account Group":
                        frmObj = new frmAccountGroup();
                        open = Application.OpenForms["frmAccountGroup"] as frmAccountGroup;
                        break;
                    case "Account Ledger":
                        frmObj = new frmAccountLedger();
                        open = Application.OpenForms["frmAccountLedger"] as frmAccountLedger;
                        break;
                    case "Multiple Account Ledgers":
                        frmObj = new frmmultipleAccountLedger();
                        open = Application.OpenForms["frmmultipleAccountLedger"] as frmmultipleAccountLedger;
                        break;
                    case "Product Group":
                        frmObj = new frmProductGroup();
                        open = Application.OpenForms["frmProductGroup"] as frmProductGroup;
                        break;
                    case "Product Creation":
                        frmObj = new frmProductCreation();
                        open = Application.OpenForms["frmProductCreation"] as frmProductCreation;
                        break;
                    case "Multiple Product Creation":
                        frmObj = new frmMultipleProductCreation();
                        open = Application.OpenForms["frmMultipleProductCreation"] as frmMultipleProductCreation;
                        break;
                    case "Batch":
                        if (BllSettings.SettingsStatusCheck("AllowBatch") == "Yes")
                        {
                            frmObj = new frmBatch();
                            open = Application.OpenForms["frmBatch"] as frmBatch;
                        }
                        break;
                    case "Brand":
                        frmObj = new frmBrand();
                        open = Application.OpenForms["frmBrand"] as frmBrand;
                        break;
                    case "Model Number":
                        if (BllSettings.SettingsStatusCheck("AllowModelNo") == "Yes")
                        {
                            frmObj = new frmModalNo();
                            open = Application.OpenForms["frmModalNo"] as frmModalNo;
                        }
                        break;
                    case "Size":
                        if (BllSettings.SettingsStatusCheck("AllowSize") == "Yes")
                        {
                            frmObj = new frmSize();
                            open = Application.OpenForms["frmSize"] as frmSize;
                        }
                        break;
                    case "Unit":
                        frmObj = new frmUnit();
                        open = Application.OpenForms["frmUnit"] as frmUnit;
                        break;
                    case "Godown":
                        if (BllSettings.SettingsStatusCheck("AllowGodown") == "Yes")
                        {
                            frmObj = new frmGodown();
                            open = Application.OpenForms["frmGodown"] as frmGodown;
                        }
                        break;
                    case "Rack":
                        if (BllSettings.SettingsStatusCheck("AllowRack") == "Yes")
                        {
                            frmObj = new frmRack();
                            open = Application.OpenForms["frmRack"] as frmRack;
                        }
                        break;
                    case "Pricing Level":
                        frmObj = new frmPricingLevel();
                        open = Application.OpenForms["frmPricingLevel"] as frmPricingLevel;
                        break;
                    case "Price List":
                        frmObj = new frmPriceList();
                        open = Application.OpenForms["frmPriceList"] as frmPriceList;
                        break;
                    case "Standard Rate":
                        frmObj = new frmStandardRate();
                        open = Application.OpenForms["frmStandardRate"] as frmStandardRate;
                        break;
                    case "Tax":
                        if (BllSettings.SettingsStatusCheck("Tax") == "Yes")
                        {
                            frmObj = new frmTax();
                            open = Application.OpenForms["frmTax"] as frmTax;
                        }
                        break;
                    case "Currency":
                        if (BllSettings.SettingsStatusCheck("MultiCurrency") == "Yes")
                        {
                            frmObj = new frmCurrency();
                            open = Application.OpenForms["frmCurrency"] as frmCurrency;
                        }
                        break;
                    case "Exchange Rate":
                        frmObj = new frmExchangeRate();
                        open = Application.OpenForms["frmExchangeRate"] as frmExchangeRate;
                        break;
                    case "Service Category":
                        frmObj = new frmServiceCategory();
                        open = Application.OpenForms["frmServiceCategory"] as frmServiceCategory;
                        break;
                    case "Services":
                        frmObj = new frmServices();
                        open = Application.OpenForms["frmServices"] as frmServices;
                        break;
                    case "Voucher Type":
                        frmObj = new frmVoucherType();
                        open = Application.OpenForms["frmVoucherType"] as frmVoucherType;
                        break;
                    case "Area":
                        frmObj = new frmArea();
                        open = Application.OpenForms["frmArea"] as frmArea;
                        break;
                    case "Route":
                        frmObj = new frmRoute();
                        open = Application.OpenForms["frmRoute"] as frmRoute;
                        break;
                    case "Counter":
                        frmObj = new frmCounter();
                        open = Application.OpenForms["frmCounter"] as frmCounter;
                        break;
                    case "Product Register":
                        frmObj = new frmProductRegister();
                        open = Application.OpenForms["frmProductRegister"] as frmProductRegister;
                        break;
                    case "Salesman":
                        frmObj = new frmSalesman();
                        open = Application.OpenForms["frmSalesman"] as frmSalesman;
                        break;
                    case "Contra Register":
                        frmObj = new frmContraRegister();
                        open = Application.OpenForms["frmContraRegister"] as frmContraRegister;
                        break;
                    case "Payment Register":
                        frmObj = new frmPaymentRegister();
                        open = Application.OpenForms["frmPaymentRegister"] as frmPaymentRegister;
                        break;
                    case "Receipt Register":
                        frmObj = new frmReceiptRegister();
                        open = Application.OpenForms["frmReceiptRegister"] as frmReceiptRegister;
                        break;
                    case "Journal Register":
                        frmObj = new frmJournalRegister();
                        open = Application.OpenForms["frmJournalRegister"] as frmJournalRegister;
                        break;
                    case "PDC Payable Register":
                        frmObj = new frmPDCPayableRegister();
                        open = Application.OpenForms["frmPDCPayableRegister"] as frmPDCPayableRegister;
                        break;
                    case "PDC Receivable Register":
                        frmObj = new frmPDCReceivableRegister();
                        open = Application.OpenForms["frmPDCReceivableRegister"] as frmPDCReceivableRegister;
                        break;
                    case "PDC Clearance Register":
                        frmObj = new frmPdcClearanceRegister();
                        open = Application.OpenForms["frmPdcClearanceRegister"] as frmPdcClearanceRegister;
                        break;
                    case "Purchase Order Register":
                        frmObj = new frmPurchaseOrderRegister();
                        open = Application.OpenForms["frmPurchaseOrderRegister"] as frmPurchaseOrderRegister;
                        break;
                    case "Material Receipt Register":
                        frmObj = new frmMaterialReceiptRegister();
                        open = Application.OpenForms["frmMaterialReceiptRegister"] as frmMaterialReceiptRegister;
                        break;
                    case "Rejection Out Register":
                        frmObj = new frmRejectionOutRegister();
                        open = Application.OpenForms["frmRejectionOutRegister"] as frmRejectionOutRegister;
                        break;
                    case "Purchase Invoice Register":
                        frmObj = new frmPurchaseInvoiceRegister();
                        open = Application.OpenForms["frmPurchaseInvoiceRegister"] as frmPurchaseInvoiceRegister;
                        break;
                    case "Purchase Return Register":
                        frmObj = new frmPurchaseReturnRegister();
                        open = Application.OpenForms["frmPurchaseReturnRegister"] as frmPurchaseReturnRegister;
                        break;
                    case "Sales Quotation Register":
                        frmObj = new frmSalesQuotationRegister();
                        open = Application.OpenForms["frmSalesQuotationRegister"] as frmSalesQuotationRegister;
                        break;
                    case "Sales Order Register":
                        frmObj = new frmSalesOrderRegister();
                        open = Application.OpenForms["frmSalesOrderRegister"] as frmSalesOrderRegister;
                        break;
                    case "Delivery Note Register":
                        frmObj = new frmDeliveryNoteRegister();
                        open = Application.OpenForms["frmDeliveryNoteRegister"] as frmDeliveryNoteRegister;
                        break;
                    case "Rejection In Register":
                        frmObj = new frmRejectionInRegister();
                        open = Application.OpenForms["frmRejectionInRegister"] as frmRejectionInRegister;
                        break;
                    case "Sales Invoice Register":
                        frmObj = new frmSalesInvoiceRegister();
                        open = Application.OpenForms["frmSalesInvoiceRegister"] as frmSalesInvoiceRegister;
                        break;
                    case "Sales Return Register":
                        frmObj = new frmSalesReturnRegister();
                        open = Application.OpenForms["frmSalesReturnRegister"] as frmSalesReturnRegister;
                        break;
                    case "Physical Stock Register":
                        frmObj = new frmPhysicalStockRegister();
                        open = Application.OpenForms["frmPhysicalStockRegister"] as frmPhysicalStockRegister;
                        break;
                    case "Service Voucher Register":
                        frmObj = new frmServiceVoucherRegister();
                        open = Application.OpenForms["frmServiceVoucherRegister"] as frmServiceVoucherRegister;
                        break;
                    case "Credit Note Register":
                        frmObj = new frmCreditNoteRegister();
                        open = Application.OpenForms["frmCreditNoteRegister"] as frmCreditNoteRegister;
                        break;
                    case "Debit Note Register":
                        frmObj = new frmDebitNoteRegister();
                        open = Application.OpenForms["frmDebitNoteRegister"] as frmDebitNoteRegister;
                        break;
                    case "Stock Journal Register":
                        frmObj = new frmStockJournalRegister();
                        open = Application.OpenForms["frmStockJournalRegister"] as frmStockJournalRegister;
                        break;
                    case "Designation":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmDesignation();
                            open = Application.OpenForms["frmDesignation"] as frmDesignation;
                        }
                        break;
                    case "Pay Head":
                        {
                            frmObj = new frmPayHead();
                            open = Application.OpenForms["frmPayHead"] as frmPayHead;
                        }
                        break;
                    case "Salary Package Creation":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmSalaryPackageCreation();
                            open = Application.OpenForms["frmSalaryPackageCreation"] as frmSalaryPackageCreation;
                        }
                        break;
                    case "Salary Package Register":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmSalaryPackageRegister();
                            open = Application.OpenForms["frmSalaryPackageRegister"] as frmSalaryPackageRegister;
                        }
                        break;
                    case "Employee Creation":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmEmployeeCreation();
                            open = Application.OpenForms["frmEmployeeCreation"] as frmEmployeeCreation;
                        }
                        break;
                    case "Employee Register":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmEmployeeRegister();
                            open = Application.OpenForms["frmEmployeeRegister"] as frmEmployeeRegister;
                        }
                        break;
                    case "Holiday Settings":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmHolydaySettings();
                            open = Application.OpenForms["frmHolydaySettings"] as frmHolydaySettings;
                        }
                        break;
                    case "Monthly Salary Settings":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmMonthlySalarySettings();
                            open = Application.OpenForms["frmMonthlySalarySettings"] as frmMonthlySalarySettings;
                        }
                        break;
                    case "Attendance":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmAttendance();
                            open = Application.OpenForms["frmAttendance"] as frmAttendance;
                        }
                        break;
                    case "Advance Payment":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmAdvancePayment();
                            open = Application.OpenForms["frmAdvancePayment"] as frmAdvancePayment;
                        }
                        break;
                    case "Advance Register":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmAdvanceRegister();
                            open = Application.OpenForms["frmAdvanceRegister"] as frmAdvanceRegister;
                        }
                        break;
                    case "Bonus Deduction":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmBonusDeduction();
                            open = Application.OpenForms["frmBonusDeduction"] as frmBonusDeduction;
                        }
                        break;
                    case "Bonus Deduction Register":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmBonusDeductionRegister();
                            open = Application.OpenForms["frmBonusDeductionRegister"] as frmBonusDeductionRegister;
                        }
                        break;
                    case "Monthly Salary Voucher":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmMonthlySalaryVoucher();
                            open = Application.OpenForms["frmMonthlySalaryVoucher"] as frmMonthlySalaryVoucher;
                        }
                        break;
                    case "Monthly Salary Register":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmMonthlySalaryRegister();
                            open = Application.OpenForms["frmMonthlySalaryRegister"] as frmMonthlySalaryRegister;
                        }
                        break;
                    case "Daily Salary Voucher":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmDailySalaryVoucher();
                            open = Application.OpenForms["frmDailySalaryVoucher"] as frmDailySalaryVoucher;
                        }
                        break;
                    case "Daily Salary Register":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmDailySalaryRegister();
                            open = Application.OpenForms["frmDailySalaryRegister"] as frmDailySalaryRegister;
                        }
                        break;
                    case "Pay Slip":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmPaySlip();
                            open = Application.OpenForms["frmPaySlip"] as frmPaySlip;
                        }
                        break;
                    case "Budget":
                        if (BllSettings.SettingsStatusCheck("Budget") == "Yes")
                        {
                            frmObj = new frmBudget();
                            open = Application.OpenForms["frmBudget"] as frmBudget;
                        }
                        break;
                    case "Budget Variance":
                        if (BllSettings.SettingsStatusCheck("Budget") == "Yes")
                        {
                            frmObj = new frmBudgetVariance();
                            open = Application.OpenForms["frmBudgetVariance"] as frmBudgetVariance;
                        }
                        break;
                    case "Change Current Date":
                        frmObj = new frmChangeCurrentDate();
                        open = Application.OpenForms["frmChangeCurrentDate"] as frmChangeCurrentDate;
                        break;
                    case "Settings":
                        frmObj = new frmSettings();
                        open = Application.OpenForms["frmSettings"] as frmSettings;
                        break;
                    case "Role":
                        frmObj = new frmRole();
                        open = Application.OpenForms["frmRole"] as frmRole;
                        break;
                    case "Role Privilege Settings":
                        frmObj = new frmRolePrivilegeSettings();
                        open = Application.OpenForms["frmRolePrivilegeSettings"] as frmRolePrivilegeSettings;
                        break;
                    case "User Creation":
                        frmObj = new frmUserCreation();
                        open = Application.OpenForms["frmUserCreation"] as frmUserCreation;
                        break;
                    case "Change Password":
                        frmObj = new frmChangePassword();
                        open = Application.OpenForms["frmChangePassword"] as frmChangePassword;
                        break;
                    case "New Financial Year":
                        frmObj = new frmNewFinancialYear();
                        open = Application.OpenForms["frmNewFinancialYear"] as frmNewFinancialYear;
                        break;
                    case "Change Financial Year":
                        frmObj = new frmChangeFinancialYear();
                        open = Application.OpenForms["frmChangeFinancialYear"] as frmChangeFinancialYear;
                        break;
                    case "Barcode Settings":
                        frmObj = new frmBarcodeSettings();
                        open = Application.OpenForms["frmBarcodeSettings"] as frmBarcodeSettings;
                        break;
                    case "Barcode Printing":
                        frmObj = new frmBarcodePrinting();
                        open = Application.OpenForms["frmBarcodePrinting"] as frmBarcodePrinting;
                        break;
                    case "Suffix Prefix Settings":
                        frmObj = new frmSuffixPrefixSettings();
                        open = Application.OpenForms["frmSuffixPrefixSettings"] as frmSuffixPrefixSettings;
                        break;
                    case "Change Product Tax":
                        frmObj = new frmChangeProductTax();
                        open = Application.OpenForms["frmChangeProductTax"] as frmChangeProductTax;
                        break;
                    case "Product Search":
                        frmObj = new frmProductSearch();
                        open = Application.OpenForms["frmProductSearch"] as frmProductSearch;
                        break;
                    case "Voucher Search":
                        frmObj = new frmVoucherSearch();
                        open = Application.OpenForms["frmVoucherSearch"] as frmVoucherSearch;
                        break;
                    case "Voucher Wise Product Search":
                        frmObj = new frmVoucherWiseProductSearch();
                        open = Application.OpenForms["frmVoucherWiseProductSearch"] as frmVoucherWiseProductSearch;
                        break;
                    case "Personal Reminder":
                        frmObj = new frmPersonalReminder();
                        open = Application.OpenForms["frmPersonalReminder"] as frmPersonalReminder;
                        break;
                    case "Overdue Purchase Order":
                        frmObj = new frmOverduePurchaseOrder();
                        open = Application.OpenForms["frmOverduePurchaseOrder"] as frmOverduePurchaseOrder;
                        break;
                    case "Overdue Sales Order":
                        frmObj = new frmOverdueSalesOrder();
                        open = Application.OpenForms["frmOverdueSalesOrder"] as frmOverdueSalesOrder;
                        break;
                    case "Short Expiry":
                        frmObj = new frmShortExpiry();
                        open = Application.OpenForms["frmShortExpiry"] as frmShortExpiry;
                        break;
                    case "Stock":
                        frmObj = new frmStock();
                        open = Application.OpenForms["frmStock"] as frmStock;
                        break;
                    case "Trial Balance":
                        frmObj = new frmTrialBalance();
                        open = Application.OpenForms["frmTrialBalance"] as frmTrialBalance;
                        break;
                    case "Balance Sheet":
                        frmObj = new frmBalanceSheet();
                        open = Application.OpenForms["frmBalanceSheet"] as frmBalanceSheet;
                        break;
                    case "Profit and Loss":
                        frmObj = new frmProfitAndLoss();
                        open = Application.OpenForms["frmProfitAndLoss"] as frmProfitAndLoss;
                        break;
                    case "Cash Flow":
                        frmObj = new frmCashFlow();
                        open = Application.OpenForms["frmCashFlow"] as frmCashFlow;
                        break;
                    case "Fund Flow":
                        frmObj = new frmFundFlow();
                        open = Application.OpenForms["frmFundFlow"] as frmFundFlow;
                        break;
                    case "Chart of Account":
                        frmObj = new frmChartOfAccount();
                        open = Application.OpenForms["frmChartOfAccount"] as frmChartOfAccount;
                        break;
                    case "Contra Report":
                        frmObj = new frmContraReport();
                        open = Application.OpenForms["frmContraReport"] as frmContraReport;
                        break;
                    case "Payment Report":
                        frmObj = new frmPaymentReport();
                        open = Application.OpenForms["frmPaymentReport"] as frmPaymentReport;
                        break;
                    case "Receipt Report":
                        frmObj = new frmReceiptReport();
                        open = Application.OpenForms["frmReceiptReport"] as frmReceiptReport;
                        break;
                    case "Journal Report":
                        frmObj = new frmJournalReport();
                        open = Application.OpenForms["frmJournalReport"] as frmJournalReport;
                        break;
                    case "PDC Payable Report":
                        frmObj = new frmPDCPayableReport();
                        open = Application.OpenForms["frmPDCPayableReport"] as frmPDCPayableReport;
                        break;
                    case "PDC Receivable Report":
                        frmObj = new frmPDCRecievableReport();
                        open = Application.OpenForms["frmPDCRecievableReport"] as frmPDCRecievableReport;
                        break;
                    case "PDC Clearance Report":
                        frmObj = new frmPDCClearanceReport();
                        open = Application.OpenForms["frmPDCClearanceReport"] as frmPDCClearanceReport;
                        break;
                    case "Purchase Order Report":
                        frmObj = new frmPurchaseOrderReport();
                        open = Application.OpenForms["frmPurchaseOrderReport"] as frmPurchaseOrderReport;
                        break;
                    case "Material Receipt Report":
                        frmObj = new frmMaterialReceiptReport();
                        open = Application.OpenForms["frmMaterialReceiptReport"] as frmMaterialReceiptReport;
                        break;
                    case "Rejection Out Report":
                        frmObj = new frmRejectionOutReport();
                        open = Application.OpenForms["frmRejectionOutReport"] as frmRejectionOutReport;
                        break;
                    case "Purchase Invoice Report":
                        frmObj = new frmPurchaseReport();
                        open = Application.OpenForms["frmPurchaseReport"] as frmPurchaseReport;
                        break;
                    case "Purchase Return Report":
                        frmObj = new frmPurchaseReturnReport();
                        open = Application.OpenForms["frmPurchaseReturnReport"] as frmPurchaseReturnReport;
                        break;
                    case "Sales Quotation Report":
                        frmObj = new frmSalesQuotationReport();
                        open = Application.OpenForms["frmSalesQuotationReport"] as frmSalesQuotationReport;
                        break;
                    case "Sales Order Report":
                        frmObj = new frmSalesOrderReport();
                        open = Application.OpenForms["frmSalesOrderReport"] as frmSalesOrderReport;
                        break;
                    case "Delivery Note Report":
                        frmObj = new frmDeliveryNoteReport();
                        open = Application.OpenForms["frmDeliveryNoteReport"] as frmDeliveryNoteReport;
                        break;
                    case "Rejection In Report":
                        frmObj = new frmRejectionInReport();
                        open = Application.OpenForms["frmRejectionInReport"] as frmRejectionInReport;
                        break;
                    case "Sales Invoice Report":
                        frmObj = new frmSalesReport();
                        open = Application.OpenForms["frmSalesReport"] as frmSalesReport;
                        break;
                    case "Sales Return Report":
                        frmObj = new frmSalesReturnReport();
                        open = Application.OpenForms["frmSalesReturnReport"] as frmSalesReturnReport;
                        break;
                    case "Physical Stock Report":
                        frmObj = new frmPhysicalStockReport();
                        open = Application.OpenForms["frmPhysicalStockReport"] as frmPhysicalStockReport;
                        break;
                    case "Service Report":
                        frmObj = new frmServiceReport();
                        open = Application.OpenForms["frmServiceReport"] as frmServiceReport;
                        break;
                    case "Credit Note Report":
                        frmObj = new frmCreditNoteReport();
                        open = Application.OpenForms["frmCreditNoteReport"] as frmCreditNoteReport;
                        break;
                    case "Debit Note Report":
                        frmObj = new frmDebitNoteReport();
                        open = Application.OpenForms["frmDebitNoteReport"] as frmDebitNoteReport;
                        break;
                    case "Stock Journal Report":
                        frmObj = new frmStockJournelReport();
                        open = Application.OpenForms["frmStockJournelReport"] as frmStockJournelReport;
                        break;
                    case "Employee Report":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmEmployeeReport();
                            open = Application.OpenForms["frmEmployeeReport"] as frmEmployeeReport;
                        }
                        break;
                    case "Daily Attendance Report":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmDailyAttendanceReport();
                            open = Application.OpenForms["frmDailyAttendanceReport"] as frmDailyAttendanceReport;
                        }
                        break;
                    case "Monthly Attendance Report":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmMonthlyAttendanceReport();
                            open = Application.OpenForms["frmMonthlyAttendanceReport"] as frmMonthlyAttendanceReport;
                        }
                        break;
                    case "Daily Salary Report":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmDailySalaryReport();
                            open = Application.OpenForms["frmDailySalaryReport"] as frmDailySalaryReport;
                        }
                        break;
                    case "Monthly Salary Report":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmMonthlySalaryReport();
                            open = Application.OpenForms["frmMonthlySalaryReport"] as frmMonthlySalaryReport;
                        }
                        break;
                    case "Payhead Report":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmPayHeadReport();
                            open = Application.OpenForms["frmPayHeadReport"] as frmPayHeadReport;
                        }
                        break;
                    case "Salary Package Report":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmSalaryPackageReport();
                            open = Application.OpenForms["frmSalaryPackageReport"] as frmSalaryPackageReport;
                        }
                        break;
                    case "Advance Payment Report":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmAdvancePaymentReport();
                            open = Application.OpenForms["frmAdvancePaymentReport"] as frmAdvancePaymentReport;
                        }
                        break;
                    case "Bonus Deduction Report":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmBonusDeductionReport();
                            open = Application.OpenForms["frmBonusDeductionReport"] as frmBonusDeductionReport;
                        }
                        break;
                    case "Employee Address Book Report":
                        if (BllSettings.SettingsStatusCheck("Payroll") == "Yes")
                        {
                            frmObj = new frmEmployeeAddressBook();
                            open = Application.OpenForms["frmEmployeeAddressBook"] as frmEmployeeAddressBook;
                        }
                        break;
                    case "Day Book":
                        frmObj = new frmDayBook();
                        open = Application.OpenForms["frmDayBook"] as frmDayBook;
                        break;
                    case "Cash/Bank Book":
                        frmObj = new frmCashBankBookReport();
                        open = Application.OpenForms["frmCashBankBookReport"] as frmCashBankBookReport;
                        break;
                    case "Account Groupwise Report":
                        frmObj = new frmAccountGroupwiseReport();
                        open = Application.OpenForms["frmAccountGroupwiseReport"] as frmAccountGroupwiseReport;
                        break;
                    case "Account Ledger Report":
                        frmObj = new frmAccountLedgerReport();
                        open = Application.OpenForms["frmAccountLedgerReport"] as frmAccountLedgerReport;
                        break;
                    case "Outstanding Report":
                        frmObj = new frmOutstandingReport();
                        open = Application.OpenForms["frmOutstandingReport"] as frmOutstandingReport;
                        break;
                    case "Ageing Report":
                        frmObj = new frmAgeingReport();
                        open = Application.OpenForms["frmAgeingReport"] as frmAgeingReport;
                        break;
                    case "Party's Address Book":
                        frmObj = new frmPartyAddressBook();
                        open = Application.OpenForms["frmPartyAddressBook"] as frmPartyAddressBook;
                        break;
                    case "Stock Report":
                        frmObj = new frmStockReport();
                        open = Application.OpenForms["frmStockReport"] as frmStockReport;
                        break;
                    case "Short Expiry Report":
                        frmObj = new frmShortExpiryReport();
                        open = Application.OpenForms["frmShortExpiryReport"] as frmShortExpiryReport;
                        break;
                    case "Product Statistics":
                        frmObj = new frmProductStatistics();
                        open = Application.OpenForms["frmProductStatistics"] as frmProductStatistics;
                        break;
                    case "Price List Report":
                        frmObj = new frmPriceListReport();
                        open = Application.OpenForms["frmPriceListReport"] as frmPriceListReport;
                        break;
                    case "Tax Report":
                        frmObj = new frmTaxReport();
                        open = Application.OpenForms["frmTaxReport"] as frmTaxReport;
                        break;
                    case "VAT Report":
                        frmObj = new frmVatReturnReport();
                        open = Application.OpenForms["frmVatReturnReport"] as frmVatReturnReport;
                        break;
                    case "Cheque Report":
                        frmObj = new frmChequeReport();
                        open = Application.OpenForms["frmChequeReport"] as frmChequeReport;
                        break;
                    case "Free Sale Report":
                        frmObj = new frmFreeSaleReport();
                        open = Application.OpenForms["frmFreeSaleReport"] as frmFreeSaleReport;
                        break;
                    case "Product Vs Batch Report":
                        frmObj = new frmProductVsBatchReport();
                        open = Application.OpenForms["frmProductVsBatchReport"] as frmProductVsBatchReport;
                        break;

                    case "Customer":
                        frmObj = new frmCustomer();
                        open = Application.OpenForms["frmCustomer"] as frmCustomer;
                        break;

                    case "Supplier":
                        frmObj = new frmSupplier();
                        open = Application.OpenForms["frmSupplier"] as frmSupplier;
                        break;
                }
                if (frmObj != null)
                {
                    if (open == null)
                    {
                        frmObj.MdiParent = formMDI.MDIObj;
                        frmObj.Show();
                    }
                    else
                    {
                        open.Activate();
                        if (open.WindowState == FormWindowState.Minimized)
                        {
                            open.WindowState = FormWindowState.Normal;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("QL:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Opens the corresponding Vouchers based on voucher type on Go button click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGo_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbVoucherType.SelectedIndex != -1)
                {
                    switch (VoucherType)
                    {
                    case "Monthly Salary Voucher":
                        decimal decVoucherTypeId     = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string  strVoucherTypeName   = cmbVoucherType.Text;
                        frmMonthlySalaryVoucher frm  = new frmMonthlySalaryVoucher();
                        frmMonthlySalaryVoucher open = Application.OpenForms["frmMonthlySalaryVoucher"] as frmMonthlySalaryVoucher;
                        if (open == null)
                        {
                            frm.MdiParent = this.MdiParent;
                            frm.CallFromVoucherTypeSelection(decVoucherTypeId, strVoucherTypeName);
                        }
                        else
                        {
                            open.CallFromVoucherTypeSelection(decVoucherTypeId, strVoucherTypeName);
                        }

                        this.Close();
                        break;

                    case "Advance Payment":
                        decimal decVoucherTypeNo    = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string  strVoucherTypeNames = cmbVoucherType.Text;

                        frmAdvancePayment abc   = new frmAdvancePayment();
                        frmAdvancePayment opens = Application.OpenForms["frmAdvancePayment"] as frmAdvancePayment;
                        if (opens == null)
                        {
                            abc.MdiParent = this.MdiParent;
                            abc.CallFromVoucherTypeSelection(decVoucherTypeNo, strVoucherTypeNames);
                        }
                        else
                        {
                            opens.CallFromVoucherTypeSelection(decVoucherTypeNo, strVoucherTypeNames);
                        }



                        this.Close();
                        break;

                    case "Daily Salary Voucher":
                        decimal decDailyVoucherTypeId         = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string  strDailySalaryVoucherTypeName = cmbVoucherType.Text.ToString();
                        frmDailySalaryVoucher frmobj          = new frmDailySalaryVoucher();
                        frmDailySalaryVoucher DailyOpen       = Application.OpenForms["frmDailySalaryVoucher"] as frmDailySalaryVoucher;
                        if (DailyOpen == null)
                        {
                            frmobj.MdiParent = this.MdiParent;
                            frmobj.CallFromVoucherTypeSelection(decDailyVoucherTypeId, strDailySalaryVoucherTypeName);
                        }
                        else
                        {
                            DailyOpen.CallFromVoucherTypeSelection(decDailyVoucherTypeId, strDailySalaryVoucherTypeName);
                        }

                        this.Close();
                        break;

                    case "Payment Voucher":
                        decimal           decPaymentVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());
                        string            strVoucherTypeNames2    = cmbVoucherType.Text.ToString();
                        frmPaymentVoucher frmPaymentObj           = new frmPaymentVoucher();
                        frmPaymentVoucher PaymentOpen             = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher;
                        if (PaymentOpen == null)
                        {
                            frmPaymentObj.MdiParent = this.MdiParent;
                            frmPaymentObj.CallFromVoucherTypeSelection(decPaymentVoucherTypeId, strVoucherTypeNames2);
                        }
                        else
                        {
                            PaymentOpen.CallFromVoucherTypeSelection(decPaymentVoucherTypeId, strVoucherTypeNames2);
                        }

                        this.Close();
                        break;

                    case "Contra Voucher":
                        decimal          decContraVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string           strVoucherTypeNames3   = cmbVoucherType.Text.ToString();
                        frmContraVoucher frmcontraObj           = new frmContraVoucher();
                        frmContraVoucher ContraOpen             = Application.OpenForms["frmContraVoucher"] as frmContraVoucher;
                        if (ContraOpen == null)
                        {
                            frmcontraObj.MdiParent = this.MdiParent;
                            frmcontraObj.CallFromVoucherTypeSelection(decContraVoucherTypeId, strVoucherTypeNames3);
                        }
                        else
                        {
                            ContraOpen.CallFromVoucherTypeSelection(decContraVoucherTypeId, strVoucherTypeNames3);
                        }

                        this.Close();
                        break;

                    case "Journal Voucher":
                        decimal           decJournalVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string            strVoucherTypeNames4    = cmbVoucherType.Text.ToString();
                        frmJournalVoucher frmJournalObj           = new frmJournalVoucher();
                        frmJournalVoucher JournalOpen             = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                        if (JournalOpen == null)
                        {
                            frmJournalObj.MdiParent = this.MdiParent;
                            frmJournalObj.CallFromVoucherTypeSelection(decJournalVoucherTypeId, strVoucherTypeNames4);
                        }
                        else
                        {
                            JournalOpen.CallFromVoucherTypeSelection(decJournalVoucherTypeId, strVoucherTypeNames4);
                        }

                        this.Close();
                        break;

                    case "Credit Note":

                        decimal       decCreditNoteVoucherTypeId   = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string        strCreditNoteVoucherTypeName = cmbVoucherType.Text.ToString();
                        frmCreditNote frmCreditNoteObj             = new frmCreditNote();
                        frmCreditNote CreditNoteOpen = Application.OpenForms["frmCreditNote"] as frmCreditNote;
                        if (CreditNoteOpen == null)
                        {
                            frmCreditNoteObj.MdiParent = this.MdiParent;
                            frmCreditNoteObj.CallFromVoucherTypeSelection(decCreditNoteVoucherTypeId, strCreditNoteVoucherTypeName);
                        }
                        else
                        {
                            CreditNoteOpen.CallFromVoucherTypeSelection(decCreditNoteVoucherTypeId, strCreditNoteVoucherTypeName);
                        }

                        this.Close();
                        break;

                    case "Receipt Voucher":
                        decimal           decReceiptVoucherTypeId   = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string            strReceiptVoucherTypeName = cmbVoucherType.Text.ToString();
                        frmReceiptVoucher frmReceiptObj             = new frmReceiptVoucher();
                        frmReceiptVoucher ReceiptOpen = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher;
                        if (ReceiptOpen == null)
                        {
                            frmReceiptObj.MdiParent = this.MdiParent;
                            frmReceiptObj.CallFromVoucherTypeSelection(decReceiptVoucherTypeId, strReceiptVoucherTypeName);
                        }
                        else
                        {
                            ReceiptOpen.CallFromVoucherTypeSelection(decReceiptVoucherTypeId, strReceiptVoucherTypeName);
                        }

                        this.Close();
                        break;

                    case "Service Voucher":
                        decimal           decServiceVoucherTypeId   = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string            strServiceVoucherTypeName = cmbVoucherType.Text.ToString();
                        frmServiceVoucher frmServiceVoucherObj      = new frmServiceVoucher();
                        frmServiceVoucher ServiceVoucherOpen        = Application.OpenForms["frmServiceVoucher"] as frmServiceVoucher;
                        if (ServiceVoucherOpen == null)
                        {
                            frmServiceVoucherObj.MdiParent = this.MdiParent;
                            frmServiceVoucherObj.CallFromVoucherTypeSelection(decServiceVoucherTypeId, strServiceVoucherTypeName);
                        }
                        else
                        {
                            ServiceVoucherOpen.CallFromVoucherTypeSelection(decServiceVoucherTypeId, strServiceVoucherTypeName);
                        }

                        this.Close();
                        break;

                    case "Purchase Order":
                        decimal          decPurchaseOrderTypeId   = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string           strPurchaseOrderTypeName = cmbVoucherType.Text.ToString();
                        frmPurchaseOrder frmPurchaseOrderObj      = new frmPurchaseOrder();
                        frmPurchaseOrder OpenPurchaseOrder        = Application.OpenForms["frmPurchaseOrder"] as frmPurchaseOrder;
                        if (OpenPurchaseOrder == null)
                        {
                            frmPurchaseOrderObj.MdiParent = this.MdiParent;
                            frmPurchaseOrderObj.CallFromVoucherTypeSelection(decPurchaseOrderTypeId, strPurchaseOrderTypeName);
                        }
                        else
                        {
                            OpenPurchaseOrder.CallFromVoucherTypeSelection(decPurchaseOrderTypeId, strPurchaseOrderTypeName);
                        }
                        this.Close();
                        break;

                    case "Debit Note":
                        decimal      decDebitNoteVoucherTypeId   = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string       strDebitNoteVoucherTypeName = cmbVoucherType.Text.ToString();
                        frmDebitNote frmDebitNoteObj             = new frmDebitNote();
                        frmDebitNote DebitNoteOpen = Application.OpenForms["frmDebitNote"] as frmDebitNote;
                        if (DebitNoteOpen == null)
                        {
                            frmDebitNoteObj.MdiParent = this.MdiParent;
                            frmDebitNoteObj.CallFromVoucherTypeSelection(decDebitNoteVoucherTypeId, strDebitNoteVoucherTypeName);
                        }
                        else
                        {
                            DebitNoteOpen.CallFromVoucherTypeSelection(decDebitNoteVoucherTypeId, strDebitNoteVoucherTypeName);
                        }

                        this.Close();
                        break;

                    case "Sales Return":
                        decimal        decSalesReturnVoucherTypeId  = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string         strSalesReturnVoucheTypeName = cmbVoucherType.Text;
                        frmSalesReturn frmSalesReturnObj            = new frmSalesReturn();
                        frmSalesReturn SalesReturnOpen = Application.OpenForms["frmSalesReturn"] as frmSalesReturn;
                        if (SalesReturnOpen == null)
                        {
                            frmSalesReturnObj.MdiParent = this.MdiParent;
                            frmSalesReturnObj.CallFromVoucherTypeSelection(decSalesReturnVoucherTypeId, strSalesReturnVoucheTypeName);
                        }
                        else
                        {
                            SalesReturnOpen.CallFromVoucherTypeSelection(decSalesReturnVoucherTypeId, strSalesReturnVoucheTypeName);
                        }

                        this.Close();
                        break;

                    case "Material Receipt":
                        decimal decMaterialReceiptVoucherTypeId  = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string  strMaterialReceiptVoucheTypeName = cmbVoucherType.Text;

                        frmMaterialReceipt frmMaterialReceiptObj = new frmMaterialReceipt();
                        frmMaterialReceipt MaterialReceiptOpen   = Application.OpenForms["frmMaterialReceipt"] as frmMaterialReceipt;
                        if (MaterialReceiptOpen == null)
                        {
                            frmMaterialReceiptObj.MdiParent = this.MdiParent;
                            frmMaterialReceiptObj.CallFromVoucherTypeSelection(decMaterialReceiptVoucherTypeId, strMaterialReceiptVoucheTypeName);
                        }
                        else
                        {
                            MaterialReceiptOpen.CallFromVoucherTypeSelection(decMaterialReceiptVoucherTypeId, strMaterialReceiptVoucheTypeName);
                        }



                        this.Close();
                        break;

                    case "Sales Order":
                        decimal decSalesOrderTypeId          = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string  strSalesOrderVoucherTypeName = cmbVoucherType.Text;

                        frmSalesOrder frmSalesOrderObj = new frmSalesOrder();
                        frmSalesOrder SalesOrderOpen   = Application.OpenForms["frmSalesOrder"] as frmSalesOrder;
                        if (SalesOrderOpen == null)
                        {
                            frmSalesOrderObj.MdiParent = this.MdiParent;
                            frmSalesOrderObj.CallFromVoucherTypeSelection(decSalesOrderTypeId, strSalesOrderVoucherTypeName);
                        }
                        else
                        {
                            SalesOrderOpen.CallFromVoucherTypeSelection(decSalesOrderTypeId, strSalesOrderVoucherTypeName);
                        }



                        this.Close();
                        break;

                    case "Rejection Out":
                        decimal         decRejectionOutVoucherTypeId   = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string          strRejectionOutVoucherTypeName = cmbVoucherType.Text.ToString();
                        frmRejectionOut frmRejectionOutObj             = new frmRejectionOut();
                        frmRejectionOut RejectionOutOpen = Application.OpenForms["frmRejectionOut"] as frmRejectionOut;
                        if (RejectionOutOpen == null)
                        {
                            frmRejectionOutObj.MdiParent = this.MdiParent;
                            frmRejectionOutObj.CallFromVoucherTypeSelection(decRejectionOutVoucherTypeId, strRejectionOutVoucherTypeName);
                        }
                        else
                        {
                            RejectionOutOpen.CallFromVoucherTypeSelection(decRejectionOutVoucherTypeId, strRejectionOutVoucherTypeName);
                        }

                        this.Close();
                        break;

                    case "Rejection In":
                        decimal        decRejectionInVoucherTypeId   = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string         strRejectionInVoucherTypeName = cmbVoucherType.Text.ToString();
                        frmRejectionIn frmRejectionInObj             = new frmRejectionIn();
                        frmRejectionIn RejectionInOpen = Application.OpenForms["frmRejectionIn"] as frmRejectionIn;
                        if (RejectionInOpen == null)
                        {
                            frmRejectionInObj.MdiParent = this.MdiParent;
                            frmRejectionInObj.CallFromVoucherTypeSelection(decRejectionInVoucherTypeId, strRejectionInVoucherTypeName);
                        }
                        else
                        {
                            RejectionInOpen.CallFromVoucherTypeSelection(decRejectionInVoucherTypeId, strRejectionInVoucherTypeName);
                        }

                        this.Close();
                        break;

                    case "Sales Quotation":
                        decimal           decsalesQuotationTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string            strSalesQuotationName   = cmbVoucherType.Text.ToString();
                        frmSalesQuotation frmsalesQuotationObj    = new frmSalesQuotation();
                        frmSalesQuotation frmsalesQuotationOpen   = Application.OpenForms["frmSalesQuotation"] as frmSalesQuotation;
                        if (frmsalesQuotationOpen == null)
                        {
                            frmsalesQuotationObj.MdiParent = this.MdiParent;
                            frmsalesQuotationObj.CallFromVoucherTypeSelection(decsalesQuotationTypeId, strSalesQuotationName);
                        }
                        else
                        {
                            frmsalesQuotationOpen.CallFromVoucherTypeSelection(decsalesQuotationTypeId, strSalesQuotationName);
                        }
                        this.Close();
                        break;

                    case "PDC Payable":
                        decimal       decPDCpayableVoucherTypeId  = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string        strPDCpayableVoucheTypeName = cmbVoucherType.Text.ToString();
                        frmPdcPayable frmPDCPayableOBj            = new frmPdcPayable();
                        frmPdcPayable frmPDCPayableOpen           = Application.OpenForms["frmPdcPayable"] as frmPdcPayable;

                        if (frmPDCPayableOpen == null)
                        {
                            frmPDCPayableOBj.MdiParent = this.MdiParent;
                            frmPDCPayableOBj.CallFromVoucherTypeSelection(decPDCpayableVoucherTypeId, strPDCpayableVoucheTypeName);
                        }
                        else
                        {
                            frmPDCPayableOpen.CallFromVoucherTypeSelection(decPDCpayableVoucherTypeId, strPDCpayableVoucheTypeName);
                        }

                        this.Close();
                        break;


                    case "Sales Invoice":
                        decimal         decSalesInvoiceVoucherTypeId  = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string          strSalesInvoiceVoucheTypeName = cmbVoucherType.Text.ToString();
                        frmSalesInvoice frmSalesInvoiceOBj            = new frmSalesInvoice();
                        frmSalesInvoice frmSalesInvoiceOpen           = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice;

                        if (frmSalesInvoiceOpen == null)
                        {
                            frmSalesInvoiceOBj.MdiParent = this.MdiParent;
                            frmSalesInvoiceOBj.CallFromVoucherTypeSelection(decSalesInvoiceVoucherTypeId, strSalesInvoiceVoucheTypeName);
                        }
                        else
                        {
                            frmSalesInvoiceOpen.CallFromVoucherTypeSelection(decSalesInvoiceVoucherTypeId, strSalesInvoiceVoucheTypeName);
                        }

                        this.Close();
                        break;


                    case "Purchase Invoice":
                        decimal            decPurchaseInvoiceVoucherTypeId  = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string             strPurchaseInvoiceVoucheTypeName = cmbVoucherType.Text.ToString();
                        frmPurchaseInvoice frmPurchaseInvoiceOBj            = new frmPurchaseInvoice();
                        frmPurchaseInvoice frmPurchaseInvoiceOpen           = Application.OpenForms["frmPurchaseInvoice"] as frmPurchaseInvoice;

                        if (frmPurchaseInvoiceOpen == null)
                        {
                            frmPurchaseInvoiceOBj.MdiParent = this.MdiParent;
                            frmPurchaseInvoiceOBj.CallFromVoucherTypeSelection(decPurchaseInvoiceVoucherTypeId, strPurchaseInvoiceVoucheTypeName);
                        }
                        else
                        {
                            frmPurchaseInvoiceOpen.CallFromVoucherTypeSelection(decPurchaseInvoiceVoucherTypeId, strPurchaseInvoiceVoucheTypeName);
                        }

                        this.Close();
                        break;

                    case "Delivery Note":
                        decimal decDeliveryVoucherTypeNo    = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string  strDeliveryVoucherTypeNames = cmbVoucherType.Text;

                        frmDeliveryNote DeliveryNote     = new frmDeliveryNote();
                        frmDeliveryNote openDeliveryNote = Application.OpenForms["frmDeliveryNote"] as frmDeliveryNote;
                        if (openDeliveryNote == null)
                        {
                            DeliveryNote.MdiParent = this.MdiParent;
                            DeliveryNote.CallFromVoucherTypeSelection(decDeliveryVoucherTypeNo, strDeliveryVoucherTypeNames);
                        }
                        else
                        {
                            openDeliveryNote.CallFromVoucherTypeSelection(decDeliveryVoucherTypeNo, strDeliveryVoucherTypeNames);
                        }



                        this.Close();
                        break;

                    case "Purchase Return":
                        decimal decPurchaseReturnVoucherTypeId    = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string  strPurchaseReturnVoucherTypeNames = cmbVoucherType.Text.ToString();

                        frmPurchaseReturn frmPurchase      = new frmPurchaseReturn();
                        frmPurchaseReturn FrmPurchaseOpens = Application.OpenForms["frmPurchaseReturn"] as frmPurchaseReturn;
                        if (FrmPurchaseOpens == null)
                        {
                            frmPurchase.MdiParent = this.MdiParent;
                            frmPurchase.CallFromVoucherTypeSelection(decPurchaseReturnVoucherTypeId, strPurchaseReturnVoucherTypeNames);
                        }
                        else
                        {
                            FrmPurchaseOpens.CallFromVoucherTypeSelection(decPurchaseReturnVoucherTypeId, strPurchaseReturnVoucherTypeNames);
                        }
                        this.Close();
                        break;

                    case "POS":
                        decimal decPOSVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());

                        string strPOSVoucheTypeName = "POS";
                        frmPOS frmPOSOBj            = new frmPOS();
                        frmPOS frmPOSOpen           = Application.OpenForms["frmPOS"] as frmPOS;

                        if (frmPOSOpen == null)
                        {
                            frmPOSOBj.MdiParent = this.MdiParent;
                            frmPOSOBj.CallFromVoucherTypeSelection(decPOSVoucherTypeId, strPOSVoucheTypeName);
                        }
                        else
                        {
                            frmPOSOpen.CallFromVoucherTypeSelection(decPOSVoucherTypeId, strPOSVoucheTypeName);
                        }

                        this.Close();

                        break;

                    case "Physical Stock":
                        decimal          DecPhysicalStockVoucherTypeId   = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string           strPhysicalStockVocherTypeNames = cmbVoucherType.Text;
                        frmPhysicalStock frmPhysicalStock     = new frmPhysicalStock();
                        frmPhysicalStock frmPhysicalStockOpen = Application.OpenForms["frmPhysicalStock"] as frmPhysicalStock;
                        if (frmPhysicalStockOpen == null)
                        {
                            frmPhysicalStock.MdiParent = this.MdiParent;
                            frmPhysicalStock.CallFromVoucherTypeSelection(DecPhysicalStockVoucherTypeId, strPhysicalStockVocherTypeNames);
                        }
                        else
                        {
                            frmPhysicalStockOpen.CallFromVoucherTypeSelection(DecPhysicalStockVoucherTypeId, strPhysicalStockVocherTypeNames);
                        }
                        this.Close();
                        break;

                    case "PDC Receivable":
                        decimal          decPDCReceivableVoucherTypeId  = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string           strPDCReceivableVoucheTypeName = cmbVoucherType.Text.ToString();
                        frmPdcReceivable frmpdreceivableObj             = new frmPdcReceivable();

                        frmPdcReceivable frmPDCReceivableOpen = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable;

                        if (frmPDCReceivableOpen == null)
                        {
                            frmpdreceivableObj.MdiParent = this.MdiParent;
                            frmpdreceivableObj.CallFromVoucherTypeSelection(decPDCReceivableVoucherTypeId, strPDCReceivableVoucheTypeName);
                        }
                        else
                        {
                            frmPDCReceivableOpen.CallFromVoucherTypeSelection(decPDCReceivableVoucherTypeId, strPDCReceivableVoucheTypeName);
                        }

                        this.Close();
                        break;

                    case "Stock Journal":
                        decimal         decStockJournalVoucherTypeId = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string          strSockJournalVocherTypeName = cmbVoucherType.Text;
                        frmStockJournal frmStockJournalObj           = new frmStockJournal();
                        frmStockJournal frmStockJournalOpen          = Application.OpenForms["frmStockJournal"] as frmStockJournal;
                        if (frmStockJournalOpen == null)
                        {
                            frmStockJournalObj.MdiParent = this.MdiParent;
                            frmStockJournalObj.CallFromVoucherTypeSelection(decStockJournalVoucherTypeId, strSockJournalVocherTypeName);
                        }
                        else
                        {
                            frmStockJournalOpen.CallFromVoucherTypeSelection(decStockJournalVoucherTypeId, strSockJournalVocherTypeName);
                        }
                        this.Close();
                        break;

                    case "PDC Clearance":
                        decimal         decPDCClearanceVoucherTypeId  = decimal.Parse(cmbVoucherType.SelectedValue.ToString());
                        string          strPDCClearanceVoucheTypeName = cmbVoucherType.Text.ToString();
                        frmPdcClearance frmpdcClearanceObj            = new frmPdcClearance();
                        frmPdcClearance frmpdcclearanceOpen           = Application.OpenForms["frmPdcClearance"] as frmPdcClearance;

                        if (frmpdcclearanceOpen == null)
                        {
                            frmpdcClearanceObj.MdiParent = this.MdiParent;
                            frmpdcClearanceObj.CallFromVoucherTypeSelection(decPDCClearanceVoucherTypeId, strPDCClearanceVoucheTypeName);
                        }
                        else
                        {
                            frmpdcclearanceOpen.CallFromVoucherTypeSelection(decPDCClearanceVoucherTypeId, strPDCClearanceVoucheTypeName);
                        }

                        this.Close();
                        break;
                    }
                }
                else
                {
                    Messages.InformationMessage("Select voucher type");
                    cmbVoucherType.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("VTS2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 //PopUp
 /// <summary>
 /// Function to call this form from frmMonthlySalaryVoucher
 /// </summary>
 /// <param name="frmMonthlySalary"></param>
 /// <param name="decId"></param>
 /// <param name="strComboType"></param>
 public void CallFromMonthlySalaryVoucher(frmMonthlySalaryVoucher frmMonthlySalary, decimal decId, string strComboType)
 {
     try
     {
         strComboTypes = strComboType;
         base.Show();
         this.frmMonthlySalaryVoucherObj = frmMonthlySalary;
         int inRowCount = dgvLedgerPopup.Rows.Count;
         for (int i = 0; i < inRowCount; i++)
         {
             if (Convert.ToDecimal(dgvLedgerPopup.Rows[i].Cells["dgvtxtLedgerId"].Value.ToString()) == decId)
             {
                 dgvLedgerPopup.Rows[i].DefaultCellStyle.BackColor = Color.MediumSeaGreen;
             }
         }
         txtLedgerName.Focus();
     }
     catch (Exception ex)
     {
         MessageBox.Show("LP11:" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// On form closing
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmLedgerPopup_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (frmMonthlySalaryRegisterObj != null)
                {
                    frmMonthlySalaryRegisterObj = Application.OpenForms["frmMonthlySalaryRegister"] as frmMonthlySalaryRegister;
                    if (frmMonthlySalaryRegisterObj == null)
                    {
                        frmMonthlySalaryRegisterObj = new frmMonthlySalaryRegister();
                        frmMonthlySalaryRegisterObj.MdiParent = formMDI.MDIObj;
                        frmMonthlySalaryRegisterObj.Show();
                    }
                    else
                    {
                        frmMonthlySalaryRegisterObj.Activate();
                    }
                }
                if (frmAdvancePaymentObj != null)
                {
                    frmAdvancePaymentObj = Application.OpenForms["frmAdvancePayment"] as frmAdvancePayment;
                    if (frmAdvancePaymentObj == null)
                    {
                        frmAdvancePaymentObj = new frmAdvancePayment();
                        frmAdvancePaymentObj.MdiParent = formMDI.MDIObj;
                        frmAdvancePaymentObj.Show();
                    }
                    else
                    {
                        frmAdvancePaymentObj.Activate();
                    }
                }
                if (frmMonthlySalaryVoucherObj != null)
                {
                    frmMonthlySalaryVoucherObj = Application.OpenForms["frmMonthlySalaryVoucher"] as frmMonthlySalaryVoucher;
                    if (frmMonthlySalaryVoucherObj == null)
                    {
                        frmMonthlySalaryVoucherObj = new frmMonthlySalaryVoucher();
                        frmMonthlySalaryVoucherObj.MdiParent = formMDI.MDIObj;
                        frmMonthlySalaryVoucherObj.Show();
                    }
                    else
                    {
                        frmMonthlySalaryVoucherObj.Activate();
                    }
                }
                if (frmDailySalaryVoucherObj != null)
                {
                    frmDailySalaryVoucherObj = Application.OpenForms["frmDailySalaryVoucher"] as frmDailySalaryVoucher;
                    if (frmDailySalaryVoucherObj == null)
                    {
                        frmDailySalaryVoucherObj = new frmDailySalaryVoucher();
                        frmDailySalaryVoucherObj.MdiParent = formMDI.MDIObj;
                        frmDailySalaryVoucherObj.Show();
                    }
                    else
                    {
                        frmDailySalaryVoucherObj.Activate();
                    }
                }
                if (frmJournalVoucherObj != null)
                {
                    frmJournalVoucherObj.Enabled = true;
                }
                if (frmReceiptVoucherObj != null)
                {
                    frmReceiptVoucherObj.Enabled = true;
                }
                if (frmContraVoucherObj != null)
                {
                    frmContraVoucherObj = Application.OpenForms["frmContraVoucher"] as frmContraVoucher;
                    if (frmContraVoucherObj == null)
                    {
                        frmContraVoucherObj = new frmContraVoucher();
                        frmContraVoucherObj.MdiParent = formMDI.MDIObj;
                        frmContraVoucherObj.Show();
                    }
                    else
                    {
                        frmContraVoucherObj.Activate();
                    }
                }
                if (frmPaymentVoucherObj != null)
                {
                    frmPaymentVoucherObj.Enabled = true;
                }

                if (frmDebitNoteObj != null)
                {
                    frmDebitNoteObj.Enabled = true;
                }
                if (frmCreditNoteObj != null)
                {
                    frmCreditNoteObj.Enabled = true;
                }
                if (frmPdcPayableObj != null)
                {
                    frmPdcPayableObj.Enabled = true;
                }
                if (frmpdReceivableObj != null)
                {
                    frmpdReceivableObj.Enabled = true;
                }
                if (frmMaterialReceiptObj != null)
                {
                    frmMaterialReceiptObj.Enabled = true;
                }
                if (frmSalesInvoiceObj != null)
                {
                    frmSalesInvoiceObj.Enabled = true;
                }
                if (frmPOSObj != null)
                {
                    frmPOSObj.Enabled = true;
                }

                if (frmMaterialReceiptObj != null)
                {
                    frmMaterialReceiptObj = Application.OpenForms["frmMaterialReceipt"] as frmMaterialReceipt;
                    if (frmMaterialReceiptObj == null)
                    {
                        frmMaterialReceiptObj = new frmMaterialReceipt();
                        frmMaterialReceiptObj.MdiParent = formMDI.MDIObj;
                        frmMaterialReceiptObj.Show();
                    }
                    else
                    {
                        frmMaterialReceiptObj.Activate();
                    }
                }

                if (frmPurchaseInvoiceObj != null)
                {
                    frmPurchaseInvoiceObj = Application.OpenForms["frmPurchaseInvoice"] as frmPurchaseInvoice;
                    if (frmPurchaseInvoiceObj == null)
                    {
                        frmPurchaseInvoiceObj = new frmPurchaseInvoice();
                        frmPurchaseInvoiceObj.MdiParent = formMDI.MDIObj;
                        frmPurchaseInvoiceObj.Show();
                    }
                    else
                    {
                        frmPurchaseInvoiceObj.Activate();
                    }
                }
                if (frmServiceVoucherObj != null)
                {
                    frmServiceVoucherObj.Enabled = true;
                }

                dgvLedgerPopup.ClearSelection();
            }
            catch (Exception ex)
            {
                MessageBox.Show("LP35:" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Function to call this form from frmMonthlySalaryVoucher for creating new account ledger
 /// </summary>
 /// <param name="frmMonthlySalaryVoucher"></param>
 public void CallFromMonthlySalaryVoucher(frmMonthlySalaryVoucher frmMonthlySalaryVoucher)
 {
     try
     {
         dgvAccountLedger.Enabled = false;
         txtLedgerNameSearch.Enabled = false;
         btnSearch.Enabled = false;
         cmbGroupSearch.Enabled = false;
         dgvAccountLedger.Enabled = false;
         lblLedgerNameSearch.Enabled = false;
         lblGroupSearch.Enabled = false;
         this.frmMonthlySalaryVoucherObj = frmMonthlySalaryVoucher;
         base.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show("AL16:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Calls the corresponding voucher on click in Quick Launch menu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn1_Click(object sender, EventArgs e)
        {
            this.SendToBack();
            Form       frmObj     = null;
            Form       open       = null;
            SettingsSP spSettings = new SettingsSP();

            try
            {
                string str = ((Button)sender).Text;
                btnFocus.Focus();
                switch (str)
                {
                case "Contra Voucher":
                    formMDI.MDIObj.ContraVoucherClick();
                    break;

                case "Payment Voucher":
                    formMDI.MDIObj.PaymentVoucherClick();
                    break;

                case "Receipt Voucher":
                    formMDI.MDIObj.ReceiptVoucherClick();
                    break;

                case "Journal Voucher":
                    formMDI.MDIObj.JournalVoucherClick();
                    break;

                case "Sales Invoice":
                    formMDI.MDIObj.SalesInvoiceClick();
                    break;

                case "Purchase Invoice":
                    formMDI.MDIObj.PurchaseInvoiceClick();
                    break;

                case "POS":
                    formMDI.MDIObj.POSClick();
                    break;

                case "PDC Payable":
                    formMDI.MDIObj.PDCPayableClick();
                    break;

                case "PDC Receivable":
                    formMDI.MDIObj.PDCReceivableClick();
                    break;

                case "PDC Clearance":
                    formMDI.MDIObj.PDCClearenceClick();
                    break;

                case "Bank Reconciliation":
                    frmObj = new frmBankReconciliation();
                    open   = Application.OpenForms["frmBankReconciliation"] as frmBankReconciliation;
                    break;

                case "Purchase Order":
                    formMDI.MDIObj.PurchaseOrderClick();
                    break;

                case "Material Reciept":
                    formMDI.MDIObj.MaterialReceiptClick();
                    break;

                case "Rejection Out":
                    formMDI.MDIObj.RejectionOutClick();
                    break;

                case "Purchase Return":
                    formMDI.MDIObj.PurchaseReturnClick();
                    break;

                case "Sales Quotation":
                    formMDI.MDIObj.SalesQuotationClick();
                    break;

                case "Sales Order":
                    formMDI.MDIObj.SalesOrderClick();
                    break;

                case "Delivery Note":
                    formMDI.MDIObj.DeliveryNoteClick();
                    break;

                case "Rejection In":
                    formMDI.MDIObj.RejectionInClick();
                    break;

                case "Sales Return":
                    formMDI.MDIObj.SalesReturnClick();
                    break;

                case "Physical Stock":
                    formMDI.MDIObj.PhysicalStockClick();
                    break;

                case "Service Voucher":
                    formMDI.MDIObj.ServiceVoucherClick();
                    break;

                case "Credit Note":
                    formMDI.MDIObj.CreditNoteClick();
                    break;

                case "Debit Note":
                    formMDI.MDIObj.DebitNoteClick();
                    break;

                case "Stock Journal":
                    //frmObj = new frmStockJournal();
                    //open = Application.OpenForms["frmStockJournal"] as frmStockJournal;
                    formMDI.MDIObj.StockJournalClick();
                    break;

                case "Bill Allocation":
                    frmObj = new frmBillallocation();
                    open   = Application.OpenForms["frmBillallocation"] as frmBillallocation;
                    break;

                case "Account Group":
                    frmObj = new frmAccountGroup();
                    open   = Application.OpenForms["frmAccountGroup"] as frmAccountGroup;
                    break;

                case "Account Ledger":
                    frmObj = new frmAccountLedger();
                    open   = Application.OpenForms["frmAccountLedger"] as frmAccountLedger;
                    break;

                case "Multiple Account Ledgers":
                    frmObj = new frmmultipleAccountLedger();
                    open   = Application.OpenForms["frmmultipleAccountLedger"] as frmmultipleAccountLedger;
                    break;

                case "Product Group":
                    frmObj = new frmProductGroup();
                    open   = Application.OpenForms["frmProductGroup"] as frmProductGroup;
                    break;

                case "Product Creation":
                    frmObj = new frmProductCreation();
                    open   = Application.OpenForms["frmProductCreation"] as frmProductCreation;
                    break;

                case "Multiple Product Creation":
                    frmObj = new frmMultipleProductCreation();
                    open   = Application.OpenForms["frmMultipleProductCreation"] as frmMultipleProductCreation;
                    break;

                case "Batch":
                    if (spSettings.SettingsStatusCheck("AllowBatch") == "Yes")
                    {
                        frmObj = new frmBatch();
                        open   = Application.OpenForms["frmBatch"] as frmBatch;
                    }
                    break;

                case "Brand":
                    frmObj = new frmBrand();
                    open   = Application.OpenForms["frmBrand"] as frmBrand;
                    break;

                case "Model Number":
                    if (spSettings.SettingsStatusCheck("AllowModelNo") == "Yes")
                    {
                        frmObj = new frmModalNo();
                        open   = Application.OpenForms["frmModalNo"] as frmModalNo;
                    }
                    break;

                case "Size":
                    if (spSettings.SettingsStatusCheck("AllowSize") == "Yes")
                    {
                        frmObj = new frmSize();
                        open   = Application.OpenForms["frmSize"] as frmSize;
                    }
                    break;

                case "Unit":
                    frmObj = new frmUnit();
                    open   = Application.OpenForms["frmUnit"] as frmUnit;
                    break;

                case "Godown":
                    if (spSettings.SettingsStatusCheck("AllowGodown") == "Yes")
                    {
                        frmObj = new frmGodown();
                        open   = Application.OpenForms["frmGodown"] as frmGodown;
                    }
                    break;

                case "Rack":
                    if (spSettings.SettingsStatusCheck("AllowRack") == "Yes")
                    {
                        frmObj = new frmRack();
                        open   = Application.OpenForms["frmRack"] as frmRack;
                    }
                    break;

                case "Pricing Level":
                    frmObj = new frmPricingLevel();
                    open   = Application.OpenForms["frmPricingLevel"] as frmPricingLevel;
                    break;

                case "Price List":
                    frmObj = new frmPriceList();
                    open   = Application.OpenForms["frmPriceList"] as frmPriceList;
                    break;

                case "Standard Rate":
                    frmObj = new frmStandardRate();
                    open   = Application.OpenForms["frmStandardRate"] as frmStandardRate;
                    break;

                case "Tax":
                    if (spSettings.SettingsStatusCheck("Tax") == "Yes")
                    {
                        frmObj = new frmTax();
                        open   = Application.OpenForms["frmTax"] as frmTax;
                    }
                    break;

                case "Currency":
                    if (spSettings.SettingsStatusCheck("MultiCurrency") == "Yes")
                    {
                        frmObj = new frmCurrency();
                        open   = Application.OpenForms["frmCurrency"] as frmCurrency;
                    }
                    break;

                case "Exchange Rate":
                    frmObj = new frmExchangeRate();
                    open   = Application.OpenForms["frmExchangeRate"] as frmExchangeRate;
                    break;

                case "Service Category":
                    frmObj = new frmServiceCategory();
                    open   = Application.OpenForms["frmServiceCategory"] as frmServiceCategory;
                    break;

                case "Services":
                    frmObj = new frmServices();
                    open   = Application.OpenForms["frmServices"] as frmServices;
                    break;

                case "Voucher Type":
                    frmObj = new frmVoucherType();
                    open   = Application.OpenForms["frmVoucherType"] as frmVoucherType;
                    break;

                case "Area":
                    frmObj = new frmArea();
                    open   = Application.OpenForms["frmArea"] as frmArea;
                    break;

                case "Route":
                    frmObj = new frmRoute();
                    open   = Application.OpenForms["frmRoute"] as frmRoute;
                    break;

                case "Counter":
                    frmObj = new frmCounter();
                    open   = Application.OpenForms["frmCounter"] as frmCounter;
                    break;

                case "Product Register":
                    frmObj = new frmProductRegister();
                    open   = Application.OpenForms["frmProductRegister"] as frmProductRegister;
                    break;

                case "Salesman":
                    frmObj = new frmSalesman();
                    open   = Application.OpenForms["frmSalesman"] as frmSalesman;
                    break;

                case "Contra Register":
                    frmObj = new frmContraRegister();
                    open   = Application.OpenForms["frmContraRegister"] as frmContraRegister;
                    break;

                case "Payment Register":
                    frmObj = new frmPaymentRegister();
                    open   = Application.OpenForms["frmPaymentRegister"] as frmPaymentRegister;
                    break;

                case "Receipt Register":
                    frmObj = new frmReceiptRegister();
                    open   = Application.OpenForms["frmReceiptRegister"] as frmReceiptRegister;
                    break;

                case "Journal Register":
                    frmObj = new frmJournalRegister();
                    open   = Application.OpenForms["frmJournalRegister"] as frmJournalRegister;
                    break;

                case "PDC Payable Register":
                    frmObj = new frmPDCPayableRegister();
                    open   = Application.OpenForms["frmPDCPayableRegister"] as frmPDCPayableRegister;
                    break;

                case "PDC Receivable Register":
                    frmObj = new frmPDCReceivableRegister();
                    open   = Application.OpenForms["frmPDCReceivableRegister"] as frmPDCReceivableRegister;
                    break;

                case "PDC Clearance Register":
                    frmObj = new frmPdcClearanceRegister();
                    open   = Application.OpenForms["frmPdcClearanceRegister"] as frmPdcClearanceRegister;
                    break;

                case "Purchase Order Register":
                    frmObj = new frmPurchaseOrderRegister();
                    open   = Application.OpenForms["frmPurchaseOrderRegister"] as frmPurchaseOrderRegister;
                    break;

                case "Material Receipt Register":
                    frmObj = new frmMaterialReceiptRegister();
                    open   = Application.OpenForms["frmMaterialReceiptRegister"] as frmMaterialReceiptRegister;
                    break;

                case "Rejection Out Register":
                    frmObj = new frmRejectionOutRegister();
                    open   = Application.OpenForms["frmRejectionOutRegister"] as frmRejectionOutRegister;
                    break;

                case "Purchase Invoice Register":
                    frmObj = new frmPurchaseInvoiceRegister();
                    open   = Application.OpenForms["frmPurchaseInvoiceRegister"] as frmPurchaseInvoiceRegister;
                    break;

                case "Purchase Return Register":
                    frmObj = new frmPurchaseReturnRegister();
                    open   = Application.OpenForms["frmPurchaseReturnRegister"] as frmPurchaseReturnRegister;
                    break;

                case "Sales Quotation Register":
                    frmObj = new frmSalesQuotationRegister();
                    open   = Application.OpenForms["frmSalesQuotationRegister"] as frmSalesQuotationRegister;
                    break;

                case "Sales Order Register":
                    frmObj = new frmSalesOrderRegister();
                    open   = Application.OpenForms["frmSalesOrderRegister"] as frmSalesOrderRegister;
                    break;

                case "Delivery Note Register":
                    frmObj = new frmDeliveryNoteRegister();
                    open   = Application.OpenForms["frmDeliveryNoteRegister"] as frmDeliveryNoteRegister;
                    break;

                case "Rejection In Register":
                    frmObj = new frmRejectionInRegister();
                    open   = Application.OpenForms["frmRejectionInRegister"] as frmRejectionInRegister;
                    break;

                case "Sales Invoice Register":
                    frmObj = new frmSalesInvoiceRegister();
                    open   = Application.OpenForms["frmSalesInvoiceRegister"] as frmSalesInvoiceRegister;
                    break;

                case "Sales Return Register":
                    frmObj = new frmSalesReturnRegister();
                    open   = Application.OpenForms["frmSalesReturnRegister"] as frmSalesReturnRegister;
                    break;

                case "Physical Stock Register":
                    frmObj = new frmPhysicalStockRegister();
                    open   = Application.OpenForms["frmPhysicalStockRegister"] as frmPhysicalStockRegister;
                    break;

                case "Service Voucher Register":
                    frmObj = new frmServiceVoucherRegister();
                    open   = Application.OpenForms["frmServiceVoucherRegister"] as frmServiceVoucherRegister;
                    break;

                case "Credit Note Register":
                    frmObj = new frmCreditNoteRegister();
                    open   = Application.OpenForms["frmCreditNoteRegister"] as frmCreditNoteRegister;
                    break;

                case "Debit Note Register":
                    frmObj = new frmDebitNoteRegister();
                    open   = Application.OpenForms["frmDebitNoteRegister"] as frmDebitNoteRegister;
                    break;

                case "Stock Journal Register":
                    frmObj = new frmStockJournalRegister();
                    open   = Application.OpenForms["frmStockJournalRegister"] as frmStockJournalRegister;
                    break;

                case "Designation":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmDesignation();
                        open   = Application.OpenForms["frmDesignation"] as frmDesignation;
                    }
                    break;

                case "Pay Head":
                {
                    frmObj = new frmPayHead();
                    open   = Application.OpenForms["frmPayHead"] as frmPayHead;
                }
                break;

                case "Salary Package Creation":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmSalaryPackageCreation();
                        open   = Application.OpenForms["frmSalaryPackageCreation"] as frmSalaryPackageCreation;
                    }
                    break;

                case "Salary Package Register":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmSalaryPackageRegister();
                        open   = Application.OpenForms["frmSalaryPackageRegister"] as frmSalaryPackageRegister;
                    }
                    break;

                case "Employee Creation":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmEmployeeCreation();
                        open   = Application.OpenForms["frmEmployeeCreation"] as frmEmployeeCreation;
                    }
                    break;

                case "Employee Register":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmEmployeeRegister();
                        open   = Application.OpenForms["frmEmployeeRegister"] as frmEmployeeRegister;
                    }
                    break;

                case "Holiday Settings":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmHolydaySettings();
                        open   = Application.OpenForms["frmHolydaySettings"] as frmHolydaySettings;
                    }
                    break;

                case "Monthly Salary Settings":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmMonthlySalarySettings();
                        open   = Application.OpenForms["frmMonthlySalarySettings"] as frmMonthlySalarySettings;
                    }
                    break;

                case "Attendance":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmAttendance();
                        open   = Application.OpenForms["frmAttendance"] as frmAttendance;
                    }
                    break;

                case "Advance Payment":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmAdvancePayment();
                        open   = Application.OpenForms["frmAdvancePayment"] as frmAdvancePayment;
                    }
                    break;

                case "Advance Register":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmAdvanceRegister();
                        open   = Application.OpenForms["frmAdvanceRegister"] as frmAdvanceRegister;
                    }
                    break;

                case "Bonus Deduction":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmBonusDeduction();
                        open   = Application.OpenForms["frmBonusDeduction"] as frmBonusDeduction;
                    }
                    break;

                case "Bonus Deduction Register":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmBonusDeductionRegister();
                        open   = Application.OpenForms["frmBonusDeductionRegister"] as frmBonusDeductionRegister;
                    }
                    break;

                case "Monthly Salary Voucher":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmMonthlySalaryVoucher();
                        open   = Application.OpenForms["frmMonthlySalaryVoucher"] as frmMonthlySalaryVoucher;
                    }
                    break;

                case "Monthly Salary Register":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmMonthlySalaryRegister();
                        open   = Application.OpenForms["frmMonthlySalaryRegister"] as frmMonthlySalaryRegister;
                    }
                    break;

                case "Daily Salary Voucher":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmDailySalaryVoucher();
                        open   = Application.OpenForms["frmDailySalaryVoucher"] as frmDailySalaryVoucher;
                    }
                    break;

                case "Daily Salary Register":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmDailySalaryRegister();
                        open   = Application.OpenForms["frmDailySalaryRegister"] as frmDailySalaryRegister;
                    }
                    break;

                case "Pay Slip":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmPaySlip();
                        open   = Application.OpenForms["frmPaySlip"] as frmPaySlip;
                    }
                    break;

                case "Budget":
                    if (spSettings.SettingsStatusCheck("Budget") == "Yes")
                    {
                        frmObj = new frmBudget();
                        open   = Application.OpenForms["frmBudget"] as frmBudget;
                    }
                    break;

                case "Budget Variance":
                    if (spSettings.SettingsStatusCheck("Budget") == "Yes")
                    {
                        frmObj = new frmBudgetVariance();
                        open   = Application.OpenForms["frmBudgetVariance"] as frmBudgetVariance;
                    }
                    break;

                case "Change Current Date":
                    frmObj = new frmChangeCurrentDate();
                    open   = Application.OpenForms["frmChangeCurrentDate"] as frmChangeCurrentDate;
                    break;

                case "Settings":
                    frmObj = new frmSettings();
                    open   = Application.OpenForms["frmSettings"] as frmSettings;
                    break;

                case "Role":
                    frmObj = new frmRole();
                    open   = Application.OpenForms["frmRole"] as frmRole;
                    break;

                case "Role Privilege Settings":
                    frmObj = new frmRolePrivilegeSettings();
                    open   = Application.OpenForms["frmRolePrivilegeSettings"] as frmRolePrivilegeSettings;
                    break;

                case "User Creation":
                    frmObj = new frmUserCreation();
                    open   = Application.OpenForms["frmUserCreation"] as frmUserCreation;
                    break;

                case "Change Password":
                    frmObj = new frmChangePassword();
                    open   = Application.OpenForms["frmChangePassword"] as frmChangePassword;
                    break;

                case "New Financial Year":
                    frmObj = new frmNewFinancialYear();
                    open   = Application.OpenForms["frmNewFinancialYear"] as frmNewFinancialYear;
                    break;

                case "Change Financial Year":
                    frmObj = new frmChangeFinancialYear();
                    open   = Application.OpenForms["frmChangeFinancialYear"] as frmChangeFinancialYear;
                    break;

                case "Barcode Settings":
                    frmObj = new frmBarcodeSettings();
                    open   = Application.OpenForms["frmBarcodeSettings"] as frmBarcodeSettings;
                    break;

                case "Barcode Printing":
                    frmObj = new frmBarcodePrinting();
                    open   = Application.OpenForms["frmBarcodePrinting"] as frmBarcodePrinting;
                    break;

                case "Suffix Prefix Settings":
                    frmObj = new frmSuffixPrefixSettings();
                    open   = Application.OpenForms["frmSuffixPrefixSettings"] as frmSuffixPrefixSettings;
                    break;

                case "Change Product Tax":
                    frmObj = new frmChangeProductTax();
                    open   = Application.OpenForms["frmChangeProductTax"] as frmChangeProductTax;
                    break;

                case "Product Search":
                    frmObj = new frmProductSearch();
                    open   = Application.OpenForms["frmProductSearch"] as frmProductSearch;
                    break;

                case "Voucher Search":
                    frmObj = new frmVoucherSearch();
                    open   = Application.OpenForms["frmVoucherSearch"] as frmVoucherSearch;
                    break;

                case "Voucher Wise Product Search":
                    frmObj = new frmVoucherWiseProductSearch();
                    open   = Application.OpenForms["frmVoucherWiseProductSearch"] as frmVoucherWiseProductSearch;
                    break;

                case "Personal Reminder":
                    frmObj = new frmPersonalReminder();
                    open   = Application.OpenForms["frmPersonalReminder"] as frmPersonalReminder;
                    break;

                case "Overdue Purchase Order":
                    frmObj = new frmOverduePurchaseOrder();
                    open   = Application.OpenForms["frmOverduePurchaseOrder"] as frmOverduePurchaseOrder;
                    break;

                case "Overdue Sales Order":
                    frmObj = new frmOverdueSalesOrder();
                    open   = Application.OpenForms["frmOverdueSalesOrder"] as frmOverdueSalesOrder;
                    break;

                case "Short Expiry":
                    frmObj = new frmShortExpiry();
                    open   = Application.OpenForms["frmShortExpiry"] as frmShortExpiry;
                    break;

                case "Stock":
                    frmObj = new frmStock();
                    open   = Application.OpenForms["frmStock"] as frmStock;
                    break;

                case "Trial Balance":
                    frmObj = new frmTrialBalance();
                    open   = Application.OpenForms["frmTrialBalance"] as frmTrialBalance;
                    break;

                case "Balance Sheet":
                    frmObj = new frmBalanceSheet();
                    open   = Application.OpenForms["frmBalanceSheet"] as frmBalanceSheet;
                    break;

                case "Profit and Loss":
                    frmObj = new frmProfitAndLoss();
                    open   = Application.OpenForms["frmProfitAndLoss"] as frmProfitAndLoss;
                    break;

                case "Cash Flow":
                    frmObj = new frmCashFlow();
                    open   = Application.OpenForms["frmCashFlow"] as frmCashFlow;
                    break;

                case "Fund Flow":
                    frmObj = new frmFundFlow();
                    open   = Application.OpenForms["frmFundFlow"] as frmFundFlow;
                    break;

                case "Chart of Account":
                    frmObj = new frmChartOfAccount();
                    open   = Application.OpenForms["frmChartOfAccount"] as frmChartOfAccount;
                    break;

                case "Contra Report":
                    frmObj = new frmContraReport();
                    open   = Application.OpenForms["frmContraReport"] as frmContraReport;
                    break;

                case "Payment Report":
                    frmObj = new frmPaymentReport();
                    open   = Application.OpenForms["frmPaymentReport"] as frmPaymentReport;
                    break;

                case "Receipt Report":
                    frmObj = new frmReceiptReport();
                    open   = Application.OpenForms["frmReceiptReport"] as frmReceiptReport;
                    break;

                case "Journal Report":
                    frmObj = new frmJournalReport();
                    open   = Application.OpenForms["frmJournalReport"] as frmJournalReport;
                    break;

                case "PDC Payable Report":
                    frmObj = new frmPDCPayableReport();
                    open   = Application.OpenForms["frmPDCPayableReport"] as frmPDCPayableReport;
                    break;

                case "PDC Receivable Report":
                    frmObj = new frmPDCRecievableReport();
                    open   = Application.OpenForms["frmPDCRecievableReport"] as frmPDCRecievableReport;
                    break;

                case "PDC Clearance Report":
                    frmObj = new frmPDCClearanceReport();
                    open   = Application.OpenForms["frmPDCClearanceReport"] as frmPDCClearanceReport;
                    break;

                case "Purchase Order Report":
                    frmObj = new frmPurchaseOrderReport();
                    open   = Application.OpenForms["frmPurchaseOrderReport"] as frmPurchaseOrderReport;
                    break;

                case "Material Receipt Report":
                    frmObj = new frmMaterialReceiptReport();
                    open   = Application.OpenForms["frmMaterialReceiptReport"] as frmMaterialReceiptReport;
                    break;

                case "Rejection Out Report":
                    frmObj = new frmRejectionOutReport();
                    open   = Application.OpenForms["frmRejectionOutReport"] as frmRejectionOutReport;
                    break;

                case "Purchase Invoice Report":
                    frmObj = new frmPurchaseReport();
                    open   = Application.OpenForms["frmPurchaseReport"] as frmPurchaseReport;
                    break;

                case "Purchase Return Report":
                    frmObj = new frmPurchaseReturnReport();
                    open   = Application.OpenForms["frmPurchaseReturnReport"] as frmPurchaseReturnReport;
                    break;

                case "Sales Quotation Report":
                    frmObj = new frmSalesQuotationReport();
                    open   = Application.OpenForms["frmSalesQuotationReport"] as frmSalesQuotationReport;
                    break;

                case "Sales Order Report":
                    frmObj = new frmSalesOrderReport();
                    open   = Application.OpenForms["frmSalesOrderReport"] as frmSalesOrderReport;
                    break;

                case "Delivery Note Report":
                    frmObj = new frmDeliveryNoteReport();
                    open   = Application.OpenForms["frmDeliveryNoteReport"] as frmDeliveryNoteReport;
                    break;

                case "Rejection In Report":
                    frmObj = new frmRejectionInReport();
                    open   = Application.OpenForms["frmRejectionInReport"] as frmRejectionInReport;
                    break;

                case "Sales Invoice Report":
                    frmObj = new frmSalesReport();
                    open   = Application.OpenForms["frmSalesReport"] as frmSalesReport;
                    break;

                case "Sales Return Report":
                    frmObj = new frmSalesReturnReport();
                    open   = Application.OpenForms["frmSalesReturnReport"] as frmSalesReturnReport;
                    break;

                case "Physical Stock Report":
                    frmObj = new frmPhysicalStockReport();
                    open   = Application.OpenForms["frmPhysicalStockReport"] as frmPhysicalStockReport;
                    break;

                case "Service Report":
                    frmObj = new frmServiceReport();
                    open   = Application.OpenForms["frmServiceReport"] as frmServiceReport;
                    break;

                case "Credit Note Report":
                    frmObj = new frmCreditNoteReport();
                    open   = Application.OpenForms["frmCreditNoteReport"] as frmCreditNoteReport;
                    break;

                case "Debit Note Report":
                    frmObj = new frmDebitNoteReport();
                    open   = Application.OpenForms["frmDebitNoteReport"] as frmDebitNoteReport;
                    break;

                case "Stock Journal Report":
                    frmObj = new frmStockJournelReport();
                    open   = Application.OpenForms["frmStockJournelReport"] as frmStockJournelReport;
                    break;

                case "Employee Report":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmEmployeeReport();
                        open   = Application.OpenForms["frmEmployeeReport"] as frmEmployeeReport;
                    }
                    break;

                case "Daily Attendance Report":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmDailyAttendanceReport();
                        open   = Application.OpenForms["frmDailyAttendanceReport"] as frmDailyAttendanceReport;
                    }
                    break;

                case "Monthly Attendance Report":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmMonthlyAttendanceReport();
                        open   = Application.OpenForms["frmMonthlyAttendanceReport"] as frmMonthlyAttendanceReport;
                    }
                    break;

                case "Daily Salary Report":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmDailySalaryReport();
                        open   = Application.OpenForms["frmDailySalaryReport"] as frmDailySalaryReport;
                    }
                    break;

                case "Monthly Salary Report":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmMonthlySalaryReport();
                        open   = Application.OpenForms["frmMonthlySalaryReport"] as frmMonthlySalaryReport;
                    }
                    break;

                case "Payhead Report":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmPayHeadReport();
                        open   = Application.OpenForms["frmPayHeadReport"] as frmPayHeadReport;
                    }
                    break;

                case "Salary Package Report":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmSalaryPackageReport();
                        open   = Application.OpenForms["frmSalaryPackageReport"] as frmSalaryPackageReport;
                    }
                    break;

                case "Advance Payment Report":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmAdvancePaymentReport();
                        open   = Application.OpenForms["frmAdvancePaymentReport"] as frmAdvancePaymentReport;
                    }
                    break;

                case "Bonus Deduction Report":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmBonusDeductionReport();
                        open   = Application.OpenForms["frmBonusDeductionReport"] as frmBonusDeductionReport;
                    }
                    break;

                case "Employee Address Book Report":
                    if (spSettings.SettingsStatusCheck("Payroll") == "Yes")
                    {
                        frmObj = new frmEmployeeAddressBook();
                        open   = Application.OpenForms["frmEmployeeAddressBook"] as frmEmployeeAddressBook;
                    }
                    break;

                case "Day Book":
                    frmObj = new frmDayBook();
                    open   = Application.OpenForms["frmDayBook"] as frmDayBook;
                    break;

                case "Cash/Bank Book":
                    frmObj = new frmCashBankBookReport();
                    open   = Application.OpenForms["frmCashBankBookReport"] as frmCashBankBookReport;
                    break;

                case "Account Groupwise Report":
                    frmObj = new frmAccountGroupwiseReport();
                    open   = Application.OpenForms["frmAccountGroupwiseReport"] as frmAccountGroupwiseReport;
                    break;

                case "Account Ledger Report":
                    frmObj = new frmAccountLedgerReport();
                    open   = Application.OpenForms["frmAccountLedgerReport"] as frmAccountLedgerReport;
                    break;

                case "Outstanding Report":
                    frmObj = new frmOutstandingReport();
                    open   = Application.OpenForms["frmOutstandingReport"] as frmOutstandingReport;
                    break;

                case "Ageing Report":
                    frmObj = new frmAgeingReport();
                    open   = Application.OpenForms["frmAgeingReport"] as frmAgeingReport;
                    break;

                case "Party's Address Book":
                    frmObj = new frmPartyAddressBook();
                    open   = Application.OpenForms["frmPartyAddressBook"] as frmPartyAddressBook;
                    break;

                case "Stock Report":
                    frmObj = new frmStockReport();
                    open   = Application.OpenForms["frmStockReport"] as frmStockReport;
                    break;

                case "Short Expiry Report":
                    frmObj = new frmShortExpiryReport();
                    open   = Application.OpenForms["frmShortExpiryReport"] as frmShortExpiryReport;
                    break;

                case "Product Statistics":
                    frmObj = new frmProductStatistics();
                    open   = Application.OpenForms["frmProductStatistics"] as frmProductStatistics;
                    break;

                case "Price List Report":
                    frmObj = new frmPriceListReport();
                    open   = Application.OpenForms["frmPriceListReport"] as frmPriceListReport;
                    break;

                case "Tax Report":
                    frmObj = new frmTaxReport();
                    open   = Application.OpenForms["frmTaxReport"] as frmTaxReport;
                    break;

                case "VAT Report":
                    frmObj = new frmVatReturnReport();
                    open   = Application.OpenForms["frmVatReturnReport"] as frmVatReturnReport;
                    break;

                case "Cheque Report":
                    frmObj = new frmChequeReport();
                    open   = Application.OpenForms["frmChequeReport"] as frmChequeReport;
                    break;

                case "Free Sale Report":
                    frmObj = new frmFreeSaleReport();
                    open   = Application.OpenForms["frmFreeSaleReport"] as frmFreeSaleReport;
                    break;

                case "Product Vs Batch Report":
                    frmObj = new frmProductVsBatchReport();
                    open   = Application.OpenForms["frmProductVsBatchReport"] as frmProductVsBatchReport;
                    break;

                case "Customer":
                    frmObj = new frmCustomer();
                    open   = Application.OpenForms["frmCustomer"] as frmCustomer;
                    break;

                case "Supplier":
                    frmObj = new frmSupplier();
                    open   = Application.OpenForms["frmSupplier"] as frmSupplier;
                    break;
                }
                if (frmObj != null)
                {
                    if (open == null)
                    {
                        frmObj.MdiParent = formMDI.MDIObj;
                        frmObj.Show();
                    }
                    else
                    {
                        open.Activate();
                        if (open.WindowState == FormWindowState.Minimized)
                        {
                            open.WindowState = FormWindowState.Normal;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("QL:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }