public ActionResult Payroll()
        {
            var filtersList = PayrollFilterListItem.GetList();

            ViewBag.Push            = new ViewModelBase(PushState, "/Providers/Payroll", "Payroll");
            ViewBag.AvailableDates  = HoursRepository.GetScrubAvailableDates();
            ViewBag.FilterSelection = filtersList;
            ViewBag.SelectedFilter  = filtersList.Where(x => x.Value == "none").Single();

            // if within 10 days of start of month, default to last month, otherwise use this month
            var targetDate = DateTime.Now;

            if (targetDate.Day <= 10)
            {
                targetDate = targetDate.AddMonths(-1);
            }
            ViewBag.SelectedDate = new AvailableDate()
            {
                Date = new DateTime(targetDate.Year, targetDate.Month, 1)
            };
            var model = new PayrollVM
            {
                Items = HoursRepository.GetPayablesByPeriod(new DateTime(targetDate.Year, targetDate.Month, 1))
            };

            return(GetView("Payroll", model));
        }
        public ActionResult PayrollExportXlsx(DateTime targetDate, bool commit, string filter)
        {
            var filterValue = PayrollFilterListItem.GetEnumValue(filter);

            ProviderService.PayrollExportXlxs(targetDate, commit, filterValue, out GridViewSettings gridViewSettings, out IEnumerable <PayrollGridItemVM> data);
            return(GridViewExtension.ExportToXlsx(gridViewSettings, data));
        }
        public ActionResult PayrollGridCallback(DateTime targetDate, string selectedFilter)
        {
            var filtersList = PayrollFilterListItem.GetList();

            ViewBag.FilterSelection = filtersList;
            ViewBag.SelectedFilter  = filtersList.Where(x => x.Value == selectedFilter).Single();
            ViewBag.AvailableDates  = HoursRepository.GetScrubAvailableDates();
            ViewBag.SelectedDate    = new AvailableDate()
            {
                Date = targetDate
            };
            var filterEnumValue = PayrollFilterListItem.GetEnumValue(selectedFilter);
            var model           = HoursRepository.GetPayablesByPeriod(new DateTime(targetDate.Year, targetDate.Month, 1), filterEnumValue);

            return(PartialView("PayrollGrid", model));
        }