IDEMPIERE-1766 Add support to print different text for summary line ( "Grand Total" instead of "total" ).

This commit is contained in:
Heng Sin Low 2014-02-24 10:27:38 -05:00
parent 6fb6825665
commit e0a5c43285
1 changed files with 15 additions and 3 deletions

View File

@ -994,7 +994,8 @@ public class LayoutEngine implements Pageable, Printable, Doc
if (m_data == null) if (m_data == null)
return; return;
// for every row // for every row
for (int row = 0; row < m_data.getRowCount(); row++) int rowCount = m_data.getRowCount();
for (int row = 0; row < rowCount; row++)
{ {
if (log.isLoggable(Level.INFO)) log.info("Row=" + row); if (log.isLoggable(Level.INFO)) log.info("Row=" + row);
m_data.setRowIndex(row); m_data.setRowIndex(row);
@ -1116,9 +1117,20 @@ public class LayoutEngine implements Pageable, Printable, Doc
} }
else // (item.isTypeText()) //** Text else // (item.isTypeText()) //** Text
{ {
String printName = item.getPrintName (m_format.getLanguage ());
int summaryTagStart = printName == null ? -1 : printName.indexOf("<s>");
int summaryTagEnd = summaryTagStart >= 0 ? printName.indexOf("</s>", summaryTagStart) : -1;
if (summaryTagStart >= 0 && summaryTagEnd > summaryTagStart) {
if (m_data.isFunctionRow(row) && row+1 == rowCount) {
printName = printName.substring(summaryTagStart+3);
printName = printName.substring(0, printName.length()-4);
} else {
printName = printName.substring(0, summaryTagStart);
}
}
if (maxWidth == 0 && item.isFieldAlignBlock()) if (maxWidth == 0 && item.isFieldAlignBlock())
maxWidth = getAreaBounds().width; maxWidth = getAreaBounds().width;
element = createStringElement (item.getPrintName (m_format.getLanguage ()), element = createStringElement (printName,
item.getAD_PrintColor_ID (), item.getAD_PrintFont_ID (), item.getAD_PrintColor_ID (), item.getAD_PrintFont_ID (),
maxWidth, item.getMaxHeight (), item.isHeightOneLine (), alignment, true); maxWidth, item.getMaxHeight (), item.isHeightOneLine (), alignment, true);
} }