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