@RequestMapping("/update")
  public ModelAndView updatePaytype(
      String id, HttpServletResponse response, HttpServletRequest request) throws Exception {
    ModelAndView view = new ModelAndView();
    Report report = reportLogService.findById(id);
    User user = SessionUtils.getUser(request);
    if (user != null && user.getCompany() != null) {
      List<PayGroup> payGroups = tmsService.findAllPageGroups(user.getCompany().getId());
      view.getModelMap().put("payGroupList", payGroups);
    }
    view.getModelMap().put("reportTypeList", ReportType.values());
    List<String> pagings = new ArrayList<String>();
    pagings.add("Postion");
    pagings.add("Employee");
    view.getModelMap().put("pagingList", pagings);

    List<String> sorts = new ArrayList<String>();
    sorts.add("surname");
    sorts.add("Firstname");
    sorts.add("Employee No");
    view.getModelMap().put("sortList", sorts);
    view.getModel().put("report", new ReportVo(report));
    view.setViewName("admin/report/savereport");
    return view;
  }
  @RequestMapping("/condition")
  public ModelAndView condition(
      ReportType type, HttpServletResponse response, HttpServletRequest request) throws Exception {
    ModelAndView view = new ModelAndView();

    User user = SessionUtils.getUser(request);
    if (user != null && user.getCompany() != null) {
      List<PayGroup> payGroups = tmsService.findAllPageGroups(user.getCompany().getId());
      view.getModelMap().put("payGroupList", payGroups);
    }

    if (ReportType.TimeCardReport.getName().equals(type.getName())) {
      view.setViewName("admin/report/timecard");
    }

    if (ReportType.TimeCardDetailsReport.getName().equals(type.getName())) {
      view.setViewName("admin/report/timecarddetails");
    }
    if (ReportType.EmployeesListReport.getName().equals(type.getName())) {
      view.setViewName("admin/report/employeelist");
    }
    if (ReportType.ExceptionsReport.getName().equals(type.getName())) {
      view.getModelMap().put("types", ExcetpitonTypes.values());
      view.setViewName("admin/report/exceptions");
    }
    if (ReportType.OnsiteReport.getName().equals(type.getName())) {
      view.setViewName("admin/report/onsite");
    }
    if (ReportType.LeaveReport.getName().equals(type.getName())) {
      view.setViewName("admin/report/leave");
    }
    if (ReportType.JobHoursSummaryReport.getName().equals(type.getName())) {
      view.setViewName("admin/report/jobhourssummary");
    }
    if (ReportType.JobHoursDetailsReport.getName().equals(type.getName())) {
      view.setViewName("admin/report/jobhoursdetails");
    }
    if (ReportType.AuditingReport.getName().equals(type.getName())) {
      view.setViewName("admin/report/auditing");
    }

    return view;
  }
 @RequestMapping("/save")
 public ModelAndView saveReport(
     ReportVo reportVo, HttpServletResponse response, HttpServletRequest request)
     throws Exception {
   User user = SessionUtils.getUser(request);
   ModelAndView view = new ModelAndView();
   Report report = new Report();
   if (StringUtils.isNotEmpty(reportVo.getId())) {
     report = reportLogService.findById(reportVo.getId());
   }
   if (StringUtils.isNotEmpty(reportVo.getPaging())) {
     report.setPaging(reportVo.getPaging());
   }
   if (StringUtils.isNotEmpty(reportVo.getSort())) {
     report.setSort(reportVo.getSort());
   }
   if (StringUtils.isNotEmpty(reportVo.getPayGroupId())) {
     PayGroup payGroup = tmsService.findPayGroupById(reportVo.getPayGroupId());
     if (payGroup != null) {
       report.setPayGroup(payGroup);
     }
   }
   if (StringUtils.isNotEmpty(reportVo.getReportType())) {
     report.setReportType(ReportType.valueOf(reportVo.getReportType()));
   }
   report.setUpdateTime(new Date());
   if (StringUtils.isNotEmpty(reportVo.getId())) {
     reportLogService.update(report);
   } else {
     report.setUser(user);
     report.setCompany(user.getCompany());
     reportLogService.save(report);
   }
   view.getModel().put("message", "success");
   return view;
 }