Examples of DayHolder


Examples of org.projectforge.calendar.DayHolder

    final TimeSeries accumulatedSeriesExpected = new TimeSeries(I18n.getString("plugins.liquidityplanning.forecast.expected"));
    final TimeSeries creditSeries = new TimeSeries(I18n.getString("plugins.liquidityplanning.common.credit"));
    final TimeSeries debitSeries = new TimeSeries(I18n.getString("plugins.liquidityplanning.common.debit"));
    double accumulatedExpected = settings.getStartAmount().doubleValue();

    final DayHolder dh = new DayHolder();
    final Date lower = dh.getDate();
    for (int i = 0; i < settings.getNextDays(); i++) {
      final Day day = new Day(dh.getDayOfMonth(), dh.getMonth() + 1, dh.getYear());
      if (i > 0) {
        accumulatedExpected += cashFlow.getDebitsExpected()[i - 1].doubleValue() + cashFlow.getCreditsExpected()[i - 1].doubleValue();
      }
      accumulatedSeriesExpected.add(day, accumulatedExpected);
      creditSeries.add(day, cashFlow.getCreditsExpected()[i].doubleValue());
      debitSeries.add(day, cashFlow.getDebitsExpected()[i].doubleValue());
      dh.add(Calendar.DATE, 1);
    }
    dh.add(Calendar.DATE, -1);
    final XYChartBuilder cb = new XYChartBuilder(ChartFactory.createXYBarChart(null, null, false, null, null, PlotOrientation.VERTICAL,
        false, false, false));
    int counter = 0;

    final TimeSeriesCollection xyDataSeries = new TimeSeriesCollection();
    xyDataSeries.addSeries(accumulatedSeriesExpected);
    final XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer(true, true);
    lineRenderer.setSeriesPaint(0, cb.getRedMarker());
    lineRenderer.setSeriesVisibleInLegend(0, true);
    cb.setRenderer(counter, lineRenderer).setDataset(counter++, xyDataSeries)
    .setStrongStyle(lineRenderer, false, accumulatedSeriesExpected);

    final TimeSeriesCollection cashflowSet = new TimeSeriesCollection();
    cashflowSet.addSeries(debitSeries);
    cashflowSet.addSeries(creditSeries);
    final XYBarRenderer barRenderer = new XYBarRenderer(.2);
    barRenderer.setSeriesPaint(0, cb.getGreenFill());
    barRenderer.setSeriesPaint(1, cb.getRedFill());
    barRenderer.setShadowVisible(false);
    cb.setRenderer(counter, barRenderer).setDataset(counter++, cashflowSet);

    cb.setDateXAxis(true).setDateXAxisRange(lower, dh.getDate()).setYAxis(true, null);
    return cb.getChart();
  }
View Full Code Here

