/// <summary>
        /// 
        /// </summary>
        /// <param name="paymentmasterinfo"></param>
        /// <returns></returns>
        public decimal PaymentMasterEdit(PaymentMasterInfo paymentmasterinfo)
        {
            decimal decId = 0;
               try
               {
               decId = SpPaymentMaster.PaymentMasterEdit(paymentmasterinfo);
               }

               catch (Exception ex)
               {
               MessageBox.Show("PM5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
               }
               return decId;
        }
 /// <summary>
 /// Function to insert values to PaymentMaster Table
 /// </summary>
 /// <param name="paymentmasterinfo"></param>
 /// <returns></returns>
 public decimal PaymentMasterAdd(PaymentMasterInfo paymentmasterinfo)
 {
     decimal decPaymentMasterId = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PaymentMasterAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = paymentmasterinfo.VoucherNo;
         sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = paymentmasterinfo.InvoiceNo;
         sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = paymentmasterinfo.SuffixPrefixId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = paymentmasterinfo.Date;
         sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = paymentmasterinfo.LedgerId;
         sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = paymentmasterinfo.TotalAmount;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = paymentmasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = paymentmasterinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = paymentmasterinfo.UserId;
         sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = paymentmasterinfo.FinancialYearId;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = paymentmasterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = paymentmasterinfo.Extra2;
         decPaymentMasterId = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decPaymentMasterId;
 }
 /// <summary>
 /// Function to get particular values from PaymentMaster table based on the parameter
 /// </summary>
 /// <param name="paymentMastertId"></param>
 /// <returns></returns>
 public PaymentMasterInfo PaymentMasterViewByMasterId(decimal paymentMastertId)
 {
     PaymentMasterInfo paymentmasterinfo = new PaymentMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PaymentMasterViewByMasterId", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@paymentMasterId", SqlDbType.Decimal);
         sprmparam.Value = paymentMastertId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             paymentmasterinfo.VoucherNo = sdrreader["voucherNo"].ToString();
             paymentmasterinfo.InvoiceNo = sdrreader["invoiceNo"].ToString();
             paymentmasterinfo.SuffixPrefixId = decimal.Parse(sdrreader["suffixprefixId"].ToString());
             paymentmasterinfo.Date = DateTime.Parse(sdrreader["date"].ToString());
             paymentmasterinfo.LedgerId = decimal.Parse(sdrreader["ledgerId"].ToString());
             paymentmasterinfo.TotalAmount = decimal.Parse(sdrreader["totalAmount"].ToString());
             paymentmasterinfo.Narration = sdrreader["narration"].ToString();
             paymentmasterinfo.VoucherTypeId = decimal.Parse(sdrreader["voucherTypeId"].ToString());
             paymentmasterinfo.UserId = decimal.Parse(sdrreader["userId"].ToString());
             paymentmasterinfo.FinancialYearId = decimal.Parse(sdrreader["financialYearId"].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return paymentmasterinfo;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="paymentMastertId"></param>
        /// <returns></returns>
        public PaymentMasterInfo PaymentMasterViewByMasterId(decimal paymentMastertId)
        {
            try
            {
                InfoPaymentMaster = SPPaymentMaster.PaymentMasterViewByMasterId(paymentMastertId);
            }

            catch (Exception ex)
            {
                MessageBox.Show("PVBLL:11" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return InfoPaymentMaster;
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="paymentmasterinfo"></param>
 /// <returns></returns>
 public decimal PaymentMasterAdd(PaymentMasterInfo paymentmasterinfo)
 {
     decimal decCompanyId = 0;
     try
     {
         decCompanyId = SPPaymentMaster.PaymentMasterAdd(paymentmasterinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PVBLL:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return decCompanyId;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="paymentMastertId"></param>
 /// <returns></returns>
 public PaymentMasterInfo PaymentMasterViewByMasterId(decimal paymentMastertId)
 {
     PaymentMasterInfo infoPaymentMaster = new PaymentMasterInfo();
        try
        {
        infoPaymentMaster = SpPaymentMaster.PaymentMasterViewByMasterId(paymentMastertId);
        }
        catch (Exception ex)
        {
        MessageBox.Show("PM7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        return infoPaymentMaster;
 }