Package org.projectforge.timesheet

Examples of org.projectforge.timesheet.TimesheetFilter


      final DayHolder day = new DayHolder(filter.getStartTime());
      day.setEndOfWeek();
      filter.setStopTime(day.getDate());
    }
    if (filter.isShowBookedTimesheets() == true) {
      final TimesheetFilter tsFilter = new TimesheetFilter();
      tsFilter.setStartTime(filter.getStartTime());
      tsFilter.setStopTime(filter.getStopTime());
      final List<TimesheetDO> sheets = timesheetDao.getList(tsFilter);
      for (final TimesheetDO sheet : sheets) {
        final PFUserDO user = userGroupCache.getUser(sheet.getUserId());
        if (user == null) {
          log.error("Oups, user of time sheet is null or unknown? Ignoring entry: " + sheet);
View Full Code Here


   */
  public JFreeChart create(final TimesheetDao timesheetDao, final Integer userId, final double workingHoursPerDay,
      final short forLastNDays, final boolean showAxisValues)
  {
    final DayHolder dh = new DayHolder();
    final TimesheetFilter filter = new TimesheetFilter();
    filter.setStopTime(dh.getDate());
    dh.add(Calendar.DATE, -forLastNDays);
    filter.setStartTime(dh.getDate());
    filter.setUserId(userId);
    filter.setOrderType(OrderDirection.ASC);
    final List<TimesheetDO> list = timesheetDao.getList(filter);
    final TimeSeries sollSeries = new TimeSeries("Soll");
    final TimeSeries istSeries = new TimeSeries("Ist");
    planWorkingHours = 0;
    actualWorkingHours = 0;
View Full Code Here

   * @return
   */
  public JFreeChart create(final TimesheetDao timesheetDao, final Integer userId, final short forLastNDays, final boolean showAxisValues)
  {
    final DayHolder dh = new DayHolder();
    final TimesheetFilter filter = new TimesheetFilter();
    filter.setStopTime(dh.getDate());
    dh.add(Calendar.DATE, -forLastNDays);
    filter.setStartTime(dh.getDate());
    filter.setUserId(userId);
    filter.setOrderType(OrderDirection.ASC);
    final List<TimesheetDO> list = timesheetDao.getList(filter);
    final TimeSeries planSeries = new TimeSeries("Soll");
    final TimeSeries actualSeries = new TimeSeries("Ist");
    final Iterator<TimesheetDO> it = list.iterator();
    TimesheetDO current = null;
View Full Code Here

   * @see org.projectforge.web.wicket.AbstractListPage#buildList()
   */
  @Override
  protected List<TimesheetDO> buildList()
  {
    final TimesheetFilter filter = form.getSearchFilter();
    if (filter.getStartTime() == null && filter.getStopTime() == null && filter.getTaskId() == null) {
      return null;
    }
    return super.buildList();
  }
View Full Code Here

      form.addError("validation.error.nothingToExport");
      return;
    }
    final StringBuffer buf = new StringBuffer();
    buf.append("timesheets_");
    final TimesheetFilter filter = form.getSearchFilter();
    if (filter.getUserId() != null) {
      buf.append(FileHelper.createSafeFilename(userGroupCache.getUser(filter.getUserId()).getLastname(), 20)).append("_");
    }
    if (filter.getTaskId() != null) {
      final String taskTitle = taskTree.getTaskById(filter.getTaskId()).getTitle();
      buf.append(FileHelper.createSafeFilename(taskTitle, 8)).append("_");
    }
    buf.append(DateHelper.getDateAsFilenameSuffix(filter.getStartTime())).append("_")
    .append(DateHelper.getDateAsFilenameSuffix(filter.getStopTime())).append(".pdf");
    final String filename = buf.toString();

    // get the sheets from the given Format
    final String styleSheet = "fo-styles/" + form.getExportFormat() + "/timesheet-template-fo.xsl";
    final String xmlData = "fo-styles/" + form.getExportFormat() + "/timesheets2pdf.xml";

    // get the formatter for the different export formats
    final Formatter formatter = formatterFactory.getFormatter(form.getExportFormat());

    final Integer taskId = filter.getTaskId();

    final Map<String, Object> data = formatter.getData(timeSheets, taskId, getRequest(), getResponse(), filter);

    // render the PDF with fop
    final byte[] content = pdfRenderer.render(styleSheet, xmlData, data);
View Full Code Here

      report.setEmployee(employee);
    } else {
      report.setUser(user);
    }
    report.init();
    TimesheetFilter filter = new TimesheetFilter();
    filter.setDeleted(false);
    filter.setStartTime(report.getFromDate());
    filter.setStopTime(report.getToDate());
    filter.setUserId(user.getId());
    List<TimesheetDO> list = timesheetDao.getList(filter);
    if (CollectionUtils.isNotEmpty(list) == true) {
      for (TimesheetDO sheet : list) {
        report.addTimesheet(sheet);
      }
View Full Code Here

    if (userId == null) {
      return;
    }
    breaksMap = new HashMap<String, TimesheetDO>();
    int breaksCounter = 0;
    final TimesheetFilter filter = new TimesheetFilter();
    filter.setUserId(userId);
    filter.setStartTime(start.toDate());
    filter.setStopTime(end.toDate());
    filter.setOrderType(OrderDirection.ASC);
    timesheets = timesheetDao.getList(filter);
    boolean longFormat = false;
    days = Days.daysBetween(start, end).getDays();
    if (days < 10) {
      // Week or day view:
View Full Code Here

      public void validate(final Form< ? > form)
      {
        if (parentPage.isMassUpdateMode() == true) {

        } else {
          final TimesheetFilter filter = getSearchFilter();
          final Date from = startDate.getConvertedInput();
          final Date to = stopDate.getConvertedInput();
          if (from == null && to == null && filter.getTaskId() == null) {
            error(getString("timesheet.error.filter.needMore"));
          } else if (from != null && to != null && from.after(to) == true) {
            error(getString("timesheet.error.startTimeAfterStopTime"));
          }
        }
      }
    });
    final TimesheetFilter filter = getSearchFilter();
    {
      gridBuilder.newSplitPanel(GridSize.COL66);
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("task")).suppressLabelForWarning();
      final TaskSelectPanel taskSelectPanel = new TaskSelectPanel(fs, new Model<TaskDO>() {
        @Override
        public TaskDO getObject()
        {
          return taskTree.getTaskById(getSearchFilter().getTaskId());
        }

        @Override
        public void setObject(final TaskDO task)
        {
          if (task != null) {
            getSearchFilter().setTaskId(task.getId());
          } else {
            getSearchFilter().setTaskId(null);
          }
        }
      }, parentPage, "taskId");
      fs.add(taskSelectPanel);
      taskSelectPanel.init();
      taskSelectPanel.setRequired(false);
    }
    {
      // Assignee
      gridBuilder.newSplitPanel(GridSize.COL33);
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("user"));
      final UserSelectPanel assigneeSelectPanel = new UserSelectPanel(fs.newChildId(), new Model<PFUserDO>() {
        @Override
        public PFUserDO getObject()
        {
          return userGroupCache.getUser(filter.getUserId());
        }

        @Override
        public void setObject(final PFUserDO object)
        {
          if (object == null) {
            filter.setUserId(null);
          } else {
            filter.setUserId(object.getId());
          }
        }
      }, parentPage, "userId");
      fs.add(assigneeSelectPanel);
      assigneeSelectPanel.setDefaultFormProcessing(false);
      assigneeSelectPanel.init().withAutoSubmit(true);
    }
    {
      gridBuilder.newSplitPanel(GridSize.COL66);
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("timePeriod"));
      startDate = new DatePanel(fs.newChildId(), new PropertyModel<Date>(filter, "startTime"), DatePanelSettings.get()
          .withSelectPeriodMode(true));
      fs.add(dependentFormComponents[0] = startDate);
      fs.setLabelFor(startDate);
      fs.add(new DivTextPanel(fs.newChildId(), " - "));
      stopDate = new DatePanel(fs.newChildId(), new PropertyModel<Date>(filter, "stopTime"), DatePanelSettings.get().withSelectPeriodMode(
          true));
      fs.add(dependentFormComponents[1] = stopDate);
      {
        final SubmitLink unselectPeriodLink = new SubmitLink(IconLinkPanel.LINK_ID) {
          @Override
          public void onSubmit()
          {
            getSearchFilter().setStartTime(null);
            getSearchFilter().setStopTime(null);
            clearInput();
            parentPage.refresh();
          };
        };
        unselectPeriodLink.setDefaultFormProcessing(false);
        fs.add(new IconLinkPanel(fs.newChildId(), IconType.REMOVE_SIGN, new ResourceModel("calendar.tooltip.unselectPeriod"),
            unselectPeriodLink).setColor(CSSColor.RED));
      }
      final QuickSelectPanel quickSelectPanel = new QuickSelectPanel(fs.newChildId(), parentPage, "quickSelect", startDate);
      fs.add(quickSelectPanel);
      quickSelectPanel.init();
      fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
        @Override
        public String getObject()
        {
          return WicketUtils.getCalendarWeeks(TimesheetListForm.this, filter.getStartTime(), filter.getStopTime());
        }
      }));
      fs.add(new HtmlCommentPanel(fs.newChildId(), new Model<String>() {
        @Override
        public String getObject()
        {
          return WicketUtils.getUTCDates(filter.getStartTime(), filter.getStopTime());
        }
      }));
    }
    {
      // Duration
View Full Code Here

        // Only project managers, controllers and administrative staff is allowed to subscribe time-sheets of other users.
        log.warn("User tried to get time-sheets of other user: " + timesheetUser);
        timesheetUser = loggedInUser;
      }
      // initializes timesheet filter
      final TimesheetFilter filter = new TimesheetFilter();
      filter.setUserId(timesheetUser.getId());
      filter.setDeleted(false);
      filter.setStopTime(cal.getTime());
      // calculates the offset of the calendar
      final int offset = cal.get(java.util.Calendar.MONTH) - PERIOD_IN_MONTHS;
      if (offset < 0) {
        setCalDate(cal, cal.get(java.util.Calendar.YEAR) - 1, 12 + offset);
      } else {
        setCalDate(cal, cal.get(java.util.Calendar.YEAR), offset);
      }
      filter.setStartTime(cal.getTime());

      final TimesheetDao timesheetDao = Registry.instance().getDao(TimesheetDao.class);
      final List<TimesheetDO> timesheetList = timesheetDao.getList(filter);

      // iterate over all timesheets and adds each event to the calendar
View Full Code Here

TOP

Related Classes of org.projectforge.timesheet.TimesheetFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.