/// <summary>
        /// Function to insert values to PurchaseReturnMaster Table
        /// </summary>
        /// <param name="purchasereturnmasterinfo"></param>
        /// <returns></returns>
        public void PurchaseReturnMasterEdit(PurchaseReturnMasterInfo purchasereturnmasterinfo)
        {
            PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP();

            try
            {
                SPPurchaseReturnMaster.PurchaseReturnMasterEdit(purchasereturnmasterinfo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PrBll 8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Function to delete particular details based on the parameter
        /// </summary>
        /// <param name="decPurchaseReturnMasterId"></param>
        public void PurchaseReturnMasterAndDetailsDelete(decimal decPurchaseReturnMasterId)
        {
            PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP();

            try
            {
                SPPurchaseReturnMaster.PurchaseReturnMasterAndDetailsDelete(decPurchaseReturnMasterId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PrBll 19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Function to get the details of PurchaseReturn Report
        /// </summary>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <param name="decLedgerId"></param>
        /// <param name="decVoucherTypeId"></param>
        /// <param name="decInvoiceNo"></param>
        /// <param name="strProductCode"></param>
        /// <param name="strVoucherNo"></param>
        /// <returns></returns>
        public List <DataTable> PurchaseReturnReportGridFill(DateTime fromDate, DateTime toDate, decimal decLedgerId, decimal decVoucherTypeId, decimal decInvoiceNo, string strProductCode, string strVoucherNo)
        {
            PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP();
            List <DataTable>       ListObj = new List <DataTable>();

            try
            {
                ListObj = SPPurchaseReturnMaster.PurchaseReturnReportGridFill(fromDate, toDate, decLedgerId, decVoucherTypeId, decInvoiceNo, strProductCode, strVoucherNo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PrBll 4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ListObj);
        }
        /// <summary>
        /// Get InvoiceNo Corresponding to Ledger For PurchaseReturn Register
        /// </summary>
        /// <param name="decLedgerId"></param>
        /// <returns></returns>
        public List <DataTable> GetInvoiceNoCorrespondingtoLedgerForPurchaseReturnReport(decimal decLedgerId, decimal decVoucherId)
        {
            PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP();
            List <DataTable>       ListObj = new List <DataTable>();

            try
            {
                ListObj = SPPurchaseReturnMaster.GetInvoiceNoCorrespondingtoLedgerForPurchaseReturnReport(decLedgerId, decVoucherId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PrBll 3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ListObj);
        }
        /// <summary>
        /// Function to get details for PurchaseReturn Register
        /// </summary>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <param name="decLedgerId"></param>
        /// <param name="strInvoiceNo"></param>
        /// <param name="decAgainstInvoiceNo"></param>
        /// <returns></returns>
        public List <DataTable> PurchaseReturnRegisterFill(DateTime fromDate, DateTime toDate, decimal decLedgerId, string strInvoiceNo, decimal decAgainstInvoiceNo, decimal decVoucherType)
        {
            PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP();
            List <DataTable>       ListObj = new List <DataTable>();

            try
            {
                ListObj = SPPurchaseReturnMaster.PurchaseReturnRegisterFill(fromDate, toDate, decLedgerId, strInvoiceNo, decAgainstInvoiceNo, decVoucherType);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PrBll 20:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ListObj);
        }
        /// <summary>
        /// Function to check existance of purchase return number
        /// </summary>
        /// <param name="strinvoiceNo"></param>
        /// <param name="decVoucherTypeId"></param>
        /// <returns></returns>
        public bool PurchaseReturnNumberCheckExistence(string strinvoiceNo, decimal decVoucherTypeId)
        {
            bool isEdit = false;
            PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP();

            try
            {
                isEdit = SPPurchaseReturnMaster.PurchaseReturnNumberCheckExistence(strinvoiceNo, decVoucherTypeId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PrBll 18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(isEdit);
        }
        /// <summary>
        /// Function to get tax rate from purchase details
        /// </summary>
        /// <param name="taxId"></param>
        /// <returns></returns>
        public string TaxRateFromPurchaseDetails(decimal taxId)
        {
            PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP();
            string max = "0";

            try
            {
                max = SPPurchaseReturnMaster.TaxRateFromPurchaseDetails(taxId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PrBll 17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(max);
        }
        /// <summary>
        /// Function to  get the next id for PurchaseReturnMaster table
        /// </summary>
        /// <param name="decVoucherTypeId"></param>
        /// <returns></returns>
        public string PurchaseReturnMasterGetMax(decimal decVoucherTypeId)
        {
            PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP();
            string max = "0";

            try
            {
                max = SPPurchaseReturnMaster.PurchaseReturnMasterGetMax(decVoucherTypeId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PrBll 16:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(max);
        }
        /// <summary>
        /// Function to get particular values from PurchaseReturnMaster table based on the parameter
        /// </summary>
        /// <param name="decPurchaseMasterId"></param>
        /// <returns></returns>
        public List <DataTable> PurchaseReturnMasterViewByPurchaseMasterId(decimal decPurchaseMasterId)
        {
            PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP();
            List <DataTable>       ListObj = new List <DataTable>();

            try
            {
                ListObj = SPPurchaseReturnMaster.PurchaseReturnMasterViewByPurchaseMasterId(decPurchaseMasterId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PrBll 13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ListObj);
        }
        /// <summary>
        /// Function to get details for printing purchase return
        /// </summary>
        /// <param name="decPurchaseReturnMasterId"></param>
        /// <param name="decCompanyId"></param>
        /// <param name="decPurchaseMasterId"></param>
        /// <returns></returns>
        public DataSet PurchaseReturnPrinting(decimal decPurchaseReturnMasterId, decimal decCompanyId, decimal decPurchaseMasterId)
        {
            PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP();
            DataSet ds = new DataSet();

            try
            {
                ds = SPPurchaseReturnMaster.PurchaseReturnPrinting(decPurchaseReturnMasterId, decCompanyId, decPurchaseMasterId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PrBll 12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ds);
        }
        /// <summary>
        /// Function to get particular values from PurchaseReturnMaster table based on the parameter
        /// </summary>
        /// <param name="purchaseReturnMasterId"></param>
        /// <returns></returns>
        public PurchaseReturnMasterInfo PurchaseReturnMasterView(decimal purchaseReturnMasterId)
        {
            PurchaseReturnMasterSP   SPPurchaseReturnMaster   = new PurchaseReturnMasterSP();
            PurchaseReturnMasterInfo infopurchasereturnmaster = new PurchaseReturnMasterInfo();

            try
            {
                infopurchasereturnmaster = SPPurchaseReturnMaster.PurchaseReturnMasterView(purchaseReturnMasterId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PrBll 9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(infopurchasereturnmaster);
        }
        /// <summary>
        /// Function to insert values to PurchaseReturnMaster Table
        /// </summary>
        /// <param name="purchasereturnmasterinfo"></param>
        /// <returns></returns>
        public decimal PurchaseReturnMasterAddWithReturnIdentity(PurchaseReturnMasterInfo purchasereturnmasterinfo)
        {
            PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP();
            decimal decIdentity = 0;

            try
            {
                decIdentity = SPPurchaseReturnMaster.PurchaseReturnMasterAddWithReturnIdentity(purchasereturnmasterinfo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PrBll 7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(decIdentity);
        }