/// <summary> /// Cell double click in grid to view the curresponding item in that form and open the form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvVoucherwiseProductSearch_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex!=-1) { int inI = dgvVoucherwiseProductSearch.CurrentCell.RowIndex; foreach (DataGridViewRow dgv in dgvVoucherwiseProductSearch.Rows) { decMasterId = decimal.Parse(dgv.Cells["dgvtxtmasterId"].Value.ToString()); strVoucherType = dgv.Cells["dgvtxtTypeOfVoucher"].Value.ToString(); decVoucherTypeId = Convert.ToDecimal(dgv.Cells["dgvtxtvoucherTypeId"].Value.ToString()); if (dgv.Index == inI) { break; } } if (decMasterId != 0 && strVoucherType == "Material Receipt") { frmMaterialReceipt objReceipt = new frmMaterialReceipt(); objReceipt.WindowState = FormWindowState.Normal; objReceipt.MdiParent = formMDI.MDIObj; objReceipt.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Physical Stock") { frmPhysicalStock objPhysical = new frmPhysicalStock(); objPhysical.WindowState = FormWindowState.Normal; objPhysical.MdiParent = formMDI.MDIObj; objPhysical.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Purchase Invoice") { frmPurchaseInvoice objpurchase = new frmPurchaseInvoice(); objpurchase.WindowState = FormWindowState.Normal; objpurchase.MdiParent = formMDI.MDIObj; objpurchase.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Rejection Out") { frmRejectionOut objRejection = new frmRejectionOut(); objRejection.WindowState = FormWindowState.Normal; objRejection.MdiParent = formMDI.MDIObj; objRejection.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Rejection In") { frmRejectionIn objRejection = new frmRejectionIn(); objRejection.WindowState = FormWindowState.Normal; objRejection.MdiParent = formMDI.MDIObj; objRejection.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Purchase Return") { frmPurchaseReturn objPurchase = new frmPurchaseReturn(); objPurchase.WindowState = FormWindowState.Normal; objPurchase.MdiParent = formMDI.MDIObj; objPurchase.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Sales Return") { frmSalesReturn frmObj = new frmSalesReturn(); frmObj.WindowState = FormWindowState.Normal; frmObj.MdiParent = formMDI.MDIObj; frmObj.CallFromVoucherWiseProductSearch(this, decMasterId, true); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Delivery Note") { frmDeliveryNote objDeliveryReport = new frmDeliveryNote(); objDeliveryReport.WindowState = FormWindowState.Normal; objDeliveryReport.MdiParent = formMDI.MDIObj; objDeliveryReport.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Sales Order") { frmSalesOrder dbjfrmSalesorder = new frmSalesOrder(); dbjfrmSalesorder.WindowState = FormWindowState.Normal; dbjfrmSalesorder.MdiParent = formMDI.MDIObj; dbjfrmSalesorder.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Purchase Order") { frmPurchaseOrder objfrmPurchaseorder = new frmPurchaseOrder(); objfrmPurchaseorder.WindowState = FormWindowState.Normal; objfrmPurchaseorder.MdiParent = formMDI.MDIObj; objfrmPurchaseorder.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Sales Quotation") { frmSalesQuotation objfrmSalesquotation = new frmSalesQuotation(); objfrmSalesquotation.WindowState = FormWindowState.Normal; objfrmSalesquotation.MdiParent = formMDI.MDIObj; objfrmSalesquotation.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Sales Invoice") { frmSalesInvoice objSalesReport = new frmSalesInvoice(); //SalesMasterSP spSalesMaster = new SalesMasterSP(); SalesInvoiceBll BllSalesInvoice = new SalesInvoiceBll(); objSalesReport.WindowState = FormWindowState.Normal; objSalesReport.MdiParent = formMDI.MDIObj; bool blPOS = BllSalesInvoice.DayBookSalesInvoiceOrPOS(decMasterId, decVoucherTypeId); frmSalesInvoice frmSalesInvoice = new frmSalesInvoice(); frmPOS frmPOS = new frmPOS(); if (blPOS == true) { frmPOS = Application.OpenForms["frmPOS"] as frmPOS; if (frmPOS == null) { frmPOS = new frmPOS(); frmPOS.MdiParent = formMDI.MDIObj; frmPOS.callFromVoucherWiseProductSearch(this, decMasterId); } } else { frmSalesInvoice = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice; if (frmSalesInvoice == null) { frmSalesInvoice = new frmSalesInvoice(); frmSalesInvoice.MdiParent = formMDI.MDIObj; objSalesReport.CallFromVoucherWiseProductSearch(this, decMasterId); } } this.Enabled = false; } } } catch (Exception ex) { MessageBox.Show("VPS :11" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// When doubleclicking on the grid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvReport_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { decimal decVouchertypeId = 0; string strVoucherNo = string.Empty; try { if (dgvReport.CurrentRow.Index == e.RowIndex) { if ((dgvReport.CurrentRow.Cells["voucherTypeId"].Value != null && dgvReport.CurrentRow.Cells["voucherTypeId"].Value.ToString() != string.Empty)) { int inI = dgvReport.CurrentCell.RowIndex; foreach (DataGridViewRow dgv in dgvReport.Rows) { if (dgv.Cells["VoucherNo"].Value != null && dgv.Cells["VoucherNo"].Value.ToString() != string.Empty && dgv.Cells["voucherTypeId"].Value != null && dgv.Cells["voucherTypeId"].Value.ToString() != string.Empty) { strVoucherType = dgv.Cells["VoucherType"].Value.ToString(); decVouchertypeId = Convert.ToDecimal(dgv.Cells["voucherTypeId"].Value.ToString()); strVoucherNo = dgv.Cells["VoucherNo"].Value.ToString(); } else { if (dgv.Cells["ledgerId"].Value.ToString() != string.Empty) { decledgerId = decimal.Parse(dgv.Cells["ledgerId"].Value.ToString()); strVoucherType = dgv.Cells["Account Ledger"].Value.ToString(); frmLedgerDetails frmLedger = new frmLedgerDetails(); frmLedger = Application.OpenForms["frmLedgerDetails"] as frmLedgerDetails; if (frmLedger == null) { frmLedger = new frmLedgerDetails(); frmLedger.MdiParent = formMDI.MDIObj; frmLedger.callFromAgeing(this, decledgerId); this.Enabled = false; } } } if (dgv.Index == inI) { break; } } if (strVoucherType == "Payment Voucher") { PaymentVoucherBll BllPaymentVoucher = new PaymentVoucherBll(); decMasterId = BllPaymentVoucher.paymentMasterIdView(decVouchertypeId, strVoucherNo); frmPaymentVoucher frmPaymentVoucher = new frmPaymentVoucher(); frmPaymentVoucher = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher; if (frmPaymentVoucher == null) { frmPaymentVoucher = new frmPaymentVoucher(); frmPaymentVoucher.MdiParent = formMDI.MDIObj; frmPaymentVoucher.callFromAgeing(this, decMasterId); this.Enabled = false; } } else if (strVoucherType == "Receipt Voucher") { RecieptVoucherBll bllRecieptVoucher = new RecieptVoucherBll(); //ReceiptMasterSP spRecieptMaster = new ReceiptMasterSP(); decMasterId = bllRecieptVoucher.ReceiptMasterIdView(decVouchertypeId, strVoucherNo); frmReceiptVoucher frmReceiptVoucher = new frmReceiptVoucher(); frmReceiptVoucher = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher; if (frmReceiptVoucher == null) { frmReceiptVoucher = new frmReceiptVoucher(); frmReceiptVoucher.MdiParent = formMDI.MDIObj; frmReceiptVoucher.callFromAgeing(this, decMasterId); this.Enabled = false; } } else if (strVoucherType == "Journal Voucher") { JournalVoucherBll bllJournalMaster = new JournalVoucherBll(); decMasterId = bllJournalMaster.JournalMasterIdView(decVouchertypeId, strVoucherNo); frmJournalVoucher frmJournalVoucher = new frmJournalVoucher(); frmJournalVoucher = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher; if (frmJournalVoucher == null) { frmJournalVoucher = new frmJournalVoucher(); frmJournalVoucher.MdiParent = formMDI.MDIObj; frmJournalVoucher.callFromAgeing(this, decMasterId); this.Enabled = false; } } else if (strVoucherType == "PDC Receivable") { PDCRecivebleBll BllPDCReciveble = new PDCRecivebleBll(); decMasterId = BllPDCReciveble.PdcReceivableMasterIdView(decVouchertypeId, strVoucherNo); frmPdcReceivable frmPdcReceivable = new frmPdcReceivable(); frmPdcReceivable = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable; if (frmPdcReceivable == null) { frmPdcReceivable = new frmPdcReceivable(); frmPdcReceivable.MdiParent = formMDI.MDIObj; frmPdcReceivable.callFromAgeing(this, decMasterId); this.Enabled = false; } } else if (strVoucherType == "PDC Payable") { PDCPayableBll BllPDCPayable = new PDCPayableBll(); decMasterId = BllPDCPayable.PdcPayableMasterIdView(decVouchertypeId, strVoucherNo); frmPdcPayable frmPdcPayable = new frmPdcPayable(); frmPdcPayable = Application.OpenForms["frmPdcPayable"] as frmPdcPayable; if (frmPdcPayable == null) { frmPdcPayable = new frmPdcPayable(); frmPdcPayable.MdiParent = formMDI.MDIObj; frmPdcPayable.callFromAgeing(this, decMasterId); this.Enabled = false; } } else if (strVoucherType == "Sales Invoice") { //SalesMasterSP spMaster = new SalesMasterSP(); SalesInvoiceBll BllSalesInvoice = new SalesInvoiceBll(); decMasterId = BllSalesInvoice.SalesMasterIdViewByvoucherNoAndVoucherType(decVouchertypeId, strVoucherNo); //SalesMasterSP spSalesMaster = new SalesMasterSP(); bool blPOS = BllSalesInvoice.DayBookSalesInvoiceOrPOS(decMasterId, decVouchertypeId); frmSalesInvoice frmSalesInvoice = new frmSalesInvoice(); frmPOS frmPOS = new frmPOS(); if (blPOS == true) { frmPOS = Application.OpenForms["frmPOS"] as frmPOS; if (frmPOS == null) { frmPOS = new frmPOS(); frmPOS.MdiParent = formMDI.MDIObj; frmPOS.callFromAgeing(this, decMasterId); this.Enabled = false; } } else { frmSalesInvoice = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice; if (frmSalesInvoice == null) { frmSalesInvoice = new frmSalesInvoice(); frmSalesInvoice.MdiParent = formMDI.MDIObj; frmSalesInvoice.callFromAgeing(this, decMasterId); this.Enabled = false; } } } else if (strVoucherType == "Purchase Invoice") { PurchaseInvoiceBll BllPurchaseInvoice = new PurchaseInvoiceBll(); decMasterId = BllPurchaseInvoice.PurchaseMasterIdViewByvoucherNoAndVoucherType(decVouchertypeId, strVoucherNo); frmPurchaseInvoice objpurchase = new frmPurchaseInvoice(); objpurchase.WindowState = FormWindowState.Normal; objpurchase.MdiParent = formMDI.MDIObj; objpurchase.callFromAgeing(this, decMasterId); this.Enabled = false; } else if (strVoucherType == "Credit Note") { CreditNoteBll BllCreditNoteMaster = new CreditNoteBll(); decMasterId = BllCreditNoteMaster.CreditNoteMasterIdView(decVouchertypeId, strVoucherNo); frmCreditNote objpurchase = new frmCreditNote(); objpurchase.WindowState = FormWindowState.Normal; objpurchase.MdiParent = formMDI.MDIObj; objpurchase.callFromAgeing(this, decMasterId); this.Enabled = false; } else if (strVoucherType == "Debit Note") { //DebitNoteMasterSP spDebitNote = new DebitNoteMasterSP(); DebitNoteBll bllDebitNote = new DebitNoteBll(); decMasterId = bllDebitNote.DebitNoteMasterIdView(decVouchertypeId, strVoucherNo); frmDebitNote objpurchase = new frmDebitNote(); objpurchase.WindowState = FormWindowState.Normal; objpurchase.MdiParent = formMDI.MDIObj; objpurchase.callFromAgeing(this, decMasterId); this.Enabled = false; } } } } catch (Exception ex) { MessageBox.Show("AR17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <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(); SalesInvoiceBll BllSalesInvoice = new SalesInvoiceBll(); 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 = BllSalesInvoice.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); } }