public ActionResult YearWiseFeeReportList(string name, string year) { if (Session["id"] == null) return RedirectToAction("signin", "Home"); schooldbEntities db = new schooldbEntities(); ViewBag.className = name; ViewBag.year = year; int classId = (from tmp in db.classes where tmp.className == name select tmp.classId).First(); ReportStructure structure = new ReportStructure(); List<student> stdList = (from tmp in db.students where tmp.classId == classId && tmp.StudentStatus == 1 select tmp).ToList(); structure.stdList = stdList; List<double?> feeList1 = new List<double?>(); List<double?> feeList2 = new List<double?>(); List<double?> feeList3 = new List<double?>(); List<double?> feeList4 = new List<double?>(); List<double?> feeList5 = new List<double?>(); List<double?> feeList6 = new List<double?>(); List<double?> feeList7 = new List<double?>(); List<double?> feeList8 = new List<double?>(); List<double?> feeList9 = new List<double?>(); List<double?> feeList10 = new List<double?>(); List<double?> feeList11 = new List<double?>(); List<double?> feeList12 = new List<double?>(); Boolean isPaid = true; foreach (student std in stdList) { // 1 isPaid = (from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "January" select tmp.Is_Paid).FirstOrDefault(); if (isPaid) feeList1.Add((double)std.StudentFee); else feeList1.Add(0); // 2 isPaid = (from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "Februray" select tmp.Is_Paid).FirstOrDefault(); if (isPaid) feeList2.Add((double)std.StudentFee); else feeList2.Add(0); // 3 isPaid = (from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "March" select tmp.Is_Paid).FirstOrDefault(); if (isPaid) feeList3.Add((double)std.StudentFee); else feeList3.Add(0); // 4 isPaid = (from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "April" select tmp.Is_Paid).FirstOrDefault(); if (isPaid) feeList4.Add((double)std.StudentFee); else feeList4.Add(0); // 5 isPaid = (from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "May" select tmp.Is_Paid).FirstOrDefault(); if (isPaid) feeList5.Add((double)std.StudentFee); else feeList5.Add(0); // 6 isPaid = (from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "June" select tmp.Is_Paid).FirstOrDefault(); if (isPaid) feeList6.Add((double)std.StudentFee); else feeList6.Add(0); // 7 isPaid = (from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "July" select tmp.Is_Paid).FirstOrDefault(); if (isPaid) feeList7.Add((double)std.StudentFee); else feeList7.Add(0); // 8 isPaid = (from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "August" select tmp.Is_Paid).FirstOrDefault(); if (isPaid) feeList8.Add((double)std.StudentFee); else feeList8.Add(0); // 9 isPaid = (from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "September" select tmp.Is_Paid).FirstOrDefault(); if (isPaid) feeList9.Add((double)std.StudentFee); else feeList9.Add(0); // 10 isPaid = (from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "October" select tmp.Is_Paid).FirstOrDefault(); if (isPaid) feeList10.Add((double)std.StudentFee); else feeList10.Add(0); // 11 isPaid = (from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "November" select tmp.Is_Paid).FirstOrDefault(); if (isPaid) feeList11.Add((double)std.StudentFee); else feeList11.Add(0); // 12 isPaid = (from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "December" select tmp.Is_Paid).FirstOrDefault(); if (isPaid) feeList12.Add((double)std.StudentFee); else feeList12.Add(0); } structure.feeList1 = feeList1; structure.feeList2 = feeList2; structure.feeList3 = feeList3; structure.feeList4 = feeList4; structure.feeList5 = feeList5; structure.feeList6 = feeList6; structure.feeList7 = feeList7; structure.feeList8 = feeList8; structure.feeList9 = feeList9; structure.feeList10 = feeList10; structure.feeList11 = feeList11; structure.feeList12 = feeList12; List<fee> feesList1 = new List<fee>(); List<fee> feesList2 = new List<fee>(); List<fee> feesList3 = new List<fee>(); List<fee> feesList4 = new List<fee>(); List<fee> feesList5 = new List<fee>(); List<fee> feesList6 = new List<fee>(); List<fee> feesList7 = new List<fee>(); List<fee> feesList8 = new List<fee>(); List<fee> feesList9 = new List<fee>(); List<fee> feesList10 = new List<fee>(); List<fee> feesList11 = new List<fee>(); List<fee> feesList12 = new List<fee>(); foreach (student std in stdList) { // 1 feesList1.Add((from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "January" select tmp).FirstOrDefault()); // 2 feesList2.Add((from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "Februray" select tmp).FirstOrDefault()); // 3 feesList3.Add((from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "March" select tmp).FirstOrDefault()); // 4 feesList4.Add((from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "April" select tmp).FirstOrDefault()); // 5 feesList5.Add((from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "May" select tmp).FirstOrDefault()); // 6 feesList6.Add((from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "June" select tmp).FirstOrDefault()); // 7 feesList7.Add((from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "July" select tmp).FirstOrDefault()); // 8 feesList8.Add((from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "August" select tmp).FirstOrDefault()); // 9 feesList9.Add((from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "September" select tmp).FirstOrDefault()); // 10 feesList10.Add((from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "October" select tmp).FirstOrDefault()); // 11 feesList11.Add((from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "November" select tmp).FirstOrDefault()); // 12 feesList12.Add((from tmp in db.fees where tmp.studentId == std.studentId && tmp.Year == year && tmp.Month == "December" select tmp).FirstOrDefault()); } structure.feesList1 = feesList1; structure.feesList2 = feesList2; structure.feesList3 = feesList3; structure.feesList4 = feesList4; structure.feesList5 = feesList5; structure.feesList6 = feesList6; structure.feesList7 = feesList7; structure.feesList8 = feesList8; structure.feesList9 = feesList9; structure.feesList10 = feesList10; structure.feesList11 = feesList11; structure.feesList12 = feesList12; return View(structure); }
// // GET: /Fees/Details/5 public ActionResult Details(int id, string year) { if (Session["id"] == null) return RedirectToAction("signin", "Home"); schooldbEntities db = new schooldbEntities(); ReportStructure structure = new ReportStructure(); ViewBag.year = year; List<student> stdList = (from tmp in db.students where tmp.familyId == id && tmp.StudentStatus == 1 select tmp).ToList(); structure.stdList = stdList; List<double?> sum = (from tmp in db.students where tmp.familyId == id && tmp.StudentStatus == 1 select tmp.StudentFee).ToList(); structure.feeList = sum; structure.totalFee = sum.Sum(); List<fee> feeList = new List<fee>(); foreach (student tmp in stdList) { List <fee> tmpFeeList = (from t in db.fees where tmp.studentId == t.studentId && t.Year == year select t).ToList(); foreach (fee obj in tmpFeeList) feeList.Add(obj); } structure.feesList = feeList; double? discount = (from tmp in db.families where tmp.familyId == id select tmp.Discount).FirstOrDefault(); structure.netFee = sum.Sum() - (discount / 100 * sum.Sum()); return View(structure); }