/// <summary>
 /// Function to get particular values from StockJournal Table based on the parameter
 /// </summary>
 /// <param name="stockJournalMasterId"></param>
 /// <returns></returns>
 public StockJournalMasterInfo StockJournalMasterView(decimal stockJournalMasterId)
 {
     StockJournalMasterInfo stockjournalmasterinfo = new StockJournalMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("StockJournalMasterView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@stockJournalMasterId", SqlDbType.Decimal);
         sprmparam.Value = stockJournalMasterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             stockjournalmasterinfo.StockJournalMasterId = decimal.Parse(sdrreader[0].ToString());
             stockjournalmasterinfo.VoucherNo = sdrreader[1].ToString();
             stockjournalmasterinfo.InvoiceNo = sdrreader[2].ToString();
             stockjournalmasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[3].ToString());
             stockjournalmasterinfo.VoucherTypeId = decimal.Parse(sdrreader[4].ToString());
             stockjournalmasterinfo.Date = DateTime.Parse(sdrreader[5].ToString());
             stockjournalmasterinfo.Narration = sdrreader[6].ToString();
             stockjournalmasterinfo.AdditionalCost = decimal.Parse(sdrreader[7].ToString());
             stockjournalmasterinfo.FinancialYearId = decimal.Parse(sdrreader[8].ToString());
             stockjournalmasterinfo.ExtraDate = DateTime.Parse(sdrreader[9].ToString());
             stockjournalmasterinfo.Extra1 = sdrreader[10].ToString();
             stockjournalmasterinfo.Extra2 = sdrreader[11].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return stockjournalmasterinfo;
 }
 /// <summary>
 /// Function to Update values in StockJournal Table
 /// </summary>
 /// <param name="stockjournalmasterinfo"></param>
 public void StockJournalMasterEdit(StockJournalMasterInfo stockjournalmasterinfo)
 {
     try
     {
         spStockJournalMaster.StockJournalMasterEdit(stockjournalmasterinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("AL6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to Update values in StockJournal Table
 /// </summary>
 /// <param name="stockjournalmasterinfo"></param>
 public void StockJournalMasterEdit(StockJournalMasterInfo stockjournalmasterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("StockJournalMasterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@stockJournalMasterId", SqlDbType.Decimal);
         sprmparam.Value = stockjournalmasterinfo.StockJournalMasterId;
         sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = stockjournalmasterinfo.VoucherNo;
         sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = stockjournalmasterinfo.InvoiceNo;
         sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = stockjournalmasterinfo.SuffixPrefixId;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = stockjournalmasterinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = stockjournalmasterinfo.Date;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = stockjournalmasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@additionalCost", SqlDbType.Decimal);
         sprmparam.Value = stockjournalmasterinfo.AdditionalCost;
         sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = stockjournalmasterinfo.FinancialYearId;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = stockjournalmasterinfo.ExtraDate;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = stockjournalmasterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = stockjournalmasterinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 /// <summary>
 /// Function to insert values to StockJournal Table
 /// </summary>
 /// <param name="stockjournalmasterinfo"></param>
 /// <returns></returns>
 public decimal StockJournalMasterAdd(StockJournalMasterInfo stockjournalmasterinfo)
 {
     decimal decStockJournalMasterId = 0;
     try
     {
         decStockJournalMasterId = spStockJournalMaster.StockJournalMasterAdd(stockjournalmasterinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("AL6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return decStockJournalMasterId;
 }