public ActionResult GetInwardDistReport(DateTime? fromDate, DateTime? toDate, string ReportList) { try { var TempleID = Convert.ToInt32(Request.Cookies["dcsankirtan"].Values["TempleID"]); if (fromDate == null || toDate == null) { return RedirectToAction("ValidationError", "Error", new { errorMesage = "From date and To date must be a valid date" }); } if (ReportList == "InDist") { ReportDataAccess Rpt = new ReportDataAccess(); var rptResult = Rpt.GetInventoryReportByDateRange(fromDate.Value, toDate.Value, TempleID); return PartialView("InventoryInwardDistReport", rptResult); } else { throw new Exception("Report type not supported"); } } catch (Exception ex) { ViewBag.PageError = ex.Message; return RedirectToAction("ValidationError", "Error", new { errorMesage = ex.Message }); // return PartialView("JobReportSearchResult", null); } }
// // GET: /Inventory/ public ActionResult Index(int? currentMonth, int? year) { int filteredMonth = DateTime.Now.Month; int filteredYear = DateTime.Now.Year; if (currentMonth != null) { filteredMonth = currentMonth.Value; } if (year != null) { filteredYear = year.Value; } ReportDataAccess summaryInfo = new ReportDataAccess(); var TempleID = Convert.ToInt32(Request.Cookies["dcsankirtan"].Values["TempleID"]); var inboundList = db.InboundMasters.Where(o => o.Date.Value.Month == filteredMonth && o.Date.Value.Year == filteredYear && o.TempleID == TempleID) .OrderByDescending(o => o.ModifiedDate).ToList(); if (inboundList.Count == 0) { var lastestEvent = db.InboundMasters.OrderByDescending(o => o.CreatedDate).FirstOrDefault(); if (lastestEvent == null) { lastestEvent = new InboundMaster { Date = DateTime.Now, Description = "DummyForNewTemple" }; } filteredMonth = lastestEvent.Date.Value.Month; filteredYear = lastestEvent.Date.Value.Year; inboundList = db.InboundMasters.Where(o => o.Date.Value.Month == filteredMonth && o.Date.Value.Year == filteredYear && o.TempleID == TempleID) .OrderByDescending(o => o.ModifiedDate).ToList(); } var orderedlist = inboundList.OrderByDescending(o => o.ModifiedDate); if (orderedlist.Count() == 0) { return View("InventoryDetails", new List<InboundMaster> { new InboundMaster { Date = DateTime.Now, Description = "DummyForNewTemple" } }); } else { return View("InventoryDetails",orderedlist); } }
private List<ReportData_EventType> GetReportByEventType(DateTime fromDate, DateTime toDate,int TempleID) { DataAccess.ReportDataAccess dataaccess = new DataAccess.ReportDataAccess(); return dataaccess.GetReportByEventType(fromDate, toDate, TempleID); }