Exemplo n.º 1
0
 /// <summary>
 /// Calls Corresponding voucher for updation on 'ViewDetails' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnViewDetails_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvJournalRegister.CurrentRow != null)
         {
             frmJournalVoucher frmJournalVoucherObj = new frmJournalVoucher();
             frmJournalVoucher open        = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
             decimal           decMasterId = Convert.ToDecimal(dgvJournalRegister.CurrentRow.Cells["dgvtxtJournalMasterId"].Value.ToString());
             if (open == null)
             {
                 frmJournalVoucherObj.WindowState = FormWindowState.Normal;
                 frmJournalVoucherObj.MdiParent   = formMDI.MDIObj;
                 frmJournalVoucherObj.CallFromJournalRegister(this, decMasterId);
             }
             else
             {
                 open.MdiParent = formMDI.MDIObj;
                 open.BringToFront();
                 open.CallFromJournalRegister(this, decMasterId);
                 if (open.WindowState == FormWindowState.Minimized)
                 {
                     open.WindowState = FormWindowState.Normal;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("JREG8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Cell double click to open the curresponding details into the form JournalVoucher for updation
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvJournalReport_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             if (dgvJournalReport.CurrentRow.Index == e.RowIndex)
             {
                 decimal           decMasterId          = Convert.ToDecimal(dgvJournalReport.Rows[e.RowIndex].Cells["dgvtxtJournalMasterId"].Value.ToString());
                 frmJournalVoucher frmJournalVoucherObj = new frmJournalVoucher();
                 frmJournalVoucher open = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                 if (open == null)
                 {
                     frmJournalVoucherObj.WindowState = FormWindowState.Normal;
                     frmJournalVoucherObj.MdiParent   = formMDI.MDIObj;
                     frmJournalVoucherObj.CallFromJournalReport(this, decMasterId);
                 }
                 else
                 {
                     open.MdiParent = formMDI.MDIObj;
                     open.BringToFront();
                     open.CallFromJournalReport(this, decMasterId);
                     if (open.WindowState == FormWindowState.Minimized)
                     {
                         open.WindowState = FormWindowState.Normal;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("JVREP31:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to call this form from frmJournalVoucher
 /// </summary>
 /// <param name="frmJournalVoucher"></param>
 /// <param name="decId"></param>
 public void CallFromJournalVoucher(frmJournalVoucher frmJournalVoucher, decimal decId)
 {
     try
     {
         base.Show();
         this.frmJournalVoucherObj    = frmJournalVoucher;
         frmJournalVoucherObj.Enabled = false;
         int inRowCount = dgvCurrency.Rows.Count;
         for (int ini = 0; ini < inRowCount; ini++)
         {
             if (Convert.ToDecimal(dgvCurrency.Rows[ini].Cells["dgvtxtCurrencyId"].Value.ToString()) == decId)
             {
                 dgvCurrency.Rows[ini].DefaultCellStyle.BackColor = Color.MediumSeaGreen;
             }
         }
         txtCurrencyName.Focus();
     }
     catch (Exception ex)
     {
         MessageBox.Show("CDP8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 4
0
        /// <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")
                        {
                            PaymentMasterSP spPaymentMaster = new PaymentMasterSP();
                            decMasterId = spPaymentMaster.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")
                        {
                            ReceiptMasterSP spRecieptMaster = new ReceiptMasterSP();
                            decMasterId = spRecieptMaster.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")
                        {
                            JournalMasterSP spJournalMaster = new JournalMasterSP();
                            decMasterId = spJournalMaster.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")
                        {
                            PDCReceivableMasterSP spPdcRecievabl = new PDCReceivableMasterSP();
                            decMasterId = spPdcRecievabl.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")
                        {
                            PDCPayableMasterSP spPdcPayable = new PDCPayableMasterSP();
                            decMasterId = spPdcPayable.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();
                            decMasterId = spMaster.SalesMasterIdViewByvoucherNoAndVoucherType(decVouchertypeId, strVoucherNo);
                            SalesMasterSP   spSalesMaster   = new SalesMasterSP();
                            bool            blPOS           = spSalesMaster.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")
                        {
                            PurchaseMasterSP spPurchaseMaster = new PurchaseMasterSP();
                            decMasterId = spPurchaseMaster.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")
                        {
                            CreditNoteMasterSP spCreditNoteMaster = new CreditNoteMasterSP();
                            decMasterId = spCreditNoteMaster.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();
                            decMasterId = spDebitNote.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>
        /// 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>
        /// On double clicking the cell in grid, it loads the corresponding Voucher to update or delete the entries
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvBillAllocation_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    decVoucherTypeId = Convert.ToDecimal(dgvBillAllocation.CurrentRow.Cells["voucherTypeId"].Value.ToString());

                    strTypeOfVoucher = dgvBillAllocation.CurrentRow.Cells["typeOfVoucher"].Value.ToString();
                    strVoucherNo = dgvBillAllocation.CurrentRow.Cells["voucherNo"].Value.ToString();
                    if (strTypeOfVoucher == "PDC Payable")
                    {
                        PDCPayableBll BllPDCPayable = new PDCPayableBll();
                        decimal decMasterId = BllPDCPayable.PdcPayableMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPdcPayable frmpdcPayableObj = new frmPdcPayable();
                        frmpdcPayableObj = Application.OpenForms["frmPdcPayable"] as frmPdcPayable;

                        if (frmpdcPayableObj == null)
                        {
                            frmpdcPayableObj = new frmPdcPayable();
                            frmpdcPayableObj.MdiParent = formMDI.MDIObj;

                            frmpdcPayableObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "PDC Receivable")
                    {
                        PDCRecivebleBll BllPDCReciveble = new PDCRecivebleBll();
                        decimal decMasterId = BllPDCReciveble.PdcReceivableMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPdcReceivable frmPdcReceivableObj = new frmPdcReceivable();
                        frmPdcReceivableObj = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable;
                        if (frmPdcReceivableObj == null)
                        {
                            frmPdcReceivableObj = new frmPdcReceivable();
                            frmPdcReceivableObj.MdiParent = formMDI.MDIObj;
                            frmPdcReceivableObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Payment Voucher")
                    {
                        PaymentVoucherBll BllPaymentVoucher = new PaymentVoucherBll();
                        decimal decMasterId = BllPaymentVoucher.paymentMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPaymentVoucher frmPaymentVoucherObj = new frmPaymentVoucher();
                        frmPaymentVoucherObj = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher;
                        if (frmPaymentVoucherObj == null)
                        {
                            frmPaymentVoucherObj = new frmPaymentVoucher();
                            frmPaymentVoucherObj.MdiParent = formMDI.MDIObj;

                            frmPaymentVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Receipt Voucher")
                    {

                        RecieptVoucherBll bllRecieptVoucherBll = new RecieptVoucherBll();
                        decimal decMasterId = bllRecieptVoucherBll.ReceiptMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmReceiptVoucher frmReceiptVoucherObj = new frmReceiptVoucher();
                        frmReceiptVoucherObj = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher;
                        if (frmReceiptVoucherObj == null)
                        {
                            frmReceiptVoucherObj = new frmReceiptVoucher();
                            frmReceiptVoucherObj.MdiParent = formMDI.MDIObj;

                            frmReceiptVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Journal Voucher")
                    {
                        JournalVoucherBll JournalVoucherbll = new JournalVoucherBll();
                        decimal decMasterId = JournalVoucherbll.JournalMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmJournalVoucher frmJournalVoucherObj = new frmJournalVoucher();
                        frmJournalVoucherObj = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                        if (frmJournalVoucherObj == null)
                        {
                            frmJournalVoucherObj = new frmJournalVoucher();
                            frmJournalVoucherObj.MdiParent = formMDI.MDIObj;

                            frmJournalVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Credit Note")
                    {
                        CreditNoteBll BllCreditNoteMaster = new CreditNoteBll();
                        decimal decMasterId = BllCreditNoteMaster.CreditNoteMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmCreditNote frmCreditNoteObj = new frmCreditNote();
                        frmCreditNoteObj = Application.OpenForms["frmCreditNote"] as frmCreditNote;
                        if (frmCreditNoteObj == null)
                        {
                            frmCreditNoteObj = new frmCreditNote();
                            frmCreditNoteObj.MdiParent = formMDI.MDIObj;

                            frmCreditNoteObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Debit Note")
                    {
                        //DebitNoteMasterSP sp = new DebitNoteMasterSP();
                        DebitNoteBll bll = new DebitNoteBll();
                        decimal decMasterId = bll.DebitNoteMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmDebitNote frmDebitNoteObj = new frmDebitNote();
                        frmDebitNoteObj = Application.OpenForms["frmDebitNote"] as frmDebitNote;
                        if (frmDebitNoteObj == null)
                        {
                            frmDebitNoteObj = new frmDebitNote();
                            frmDebitNoteObj.MdiParent = formMDI.MDIObj;

                            frmDebitNoteObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                }
            }
            catch (Exception ex)
            {

                MessageBox.Show("BA:15" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Cell double click to open the curresponding details into the form JournalVoucher for updation
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvJournalReport_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    if (dgvJournalReport.CurrentRow.Index == e.RowIndex)
                    {
                        decimal decMasterId = Convert.ToDecimal(dgvJournalReport.Rows[e.RowIndex].Cells["dgvtxtJournalMasterId"].Value.ToString());
                        frmJournalVoucher frmJournalVoucherObj = new frmJournalVoucher();
                        frmJournalVoucher open = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                        if (open == null)
                        {
                            frmJournalVoucherObj.WindowState = FormWindowState.Normal;
                            frmJournalVoucherObj.MdiParent = formMDI.MDIObj;
                            frmJournalVoucherObj.CallFromJournalReport(this, decMasterId);
                        }
                        else
                        {
                            open.MdiParent = formMDI.MDIObj;
                            open.BringToFront();
                            open.CallFromJournalReport(this, decMasterId);
                            if (open.WindowState == FormWindowState.Minimized)
                            {
                                open.WindowState = FormWindowState.Normal;
                            }
                        }

                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("JVREP31:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Function to call this form from frmJournalVoucher for creating new account ledger
 /// </summary>
 /// <param name="journalVoucherObj"></param>
 /// <param name="strLedgerName"></param>
 public void CallFromJournalVoucher(frmJournalVoucher journalVoucherObj, string strLedgerName)
 {
     try
     {
         base.Show();
         this.frmJournalVoucherObj = journalVoucherObj;
         frmJournalVoucherObj.Enabled = false;
         dgvAccountLedger.Enabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("AL22:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// On double clicking the cell in grid, it loads the corresponding Voucher to update or delete the entries
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvBillAllocation_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    decVoucherTypeId = Convert.ToDecimal(dgvBillAllocation.CurrentRow.Cells["voucherTypeId"].Value.ToString());

                    strTypeOfVoucher = dgvBillAllocation.CurrentRow.Cells["typeOfVoucher"].Value.ToString();
                    strVoucherNo     = dgvBillAllocation.CurrentRow.Cells["voucherNo"].Value.ToString();
                    if (strTypeOfVoucher == "PDC Payable")
                    {
                        PDCPayableMasterSP sp          = new PDCPayableMasterSP();
                        decimal            decMasterId = sp.PdcPayableMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPdcPayable frmpdcPayableObj = new frmPdcPayable();
                        frmpdcPayableObj = Application.OpenForms["frmPdcPayable"] as frmPdcPayable;

                        if (frmpdcPayableObj == null)
                        {
                            frmpdcPayableObj           = new frmPdcPayable();
                            frmpdcPayableObj.MdiParent = formMDI.MDIObj;

                            frmpdcPayableObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "PDC Receivable")
                    {
                        PDCReceivableMasterSP sp = new PDCReceivableMasterSP();
                        decimal decMasterId      = sp.PdcReceivableMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPdcReceivable frmPdcReceivableObj = new frmPdcReceivable();
                        frmPdcReceivableObj = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable;
                        if (frmPdcReceivableObj == null)
                        {
                            frmPdcReceivableObj           = new frmPdcReceivable();
                            frmPdcReceivableObj.MdiParent = formMDI.MDIObj;
                            frmPdcReceivableObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Payment Voucher")
                    {
                        PaymentMasterSP sp          = new PaymentMasterSP();
                        decimal         decMasterId = sp.paymentMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPaymentVoucher frmPaymentVoucherObj = new frmPaymentVoucher();
                        frmPaymentVoucherObj = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher;
                        if (frmPaymentVoucherObj == null)
                        {
                            frmPaymentVoucherObj           = new frmPaymentVoucher();
                            frmPaymentVoucherObj.MdiParent = formMDI.MDIObj;

                            frmPaymentVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Receipt Voucher")
                    {
                        ReceiptMasterSP sp          = new ReceiptMasterSP();
                        decimal         decMasterId = sp.ReceiptMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmReceiptVoucher frmReceiptVoucherObj = new frmReceiptVoucher();
                        frmReceiptVoucherObj = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher;
                        if (frmReceiptVoucherObj == null)
                        {
                            frmReceiptVoucherObj           = new frmReceiptVoucher();
                            frmReceiptVoucherObj.MdiParent = formMDI.MDIObj;

                            frmReceiptVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Journal Voucher")
                    {
                        JournalMasterSP sp          = new JournalMasterSP();
                        decimal         decMasterId = sp.JournalMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmJournalVoucher frmJournalVoucherObj = new frmJournalVoucher();
                        frmJournalVoucherObj = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                        if (frmJournalVoucherObj == null)
                        {
                            frmJournalVoucherObj           = new frmJournalVoucher();
                            frmJournalVoucherObj.MdiParent = formMDI.MDIObj;

                            frmJournalVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Credit Note")
                    {
                        CreditNoteMasterSP sp          = new CreditNoteMasterSP();
                        decimal            decMasterId = sp.CreditNoteMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmCreditNote frmCreditNoteObj = new frmCreditNote();
                        frmCreditNoteObj = Application.OpenForms["frmCreditNote"] as frmCreditNote;
                        if (frmCreditNoteObj == null)
                        {
                            frmCreditNoteObj           = new frmCreditNote();
                            frmCreditNoteObj.MdiParent = formMDI.MDIObj;

                            frmCreditNoteObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Debit Note")
                    {
                        DebitNoteMasterSP sp          = new DebitNoteMasterSP();
                        decimal           decMasterId = sp.DebitNoteMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmDebitNote frmDebitNoteObj = new frmDebitNote();
                        frmDebitNoteObj = Application.OpenForms["frmDebitNote"] as frmDebitNote;
                        if (frmDebitNoteObj == null)
                        {
                            frmDebitNoteObj           = new frmDebitNote();
                            frmDebitNoteObj.MdiParent = formMDI.MDIObj;

                            frmDebitNoteObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "BA15:" + ex.Message;
            }
        }
 /// <summary>
 /// Function to call this form from frmJournalVoucher
 /// </summary>
 /// <param name="frmJournalVoucher"></param>
 /// <param name="decId"></param>
 public void CallFromJournalVoucher(frmJournalVoucher frmJournalVoucher, decimal decId)
 {
     try
     {
         base.Show();
         this.frmJournalVoucherObj = frmJournalVoucher;
         frmJournalVoucherObj.Enabled = false;
         int inRowCount = dgvCurrency.Rows.Count;
         for (int ini = 0; ini < inRowCount; ini++)
         {
             if (Convert.ToDecimal(dgvCurrency.Rows[ini].Cells["dgvtxtCurrencyId"].Value.ToString()) == decId)
             {
                 dgvCurrency.Rows[ini].DefaultCellStyle.BackColor = Color.MediumSeaGreen;
             }
         }
         txtCurrencyName.Focus();
     }
     catch (Exception ex)
     {
         MessageBox.Show("CDP8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 11
0
 /// <summary>
 /// Call Corresponding Voucher to View details for updation in edit mode
 /// </summary>
 public void GotoJournalVoucher()
 {
     try
     {
         frmJournalVoucher frmobj = new frmJournalVoucher();
         frmJournalVoucher _isOpen = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
         if (_isOpen == null)
         {
             frmobj.WindowState = FormWindowState.Normal;
             frmobj.MdiParent = formMDI.MDIObj;
             frmobj.Show();
             frmobj.CallThisFormFromVoucherSearch(this, Convert.ToDecimal(dgvVoucherSearch.CurrentRow.Cells["Id"].Value.ToString()));
         }
         else
         {
             _isOpen.MdiParent = formMDI.MDIObj;
             if (_isOpen.WindowState == FormWindowState.Minimized)
             {
                 _isOpen.WindowState = FormWindowState.Normal;
             }
             else
             {
                 _isOpen.Activate();
             }
             _isOpen.CallThisFormFromVoucherSearch(this, Convert.ToDecimal(dgvVoucherSearch.CurrentRow.Cells["Id"].Value.ToString()));
             _isOpen.BringToFront();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("VS9:" + 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);
            }
        }
Exemplo n.º 13
0
 /// <summary>
 /// Calls Corresponding voucher for updation on 'ViewDetails' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnViewDetails_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvJournalRegister.CurrentRow != null)
         {
             frmJournalVoucher frmJournalVoucherObj = new frmJournalVoucher();
             frmJournalVoucher open = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
             decimal decMasterId = Convert.ToDecimal(dgvJournalRegister.CurrentRow.Cells["dgvtxtJournalMasterId"].Value.ToString());
             if (open == null)
             {
                 frmJournalVoucherObj.WindowState = FormWindowState.Normal;
                 frmJournalVoucherObj.MdiParent = formMDI.MDIObj;
                 frmJournalVoucherObj.CallFromJournalRegister(this, decMasterId);
             }
             else
             {
                 open.MdiParent = formMDI.MDIObj;
                 open.BringToFront();
                 open.CallFromJournalRegister(this, decMasterId);
                 if (open.WindowState == FormWindowState.Minimized)
                 {
                     open.WindowState = FormWindowState.Normal;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("JREG8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 14
0
 /// <summary>
 /// Function to call frmJournalVoucher form to set amount for sundry creditors or sundry debtors
 /// </summary>
 /// <param name="frmJournalVoucherObj1"></param>
 /// <param name="decId"></param>
 /// <param name="dtblPartyBalance"></param>
 /// <param name="strDebitOrCredit1"></param>
 /// <param name="decJournalVoucherTypeId"></param>
 /// <param name="strVoucherNo"></param>
 /// <param name="date"></param>
 /// <param name="arrlstOfDeletedPartyBalanceRow"></param>
 public void CallFromJournalVoucher(frmJournalVoucher frmJournalVoucherObj1, decimal decId, DataTable dtblPartyBalance, string strDebitOrCredit1, decimal decJournalVoucherTypeId, string strVoucherNo, DateTime date, ArrayList arrlstOfDeletedPartyBalanceRow)
 {
     try
     {
         decVoucherTypeId = decJournalVoucherTypeId;
         this.strVoucherNo = strVoucherNo;
         dtmVoucherDate = date;
         decLedgerId = decId;
         this.dtblPartyBalance = dtblPartyBalance;
         strDebitOrCredit = strDebitOrCredit1;
         base.Show();
         this.frmJournalVoucherObj = frmJournalVoucherObj1;
         frmJournalVoucherObj.Enabled = false;
         this.arrlstOfDeletedPartyBalanceRow = arrlstOfDeletedPartyBalanceRow;
         int inTableRowCount = dtblPartyBalance.Rows.Count;
         PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
         PartyBalanceInfo InfoPartyBalance = new PartyBalanceInfo();
         DataTable dtbl = new DataTable();
         if (inTableRowCount > 0)
         {
             int inK = 0;
             for (int inI = 0; inI < inTableRowCount; inI++)
             {
                 if (decLedgerId == Convert.ToDecimal(dtblPartyBalance.Rows[inI]["LedgerId"].ToString()))
                 {
                     if (strDebitOrCredit == dtblPartyBalance.Rows[inI]["DebitOrCredit"].ToString())
                     {
                         dgvPartyBalance.Rows.Add();
                         dgvPartyBalance.Rows[inK].Cells["dgvcmbReference"].Value = dtblPartyBalance.Rows[inI]["ReferenceType"].ToString();
                         if (dgvPartyBalance.Rows[inK].Cells["dgvcmbReference"].Value.ToString() == "Against")
                         {
                             //----------------------------------------------------------------------------//
                             dgvPartyBalance.Rows[inK].Cells["dgvcmbVoucherType"].ReadOnly = false;
                             dtbl = SpPartyBalance.PartyBalanceComboViewByLedgerId(decLedgerId, strDebitOrCredit, decVoucherTypeId, strVoucherNo);
                             DataGridViewComboBoxCell dgvccVoucherType = (DataGridViewComboBoxCell)dgvPartyBalance[dgvPartyBalance.Columns["dgvcmbVoucherType"].Index, dgvPartyBalance.CurrentRow.Index - 1];
                             dgvccVoucherType.DataSource = dtbl;
                             dgvccVoucherType.ValueMember = "value";
                             dgvccVoucherType.DisplayMember = "display";
                             //============================================================================//
                             dgvPartyBalance.Rows[inK].Cells["dgvcmbVoucherType"].Value = dtblPartyBalance.Rows[inI]["AgainstVoucherTypeId"].ToString() + "_" + dtblPartyBalance.Rows[inI]["AgainstVoucherNo"].ToString();
                             dgvPartyBalance.Rows[inK].Cells["dgvtxtVoucherNo"].Value = dtblPartyBalance.Rows[inI]["AgainstVoucherNo"].ToString();
                             dgvPartyBalance.Rows[inK].Cells["dgvtxtInvoiceNo"].Value = dtblPartyBalance.Rows[inI]["AgainstInvoiceNo"].ToString();
                             if (dgvPartyBalance.Rows[inK].Cells["dgvcmbVoucherType"].Value != null && dgvPartyBalance.Rows[inK].Cells["dgvcmbVoucherType"].Value.ToString() != string.Empty)
                             {
                                 for (int inD = 0; inD < dtbl.Rows.Count; inD++)
                                 {
                                     if (dgvPartyBalance.Rows[inK].Cells["dgvcmbVoucherType"].Value.ToString() == dtbl.Rows[inD]["value"].ToString())
                                     {
                                         dgvPartyBalance.Rows[inK].Cells["dgvtxtpending"].Value = Math.Round(Convert.ToDecimal(dtbl.Rows[inD]["balance"].ToString()), PublicVariables._inNoOfDecimalPlaces);
                                         break;
                                     }
                                 }
                             }
                             dgvPartyBalance.Rows[inK].Cells["dgvcmbCurrency"].ReadOnly = true;
                         }
                         dgvPartyBalance.Rows[inK].Cells["dgvtxtAmount"].Value = Math.Round(Convert.ToDecimal(dtblPartyBalance.Rows[inI]["Amount"].ToString()), Convert.ToInt32(PublicVariables._inNoOfDecimalPlaces)).ToString();
                         dgvPartyBalance.Rows[inK].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(dtblPartyBalance.Rows[inI]["CurrencyId"].ToString());
                         dgvPartyBalance.Rows[inK].Cells["dgvtxtCrDr"].Value = strDebitOrCredit;
                         dgvPartyBalance.Rows[inK].Cells["dgvtxtPartyBalanceId"].Value = dtblPartyBalance.Rows[inI]["partyBalanceId"].ToString();
                         dgvPartyBalance.Rows[inK].Cells["dgvtxtOldExchangeRateId"].Value = dtblPartyBalance.Rows[inI]["OldExchangeRate"].ToString();
                         inK++;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PB:3" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 15
0
        /// <summary>
        /// Function to call this form from frmJournalVoucher
        /// </summary>
        /// <param name="frmJournalVoucher"></param>
        /// <param name="decId"></param>
        /// <param name="strComboType"></param>
        public void CallFromJournalVoucher(frmJournalVoucher frmJournalVoucher, decimal decId, string strComboType) //PopUp
        {
            try
            {
                base.Show();
                strComboTypes = strComboType;

                this.frmJournalVoucherObj = frmJournalVoucher;
                frmJournalVoucherObj.Enabled = false;
                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("LP13:" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 16
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);
     }
 }
Exemplo n.º 17
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);
            }
        }
Exemplo n.º 18
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);
            }
        }
        /// <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);
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// On double clicking the cell in grid, it loads the corresponding Voucher to update or delete the entries
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvBillAllocation_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    decVoucherTypeId = Convert.ToDecimal(dgvBillAllocation.CurrentRow.Cells["voucherTypeId"].Value.ToString());

                    strTypeOfVoucher = dgvBillAllocation.CurrentRow.Cells["typeOfVoucher"].Value.ToString();
                    strVoucherNo     = dgvBillAllocation.CurrentRow.Cells["voucherNo"].Value.ToString();
                    if (strTypeOfVoucher == "PDC Payable")
                    {
                        PDCPayableBll BllPDCPayable = new PDCPayableBll();
                        decimal       decMasterId   = BllPDCPayable.PdcPayableMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPdcPayable frmpdcPayableObj = new frmPdcPayable();
                        frmpdcPayableObj = Application.OpenForms["frmPdcPayable"] as frmPdcPayable;

                        if (frmpdcPayableObj == null)
                        {
                            frmpdcPayableObj           = new frmPdcPayable();
                            frmpdcPayableObj.MdiParent = formMDI.MDIObj;

                            frmpdcPayableObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "PDC Receivable")
                    {
                        PDCRecivebleBll BllPDCReciveble = new PDCRecivebleBll();
                        decimal         decMasterId     = BllPDCReciveble.PdcReceivableMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPdcReceivable frmPdcReceivableObj = new frmPdcReceivable();
                        frmPdcReceivableObj = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable;
                        if (frmPdcReceivableObj == null)
                        {
                            frmPdcReceivableObj           = new frmPdcReceivable();
                            frmPdcReceivableObj.MdiParent = formMDI.MDIObj;
                            frmPdcReceivableObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Payment Voucher")
                    {
                        PaymentVoucherBll BllPaymentVoucher = new PaymentVoucherBll();
                        decimal           decMasterId       = BllPaymentVoucher.paymentMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPaymentVoucher frmPaymentVoucherObj = new frmPaymentVoucher();
                        frmPaymentVoucherObj = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher;
                        if (frmPaymentVoucherObj == null)
                        {
                            frmPaymentVoucherObj           = new frmPaymentVoucher();
                            frmPaymentVoucherObj.MdiParent = formMDI.MDIObj;

                            frmPaymentVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Receipt Voucher")
                    {
                        RecieptVoucherBll bllRecieptVoucherBll = new RecieptVoucherBll();
                        decimal           decMasterId          = bllRecieptVoucherBll.ReceiptMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmReceiptVoucher frmReceiptVoucherObj = new frmReceiptVoucher();
                        frmReceiptVoucherObj = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher;
                        if (frmReceiptVoucherObj == null)
                        {
                            frmReceiptVoucherObj           = new frmReceiptVoucher();
                            frmReceiptVoucherObj.MdiParent = formMDI.MDIObj;

                            frmReceiptVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Journal Voucher")
                    {
                        JournalVoucherBll JournalVoucherbll = new JournalVoucherBll();
                        decimal           decMasterId       = JournalVoucherbll.JournalMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmJournalVoucher frmJournalVoucherObj = new frmJournalVoucher();
                        frmJournalVoucherObj = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                        if (frmJournalVoucherObj == null)
                        {
                            frmJournalVoucherObj           = new frmJournalVoucher();
                            frmJournalVoucherObj.MdiParent = formMDI.MDIObj;

                            frmJournalVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Credit Note")
                    {
                        CreditNoteBll BllCreditNoteMaster = new CreditNoteBll();
                        decimal       decMasterId         = BllCreditNoteMaster.CreditNoteMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmCreditNote frmCreditNoteObj = new frmCreditNote();
                        frmCreditNoteObj = Application.OpenForms["frmCreditNote"] as frmCreditNote;
                        if (frmCreditNoteObj == null)
                        {
                            frmCreditNoteObj           = new frmCreditNote();
                            frmCreditNoteObj.MdiParent = formMDI.MDIObj;

                            frmCreditNoteObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Debit Note")
                    {
                        //DebitNoteMasterSP sp = new DebitNoteMasterSP();
                        DebitNoteBll bll         = new DebitNoteBll();
                        decimal      decMasterId = bll.DebitNoteMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmDebitNote frmDebitNoteObj = new frmDebitNote();
                        frmDebitNoteObj = Application.OpenForms["frmDebitNote"] as frmDebitNote;
                        if (frmDebitNoteObj == null)
                        {
                            frmDebitNoteObj           = new frmDebitNote();
                            frmDebitNoteObj.MdiParent = formMDI.MDIObj;

                            frmDebitNoteObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("BA:15" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }