public ActionResult ByStaff(DateTime?fromDate, DateTime?toDate, string staff) { HCosmeticEntities2 db = new HCosmeticEntities2(); var Stafflist = db.SalePersons.ToList(); SelectList list = new SelectList(Stafflist, "SalePersonName", "SalePersonName"); ViewBag.staffName = list; if (!fromDate.HasValue) { fromDate = DateTime.Now.Date; } if (!toDate.HasValue) { toDate = fromDate.GetValueOrDefault(DateTime.Now.Date).Date.AddDays(1); } if (toDate < fromDate) { toDate = fromDate.GetValueOrDefault(DateTime.Now.Date).Date.AddDays(1); } ViewBag.fromDate = fromDate; ViewBag.toDate = toDate; var report = db.revenues.Where(c => c.OrderDate >= fromDate && c.OrderDate <= toDate && c.SalePersonName == staff).ToList(); return(View(report)); }
public ActionResult Bystore(DateTime?fromDate, DateTime?toDate, string StoreList) { HCosmeticEntities2 db = new HCosmeticEntities2(); var StoreLocation = db.Stores.ToList(); SelectList list = new SelectList(StoreLocation, "StoreLocation", "StoreLocation"); ViewBag.StoreLocation = list; if (!fromDate.HasValue) { fromDate = DateTime.Now.Date; } if (!toDate.HasValue) { toDate = fromDate.GetValueOrDefault(DateTime.Now.Date).Date.AddDays(1); } if (toDate < fromDate) { toDate = fromDate.GetValueOrDefault(DateTime.Now.Date).Date.AddDays(1); } ViewBag.fromDate = fromDate; ViewBag.toDate = toDate; var report = db.revenues.Where(c => c.OrderDate >= fromDate && c.OrderDate <= toDate && c.StoreLocation == StoreList).ToList(); return(View(report)); }