public JsonResult GetDetails(Int64 id) { var bill = billManager.GetAll(); var exist = advanceManager.GetById(id); var emp = employeeManager.GetAll(); var dis = districtManager.GetAll(); var sub = subDistrictManager.GetAll(); var advd = advanceDetailsManager.GetAll(); var pur = purposeManager.GetAll(); var ad = advanceManager.GetAll(); var query = (from b in bill where b.Id.Equals(id) join a in ad on b.AdvanceId equals a.Id join e in emp on a.EmployeeId equals e.Id select new BillVM { Id = b.Id, EmployeeId = e.Id, EmployeeName = e.Name, AdvanceId = a.Id, MemoNo = b.MemoNo, BillStatus = b.BillStatus, BillDate = b.BillDate, Vendor = b.Vendor, Description = b.Description }).ToList(); return(Json(new { Data = query, status = bill == null ? false : true }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetDetails(Int64 id) { var res = advanceManager.GetAll(); var exist = advanceManager.GetById(id); var emp = employeeManager.GetAll(); var dis = districtManager.GetAll(); var sub = subDistrictManager.GetAll(); var advd = advanceDetailsManager.GetAll(); var pur = purposeManager.GetAll(); var grd = gradeManager.GetAll(); if (exist.AdvanceType == "Travelling") { var query = (from a in res where a.Id.Equals(id) join e in emp on a.EmployeeId equals e.Id join g in grd on e.GradeId equals g.Id join d in dis on a.DistrictId equals d.Id join s in sub on a.SubDistrictId equals s.Id select new AdvanceVM { Id = a.Id, MemoNo = a.MemoNo, AdvanceType = a.AdvanceType, AdvanceStatus = a.AdvanceStatus, EmployeeId = a.EmployeeId, EmployeeName = e.Name, EmployeeCode = e.Code, GradeId = g.Id, EmployeeGrade = g.Grades, FromDate = a.FromDate, ToDate = a.ToDate, DistrictId = a.DistrictId, SubDistrictId = a.SubDistrictId, Location = a.Location, Description = a.Description }).ToList(); return(Json(new { Data = query, status = res == null ? false : true }, JsonRequestBehavior.AllowGet)); } else { var query = (from a in res where a.Id.Equals(id) join e in emp on a.EmployeeId equals e.Id join g in grd on e.GradeId equals g.Id select new AdvanceVM { Id = a.Id, MemoNo = a.MemoNo, AdvanceType = a.AdvanceType, AdvanceStatus = a.AdvanceStatus, EmployeeId = a.EmployeeId, EmployeeName = e.Name, EmployeeCode = e.Code, EmployeeGrade = g.Grades, FromDate = a.FromDate, ToDate = a.ToDate, Location = a.Location, Description = a.Description, Trainer = a.Trainer, Topic = a.Topic }).ToList(); return(Json(new { Data = query, status = res == null ? false : true }, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetDetails(Int64 id) { var res = advanceManager.GetAll(); var employeeExist = advanceManager.GetAll().Where(x => x.EmployeeId == id).FirstOrDefault(); var exist = advanceManager.GetById(employeeExist.Id); var emp = employeeManager.GetAll(); var dis = districtManager.GetAll(); var sub = subDistrictManager.GetAll(); var advd = advanceDetailsManager.GetAll(); var pur = purposeManager.GetAll(); var grd = gradeManager.GetAll(); var bill = billManager.GetAll(); var adjustInfo = adjustManager.GetAll(); if (exist.AdvanceType == "Travelling") { var query = (from e in emp where e.Id.Equals(id) join a in res on e.Id equals a.EmployeeId where a.AdvanceStatus.Equals("Confirmed") join b in bill on a.Id equals b.AdvanceId where b.BillStatus.Equals("Confirmed") join adj in adjustInfo on b.Id equals adj.BillingId join g in grd on e.GradeId equals g.Id join d in dis on a.DistrictId equals d.Id join s in sub on a.SubDistrictId equals s.Id select new AdvanceVM { Id = a.Id, MemoNo = a.MemoNo, AdvanceType = a.AdvanceType, AdvanceStatus = a.AdvanceStatus, EmployeeId = a.EmployeeId, EmployeeName = e.Name, EmployeeCode = e.Code, GradeId = g.Id, EmployeeGrade = g.Grades, FromDate = a.FromDate, ToDate = a.ToDate, DistrictId = a.DistrictId, DistrictName = d.Name, SubDistrictName = s.Name, SubDistrictId = a.SubDistrictId, Location = a.Location, Description = a.Description, GrandTotal = a.GrandTotal, BillId = b.Id, BillMemo = b.MemoNo, BillDate = b.BillDate, BillDescription = b.Description, BillVendor = b.Vendor, BillGrandTotal = adj.BillTotal }).ToList(); return(Json(new { Data = query, status = res == null ? false : true }, JsonRequestBehavior.AllowGet)); } else { var query = (from e in emp where e.Id.Equals(id) join a in res on e.Id equals a.EmployeeId where a.AdvanceStatus.Equals("Confirmed") join g in grd on e.GradeId equals g.Id join b in bill on a.Id equals b.AdvanceId where b.BillStatus.Equals("Confirmed") join adj in adjustInfo on b.Id equals adj.BillingId select new AdvanceVM { Id = a.Id, MemoNo = a.MemoNo, AdvanceType = a.AdvanceType, AdvanceStatus = a.AdvanceStatus, EmployeeId = a.EmployeeId, EmployeeName = e.Name, EmployeeCode = e.Code, EmployeeGrade = g.Grades, FromDate = a.FromDate, ToDate = a.ToDate, Location = a.Location, Description = a.Description, Trainer = a.Trainer, Topic = a.Topic, GrandTotal = a.GrandTotal, BillId = b.Id, BillMemo = b.MemoNo, BillDate = b.BillDate, BillDescription = b.Description, BillVendor = b.Vendor, BillGrandTotal = adj.BillTotal }).ToList(); return(Json(new { Data = query, status = res == null ? false : true }, JsonRequestBehavior.AllowGet)); } }