From e0a5c4328599f5723c7e075b38f3c95178efea9a Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 24 Feb 2014 10:27:38 -0500 Subject: [PATCH] IDEMPIERE-1766 Add support to print different text for summary line ( "Grand Total" instead of "total" ). --- .../compiere/print/layout/LayoutEngine.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java index f6c97cfb59..aad77cff3e 100644 --- a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java +++ b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java @@ -994,7 +994,8 @@ public class LayoutEngine implements Pageable, Printable, Doc if (m_data == null) return; // 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); m_data.setRowIndex(row); @@ -1072,7 +1073,7 @@ public class LayoutEngine implements Pageable, Printable, Doc lineAligned = true; } } - + // Type PrintElement element = null; if (item.isTypePrintFormat()) //** included PrintFormat @@ -1116,9 +1117,20 @@ public class LayoutEngine implements Pageable, Printable, Doc } else // (item.isTypeText()) //** Text { + String printName = item.getPrintName (m_format.getLanguage ()); + int summaryTagStart = printName == null ? -1 : printName.indexOf(""); + int summaryTagEnd = summaryTagStart >= 0 ? printName.indexOf("", 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()) maxWidth = getAreaBounds().width; - element = createStringElement (item.getPrintName (m_format.getLanguage ()), + element = createStringElement (printName, item.getAD_PrintColor_ID (), item.getAD_PrintFont_ID (), maxWidth, item.getMaxHeight (), item.isHeightOneLine (), alignment, true); }