/// <summary> /// find the next row on the same level /// </summary> /// <param name="currentRow"></param> /// <returns></returns> protected TResult FindNextSibling(TResult currentRow) { TResult ReturnValue; Int32 i; Int32 masterRow; Int32 childRow; // if currentRow is nil assume the root (needed to find first printable element) if (currentRow != null) { masterRow = currentRow.masterRow; childRow = currentRow.childRow; } else { masterRow = 0; childRow = 0; } ReturnValue = null; foreach (TResult row in FResults) { if (row.masterRow == masterRow) { if ((row.childRow > childRow) && ((ReturnValue == null) || (row.childRow < ReturnValue.childRow))) { if ((row.depth == 1) && (FLowestLevel != 1) && (FParameters.GetOrDefault("HasSubReports", -1, new TVariant(false)).ToBool() == true)) { // reset the FLowestLevel, because this is basically a new report (several lowerlevelreports in main level) // todo: be careful: some reports have several rows in the main level, I just assumed one total for the finance reports // it works now for reports with just one row depth, for others this still needs to be sorted properly. another parameter? FLowestLevel = FResultList.GetDeepestVisibleLevel(row.childRow); FPrinter.LineSpaceFeed(eFont.eDefaultFont); FPrinter.DrawLine(FPrinter.LeftMargin, FPrinter.RightMargin, eLinePosition.eAbove, eFont.eDefaultBoldFont); FPrinter.LineSpaceFeed(eFont.eDefaultFont); FParameters.Add("CurrentSubReport", FParameters.Get("CurrentSubReport").ToInt() + 1); for (i = 0; i <= FLowestLevel; i += 1) { FNextElementLineToPrint.Add(eStageElementPrinting.eHeader); } FNextElementLineToPrint[FLowestLevel] = eStageElementPrinting.eDetails; } ReturnValue = row; FNextElementLineToPrint[ReturnValue.depth] = eStageElementPrinting.eHeader; } } } return(ReturnValue); }