code: public Record getNextRecord(PrintWriter out, int iPrintOptions, boolean bFirstTime, boolean bHeadingFootingExists)
          throws DBException
      {
          Object[] rgobjEnabled = null;
          boolean bAfterRequery = !this.getMainRecord().isOpen();
          if (!this.getMainRecord().isOpen())
              this.getMainRecord().open();    // Make sure any listeners are called before disabling.
          if (bHeadingFootingExists)
              rgobjEnabled = this.getMainRecord().setEnableNonFilter(null, false, false, false, false, true);
  
          Record record = this.getNextGridRecord(bFirstTime);
  
          if (bHeadingFootingExists)
          {
              boolean bBreak = this.printHeadingFootingData(out, iPrintOptions | HtmlConstants.FOOTING_SCREEN | HtmlConstants.DETAIL_SCREEN);
              this.getMainRecord().setEnableNonFilter(rgobjEnabled, (record != null), bBreak, bFirstTime | bAfterRequery, (record == null), true);
          }
          return record;
  
      }
docs: Get the next record.
  This is the special method for a report. It handles breaks by disabling all listeners
  except filter listeners, then reenabling and calling the listeners after the footing
  has been printed, so totals, etc will be in the next break.
  @param out The out stream.
  @param iPrintOptions Print options.
  @param bFirstTime Reading the first record?
  @param bHeadingFootingExists Does a break exist (skips all the fancy code if not).
  @return The next record (or null if EOF).