Package org.projectforge.excel

Examples of org.projectforge.excel.PropertyMapping


    sheetProvider.putFormat(Col.WEDNESDAYHOURS, "0.00");
    sheetProvider.putFormat(Col.THURSDAYHOURS, "0.00");
    sheetProvider.putFormat(Col.FRIDAYHOURS, "0.00");
    sheetProvider.putFormat(Col.WEEKENDHOURS, "0.00");

    final PropertyMapping mapping = new PropertyMapping();
    for (final HRPlanningDO planningSheet : list) {
      // final ProjektDO projekt = projektDao.getById(planningSheet.getProjektId());
      // final PFUserDO user = userGroupCache.getUser(planningSheet.getUserId());
      // mapping.add(Col.USER, user.getFullname());
      // final String projektName = projekt != null ? projekt.getName() : "";
      // mapping.add(Col.PROJEKT, projektName);
      // mapping.add(Col.WEEK_OF_YEAR, DateTimeFormatter.instance().getFormattedWeekOfYear(planningSheet.getStartTime()));
      // mapping.add(Col.PRIORITY, planningSheet.getPriority());
      // mapping.add(Col.PROBABILITY, planningSheet.getProbability());
      // mapping.add(Col.UNASSIGNEDHOURS, planningSheet.getUnassignedHours());
      // mapping.add(Col.MONDAYHOURS, planningSheet.getMondayHours());
      // mapping.add(Col.TUESDAYHOURS, planningSheet.getTuesdayHours());
      // mapping.add(Col.WEDNESDAYHOURS, planningSheet.getWednesdayHours());
      // mapping.add(Col.THURSDAYHOURS, planningSheet.getThursdayHours());
      // mapping.add(Col.FRIDAYHOURS, planningSheet.getFridayHours());
      // mapping.add(Col.WEEKENDHOURS, planningSheet.getWeekendHours());
      // mapping.add(Col.DESCRIPTION, planningSheet.getDescription());

      sheet.addRow(mapping.getMapping(), 0);
    }
    sheet.setZoom(3, 4); // 75%

    return xls;
  }
View Full Code Here


    final ContentProvider sheetProvider = sheet.getContentProvider();
    // Columnformats
    sheetProvider.putFormat(Col.TOTAL_DURATION, "0.00");
    sheetProvider.putFormat(Col.WORKDAYS, "0.00");

    final PropertyMapping mapping = new PropertyMapping();

    // Ermittele Anzahl unterschiedlicher Projekte
    final List<String> projectNames = new ArrayList<String>();
    for (final HRPlanningDO planningSheet : list) {
      // final String projectName = planningSheet.getProjekt().getName();
View Full Code Here

    final ContentProvider sheetProvider = sheet.getContentProvider();
    // Columnformats
    sheetProvider.putFormat(Col.TOTAL_DURATION, "0.00");
    sheetProvider.putFormat(Col.WORKDAYS, "0.00");

    final PropertyMapping mapping = new PropertyMapping();

    // Ermittele Anzahl unterschiedlicher User
    final List<String> userNames = new ArrayList<String>();
    for (final HRPlanningDO planningSheet : list) {
      final String userName = planningSheet.getUser().getFullname();
View Full Code Here

    cols[i++] = new I18nExportColumn("number", "fibu.rechnung.nummer", 6);
    cols[i++] = new I18nExportColumn("debitor", "fibu.common.debitor", 60);
    cols[i++] = new I18nExportColumn("subject", PropUtils.getI18nKey(AbstractRechnungDO.class, "betreff"), 100);
    // column property names
    sheet.setColumns(cols);
    final PropertyMapping mapping = new PropertyMapping();
    for (final RechnungDO entry : list) {
      entry.recalculate();
      mapping.add("datum", entry.getDatum());
      mapping.add("faelligkeit", entry.getFaelligkeit());
      mapping.add("gross", entry.getGrossSum());
      mapping.add("number", entry.getNummer());
      mapping.add("debitor", entry.getKundeAsString());
      mapping.add("subject", entry.getBetreff());
      sheet.addRow(mapping.getMapping(), 0);
    }
  }
View Full Code Here

    exporter.putCurrencyFormat(sheetProvider, cols[i++]);
    cols[i++] = new I18nExportColumn("creditor", "fibu.common.creditor", 60);
    cols[i++] = new I18nExportColumn("subject", PropUtils.getI18nKey(AbstractRechnungDO.class, "betreff"), 100);
    // column property names
    sheet.setColumns(cols);
    final PropertyMapping mapping = new PropertyMapping();
    for (final EingangsrechnungDO entry : list) {
      entry.recalculate();
      mapping.add("datum", entry.getDatum());
      mapping.add("faelligkeit", entry.getFaelligkeit());
      mapping.add("gross", entry.getGrossSum());
      mapping.add("creditor", entry.getKreditor());
      mapping.add("subject", entry.getBetreff());
      sheet.addRow(mapping.getMapping(), 0);
    }
  }
