Package org.projectforge.excel

Examples of org.projectforge.excel.ExportRow


    employeeSheet.setColumnWidth(2, 12 * 256);
    employeeSheet.setColumnWidth(3, 12 * 256);
    employeeSheet.setColumnWidth(4, 12 * 256);
    final ContentProvider provider = employeeSheet.getContentProvider();
    provider.putFormat("STUNDEN", "0.00;[Red]-0.00");
    final ExportRow employeeRow = employeeSheet.addRow();
    employeeRow.addCell(0, PFUserContext.getLocalizedString("fibu.employee"));
    employeeRow.addCell(1, PFUserContext.getLocalizedString("fibu.employee.wochenstunden"));
    employeeRow.addCell(2, PFUserContext.getLocalizedString("fibu.employee.sollstunden"));
    employeeRow.addCell(3, PFUserContext.getLocalizedString("fibu.employee.iststunden"));
    employeeRow.addCell(4, PFUserContext.getLocalizedString("fibu.common.difference"));

    // build all column names, title, widths from fixed and variable columns
    final int numCols = ExcelColumn.values().length;

    final String[] colNames = new String[numCols];
    final String[] colTitles = new String[numCols];
    final int[] colWidths = new int[numCols];

    int idx = 0;
    for (final ExcelColumn col : EnumSet.range(ExcelColumn.START, ExcelColumn.END)) {
      colNames[idx] = col.name();
      colTitles[idx] = PFUserContext.getLocalizedString(col.theTitle);
      colWidths[idx] = col.width;
      ++idx;
    }

    // column property names
    sheet.setPropertyNames(colNames);

    final ContentProvider sheetProvider = sheet.getContentProvider();
    sheetProvider.putFormat("STUNDEN", "0.00");
    sheetProvider.putFormat("BRUTTO_MIT_AG", "#,##0.00;[Red]-#,##0.00");
    sheetProvider.putFormat("KORREKTUR", "#,##0.00;[Red]-#,##0.00");
    sheetProvider.putFormat("SUMME", "#,##0.00;[Red]-#,##0.00");
    sheetProvider.putFormat("KOST1", "#");
    sheetProvider.putFormat("KOST2", "#");
    sheetProvider.putFormat("KONTO", "#");
    sheetProvider.putFormat("GEGENKONTO", "#");
    sheetProvider.putFormat("DATUM", "dd.MM.yyyy");
    // inform provider of column widths
    for (int ci = 0; ci < colWidths.length; ++ci) {
      sheetProvider.putColWidth(ci, colWidths[ci]);
    }

    final ExportRow headRow = sheet.addRow();
    int i = 0;
    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());
View Full Code Here


  private void addEmployeeRow(final ExportSheet sheet, final EmployeeDO employee, final BigDecimal numberOfWorkingDays,
      final BigDecimal totalDuration)
  {
    final PFUserDO user = userGroupCache.getUser(employee.getUserId());
    final ExportRow row = sheet.addRow();
    row.addCell(0, user.getFullname());
    // Wochenstunden
    row.addCell(1, employee.getWeeklyWorkingHours(), "STUNDEN");
    // Sollstunden: Wochenstunden * Arbeitstage / 5 Arbeitstage pro Woche
    BigDecimal wochenstunden = employee.getWeeklyWorkingHours();
    if (wochenstunden == null) {
      wochenstunden = BigDecimal.ZERO;
    }
    final BigDecimal soll = wochenstunden.multiply(numberOfWorkingDays).divide(new BigDecimal(5), 2, RoundingMode.HALF_UP);
    row.addCell(2, soll, "STUNDEN");
    // Iststunden
    final BigDecimal total = totalDuration.divide(new BigDecimal(3600000), 2, RoundingMode.HALF_UP);
    row.addCell(3, total, "STUNDEN");
    // Differenz
    final BigDecimal differenz = total.subtract(soll);
    row.addCell(4, differenz, "STUNDEN");
  }
View Full Code Here

TOP

Related Classes of org.projectforge.excel.ExportRow

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.