Examples of org.projectforge.calendar.DayHolder

    this(forecast, 90);
  }

  public LiquidityForecastCashFlow(final LiquidityForecast forecast, final int nextDays)
  {
    today = new DayHolder();
    final DayHolder lastDay = new DayHolder();
    lastDay.add(Calendar.DAY_OF_YEAR, nextDays);
    credits = newBigDecimalArray(nextDays);
    debits = newBigDecimalArray(nextDays);
    creditsExpected = newBigDecimalArray(nextDays);
    debitsExpected = newBigDecimalArray(nextDays);
    for (final LiquidityEntry entry : forecast.getEntries()) {
View Full Code Here

Examples of org.projectforge.calendar.DayHolder

    // column property names
    sheet.setColumns(cols);

    final int firstDataRowNumber = sheet.getRowCounter() + 1;
    final DayHolder current = today.clone();
    PropertyMapping mapping = new PropertyMapping();
    mapping.add("balanceExpected", BigDecimal.ZERO);
    mapping.add("balance", new Formula("D" + firstDataRowNumber));
    sheet.addRow(mapping.getMapping(), 0);

    for (int i = 0; i < credits.length; i++) {
      final int rowNumber = sheet.getRowCounter();
      mapping.add("date", current);
      mapping.add("creditsExpected", NumberHelper.isZeroOrNull(creditsExpected[i]) == true ? "" : creditsExpected[i]);
      mapping.add("debitsExpected", NumberHelper.isZeroOrNull(debitsExpected[i]) == true ? "" : debitsExpected[i]);
      mapping.add("balanceExpected", new Formula("D" + rowNumber + "+SUM(B" + rowNumber + ":C" + rowNumber + ")"));
      mapping.add("credits", NumberHelper.isZeroOrNull(credits[i]) == true ? "" : credits[i]);
      mapping.add("debits", NumberHelper.isZeroOrNull(debits[i]) == true ? "" : debits[i]);
      mapping.add("balance", new Formula("G" + rowNumber + "+SUM(E" + rowNumber + ":F" + rowNumber + ")"));
      sheet.addRow(mapping.getMapping(), 0);
      current.add(Calendar.DAY_OF_YEAR, 1);
    }
    mapping = new PropertyMapping();
    mapping.add("creditsExpected", new Formula("SUM(B" + firstDataRowNumber + ":B" + sheet.getRowCounter() + ")"));
    mapping.add("debitsExpected", new Formula("SUM(C" + firstDataRowNumber + ":C" + sheet.getRowCounter() + ")"));
    mapping.add("balanceExpected", new Formula("D" + firstDataRowNumber + "+SUM(B" + firstDataRowNumber + ":C" + sheet.getRowCounter() + ")"));
View Full Code Here

Examples of org.projectforge.calendar.DayHolder

    if (list == null) {
      return this;
    }
    final KontoCache accountCache = Registry.instance().getKontoCache();
    for (final RechnungDO invoice : list) {
      final DayHolder date = new DayHolder(invoice.getDatum());
      final DayHolder dateOfPayment = new DayHolder(invoice.getBezahlDatum());
      if (date == null || dateOfPayment == null) {
        continue;
      }
      final int timeForPayment = date.daysBetween(dateOfPayment);
      final int amount = invoice.getGrossSum().intValue();
View Full Code Here

Examples of org.projectforge.calendar.DayHolder

  private void setExpectedTimeOfPayment(final LiquidityEntry entry, final RechnungDO invoice)
  {
    Date dateOfInvoice = invoice.getDatum();
    if (dateOfInvoice == null) {
      dateOfInvoice = new DayHolder().getSQLDate();
    }
    final ProjektDO project = invoice.getProjekt();
    if (project != null
        && setExpectedDateOfPayment(entry, dateOfInvoice, "project#" + project.getId(),
            ProjektFormatter.formatProjektKundeAsString(project, null, null)) == true) {
View Full Code Here

Examples of org.projectforge.calendar.DayHolder

  {
    if (list == null) {
      return this;
    }
    for (final EingangsrechnungDO invoice : list) {
      final DayHolder date = new DayHolder(invoice.getDatum());
      final DayHolder dateOfPayment = new DayHolder(invoice.getBezahlDatum());
      if (date == null || dateOfPayment == null) {
        continue;
      }
      final int timeForPayment = date.daysBetween(dateOfPayment);
      final int amount = invoice.getGrossSum().intValue();
View Full Code Here

Examples of org.projectforge.calendar.DayHolder

  private void setExpectedTimeOfPayment(final LiquidityEntry entry, final EingangsrechnungDO invoice)
  {
    Date dateOfInvoice = invoice.getDatum();
    if (dateOfInvoice == null) {
      dateOfInvoice = new DayHolder().getSQLDate();
    }
    final KontoDO account = invoice.getKonto();
    if (account != null
        && setExpectedDateOfCreditorPayment(entry, dateOfInvoice, "account#" + account.getId(),
            "" + account.getNummer() + " - " + account.getBezeichnung()) == true) {
View Full Code Here

Examples of org.projectforge.calendar.DayHolder

    values.add(timeForPayment, amount);
  }

  private Date getDate(final Date date, final int timeOfPayment)
  {
    final DayHolder day = new DayHolder(date);
    day.add(Calendar.DAY_OF_YEAR, timeOfPayment);
    return day.getSQLDate();
  }
View Full Code Here

Examples of org.projectforge.calendar.DayHolder

        events.add(vEvent);
      }
    }
    final String weeksOfYear = params.get(PARAM_NAME_WEEK_OF_YEARS);
    if ("true".equals(weeksOfYear) == true) {
      final DayHolder from = new DayHolder();
      from.setBeginOfYear().add(java.util.Calendar.YEAR, -2).setBeginOfWeek();
      final DayHolder to = new DayHolder(from);
      to.add(java.util.Calendar.YEAR, 6);
      final DayHolder current = new DayHolder(from);
      int paranoiaCounter = 0;
      do {
        final VEvent vEvent = ICal4JUtils.createVEvent(current.getDate(), current.getDate(), "pf-weekOfYear"
            + current.getYear()
            + "-"
            + paranoiaCounter, PFUserContext.getLocalizedString("calendar.weekOfYearShortLabel") + " " + current.getWeekOfYear(), true);
        events.add(vEvent);
        current.add(java.util.Calendar.WEEK_OF_YEAR, 1);
        if (++paranoiaCounter > 500) {
          log.warn("Dear developer, please have a look here, paranoiaCounter exceeded! Aborting calculation of weeks of year.");
        }
      } while (current.before(to) == true);
    }
    // Integer hrPlanningUserId = NumberHelper.parseInteger(params.get(PARAM_NAME_HR_PLANNING));
    // if (hrPlanningUserId != null) {
    // if (loggedInUser.getId().equals(hrPlanningUserId) == false && isOtherUsersAllowed() == false) {
    // // Only project managers, controllers and administrative staff is allowed to subscribe time-sheets of other users.
View Full Code Here

Examples of org.projectforge.calendar.DayHolder

    do {
      if (++paranoiaCounter > 4000) {
        log.error("Paranoia counter exceeded! Dear developer, please have a look at the implementation of buildEvents.");
        break;
      }
      final DayHolder dh = new DayHolder(day.toDate());
      String backgroundColor, color, textColor;
      if (dh.isHoliday() == true) {
        if (dh.isWorkingDay() == true) {
          backgroundColor = "#FFF0F0";
          color = "#EEEEEE";
          textColor = "#222222";
        } else {
          backgroundColor = "#f9dfde";
          color = "#EEEEEE";
          textColor = "#FF2222";
        }
      } else {
        day = day.plusDays(1);
        continue;
      }

      final Event event = new Event().setAllDay(true);
      final String id = "h-" + (++idCounter);
      event.setId(id);
      event.setStart(day.toDateTime());
      String title;
      final String holidayInfo = dh.getHolidayInfo();
      if (holidayInfo != null && holidayInfo.startsWith("calendar.holiday.") == true) {
        title = PFUserContext.getLocalizedString(holidayInfo);
      } else {
        title = holidayInfo;
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.