View Full Code Here

    sheetProvider.putFormat(InvoicesCol.KORREKTUR, "#,##0.00;[Red]-#,##0.00");
    sheetProvider.putFormat(InvoicesCol.KOST1, "#");
    sheetProvider.putFormat(InvoicesCol.KOST2, "#");
    sheetProvider.putFormat(InvoicesCol.DATE, "dd.MM.yyyy");

    final PropertyMapping mapping = new PropertyMapping();
    for (final KostZuweisungDO zuweisung : list) {
      final AbstractRechnungsPositionDO position;
      final AbstractRechnungDO< ? > rechnung;
      final String referenz;
      final String text;
      if (zuweisung.getRechnungsPosition() != null) {
        position = zuweisung.getRechnungsPosition();
        rechnung = ((RechnungsPositionDO) position).getRechnung();
        final RechnungDO r = (RechnungDO) rechnung;
        referenz = String.valueOf(r.getNummer());
        text = ProjektFormatter.formatProjektKundeAsString(r.getProjekt(), r.getKunde(), r.getKundeText());
      } else {
        position = zuweisung.getEingangsrechnungsPosition();
        rechnung = ((EingangsrechnungsPositionDO) position).getEingangsrechnung();
        final EingangsrechnungDO r = (EingangsrechnungDO) rechnung;
        referenz = r.getReferenz();
        text = r.getKreditor();
      }
      final BigDecimal grossSum = position.getBruttoSum();

      BigDecimal korrektur = null;
      if (grossSum.compareTo(position.getKostZuweisungGrossSum()) != 0) {
        korrektur = CurrencyHelper.getGrossAmount(position.getKostZuweisungNetFehlbetrag(), position.getVat());
        if (NumberHelper.isZeroOrNull(korrektur) == true) {
          korrektur = null;
        }
      }
      mapping.add(InvoicesCol.BRUTTO, zuweisung.getBrutto());
      mapping.add(InvoicesCol.VAT, NumberHelper.isNotZero(position.getVat()));
      Integer kontoNummer = null;
      if (rechnung instanceof RechnungDO) {
        final KontoDO konto = kontoCache.getKonto(((RechnungDO) rechnung));
        if (konto != null) {
          kontoNummer = konto.getNummer();
        }
      } else if (rechnung instanceof EingangsrechnungDO) {
        final Integer kontoId = ((EingangsrechnungDO) rechnung).getKontoId();
        if (kontoId != null) {
          final KontoDO konto = kontoCache.getKonto(kontoId);
          if (konto != null) {
            kontoNummer = konto.getNummer();
          }
        }
      }
      mapping.add(InvoicesCol.KONTO, kontoNummer != null ? kontoNummer : "");
      mapping.add(InvoicesCol.REFERENZ, StringHelper.removeNonDigitsAndNonASCIILetters(referenz));
      mapping.add(InvoicesCol.DATE, rechnung.getDatum());
      mapping.add(InvoicesCol.GEGENKONTO, "");
      mapping.add(InvoicesCol.KOST1, zuweisung.getKost1() != null ? zuweisung.getKost1().getNummer() : "");
      mapping.add(InvoicesCol.KOST2, zuweisung.getKost2() != null ? zuweisung.getKost2().getNummer() : "");
      mapping.add(InvoicesCol.TEXT, text);
      mapping.add(InvoicesCol.KORREKTUR, korrektur);
      sheet.addRow(mapping.getMapping(), 0);
    }
    addAccounts(xls, contentProvider);
    return xls.getAsByteArray();
  }
View Full Code Here

    final KontoDao kontoDao = Registry.instance().getDao(KontoDao.class);
    final QueryFilter filter = new QueryFilter();
    filter.addOrder(Order.desc("lastUpdate"));
    final List<KontoDO> list = kontoDao.getList(filter);

    final PropertyMapping mapping = new PropertyMapping();
    for (final KontoDO konto : list) {
      mapping.add(AccountsCol.NUMBER, konto.getNummer());
      mapping.add(AccountsCol.NAME, konto.getBezeichnung());
      mapping.add(AccountsCol.DATE_OF_LAST_MODIFICATION, konto.getLastUpdate());
      mapping.add(AccountsCol.DATE_OF_CREATION, konto.getCreated());
      String status = "";
      if (konto.isDeleted() == true) {
        status = PFUserContext.getLocalizedString("deleted");
      } else if (konto.getStatus() != null) {
        status = PFUserContext.getLocalizedString(konto.getStatus().getI18nKey());
      }
      mapping.add(AccountsCol.STATUS, status);
      mapping.add(AccountsCol.DESCRIPTION, konto.getDescription());
      sheet.addRow(mapping.getMapping(), 0);
    }
  }
