public ActionResult CreateGroupJournal(GroupJournalDto _groupOtherJournalDto) { try { //dto.EnmployeeName = dto.EnmployeeName; //dto.FAmount = dto.FAmount; //dto.FSLAccountId = dto.FSLAccountId; //dto.Narration = dto.Narration; //dto.OnBehalfOf = dto.OnBehalfOf; //dto.VocherRefNumber = dto.VocherRefNumber; bool isMemberJournal = false; int memberId = default(int); int.TryParse(Request.Form["MemberId"], out memberId); if (memberId > 0) { _groupOtherJournalDto.MemberId = memberId; isMemberJournal = true; } _groupOtherJournalDto.CrDr = Request.Form["FAmountMode"]; DateTime dtTranDate = Request.Form["TransactionDate"].ConvertToDateTime(); _groupOtherJournalDto.TransactionDate = dtTranDate; _groupOtherJournalDto.TransactionsList = new List <GroupJournalTranDto>(); int maxCount = Convert.ToInt32(Request.Form["hdnMaxcount"]); GroupJournalTranDto objtrn = null; for (int i = 0; i <= maxCount; i++) { if (Request.Form["hdnSLId_" + i] == null) { continue; } objtrn = new GroupJournalTranDto(); objtrn.GLAccount = Convert.ToString(Request.Form["hdnGLAccount_" + i]); objtrn.SLAccount = Convert.ToString(Request.Form["hdnSLAccount_" + i]); objtrn.SLAccountId = Convert.ToInt32(Request.Form["hdnSLId_" + i]); objtrn.GLAccountId = Convert.ToInt32(Request.Form["hdnGLId_" + i]); objtrn.Amount = Convert.ToDecimal(Request.Form["hdnAmount_" + i]); _groupOtherJournalDto.TransactionsList.Add(objtrn); } ResultDto resultDto = new ResultDto(); int GroupId = GroupInfo.GroupID; resultDto = _groupOtherJournalService.AddGroupOtherJournal(_groupOtherJournalDto, GroupId, UserInfo.UserID); _groupOtherJournalDto.VoucherNumber = resultDto.ObjectCode; _groupOtherJournalDto.AccountMasterID = resultDto.ObjectId; ViewBag.IsMemberJournal = isMemberJournal; LoadOtherJournalDropDowns(isMemberJournal ? "M" : "O"); } catch (Exception ex) { throw ex; } return(View(_groupOtherJournalDto)); }
public ResultDto AddGroupOtherJournal(GroupJournalDto grpotrjrnldto, int groupId, int UserId) { ResultDto resultDto = new ResultDto(); string groupOtherTranxml = CommonMethods.SerializeListDto <List <GroupJournalTranDto> >(grpotrjrnldto.TransactionsList); resultDto = new GroupJournalDal().AddGroupOtherJournal(groupOtherTranxml, grpotrjrnldto, groupId, UserId); return(resultDto); }
public ActionResult ViewGroupJournal(string type, string Id) { bool isMemberJournal = type != null && type.ToUpper() == "M"; int accountMasterId = string.IsNullOrEmpty(Id.DecryptString()) ? default(int) : Convert.ToInt32(Id.DecryptString()); GroupJournalDto groupJournalDto = new GroupJournalDto(); groupJournalDto = _groupOtherJournalService.GetGroupJournalDetailsByID(accountMasterId); ViewBag.IsMemberJournal = isMemberJournal; return(View(groupJournalDto)); }
public GroupJournalDto GetGroupJournalDetailsByID(int accountMasterId) { GroupJournalDto objJournal = null; SqlConnection con = new SqlConnection(DBConstants.MFIS_CS); SqlCommand cmd = new SqlCommand("uspGroupJournalDetailsByID", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@AccountMasterId", accountMasterId); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { objJournal = new GroupJournalDto(); objJournal.AccountMasterID = accountMasterId; objJournal.TransactionDate = Convert.ToDateTime(dr["TransactionDate"]); objJournal.VocherRefNumber = Convert.ToString(dr["VoucherRefNumber"]); objJournal.OnBehalfOfEmpId = Convert.ToInt32(dr["OnBehalfOfEmpID"]); objJournal.OnBehalfOfEmpName = Convert.ToString(dr["OnBehalfOfEmpName"]); objJournal.VoucherNumber = Convert.ToString(dr["VoucherNumber"]); objJournal.EmployeeName = Convert.ToString(dr["EntryEmpName"]); objJournal.Narration = Convert.ToString(dr["Narration"]); objJournal.FAmount = Convert.ToDecimal(dr["Amount"]); objJournal.FGLAccountId = Convert.ToInt32(dr["GLAccountID"]); objJournal.FSLAccountId = Convert.ToInt32(dr["SLAccountID"]); objJournal.FGLAccountName = Convert.ToString(dr["GLAccount"]); objJournal.FSLAccountName = Convert.ToString(dr["SLAccount"]); objJournal.CrDr = Convert.ToString(dr["CrDr"]); if (dr["MemberID"] != DBNull.Value) { objJournal.MemberId = Convert.ToInt32(dr["MemberID"]); objJournal.MemberName = Convert.ToString(dr["MemberName"]); } } if (dr.NextResult()) { objJournal.TransactionsList = new List <GroupJournalTranDto>(); GroupJournalTranDto objTran = null; while (dr.Read()) { objTran = new GroupJournalTranDto(); objTran.GLAccountId = Convert.ToInt32(dr["GLAhId"]); objTran.SLAccountId = Convert.ToInt32(dr["SLAhId"]); objTran.GLAccount = Convert.ToString(dr["GLAHNAME"]); objTran.SLAccount = Convert.ToString(dr["SLAHNAME"]); objTran.Amount = Convert.ToDecimal(dr["Amount"]); objJournal.TransactionsList.Add(objTran); } } return(objJournal); }
public ResultDto AddGroupOtherJournal(string groupOtherJrnlTranxml, GroupJournalDto grpOthrJrnlDto, int GroupId, int UserId) { ResultDto res = new ResultDto(); try { SqlConnection con = new SqlConnection(DBConstants.MFIS_CS); SqlCommand cmd = new SqlCommand("uspGroupOtherJournalInsertUpdate", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@UserID", UserId); cmd.Parameters.AddWithValue("@TransactionDate", grpOthrJrnlDto.TransactionDate); if (!string.IsNullOrWhiteSpace(grpOthrJrnlDto.VocherRefNumber)) { cmd.Parameters.AddWithValue("@VoucherRefNumber", grpOthrJrnlDto.VocherRefNumber); } cmd.Parameters.AddWithValue("@SLAccountId", grpOthrJrnlDto.FSLAccountId); cmd.Parameters.AddWithValue("@CollectionAgent", grpOthrJrnlDto.OnBehalfOfEmpId); cmd.Parameters.AddWithValue("@Amount", grpOthrJrnlDto.FAmount); cmd.Parameters.AddWithValue("@IsMasterCr", grpOthrJrnlDto.CrDr == "CR"); cmd.Parameters.AddWithValue("@Narration", grpOthrJrnlDto.Narration); cmd.Parameters.AddWithValue("@GroupId", GroupId); cmd.Parameters.AddWithValue("@TransactionXML", groupOtherJrnlTranxml); if (grpOthrJrnlDto.MemberId > 0) { cmd.Parameters.AddWithValue("@MemberId", grpOthrJrnlDto.MemberId); } SqlParameter prmAccountMasterId = new SqlParameter("@AccountMasterId", SqlDbType.Int); prmAccountMasterId.Value = grpOthrJrnlDto.AccountMasterID; prmAccountMasterId.Direction = ParameterDirection.InputOutput; cmd.Parameters.Add(prmAccountMasterId); SqlParameter prmVcoherNumber = new SqlParameter("@VoucherNumber", SqlDbType.VarChar, 32); prmVcoherNumber.Value = grpOthrJrnlDto.VoucherNumber; prmVcoherNumber.Direction = ParameterDirection.InputOutput; cmd.Parameters.Add(prmVcoherNumber); con.Open(); cmd.ExecuteNonQuery(); res.ObjectId = Convert.ToInt32(prmAccountMasterId.Value); res.ObjectCode = prmVcoherNumber.Value.ToString(); con.Close(); } catch (Exception ex) { throw ex; } return(res); }
public ActionResult CreateGroupJournal(string type, string Id) { bool isMemberJournal = type != null && type.ToUpper() == "M"; int accountMasterId = string.IsNullOrEmpty(Id.DecryptString()) ? default(int) : Convert.ToInt32(Id.DecryptString()); GroupJournalDto groupJournalDto = new GroupJournalDto(); ViewBag.EmpName = UserInfo.UserName; if (accountMasterId > 0) { groupJournalDto = _groupOtherJournalService.GetGroupJournalDetailsByID(accountMasterId); ViewBag.EmpName = groupJournalDto.EmployeeName; } LoadOtherJournalDropDowns(type); ViewBag.IsMemberJournal = isMemberJournal; return(View(groupJournalDto)); }