Esempio n. 1
0
 /// <summary>
 /// Call the print in butten print click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         PurchaseMasterSP spPurchaseMaster = new PurchaseMasterSP();
         string           strColumn        = string.Empty;
         GridFill();
         if (dgvPurchaseReport.RowCount > 0)
         {
             if (rbtnInvoiceDate.Checked)
             {
                 strColumn = rbtnInvoiceDate.Text;
             }
             else
             {
                 strColumn = rbtnVoucherDate.Text;
             }
             DataSet dsPurchaseReport = spPurchaseMaster.PurchaseInvoiceReportPrinting(1, strColumn, dtpFromDate.Value, dtpToDate.Value,
                                                                                       Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()), cmbStatus.Text, cmbPurchaseMode.Text,
                                                                                       Convert.ToDecimal(cmbAgainstVoucherType.SelectedValue.ToString()), txtOrderNo.Text,
                                                                                       Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()), txtVoucherNo.Text, txtProductCode.Text, txtProductName.Text);
             frmReport frmRepor = new frmReport();
             frmRepor.MdiParent = formMDI.MDIObj;
             frmRepor.PurchaseReportPrinting(dsPurchaseReport, txtTotalAmount.Text);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PIREP15:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 2
0
        public void PurchaseMasterDelete(decimal PurchaseMasterId)
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();

            try
            {
                SPPurchaseMaster.PurchaseMasterDelete(PurchaseMasterId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 23:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 3
0
        public void PurchaseMasterEdit(PurchaseMasterInfo purchasemasterinfo)
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();

            try
            {
                SPPurchaseMaster.PurchaseMasterEdit(purchasemasterinfo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 22:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 4
0
        public decimal PurchaseMasterAdd(PurchaseMasterInfo purchasemasterinfo)
        {
            PurchaseMasterSP SPPurchaseMaster    = new PurchaseMasterSP();
            decimal          decPurchaseMasterId = 0;

            try
            {
                decPurchaseMasterId = SPPurchaseMaster.PurchaseMasterAdd(purchasemasterinfo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 21:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(decPurchaseMasterId);
        }
Esempio n. 5
0
        public int PurchaseInvoiceVoucherNoCheckExistance(string strInvoiceNo, string strVoucherNo, decimal decVoucherTypeId, decimal decPurchaseMasterId)
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();
            int inRef = 0;

            try
            {
                inRef = SPPurchaseMaster.PurchaseInvoiceVoucherNoCheckExistance(strInvoiceNo, strVoucherNo, decVoucherTypeId, decPurchaseMasterId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(inRef);
        }
Esempio n. 6
0
        public int PurchaseMasterReferenceCheck(decimal decPurchaseMasterId, decimal decPurchaseDetailsId)
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();
            int inQty = 0;

            try
            {
                inQty = SPPurchaseMaster.PurchaseMasterReferenceCheck(decPurchaseMasterId, decPurchaseDetailsId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(inQty);
        }
Esempio n. 7
0
        public List <DataTable> AccountLedgerViewForAdditionalCost()
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();
            List <DataTable> ListObj          = new List <DataTable>();

            try
            {
                ListObj = SPPurchaseMaster.AccountLedgerViewForAdditionalCost();
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 16:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ListObj);
        }
Esempio n. 8
0
        /// <summary>
        /// Function to get particular values from PurchaseMaster table based on the parameter
        /// </summary>
        /// <param name="purchaseMasterId"></param>
        /// <returns></returns>
        public PurchaseMasterInfo PurchaseMasterView(Decimal purchaseMasterId)
        {
            PurchaseMasterInfo purchasemasterinfo = new PurchaseMasterInfo();
            PurchaseMasterSP   SPPurchaseMaster   = new PurchaseMasterSP();

            try
            {
                purchasemasterinfo = SPPurchaseMaster.PurchaseMasterView(purchaseMasterId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 15:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(purchasemasterinfo);
        }
Esempio n. 9
0
        public DataSet PurchaseInvoicePrinting(decimal decCompanyId, decimal decPurchaseOrderMasterId, decimal decMaterialReceiptMasterId, decimal decPurchaseMasterId)
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();
            DataSet          ds = new DataSet();

            try
            {
                ds = SPPurchaseMaster.PurchaseInvoicePrinting(decCompanyId, decPurchaseOrderMasterId, decMaterialReceiptMasterId, decPurchaseMasterId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 24:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ds);
        }
Esempio n. 10
0
        public List <DataTable> PurchaseInvoiceNoViewAllByProductCodeAndBatchNoForBarcodePrinting(decimal decProductId, decimal decBatchId, ComboBox cmbPurchaseInvoice, bool isAll)
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();
            List <DataTable> ListObj          = new List <DataTable>();

            try
            {
                ListObj = SPPurchaseMaster.PurchaseInvoiceNoViewAllByProductCodeAndBatchNoForBarcodePrinting(decProductId, decBatchId, cmbPurchaseInvoice, isAll);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 34:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ListObj);
        }
Esempio n. 11
0
        /// <summary>
        /// Function to get the details for PurchaseInvoice Register
        /// </summary>
        /// <param name="strColumn"></param>
        /// <param name="dtFromDate"></param>
        /// <param name="dtToDate"></param>
        /// <param name="decLedgerId"></param>
        /// <param name="strPurchaseMode"></param>
        /// <param name="decVoucherTypeId"></param>
        /// <param name="strInvoiceNo"></param>
        /// <returns></returns>

        public List <DataTable> PurchaseInvoiceRegisterFill(string strColumn, DateTime dtFromDate, DateTime dtToDate, decimal decLedgerId, string strPurchaseMode, decimal decVoucherTypeId, string strInvoiceNo)
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();
            List <DataTable> ListObj          = new List <DataTable>();

            try
            {
                ListObj = SPPurchaseMaster.PurchaseInvoiceRegisterFill(strColumn, dtFromDate, dtToDate, decLedgerId, strPurchaseMode, decVoucherTypeId, strInvoiceNo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ListObj);
        }
Esempio n. 12
0
        public decimal PurchaseMasterIdViewByvoucherNoAndVoucherType(decimal decVouchertypeid, string strVoucherNo)
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();
            decimal          decid            = 0;

            try
            {
                decid = SPPurchaseMaster.PurchaseMasterIdViewByvoucherNoAndVoucherType(decVouchertypeid, strVoucherNo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 29:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(decid);
        }
Esempio n. 13
0
        public List <DataTable> GetOrderNoCorrespondingtoLedger(decimal decLedgerId, decimal decReceiptMasterId, decimal decVoucherTypeId)
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();
            List <DataTable> ListObj          = new List <DataTable>();

            try
            {
                ListObj = SPPurchaseMaster.GetOrderNoCorrespondingtoLedger(decLedgerId, decReceiptMasterId, decVoucherTypeId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 30:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ListObj);
        }
Esempio n. 14
0
        public List <DataTable> GetInvoiceNoCorrespondingtoLedgerInRegister()
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();
            List <DataTable> ListObj          = new List <DataTable>();

            try
            {
                ListObj = SPPurchaseMaster.GetInvoiceNoCorrespondingtoLedgerInRegister();
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 25:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ListObj);
        }
Esempio n. 15
0
        /// <summary>
        /// Function to fill purchase account combobox
        /// </summary>
        /// <returns></returns>
        public List <DataTable> PurchaseInvoicePurchaseAccountFill()
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();
            List <DataTable> ListObj          = new List <DataTable>();

            try
            {
                ListObj = SPPurchaseMaster.PurchaseInvoicePurchaseAccountFill();
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 14:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ListObj);
        }
Esempio n. 16
0
        public decimal PurchaseMasterVoucherMax(decimal decVoucherTypeId)
        {
            PurchaseMasterInfo purchasemasterinfo = new PurchaseMasterInfo();
            PurchaseMasterSP   SPPurchaseMaster   = new PurchaseMasterSP();
            decimal            decVoucherNoMax    = 0;

            try
            {
                decVoucherNoMax = SPPurchaseMaster.PurchaseMasterVoucherMax(decVoucherTypeId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(decVoucherNoMax);
        }
Esempio n. 17
0
        public List <DataTable> PurchaseInvoiceReportFill(decimal decCompanyId, string strColumn, DateTime dtFromDate, DateTime dtToDate, decimal decLedgerId, string strStatus,
                                                          string strPurchaseMode, decimal decAgainstVoucherTypeId, string strAgainstVoucherNo, decimal decVoucherTypeId, string strVoucherNo,
                                                          string strProductCode, string strProductName)
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();
            List <DataTable> ListObj          = new List <DataTable>();

            try
            {
                ListObj = SPPurchaseMaster.PurchaseInvoiceReportFill(decCompanyId, strColumn, dtFromDate, dtToDate, decLedgerId, strStatus,
                                                                     strPurchaseMode, decAgainstVoucherTypeId, strAgainstVoucherNo, decVoucherTypeId, strVoucherNo,
                                                                     strProductCode, strProductName);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 28:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ListObj);
        }
Esempio n. 18
0
        public DataSet PurchaseInvoiceReportPrinting(decimal decCompanyId, string strColumn, DateTime dtFromDate, DateTime dtToDate, decimal decLedgerId, string strStatus,
                                                     string strPurchaseMode, decimal decAgainstVoucherTypeId, string strAgainstVoucherNo, decimal decVoucherTypeId, string strVoucherNo,
                                                     string strProductCode, string strProductName)


        {
            DataSet          ds = new DataSet();
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();

            try
            {
                ds = SPPurchaseMaster.PurchaseInvoiceReportPrinting(decCompanyId, strColumn, dtFromDate, dtToDate, decLedgerId, strStatus,
                                                                    strPurchaseMode, decAgainstVoucherTypeId, strAgainstVoucherNo, decVoucherTypeId, strVoucherNo,
                                                                    strProductCode, strProductName);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIBll 27:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ds);
        }
Esempio n. 19
0
        /// <summary>
        /// Function to fill the grid based on condition
        /// </summary>
        public void GridFill()
        {
            decimal          decTotalAmount   = 0;
            string           strColumn        = string.Empty;
            DataTable        dtbl             = new DataTable();
            PurchaseMasterSP spPurchaseMaster = new PurchaseMasterSP();

            try
            {
                if (rbtnInvoiceDate.Checked)
                {
                    strColumn = rbtnInvoiceDate.Text;
                }
                else
                {
                    strColumn = rbtnVoucherDate.Text;
                }
                dtbl = spPurchaseMaster.PurchaseInvoiceReportFill(1, strColumn, dtpFromDate.Value, dtpToDate.Value,
                                                                  Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()), cmbStatus.Text, cmbPurchaseMode.Text,
                                                                  Convert.ToDecimal(cmbAgainstVoucherType.SelectedValue.ToString()), txtOrderNo.Text,
                                                                  Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()), txtVoucherNo.Text, txtProductCode.Text, txtProductName.Text);
                dgvPurchaseReport.DataSource = dtbl;
                foreach (DataGridViewRow dgvrow in dgvPurchaseReport.Rows)
                {
                    if (dgvrow.Cells["dgvtxtBillAmount"].Value != null)
                    {
                        if (dgvrow.Cells["dgvtxtBillAmount"].Value.ToString() != string.Empty)
                        {
                            decTotalAmount = decTotalAmount + Convert.ToDecimal(dgvrow.Cells["dgvtxtBillAmount"].Value.ToString());
                        }
                    }
                }
                txtTotalAmount.Text = Math.Round(decTotalAmount, PublicVariables._inNoOfDecimalPlaces).ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIREP5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 20
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);
            }
        }