public decimal ReceiptDetailsEdit(ReceiptDetailsInfo receiptdetailsinfo)
 {
     decimal decReceiptDetailsId = 0;
     try
     {
         ReceiptDetailsSP spReceiptDetails = new ReceiptDetailsSP();
         decReceiptDetailsId = spReceiptDetails.ReceiptDetailsAdd(receiptdetailsinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("RD3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return decReceiptDetailsId;
 }
        public decimal ReceiptDetailsAdd(ReceiptDetailsInfo receiptdetailsinfo)
        {
            decimal decResult = 0;
            try
            {
            decResult = spReceiptDetails.ReceiptDetailsAdd(receiptdetailsinfo);
            }
            catch (Exception)
            {

            throw;
            }
            return decResult;
        }
 /// <summary>
 /// Function to insert values to ReceiptDetails Table
 /// </summary>
 /// <param name="receiptdetailsinfo"></param>
 /// <returns></returns>
 public decimal ReceiptDetailsAdd(ReceiptDetailsInfo receiptdetailsinfo)
 {
     decimal decReceiptDetailsId = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ReceiptDetailsAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal);
         sprmparam.Value = receiptdetailsinfo.ReceiptMasterId;
         sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = receiptdetailsinfo.LedgerId;
         sprmparam = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = receiptdetailsinfo.Amount;
         sprmparam = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
         sprmparam.Value = receiptdetailsinfo.ExchangeRateId;
         sprmparam = sccmd.Parameters.Add("@chequeNo", SqlDbType.VarChar);
         sprmparam.Value = receiptdetailsinfo.ChequeNo;
         sprmparam = sccmd.Parameters.Add("@chequeDate", SqlDbType.DateTime);
         sprmparam.Value = receiptdetailsinfo.ChequeDate;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = receiptdetailsinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = receiptdetailsinfo.Extra2;
         decReceiptDetailsId = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decReceiptDetailsId;
 }
 /// <summary>
 /// Function to get particular values from ReceiptDetails Table based on the parameter
 /// </summary>
 /// <param name="receiptDetailsId"></param>
 /// <returns></returns>
 public ReceiptDetailsInfo ReceiptDetailsView(decimal receiptDetailsId)
 {
     ReceiptDetailsInfo receiptdetailsinfo = new ReceiptDetailsInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ReceiptDetailsView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@receiptDetailsId", SqlDbType.Decimal);
         sprmparam.Value = receiptDetailsId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             receiptdetailsinfo.ReceiptDetailsId = decimal.Parse(sdrreader[0].ToString());
             receiptdetailsinfo.ReceiptMasterId = decimal.Parse(sdrreader[1].ToString());
             receiptdetailsinfo.LedgerId = decimal.Parse(sdrreader[2].ToString());
             receiptdetailsinfo.Amount = decimal.Parse(sdrreader[3].ToString());
             receiptdetailsinfo.ChequeNo = sdrreader[4].ToString();
             receiptdetailsinfo.ChequeDate = DateTime.Parse(sdrreader[5].ToString());
             receiptdetailsinfo.ExtraDate = DateTime.Parse(sdrreader[6].ToString());
             receiptdetailsinfo.Extra1 = sdrreader[7].ToString();
             receiptdetailsinfo.Extra2 = sdrreader[8].ToString();
             receiptdetailsinfo.ExchangeRateId = decimal.Parse(sdrreader[9].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return receiptdetailsinfo;
 }