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;
        }
        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;
        }
        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;
        }
        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;
        }
        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;
        }
        /// <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;
        }
        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;
        }
        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;
        }
        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);

               }
        }
        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);

               }
        }
        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;
        }
        public List<DataTable> PurchaseInvoiceNoViewAllForBarcodePrinting(ComboBox cmbPurchaseInvoice, bool isAll)
        {
            PurchaseMasterSP SPPurchaseMaster = new PurchaseMasterSP();
               List<DataTable> ListObj = new List<DataTable>();
               try
               {
               ListObj = SPPurchaseMaster.PurchaseInvoiceNoViewAllForBarcodePrinting(cmbPurchaseInvoice, isAll);
               }
               catch (Exception ex)
               {
               MessageBox.Show("PIBll 33:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);

               }
               return ListObj;
        }
        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;
        }
        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;
        }
        /// <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;
        }
        /// <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;
        }
        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;
        }