Exemple #1
0
  /** No visualizar los campos que no tengan totales */
  protected void setVisibleFields() {

    if (!showDetail) {

      for (int i = 0; i < fields.size(); i++) {

        ReportField field = ((ReportField) fields.get(i));
        // buscar el campo en los totales y totales de los grupos
        boolean exist = false;

        for (int k = 0; k < totalFields.size(); k++) {
          if (((ReportTotalField) totalFields.get(k)).getField() == field) exist = true;
        }

        for (int k = 0; k < groups.size(); k++) {

          ReportGroup group = (ReportGroup) groups.get(k);

          for (int j = 0; j < group.getTotalFields().size(); j++) {

            if (((ReportTotalField) group.getTotalFields().get(j)).getField() == field)
              exist = true;
          }
        }
        if (!exist) field.setVisible(false);
      }
    }
  }
Exemple #2
0
  /**
   * Imprimir los campos totales.
   *
   * @throws Exception
   */
  protected void writeTotalFields() throws Exception {

    if (isShowTotals()) {

      addRowIndex();

      totalFields.generate(
          groups != null && groups.size() > 0 ? HSSFColor.ORANGE.index : (short) -1);
    }

    // Total de elementos impresos.
    if (showRecordCount) {

      HSSFCell cell = null;

      int rowIndex = getRowIndex();

      cell = getExcel().getCell(rowIndex + 1, getInitColumnIndex());

      getExcel()
          .setCellValue(
              cell,
              (textTotalRecords != null
                  ? textTotalRecords + ": "
                  : "Record count: " + new Integer(getDataSize())));
    }
  }
Exemple #3
0
  /**
   * Ejecutar el informe.
   *
   * @throws Exception
   */
  public void execute(boolean writeFile) throws Exception {

    // Eliminar el fichero a generar para no mostrar el
    rowIndex = -1;

    setVisibleFields();

    totalFields.initialize();

    writeHeader();

    writeHeaderFields();

    writeDetail();

    writeTotalFields();

    writeFooter();

    configColumns();

    if (configPage) configPage();

    if (writeFile) writeFile();
  }
Exemple #4
0
 public ReportTotalField getReportTotalField(String fieldName) {
   return totalFields.getReportTotalField(fieldName);
 }