View Full Code Here

    final ExportColumn[] cols = new ExportColumn[] { //
        new I18nExportColumn(Col.KOST, "fibu.kost1", MyXlsContentProvider.LENGTH_KOSTENTRAEGER),
        new I18nExportColumn(Col.DESCRIPTION, "description", MyXlsContentProvider.LENGTH_STD),
        new I18nExportColumn(Col.STATUS, "status", MyXlsContentProvider.LENGTH_STD)};
    sheet.setColumns(cols);
    final PropertyMapping mapping = new PropertyMapping();
    for (final Kost1DO kost : kost1List) {
      mapping.add(Col.KOST, kost.getFormattedNumber());
      mapping.add(Col.STATUS, kost.getKostentraegerStatus());
      mapping.add(Col.DESCRIPTION, kost.getDescription());
      sheet.addRow(mapping.getMapping(), 0);
    }
    sheet.setZoom(3, 4); // 75%
    DownloadUtils.setDownloadTarget(xls.getAsByteArray(), filename);
  }
View Full Code Here

    for (final String title : colTitles) {
      headRow.addCell(i++, title);
    }

    for (final EmployeeSalaryDO salary : list) {
      final PropertyMapping mapping = new PropertyMapping();
      final PFUserDO user = userGroupCache.getUser(salary.getEmployee().getUserId());
      Validate.isTrue(year == salary.getYear());
      Validate.isTrue(month == salary.getMonth());
      final MonthlyEmployeeReport report = monthlyEmployeeReportDao.getReport(year, month, user);
      mapping.add(ExcelColumn.MITARBEITER, user.getFullname());
      final Kost1DO kost1 = salary.getEmployee().getKost1();
      final BigDecimal bruttoMitAGAnteil = salary.getBruttoMitAgAnteil();
      final BigDecimal netDuration = new BigDecimal(report.getTotalNetDuration());
      final Map<String, Kost2Row> rows = report.getKost2Rows();
      BigDecimal sum = BigDecimal.ZERO;
      int j = rows.size();
      for (final Kost2Row row : rows.values()) {
        final Kost2DO kost2 = row.getKost2();
        final MonthlyEmployeeReportEntry entry = report.getKost2Durations().get(kost2.getId());
        mapping.add(ExcelColumn.KOST1, kost1.getNummer());
        mapping.add(ExcelColumn.MITARBEITER, user.getFullname());
        mapping.add(ExcelColumn.KOST2, kost2.getNummer());
        final BigDecimal duration = new BigDecimal(entry.getMillis() / 1000); // Seconds
        // duration = duration.divide(new BigDecimal(60 * 60 * 24), 8, RoundingMode.HALF_UP); // Fraction of day (24 hours)
        // mapping.add(ExcelColumn.STUNDEN, duration);
        mapping.add(ExcelColumn.STUNDEN, duration.divide(new BigDecimal(3600), 2, RoundingMode.HALF_UP));
        mapping.add(ExcelColumn.BEZEICHNUNG, kost2.getToolTip());
        final BigDecimal betrag = CurrencyHelper.multiply(bruttoMitAGAnteil,
            new BigDecimal(entry.getMillis()).divide(netDuration, 8, RoundingMode.HALF_UP));
        sum = sum.add(betrag);
        if (--j == 0) {
          final BigDecimal korrektur = bruttoMitAGAnteil.subtract(sum);
          mapping.add(ExcelColumn.BRUTTO_MIT_AG, betrag.add(korrektur));
          mapping.add(ExcelColumn.KORREKTUR, korrektur);
          if (NumberHelper.isEqual(sum.add(korrektur), bruttoMitAGAnteil) == true) {
            mapping.add(ExcelColumn.SUMME, bruttoMitAGAnteil);
          } else {
            mapping.add(ExcelColumn.SUMME, "*** " + sum + " != " + bruttoMitAGAnteil);
          }
        } else {
          mapping.add(ExcelColumn.BRUTTO_MIT_AG, betrag);
          mapping.add(ExcelColumn.KORREKTUR, "");
          mapping.add(ExcelColumn.SUMME, "");
        }
        mapping.add(ExcelColumn.DATUM, buchungsdatum.getCalendar()); // Last day of month
        mapping.add(ExcelColumn.KONTO, KONTO); // constant.
        mapping.add(ExcelColumn.GEGENKONTO, GEGENKONTO); // constant.
        sheet.addRow(mapping.getMapping(), 0);
      }
      addEmployeeRow(employeeSheet, salary.getEmployee(), numberOfWorkingDays, netDuration);
    }
    for (final EmployeeDO employee : missedEmployees) {
      final PFUserDO user = userGroupCache.getUser(employee.getUserId());
      final PropertyMapping mapping = new PropertyMapping();
      mapping.add(ExcelColumn.MITARBEITER, user.getFullname());
      mapping.add(ExcelColumn.SUMME, "***");
      mapping.add(ExcelColumn.BEZEICHNUNG, "*** FEHLT! ***");
      sheet.addRow(mapping.getMapping(), 0);
      final MonthlyEmployeeReport report = monthlyEmployeeReportDao.getReport(year, month, user);
      final BigDecimal netDuration = new BigDecimal(report.getTotalNetDuration());
      addEmployeeRow(employeeSheet, employee, numberOfWorkingDays, netDuration);
    }
    // sheet.setZoom(3, 4); // 75%
View Full Code Here

    sheetProvider.putFormat(Col.STOP_TIME, "HH:mm");
    sheetProvider.putFormat(Col.DURATION, "[h]:mm");
    sheetProvider.putFormat(Col.HOURS, "#,##0.00");
    sheetProvider.putFormat(Col.ID, "0");

    final PropertyMapping mapping = new PropertyMapping();
    for (final TimesheetDO timesheet : list) {
      final TaskNode node = taskTree.getTaskNodeById(timesheet.getTaskId());
      final PFUserDO user = userGroupCache.getUser(timesheet.getUserId());
      mapping.add(Col.USER, user.getFullname());
      final Kost2DO kost2 = timesheet.getKost2();
      String kost2Name = null;
      String projektName = null;
      String kundeName = null;
      if (kost2 != null) {
        kost2Name = kost2.getShortDisplayName();
        final ProjektDO projekt = kost2.getProjekt();
        if (projekt != null) {
          projektName = projekt.getName();
          final KundeDO kunde = projekt.getKunde();
          if (kunde != null) {
            kundeName = kunde.getName();
          } else {
          }
        }
      }
      mapping.add(Col.KOST2, kost2Name);
      mapping.add(Col.PROJEKT, projektName);
      mapping.add(Col.KUNDE, kundeName);
      mapping.add(Col.TASK_TITLE, node.getTask().getTitle());
      mapping.add(Col.TASK_PATH, taskFormatter.getTaskPath(timesheet.getTaskId(), null, true, OutputType.PLAIN));
      mapping.add(Col.WEEK_OF_YEAR, timesheet.getFormattedWeekOfYear());
      mapping.add(Col.DAY_OF_WEEK, dateTimeFormatter.getFormattedDate(timesheet.getStartTime(), DateFormats
          .getFormatString(DateFormatType.DAY_OF_WEEK_SHORT)));
      final DateHolder startTime = new DateHolder(timesheet.getStartTime());
      final DateHolder stopTime = new DateHolder(timesheet.getStopTime());
      mapping.add(Col.START_TIME, startTime);
      mapping.add(Col.STOP_TIME, stopTime);
      final BigDecimal seconds = new BigDecimal(timesheet.getDuration() / 1000); // Seconds
      final BigDecimal duration = seconds.divide(new BigDecimal(60 * 60 * 24), 8, RoundingMode.HALF_UP); // Fraction of day (24 hours)
      mapping.add(Col.DURATION, duration.doubleValue());
      final BigDecimal hours = seconds.divide(new BigDecimal(60 * 60), 2, RoundingMode.HALF_UP);
      mapping.add(Col.HOURS, hours.doubleValue());
      mapping.add(Col.LOCATION, timesheet.getLocation());
      mapping.add(Col.REFERENCE, node.getReference());
      mapping.add(Col.SHORT_DESCRIPTION, timesheet.getShortDescription());
      mapping.add(Col.DESCRIPTION, timesheet.getDescription());
      mapping.add(Col.ID, timesheet.getId());
      sheet.addRow(mapping.getMapping(), 0);
    }
    sheet.setZoom(3, 4); // 75%

    return xls.getAsByteArray();
  }
View Full Code Here

TOP

Related Classes of org.projectforge.excel.PropertyMapping

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.