IDEMPIERE-4227 Unable to use 2 print format item with the same AD_Column_ID and different formatting (#740)
* IDEMPIERE-4227 Unable to use 2 print format item with the same AD_Column_ID and different formatting Fix function column
This commit is contained in:
parent
0bfeb8c0b0
commit
df704cb236
|
@ -100,15 +100,13 @@ extends AbstractExcelExporter
|
|||
Object obj = null;
|
||||
|
||||
if (item.isTypeField() || item.isTypePrintFormat() && item.isImageField()) {
|
||||
int AD_Column_ID = item.getAD_Column_ID();
|
||||
if (AD_Column_ID > 0)
|
||||
obj = m_printData.getNode(Integer.valueOf(AD_Column_ID));
|
||||
obj = m_printData.getNodeByPrintFormatItemId(item.getAD_PrintFormatItem_ID());
|
||||
}
|
||||
|
||||
/** DEVCOFFEE: script column **/
|
||||
if (item.isTypeScript())
|
||||
{
|
||||
obj = m_printData.getNode(item.getName());
|
||||
obj = m_printData.getNodeByPrintFormatItemId(item.getAD_PrintFormatItem_ID());
|
||||
}
|
||||
|
||||
if (obj != null && obj instanceof PrintDataElement) {
|
||||
|
|
|
@ -103,15 +103,13 @@ public class PrintDataXLSXExporter extends AbstractXLSXExporter
|
|||
|
||||
if (item.isTypeField() || item.isTypePrintFormat() && item.isImageField())
|
||||
{
|
||||
int AD_Column_ID = item.getAD_Column_ID();
|
||||
if (AD_Column_ID > 0)
|
||||
obj = m_printData.getNode(Integer.valueOf(AD_Column_ID));
|
||||
obj = m_printData.getNodeByPrintFormatItemId(item.getAD_PrintFormatItem_ID());
|
||||
}
|
||||
|
||||
/** DEVCOFFEE: script column **/
|
||||
if (item.isTypeScript())
|
||||
{
|
||||
obj = m_printData.getNode(item.getName());
|
||||
obj = m_printData.getNodeByPrintFormatItemId(item.getAD_PrintFormatItem_ID());
|
||||
}
|
||||
|
||||
if (obj != null && obj instanceof PrintDataElement)
|
||||
|
|
|
@ -280,7 +280,7 @@ public class DataEngine
|
|||
.append("c.ColumnSQL, COALESCE(pfi.FormatPattern, c.FormatPattern) ") // 24, 25
|
||||
//BEGIN http://jira.idempiere.com/browse/IDEMPIERE-153
|
||||
/** START DEVCOFFEE: script column **/
|
||||
.append(" , pfi.isDesc, pfi.Script, pfi.Name ") // 26..28
|
||||
.append(" , pfi.isDesc, pfi.Script, pfi.Name, pfi.AD_PrintFormatItem_ID ") // 26..29
|
||||
//END
|
||||
.append("FROM AD_PrintFormat pf")
|
||||
.append(" INNER JOIN AD_PrintFormatItem pfi ON (pf.AD_PrintFormat_ID=pfi.AD_PrintFormat_ID)")
|
||||
|
@ -322,6 +322,7 @@ public class DataEngine
|
|||
{
|
||||
// get Values from record
|
||||
int AD_Column_ID = rs.getInt(1);
|
||||
int AD_PrintFormatItem_ID = rs.getInt("AD_PrintFormatItem_ID");
|
||||
String ColumnName = rs.getString(2);
|
||||
String ColumnSQL = rs.getString(24);
|
||||
if (ColumnSQL != null && ColumnSQL.length() > 0 && ColumnSQL.startsWith("@SQLFIND="))
|
||||
|
@ -354,21 +355,21 @@ public class DataEngine
|
|||
FunctionColumn = "";
|
||||
// Breaks/Column Functions
|
||||
if ("Y".equals(rs.getString(11)))
|
||||
m_group.addGroupColumn(ColumnName);
|
||||
m_group.addGroupColumn(AD_PrintFormatItem_ID);
|
||||
if ("Y".equals(rs.getString(12)))
|
||||
m_group.addFunction(ColumnName, PrintDataFunction.F_SUM);
|
||||
m_group.addFunction(AD_PrintFormatItem_ID, PrintDataFunction.F_SUM);
|
||||
if ("Y".equals(rs.getString(13)))
|
||||
m_group.addFunction(ColumnName, PrintDataFunction.F_MEAN);
|
||||
m_group.addFunction(AD_PrintFormatItem_ID, PrintDataFunction.F_MEAN);
|
||||
if ("Y".equals(rs.getString(14)))
|
||||
m_group.addFunction(ColumnName, PrintDataFunction.F_COUNT);
|
||||
m_group.addFunction(AD_PrintFormatItem_ID, PrintDataFunction.F_COUNT);
|
||||
if ("Y".equals(rs.getString(18))) // IsMinCalc
|
||||
m_group.addFunction(ColumnName, PrintDataFunction.F_MIN);
|
||||
m_group.addFunction(AD_PrintFormatItem_ID, PrintDataFunction.F_MIN);
|
||||
if ("Y".equals(rs.getString(19))) // IsMaxCalc
|
||||
m_group.addFunction(ColumnName, PrintDataFunction.F_MAX);
|
||||
m_group.addFunction(AD_PrintFormatItem_ID, PrintDataFunction.F_MAX);
|
||||
if ("Y".equals(rs.getString(22))) // IsVarianceCalc
|
||||
m_group.addFunction(ColumnName, PrintDataFunction.F_VARIANCE);
|
||||
m_group.addFunction(AD_PrintFormatItem_ID, PrintDataFunction.F_VARIANCE);
|
||||
if ("Y".equals(rs.getString(23))) // IsDeviationCalc
|
||||
m_group.addFunction(ColumnName, PrintDataFunction.F_DEVIATION);
|
||||
m_group.addFunction(AD_PrintFormatItem_ID, PrintDataFunction.F_DEVIATION);
|
||||
if ("Y".equals(rs.getString(20))) // isRunningTotal
|
||||
// RunningTotalLines only once - use max
|
||||
m_runningTotalLines = Math.max(m_runningTotalLines, rs.getInt(21));
|
||||
|
@ -399,7 +400,7 @@ public class DataEngine
|
|||
// => Table.Column,
|
||||
sqlSELECT.append(tableName).append(".").append(ColumnName).append(",");
|
||||
groupByColumns.add(tableName+"."+ColumnName);
|
||||
pdc = new PrintDataColumn(AD_Column_ID, ColumnName, AD_Reference_ID, FieldLength, KEY, isPageBreak); // KeyColumn
|
||||
pdc = new PrintDataColumn(AD_PrintFormatItem_ID, AD_Column_ID, ColumnName, AD_Reference_ID, FieldLength, KEY, isPageBreak); // KeyColumn
|
||||
}
|
||||
/** START DEVCOFFEE: script column **/
|
||||
else if (ColumnName == null || script != null && !script.isEmpty())
|
||||
|
@ -424,7 +425,7 @@ public class DataEngine
|
|||
sqlSELECT.append(script).append(" AS \"").append(m_synonym).append(pfiName).append("\",")
|
||||
.append("''").append(" AS \"").append(pfiName).append("\",");
|
||||
//
|
||||
pdc = new PrintDataColumn(-1, pfiName, DisplayType.Text, FieldLength, orderName, isPageBreak);
|
||||
pdc = new PrintDataColumn(AD_PrintFormatItem_ID, -1, pfiName, DisplayType.Text, FieldLength, orderName, isPageBreak);
|
||||
synonymNext();
|
||||
}
|
||||
// -- Parent, TableDir (and unqualified Search) --
|
||||
|
@ -459,7 +460,7 @@ public class DataEngine
|
|||
groupByColumns.add(lookupSQL);
|
||||
orderName = m_synonym + display;
|
||||
//
|
||||
pdc = new PrintDataColumn(AD_Column_ID, ColumnName, AD_Reference_ID, FieldLength, orderName, isPageBreak);
|
||||
pdc = new PrintDataColumn(AD_PrintFormatItem_ID, AD_Column_ID, ColumnName, AD_Reference_ID, FieldLength, orderName, isPageBreak);
|
||||
synonymNext();
|
||||
}
|
||||
|
||||
|
@ -488,7 +489,7 @@ public class DataEngine
|
|||
//
|
||||
TableReference tr = getTableReference(AD_Reference_Value_ID);
|
||||
String foreignColumnName = tr.KeyColumn;
|
||||
pdc = new PrintDataColumn(AD_Column_ID, ColumnName, AD_Reference_ID, FieldLength, orderName, isPageBreak, foreignColumnName);
|
||||
pdc = new PrintDataColumn(AD_PrintFormatItem_ID, AD_Column_ID, ColumnName, AD_Reference_ID, FieldLength, orderName, isPageBreak, foreignColumnName);
|
||||
synonymNext();
|
||||
}
|
||||
|
||||
|
@ -533,7 +534,7 @@ public class DataEngine
|
|||
}
|
||||
// TableName.ColumnName,
|
||||
sqlSELECT.append(lookupSQL).append(" AS ").append(ColumnName).append(",");
|
||||
pdc = new PrintDataColumn(AD_Column_ID, ColumnName, AD_Reference_ID, FieldLength, orderName, isPageBreak);
|
||||
pdc = new PrintDataColumn(AD_PrintFormatItem_ID, AD_Column_ID, ColumnName, AD_Reference_ID, FieldLength, orderName, isPageBreak);
|
||||
synonymNext();
|
||||
}
|
||||
|
||||
|
@ -601,7 +602,7 @@ public class DataEngine
|
|||
.append(lookupSQL).append("=")
|
||||
.append(m_synonym).append(".").append(key).append(")");
|
||||
//
|
||||
pdc = new PrintDataColumn(AD_Column_ID, ColumnName, AD_Reference_ID, FieldLength, orderName, isPageBreak);
|
||||
pdc = new PrintDataColumn(AD_PrintFormatItem_ID, AD_Column_ID, ColumnName, AD_Reference_ID, FieldLength, orderName, isPageBreak);
|
||||
synonymNext();
|
||||
}
|
||||
|
||||
|
@ -638,7 +639,7 @@ public class DataEngine
|
|||
groupByColumns.add(sb.toString());
|
||||
orderName = ColumnName; // no prefix for synonym
|
||||
}
|
||||
pdc = new PrintDataColumn(AD_Column_ID, ColumnName,
|
||||
pdc = new PrintDataColumn(AD_PrintFormatItem_ID, AD_Column_ID, ColumnName,
|
||||
AD_Reference_ID, FieldLength, ColumnName, isPageBreak);
|
||||
}
|
||||
|
||||
|
@ -925,11 +926,11 @@ public class DataEngine
|
|||
for (int i = 0; i < pd.getColumnInfo().length; i++)
|
||||
{
|
||||
PrintDataColumn group_pdc = pd.getColumnInfo()[i];
|
||||
if (!m_group.isGroupColumn(group_pdc.getColumnName()))
|
||||
if (!m_group.isGroupColumn(group_pdc.getAD_PrintFormatItem_ID()))
|
||||
continue;
|
||||
|
||||
// Group change
|
||||
Object value = m_group.groupChange(group_pdc.getColumnName(), rs.getObject(group_pdc.getAlias()), force);
|
||||
Object value = m_group.groupChange(group_pdc.getAD_PrintFormatItem_ID(), rs.getObject(group_pdc.getAlias()), force);
|
||||
if (value != null) // Group change
|
||||
{
|
||||
changedGroups.add(group_pdc);
|
||||
|
@ -943,7 +944,7 @@ public class DataEngine
|
|||
PrintDataColumn group_pdc = changedGroups.get(j);
|
||||
Object value = changedValues.get(j);
|
||||
|
||||
char[] functions = m_group.getFunctions(group_pdc.getColumnName());
|
||||
char[] functions = m_group.getFunctions(group_pdc.getAD_PrintFormatItem_ID());
|
||||
for (int f = 0; f < functions.length; f++)
|
||||
{
|
||||
printRunningTotal(pd, levelNo, rowNo++);
|
||||
|
@ -954,21 +955,21 @@ public class DataEngine
|
|||
pdc = pd.getColumnInfo()[c];
|
||||
// log.fine("loadPrintData - PageBreak = " + pdc.isPageBreak());
|
||||
|
||||
if (group_pdc.getColumnName().equals(pdc.getColumnName()))
|
||||
if (group_pdc.getAD_PrintFormatItem_ID() == pdc.getAD_PrintFormatItem_ID())
|
||||
{
|
||||
String valueString = value.toString();
|
||||
if (value instanceof Timestamp)
|
||||
valueString = DisplayType.getDateFormat(pdc.getDisplayType(), m_language).format(value);
|
||||
if (format.getTableFormat().isPrintFunctionSymbols()) // Translate Sum, etc.
|
||||
valueString += PrintDataFunction.getFunctionSymbol(functions[f]);
|
||||
pd.addNode(new PrintDataElement(pdc.getColumnName(),
|
||||
pd.addNode(new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(),
|
||||
valueString, DisplayType.String, false, pdc.isPageBreak(), pdc.getFormatPattern()));
|
||||
}
|
||||
else if (m_group.isFunctionColumn(pdc.getColumnName(), functions[f]))
|
||||
else if (m_group.isFunctionColumn(pdc.getAD_PrintFormatItem_ID(), functions[f]))
|
||||
{
|
||||
pd.addNode(new PrintDataElement(pdc.getColumnName(),
|
||||
m_group.getValue(group_pdc.getColumnName(),
|
||||
pdc.getColumnName(), functions[f]),
|
||||
pd.addNode(new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(),
|
||||
m_group.getValue(group_pdc.getAD_PrintFormatItem_ID(),
|
||||
pdc.getAD_PrintFormatItem_ID(), functions[f]),
|
||||
PrintDataFunction.getFunctionDisplayType(functions[f], pdc.getDisplayType()),
|
||||
false, pdc.isPageBreak(), pdc.getFormatPattern()));
|
||||
}
|
||||
|
@ -978,7 +979,7 @@ public class DataEngine
|
|||
for (int c = 0; c < pd.getColumnInfo().length; c++)
|
||||
{
|
||||
pdc = pd.getColumnInfo()[c];
|
||||
m_group.reset(group_pdc.getColumnName(), pdc.getColumnName());
|
||||
m_group.reset(group_pdc.getAD_PrintFormatItem_ID(), pdc.getAD_PrintFormatItem_ID());
|
||||
}
|
||||
} // Group change
|
||||
} // group change
|
||||
|
@ -1006,7 +1007,7 @@ public class DataEngine
|
|||
if (!rs.wasNull())
|
||||
{
|
||||
KeyNamePair pp = new KeyNamePair(id, KEY); // Key
|
||||
pde = new PrintDataElement(pdc.getColumnName(), pp, pdc.getDisplayType(),
|
||||
pde = new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(), pp, pdc.getDisplayType(),
|
||||
true, pdc.isPageBreak(), pdc.getFormatPattern());
|
||||
}
|
||||
}
|
||||
|
@ -1017,7 +1018,7 @@ public class DataEngine
|
|||
if (!rs.wasNull())
|
||||
{
|
||||
ValueNamePair pp = new ValueNamePair(id, KEY); // Key
|
||||
pde = new PrintDataElement(pdc.getColumnName(), pp, pdc.getDisplayType(),
|
||||
pde = new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(), pp, pdc.getDisplayType(),
|
||||
true, pdc.isPageBreak(), pdc.getFormatPattern());
|
||||
}
|
||||
}
|
||||
|
@ -1036,7 +1037,7 @@ public class DataEngine
|
|||
if (display != null && !rs.wasNull())
|
||||
{
|
||||
KeyNamePair pp = new KeyNamePair(id, display);
|
||||
pde = new PrintDataElement(pdc.getColumnName(), pp, pdc.getDisplayType(), pdc.getFormatPattern(), pdc.getForeignColumnName());
|
||||
pde = new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(), pp, pdc.getDisplayType(), pdc.getFormatPattern(), pdc.getForeignColumnName());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1060,7 +1061,7 @@ public class DataEngine
|
|||
}
|
||||
|
||||
ValueNamePair pp = new ValueNamePair(id, display);
|
||||
pde = new PrintDataElement(pdc.getColumnName(), pp, displayType, pdc.getFormatPattern());
|
||||
pde = new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(), pp, displayType, pdc.getFormatPattern());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1074,7 +1075,7 @@ public class DataEngine
|
|||
if (!rs.wasNull())
|
||||
{
|
||||
boolean b = s.equals("Y");
|
||||
pde = new PrintDataElement(pdc.getColumnName(), Boolean.valueOf(b), pdc.getDisplayType(), pdc.getFormatPattern());
|
||||
pde = new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(), Boolean.valueOf(b), pdc.getDisplayType(), pdc.getFormatPattern());
|
||||
}
|
||||
}
|
||||
else if (pdc.getDisplayType() == DisplayType.TextLong)
|
||||
|
@ -1093,13 +1094,13 @@ public class DataEngine
|
|||
value = clob.getSubString(1, (int)length);
|
||||
}
|
||||
}
|
||||
pde = new PrintDataElement(pdc.getColumnName(), value, pdc.getDisplayType(), pdc.getFormatPattern());
|
||||
pde = new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(), value, pdc.getDisplayType(), pdc.getFormatPattern());
|
||||
}
|
||||
// fix bug [ 1755592 ] Printing time in format
|
||||
else if (pdc.getDisplayType() == DisplayType.DateTime)
|
||||
{
|
||||
Timestamp datetime = rs.getTimestamp(counter++);
|
||||
pde = new PrintDataElement(pdc.getColumnName(), datetime, pdc.getDisplayType(), pdc.getFormatPattern());
|
||||
pde = new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(), datetime, pdc.getDisplayType(), pdc.getFormatPattern());
|
||||
}
|
||||
else
|
||||
// The general case
|
||||
|
@ -1118,10 +1119,10 @@ public class DataEngine
|
|||
{
|
||||
String s = (String)obj;
|
||||
s = Msg.parseTranslation(pd.getCtx(), s);
|
||||
pde = new PrintDataElement(pdc.getColumnName(), s, pdc.getDisplayType(), pdc.getFormatPattern());
|
||||
pde = new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(), s, pdc.getDisplayType(), pdc.getFormatPattern());
|
||||
}
|
||||
else
|
||||
pde = new PrintDataElement(pdc.getColumnName(), (Serializable)obj, pdc.getDisplayType(), pdc.getFormatPattern());
|
||||
pde = new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(), (Serializable)obj, pdc.getDisplayType(), pdc.getFormatPattern());
|
||||
}
|
||||
}
|
||||
} // Value only
|
||||
|
@ -1131,7 +1132,7 @@ public class DataEngine
|
|||
/** Report Summary FR [ 2011569 ]**/
|
||||
if(!m_summary)
|
||||
pd.addNode(pde);
|
||||
m_group.addValue(pde.getColumnName(), pde.getFunctionValue());
|
||||
m_group.addValue(pde.getAD_PrintFormatItem_ID(), pde.getFunctionValue());
|
||||
}
|
||||
} // for all columns
|
||||
|
||||
|
@ -1155,12 +1156,12 @@ public class DataEngine
|
|||
for (int i = pd.getColumnInfo().length-1; i >= 0; i--) // backwards (leaset group first)
|
||||
{
|
||||
PrintDataColumn group_pdc = pd.getColumnInfo()[i];
|
||||
if (!m_group.isGroupColumn(group_pdc.getColumnName()))
|
||||
if (!m_group.isGroupColumn(group_pdc.getAD_PrintFormatItem_ID()))
|
||||
continue;
|
||||
Object value = m_group.groupChange(group_pdc.getColumnName(), new Object(), false);
|
||||
Object value = m_group.groupChange(group_pdc.getAD_PrintFormatItem_ID(), new Object(), false);
|
||||
if (value != null) // Group change
|
||||
{
|
||||
char[] functions = m_group.getFunctions(group_pdc.getColumnName());
|
||||
char[] functions = m_group.getFunctions(group_pdc.getAD_PrintFormatItem_ID());
|
||||
for (int f = 0; f < functions.length; f++)
|
||||
{
|
||||
printRunningTotal(pd, levelNo, rowNo++);
|
||||
|
@ -1176,14 +1177,14 @@ public class DataEngine
|
|||
valueString = DisplayType.getDateFormat(pdc.getDisplayType(), m_language).format(value);
|
||||
if (format.getTableFormat().isPrintFunctionSymbols()) // Translate Sum, etc.
|
||||
valueString += PrintDataFunction.getFunctionSymbol(functions[f]);
|
||||
pd.addNode(new PrintDataElement(pdc.getColumnName(),
|
||||
pd.addNode(new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(),
|
||||
valueString, DisplayType.String, pdc.getFormatPattern()));
|
||||
}
|
||||
else if (m_group.isFunctionColumn(pdc.getColumnName(), functions[f]))
|
||||
else if (m_group.isFunctionColumn(pdc.getAD_PrintFormatItem_ID(), functions[f]))
|
||||
{
|
||||
pd.addNode(new PrintDataElement(pdc.getColumnName(),
|
||||
m_group.getValue(group_pdc.getColumnName(),
|
||||
pdc.getColumnName(), functions[f]),
|
||||
pd.addNode(new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(),
|
||||
m_group.getValue(group_pdc.getAD_PrintFormatItem_ID(),
|
||||
pdc.getAD_PrintFormatItem_ID(), functions[f]),
|
||||
PrintDataFunction.getFunctionDisplayType(functions[f],
|
||||
pdc.getDisplayType()),pdc.getFormatPattern()));
|
||||
}
|
||||
|
@ -1213,14 +1214,14 @@ public class DataEngine
|
|||
name = Msg.getMsg(format.getLanguage(), PrintDataFunction.getFunctionName(functions[f]));
|
||||
else
|
||||
name = PrintDataFunction.getFunctionSymbol(functions[f]); // Symbol
|
||||
pd.addNode(new PrintDataElement(pdc.getColumnName(), name.trim(),
|
||||
pd.addNode(new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(), name.trim(),
|
||||
DisplayType.String, pdc.getFormatPattern()));
|
||||
}
|
||||
else if (m_group.isFunctionColumn(pdc.getColumnName(), functions[f]))
|
||||
else if (m_group.isFunctionColumn(pdc.getAD_PrintFormatItem_ID(), functions[f]))
|
||||
{
|
||||
pd.addNode(new PrintDataElement(pdc.getColumnName(),
|
||||
pd.addNode(new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(),
|
||||
m_group.getValue(PrintDataGroup.TOTAL,
|
||||
pdc.getColumnName(), functions[f]),
|
||||
pdc.getAD_PrintFormatItem_ID(), functions[f]),
|
||||
PrintDataFunction.getFunctionDisplayType(functions[f], pdc.getDisplayType()), pdc.getFormatPattern()));
|
||||
}
|
||||
} // for all columns
|
||||
|
@ -1273,13 +1274,13 @@ public class DataEngine
|
|||
if (c == 0)
|
||||
{
|
||||
String title = "RunningTotal";
|
||||
pd.addNode(new PrintDataElement(pdc.getColumnName(),
|
||||
pd.addNode(new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(),
|
||||
title, DisplayType.String, false, rt==0, pdc.getFormatPattern())); // page break
|
||||
}
|
||||
else if (m_group.isFunctionColumn(pdc.getColumnName(), PrintDataFunction.F_SUM))
|
||||
else if (m_group.isFunctionColumn(pdc.getAD_PrintFormatItem_ID(), PrintDataFunction.F_SUM))
|
||||
{
|
||||
pd.addNode(new PrintDataElement(pdc.getColumnName(),
|
||||
m_group.getValue(PrintDataGroup.TOTAL, pdc.getColumnName(), PrintDataFunction.F_SUM),
|
||||
pd.addNode(new PrintDataElement(pdc.getAD_PrintFormatItem_ID(), pdc.getColumnName(),
|
||||
m_group.getValue(PrintDataGroup.TOTAL, pdc.getAD_PrintFormatItem_ID(), PrintDataFunction.F_SUM),
|
||||
PrintDataFunction.getFunctionDisplayType(PrintDataFunction.F_SUM,
|
||||
pdc.getDisplayType()), false, false, pdc.getFormatPattern()));
|
||||
}
|
||||
|
|
|
@ -255,7 +255,7 @@ public class PrintData implements Serializable
|
|||
if (functionRow)
|
||||
m_functionRows.add(Integer.valueOf(m_matrix.getRowIndex()));
|
||||
if (m_hasLevelNo && levelNo != 0)
|
||||
addNode(new PrintDataElement(LEVEL_NO, Integer.valueOf(levelNo), DisplayType.Integer, null));
|
||||
addNode(new PrintDataElement(0, LEVEL_NO, Integer.valueOf(levelNo), DisplayType.Integer, null));
|
||||
} // addRow
|
||||
|
||||
/**
|
||||
|
@ -448,6 +448,7 @@ public class PrintData implements Serializable
|
|||
* @param AD_Column_ID AD_Column_ID
|
||||
* @return PrintData(Element) with AD_Column_ID or null
|
||||
*/
|
||||
@Deprecated
|
||||
public Object getNode (Integer AD_Column_ID)
|
||||
{
|
||||
int index = getIndex (AD_Column_ID.intValue());
|
||||
|
@ -457,6 +458,30 @@ public class PrintData implements Serializable
|
|||
return nodes.get(index);
|
||||
} // getNode
|
||||
|
||||
/**
|
||||
*
|
||||
* @param item
|
||||
* @return PrintData(Element) with AD_PrintFormatItem_ID or null
|
||||
*/
|
||||
public Object getNodeByPrintFormatItem(MPrintFormatItem item)
|
||||
{
|
||||
return getNodeByPrintFormatItemId(item.getAD_PrintFormatItem_ID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Node with AD_PrintFormatItem_ID in row
|
||||
* @param AD_PrintFormatItem_ID AD_PrintFormatItem_ID
|
||||
* @return PrintData(Element) with AD_PrintFormatItem_ID or null
|
||||
*/
|
||||
public Object getNodeByPrintFormatItemId (int AD_PrintFormatItem_ID)
|
||||
{
|
||||
int index = getIndexOfPrintFormatItem(AD_PrintFormatItem_ID);
|
||||
if (index < 0)
|
||||
return null;
|
||||
List<Serializable> nodes = m_matrix.getRowData();
|
||||
return nodes.get(index);
|
||||
} // getNode
|
||||
|
||||
/**
|
||||
* Get Primary Key in row
|
||||
* @return PK or null
|
||||
|
@ -515,6 +540,7 @@ public class PrintData implements Serializable
|
|||
* @param AD_Column_ID AD_Column_ID
|
||||
* @return index or -1
|
||||
*/
|
||||
@Deprecated
|
||||
public int getIndex (int AD_Column_ID)
|
||||
{
|
||||
if (m_columnInfo == null)
|
||||
|
@ -530,6 +556,35 @@ public class PrintData implements Serializable
|
|||
return -1;
|
||||
} // getIndex
|
||||
|
||||
/**
|
||||
* Get Index of Node in Structure (not recursing) row
|
||||
* @param AD_PrintFormatItem_ID AD_PrintFormatItem_ID
|
||||
* @return index or -1
|
||||
*/
|
||||
public int getIndexOfPrintFormatItem(int AD_PrintFormatItem_ID)
|
||||
{
|
||||
List<Serializable> nodes = m_matrix.getRowData();
|
||||
if (nodes == null)
|
||||
return -1;
|
||||
for (int i = 0; i < nodes.size(); i++)
|
||||
{
|
||||
Object o = nodes.get(i);
|
||||
if (o instanceof PrintDataElement)
|
||||
{
|
||||
if (AD_PrintFormatItem_ID == ((PrintDataElement)o).getAD_PrintFormatItem_ID())
|
||||
return i;
|
||||
}
|
||||
else if (o instanceof PrintData)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
log.log(Level.SEVERE, "Element not PrintData(Element) " + o.getClass().getName());
|
||||
}
|
||||
// As Data is stored sparse, there might be lots of NULL values
|
||||
// log.log(Level.SEVERE, "PrintData.getIndex - Element not found - " + name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Dump All Data - header and rows
|
||||
|
@ -686,6 +741,7 @@ public class PrintData implements Serializable
|
|||
if (!pde.isNull())
|
||||
{
|
||||
Element element = document.createElement(PrintDataElement.XML_TAG);
|
||||
element.setAttribute(PrintDataElement.XML_ATTRIBUTE_PRINTFORMATITEM_ID, Integer.toString(pde.getAD_PrintFormatItem_ID()));
|
||||
element.setAttribute(PrintDataElement.XML_ATTRIBUTE_NAME, pde.getColumnName());
|
||||
if (pde.hasKey())
|
||||
element.setAttribute(PrintDataElement.XML_ATTRIBUTE_KEY, pde.getValueKey());
|
||||
|
@ -771,39 +827,6 @@ public class PrintData implements Serializable
|
|||
} // parseXML
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Test
|
||||
* @param args test
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PrintData pd = new PrintData(new Properties(), "test1");
|
||||
pd.addNode(new PrintDataElement("test1element1","testvalue<1>",0,null));
|
||||
pd.addNode(new PrintDataElement("test1element2","testvalue&2&",0,null));
|
||||
|
||||
PrintData pdx = new PrintData(new Properties(), "test2");
|
||||
pdx.addNode(new PrintDataElement("test2element1-1","testvalue11",0,null));
|
||||
pdx.addNode(new PrintDataElement("test2element1-2","testvalue12",0,null));
|
||||
pdx.addRow(false, 0, new ArrayList<Serializable>());
|
||||
pdx.addNode(new PrintDataElement("test2element2-1","testvalue21",0,null));
|
||||
pdx.addNode(new PrintDataElement("test2element2-2","testvalue22",0,null));
|
||||
|
||||
pd.addNode(pdx);
|
||||
pd.addNode(new PrintDataElement("test1element3","testvalue/3/",0,null));
|
||||
|
||||
pd.createXML("C:\\Temp\\printData.xml");
|
||||
pd.createXML(new StreamResult(System.out));
|
||||
System.out.println("");
|
||||
pd.dump();
|
||||
|
||||
// parse
|
||||
System.out.println("");
|
||||
PrintData pd1 = parseXML (new Properties(), new File("C:\\Temp\\printData.xml"));
|
||||
pd1.createXML(new StreamResult(System.out));
|
||||
System.out.println("");
|
||||
pd1.dump();
|
||||
} // main
|
||||
|
||||
public MReportLine getMReportLine()
|
||||
{
|
||||
List<Serializable> nodes = m_matrix.getRowData();
|
||||
|
@ -834,7 +857,7 @@ public class PrintData implements Serializable
|
|||
{
|
||||
addRow(functionRow, levelNo);
|
||||
if (m_hasLevelNo && reportLineID != 0)
|
||||
addNode(new PrintDataElement("PA_ReportLine_ID", reportLineID, DisplayType.Integer, null));
|
||||
addNode(new PrintDataElement(0, "PA_ReportLine_ID", reportLineID, DisplayType.Integer, null));
|
||||
}
|
||||
|
||||
} // PrintData
|
||||
|
|
|
@ -30,6 +30,7 @@ public class PrintDataColumn
|
|||
/**
|
||||
* Print Data Column
|
||||
*
|
||||
* @param AD_PrintFormatItem_ID
|
||||
* @param AD_Column_ID Column
|
||||
* @param columnName Column Name
|
||||
* @param displayType Display Type
|
||||
|
@ -38,8 +39,9 @@ public class PrintDataColumn
|
|||
* @param isPageBreak if true force page break after function
|
||||
* @param foreignColumnName name foreign
|
||||
*/
|
||||
public PrintDataColumn(int AD_Column_ID, String columnName,int displayType, int columnSize,String alias, boolean isPageBreak, String foreignColumnName)
|
||||
public PrintDataColumn(int AD_PrintFormatItem_ID, int AD_Column_ID, String columnName,int displayType, int columnSize,String alias, boolean isPageBreak, String foreignColumnName)
|
||||
{
|
||||
m_AD_PrintFormatItem_ID = AD_PrintFormatItem_ID;
|
||||
m_AD_Column_ID = AD_Column_ID;
|
||||
m_columnName = columnName;
|
||||
//
|
||||
|
@ -53,11 +55,12 @@ public class PrintDataColumn
|
|||
m_foreignColumnName = foreignColumnName;
|
||||
}
|
||||
|
||||
public PrintDataColumn (int AD_Column_ID, String columnName,int displayType, int columnSize,String alias, boolean isPageBreak)
|
||||
public PrintDataColumn (int AD_PrintFormatItem_ID, int AD_Column_ID, String columnName,int displayType, int columnSize,String alias, boolean isPageBreak)
|
||||
{
|
||||
this(AD_Column_ID, columnName, displayType, columnSize, alias, isPageBreak, null);
|
||||
this(AD_PrintFormatItem_ID, AD_Column_ID, columnName, displayType, columnSize, alias, isPageBreak, null);
|
||||
} // PrintDataColumn
|
||||
|
||||
private int m_AD_PrintFormatItem_ID;
|
||||
private int m_AD_Column_ID;
|
||||
private String m_columnName;
|
||||
private String m_foreignColumnName;
|
||||
|
@ -69,6 +72,15 @@ public class PrintDataColumn
|
|||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
*
|
||||
* @return AD_PrintFormatItem_ID
|
||||
*/
|
||||
public int getAD_PrintFormatItem_ID()
|
||||
{
|
||||
return m_AD_PrintFormatItem_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AD_Column_ID
|
||||
* @return AD_Column_ID
|
||||
|
@ -143,7 +155,8 @@ public class PrintDataColumn
|
|||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder("PrintDataColumn[");
|
||||
sb.append("ID=").append(m_AD_Column_ID)
|
||||
sb.append("AD_PrintFormatItem_ID=").append(m_AD_PrintFormatItem_ID);
|
||||
sb.append(",AD_Column_ID=").append(m_AD_Column_ID)
|
||||
.append("-").append(m_columnName);
|
||||
if (hasAlias())
|
||||
sb.append("(").append(m_alias).append(")");
|
||||
|
|
|
@ -43,6 +43,7 @@ public class PrintDataElement implements Serializable
|
|||
|
||||
/**
|
||||
* Print Data Element Constructor
|
||||
* @param AD_PrintFormatItem_ID
|
||||
* @param columnName name
|
||||
* @param value display value
|
||||
* @param displayType optional displayType
|
||||
|
@ -50,10 +51,11 @@ public class PrintDataElement implements Serializable
|
|||
* @param isPageBreak if true force page break
|
||||
* @param foreignColumnName name foreign
|
||||
*/
|
||||
public PrintDataElement (String columnName, Serializable value, int displayType, boolean isPKey, boolean isPageBreak, String format, String foreignColumnName)
|
||||
public PrintDataElement (int AD_PrintFormatItem_ID, String columnName, Serializable value, int displayType, boolean isPKey, boolean isPageBreak, String format, String foreignColumnName)
|
||||
{
|
||||
if (columnName == null)
|
||||
throw new IllegalArgumentException("PrintDataElement - Name cannot be null");
|
||||
m_AD_PrintFormatItem_ID = AD_PrintFormatItem_ID;
|
||||
m_columnName = columnName;
|
||||
m_value = value;
|
||||
m_displayType = displayType;
|
||||
|
@ -63,28 +65,30 @@ public class PrintDataElement implements Serializable
|
|||
m_foreignColumnName = foreignColumnName;
|
||||
} // PrintDataElement
|
||||
|
||||
public PrintDataElement(String columnName, Serializable value, int displayType, String pattern, String foreignColumnName)
|
||||
public PrintDataElement(int AD_PrintFormatItem_ID, String columnName, Serializable value, int displayType, String pattern, String foreignColumnName)
|
||||
{
|
||||
this (columnName, value, displayType, false, false, pattern, foreignColumnName);
|
||||
this (AD_PrintFormatItem_ID, columnName, value, displayType, false, false, pattern, foreignColumnName);
|
||||
} // PrintDataElement
|
||||
|
||||
/**
|
||||
* Print Data Element Constructor
|
||||
* @param AD_PrintFormatItem_ID
|
||||
* @param columnName name
|
||||
* @param value display value
|
||||
* @param pattern Number/date format pattern
|
||||
* @param displayType optional displayType
|
||||
*/
|
||||
public PrintDataElement(String columnName, Serializable value, int displayType, String pattern)
|
||||
public PrintDataElement(int AD_PrintFormatItem_ID, String columnName, Serializable value, int displayType, String pattern)
|
||||
{
|
||||
this (columnName, value, displayType, false, false, pattern, null);
|
||||
this (AD_PrintFormatItem_ID, columnName, value, displayType, false, false, pattern, null);
|
||||
} // PrintDataElement
|
||||
|
||||
public PrintDataElement (String columnName, Serializable value, int displayType, boolean isPKey, boolean isPageBreak, String format)
|
||||
public PrintDataElement (int AD_PrintFormatItem_ID, String columnName, Serializable value, int displayType, boolean isPKey, boolean isPageBreak, String format)
|
||||
{
|
||||
this(columnName, value, displayType, isPKey, isPageBreak, format, null);
|
||||
this(AD_PrintFormatItem_ID, columnName, value, displayType, isPKey, isPageBreak, format, null);
|
||||
}
|
||||
|
||||
private int m_AD_PrintFormatItem_ID;
|
||||
/** Data Name */
|
||||
private String m_columnName;
|
||||
/** Data Value */
|
||||
|
@ -107,8 +111,18 @@ public class PrintDataElement implements Serializable
|
|||
public static final String XML_ATTRIBUTE_NAME = "name";
|
||||
/** XML Attribute Key */
|
||||
public static final String XML_ATTRIBUTE_KEY = "key";
|
||||
|
||||
|
||||
/** XML Attribute PrintFormatItem Id */
|
||||
public static final String XML_ATTRIBUTE_PRINTFORMATITEM_ID = "printformatitem-id";
|
||||
|
||||
/**
|
||||
*
|
||||
* @return AD_PrintFormatItem_ID
|
||||
*/
|
||||
public int getAD_PrintFormatItem_ID()
|
||||
{
|
||||
return m_AD_PrintFormatItem_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
* @return name
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.math.BigDecimal;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Group By Management
|
||||
|
@ -39,27 +40,27 @@ public class PrintDataGroup
|
|||
/** Column-Function Delimiter */
|
||||
static public final String DELIMITER = "~";
|
||||
/** Grand Total Indicator */
|
||||
static public final String TOTAL = "=TOTAL=";
|
||||
static public final int TOTAL = -1;
|
||||
/** NULL substitute value */
|
||||
static private final Object NULL = new String();
|
||||
|
||||
/** List of group columns */
|
||||
private ArrayList<String> m_groups = new ArrayList<String>();
|
||||
private ArrayList<Integer> m_groups = new ArrayList<Integer>();
|
||||
/** Map of group column & value */
|
||||
private HashMap<String,Object> m_groupMap = new HashMap<String,Object>();
|
||||
private HashMap<Integer,Object> m_groupMap = new HashMap<Integer,Object>();
|
||||
/** List of column_function */
|
||||
private ArrayList<String> m_functions = new ArrayList<String>();
|
||||
private HashMap<Integer,List<Character>> m_functions = new HashMap<>();
|
||||
/** Map of group_function column & function */
|
||||
private HashMap<String,PrintDataFunction> m_groupFunction = new HashMap<String,PrintDataFunction>();
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Add Group Column
|
||||
* @param groupColumnName group column
|
||||
* @param AD_PrintFormatItem_ID group column
|
||||
*/
|
||||
public void addGroupColumn (String groupColumnName)
|
||||
public void addGroupColumn (int AD_PrintFormatItem_ID)
|
||||
{
|
||||
m_groups.add(groupColumnName);
|
||||
m_groups.add(AD_PrintFormatItem_ID);
|
||||
} // addGroup
|
||||
|
||||
/**
|
||||
|
@ -74,101 +75,92 @@ public class PrintDataGroup
|
|||
|
||||
/**
|
||||
* Column has a function
|
||||
* @param columnName column name or TOTAL
|
||||
* @param AD_PrintFormatItem_ID column or TOTAL
|
||||
* @return true if column has function
|
||||
*/
|
||||
public boolean isGroupColumn (String columnName)
|
||||
public boolean isGroupColumn (int AD_PrintFormatItem_ID)
|
||||
{
|
||||
if (columnName == null || m_groups.size() == 0)
|
||||
return false;
|
||||
for (int i = 0; i < m_groups.size(); i++)
|
||||
{
|
||||
if (columnName.equals(m_groups.get(i)))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return m_groups.contains(AD_PrintFormatItem_ID);
|
||||
} // isGroupColumn
|
||||
|
||||
/**
|
||||
* Check for Group Change
|
||||
* @param groupColumnName column name
|
||||
* @param AD_PrintFormatItem_ID group column
|
||||
* @param value column value
|
||||
* @return null if no group change otherwise old value
|
||||
*/
|
||||
public Object groupChange (String groupColumnName, Object value, boolean force)
|
||||
public Object groupChange (int AD_PrintFormatItem_ID, Object value, boolean force)
|
||||
{
|
||||
if (!isGroupColumn(groupColumnName))
|
||||
if (!isGroupColumn(AD_PrintFormatItem_ID))
|
||||
return null;
|
||||
Object newValue = value;
|
||||
if (newValue == null)
|
||||
newValue = NULL;
|
||||
//
|
||||
if (m_groupMap.containsKey(groupColumnName))
|
||||
if (m_groupMap.containsKey(AD_PrintFormatItem_ID))
|
||||
{
|
||||
Object oldValue = m_groupMap.get(groupColumnName);
|
||||
Object oldValue = m_groupMap.get(AD_PrintFormatItem_ID);
|
||||
if (newValue.equals(oldValue) && !force )
|
||||
return null;
|
||||
m_groupMap.put(groupColumnName, newValue);
|
||||
m_groupMap.put(AD_PrintFormatItem_ID, newValue);
|
||||
return oldValue;
|
||||
}
|
||||
m_groupMap.put(groupColumnName, newValue);
|
||||
m_groupMap.put(AD_PrintFormatItem_ID, newValue);
|
||||
return null;
|
||||
} // groupChange
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Add Function Column
|
||||
* @param functionColumnName column name
|
||||
* @param AD_PrintFormatItem_ID column
|
||||
* @param function function
|
||||
*/
|
||||
public void addFunction (String functionColumnName, char function)
|
||||
public void addFunction (int AD_PrintFormatItem_ID, char function)
|
||||
{
|
||||
m_functions.add(functionColumnName + DELIMITER + function);
|
||||
List<Character> list = m_functions.get(AD_PrintFormatItem_ID);
|
||||
if (list == null)
|
||||
{
|
||||
list = new ArrayList<Character>();
|
||||
m_functions.put(AD_PrintFormatItem_ID, list);
|
||||
}
|
||||
if (!list.contains(function))
|
||||
list.add(function);
|
||||
if (!m_groups.contains(TOTAL))
|
||||
m_groups.add(TOTAL);
|
||||
} // addFunction
|
||||
|
||||
/**
|
||||
* Column has a function
|
||||
* @param columnName column name
|
||||
* @param AD_PrintFormatItem_ID column
|
||||
* @return true if column has function
|
||||
*/
|
||||
public boolean isFunctionColumn (String columnName)
|
||||
public boolean isFunctionColumn (int AD_PrintFormatItem_ID)
|
||||
{
|
||||
if (columnName == null || m_functions.size() == 0)
|
||||
return false;
|
||||
for (int i = 0; i < m_functions.size(); i++)
|
||||
{
|
||||
String f = (String)m_functions.get(i);
|
||||
if (f.startsWith(columnName))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return m_functions.containsKey(AD_PrintFormatItem_ID);
|
||||
} // isFunctionColumn
|
||||
|
||||
/**
|
||||
* Get calculated functions of column
|
||||
* @param columnName column name or TOTAL
|
||||
* @param groupId group column or TOTAL
|
||||
* @return array of functions
|
||||
*/
|
||||
public char[] getFunctions(String columnName)
|
||||
public char[] getFunctions(int groupId)
|
||||
{
|
||||
ArrayList<String> list = new ArrayList<String>(); // the final function List
|
||||
ArrayList<Character> list = new ArrayList<Character>(); // the final function List
|
||||
Iterator<String> it = m_groupFunction.keySet().iterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
String group_function = (String)it.next(); // =TOTAL=~LoadSeq
|
||||
if (group_function.startsWith(columnName))
|
||||
if (group_function.startsWith(Integer.toString(groupId)))
|
||||
{
|
||||
group_function = group_function.substring(group_function.lastIndexOf(DELIMITER)+1); // LoadSeq
|
||||
for (int i = 0; i < m_functions.size(); i++)
|
||||
String functionColumn = group_function.substring(group_function.lastIndexOf(DELIMITER)+1); // LoadSeq
|
||||
List<Character> fs = m_functions.get(Integer.parseInt(functionColumn));
|
||||
if (fs != null && fs.size() > 0)
|
||||
{
|
||||
String col_function = ((String)m_functions.get(i)); // LoadSeq~A
|
||||
if (col_function.startsWith(group_function))
|
||||
for (Character f : fs)
|
||||
{
|
||||
String function = col_function.substring(col_function.lastIndexOf(DELIMITER)+1);
|
||||
if (!list.contains(function))
|
||||
list.add(function);
|
||||
if (!list.contains(f))
|
||||
list.add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -176,27 +168,29 @@ public class PrintDataGroup
|
|||
// Return Value
|
||||
char[] retValue = new char[list.size()];
|
||||
for (int i = 0; i < retValue.length; i++)
|
||||
retValue[i] = ((String)list.get(i)).charAt(0);
|
||||
retValue[i] = list.get(i);
|
||||
// log.finest( "PrintDataGroup.getFunctions for " + columnName + "/" + retValue.length, new String(retValue));
|
||||
return retValue;
|
||||
} // getFunctions
|
||||
|
||||
/**
|
||||
* Column has a function
|
||||
* @param columnName column name
|
||||
* @param AD_PrintFormatItem_ID column
|
||||
* @param function function
|
||||
* @return true if column has function
|
||||
*/
|
||||
public boolean isFunctionColumn (String columnName, char function)
|
||||
public boolean isFunctionColumn (int AD_PrintFormatItem_ID, char function)
|
||||
{
|
||||
if (columnName == null || m_functions.size() == 0)
|
||||
if (m_functions.size() == 0)
|
||||
return false;
|
||||
String key = columnName + DELIMITER + function;
|
||||
for (int i = 0; i < m_functions.size(); i++)
|
||||
List<Character> fs = m_functions.get(AD_PrintFormatItem_ID);
|
||||
if (fs != null && fs.size() > 0)
|
||||
{
|
||||
String f = (String)m_functions.get(i);
|
||||
if (f.equals(key))
|
||||
return true;
|
||||
for (Character f : fs)
|
||||
{
|
||||
if (f.charValue() == function)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} // isFunctionColumn
|
||||
|
@ -204,18 +198,18 @@ public class PrintDataGroup
|
|||
|
||||
/**************************************************************************
|
||||
* Add Value to groups
|
||||
* @param functionColumnName column name
|
||||
* @param functionColumnId function column
|
||||
* @param functionValue value
|
||||
*/
|
||||
public void addValue (String functionColumnName, BigDecimal functionValue)
|
||||
public void addValue (int functionColumnId, BigDecimal functionValue)
|
||||
{
|
||||
if (!isFunctionColumn(functionColumnName))
|
||||
if (!isFunctionColumn(functionColumnId))
|
||||
return;
|
||||
// Group Breaks
|
||||
for (int i = 0; i < m_groups.size(); i++)
|
||||
{
|
||||
String groupColumnName = (String)m_groups.get(i);
|
||||
String key = groupColumnName + DELIMITER + functionColumnName;
|
||||
int groupId = m_groups.get(i);
|
||||
String key = groupId + DELIMITER + functionColumnId;
|
||||
PrintDataFunction pdf = (PrintDataFunction)m_groupFunction.get(key);
|
||||
if (pdf == null)
|
||||
pdf = new PrintDataFunction();
|
||||
|
@ -226,15 +220,15 @@ public class PrintDataGroup
|
|||
|
||||
/**
|
||||
* Get Value
|
||||
* @param groupColumnName group column name (or TOTAL)
|
||||
* @param functionColumnName function column name
|
||||
* @param groupId group column (or TOTAL)
|
||||
* @param functionColumnId function column
|
||||
* @param function function
|
||||
* @return value
|
||||
*/
|
||||
public BigDecimal getValue (String groupColumnName, String functionColumnName,
|
||||
public BigDecimal getValue (int groupId, int functionColumnId,
|
||||
char function)
|
||||
{
|
||||
String key = groupColumnName + DELIMITER + functionColumnName;
|
||||
String key = groupId + DELIMITER + functionColumnId;
|
||||
PrintDataFunction pdf = (PrintDataFunction)m_groupFunction.get(key);
|
||||
if (pdf == null)
|
||||
return null;
|
||||
|
@ -243,12 +237,12 @@ public class PrintDataGroup
|
|||
|
||||
/**
|
||||
* Reset Function values
|
||||
* @param groupColumnName group column name (or TOTAL)
|
||||
* @param functionColumnName function column name
|
||||
* @param groupId group column (or TOTAL)
|
||||
* @param functionColumnId function column
|
||||
*/
|
||||
public void reset (String groupColumnName, String functionColumnName)
|
||||
public void reset (int groupId, int functionColumnId)
|
||||
{
|
||||
String key = groupColumnName + DELIMITER + functionColumnName;
|
||||
String key = groupId + DELIMITER + functionColumnId;
|
||||
PrintDataFunction pdf = (PrintDataFunction)m_groupFunction.get(key);
|
||||
if (pdf != null)
|
||||
pdf.reset();
|
||||
|
@ -280,7 +274,7 @@ public class PrintDataGroup
|
|||
}
|
||||
if (withData)
|
||||
{
|
||||
Iterator<String> it = m_groupMap.keySet().iterator();
|
||||
Iterator<Integer> it = m_groupMap.keySet().iterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
Object key = it.next();
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.compiere.print;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.util.Util;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
|
@ -45,6 +46,7 @@ public class PrintDataHandler extends DefaultHandler
|
|||
/** Final Structure */
|
||||
private PrintData m_pd = null;
|
||||
|
||||
private String m_curPrintFormatItemId = null;
|
||||
/** Current Active Element Name */
|
||||
private String m_curPDEname = null;
|
||||
/** Current Active Element Value */
|
||||
|
@ -96,6 +98,7 @@ public class PrintDataHandler extends DefaultHandler
|
|||
}
|
||||
else if (qName.equals(PrintDataElement.XML_TAG))
|
||||
{
|
||||
m_curPrintFormatItemId = attributes.getValue(PrintDataElement.XML_ATTRIBUTE_PRINTFORMATITEM_ID);
|
||||
m_curPDEname = attributes.getValue(PrintDataElement.XML_ATTRIBUTE_NAME);
|
||||
m_curPDEvalue = new StringBuffer();
|
||||
}
|
||||
|
@ -131,7 +134,16 @@ public class PrintDataHandler extends DefaultHandler
|
|||
}
|
||||
else if (qName.equals(PrintDataElement.XML_TAG))
|
||||
{
|
||||
m_curPD.addNode(new PrintDataElement(m_curPDEname, m_curPDEvalue.toString(),0, null));
|
||||
int id = 0;
|
||||
if (!Util.isEmpty(m_curPrintFormatItemId, true))
|
||||
{
|
||||
try
|
||||
{
|
||||
id = Integer.parseInt(m_curPrintFormatItemId);
|
||||
}
|
||||
catch (Exception ex) {}
|
||||
}
|
||||
m_curPD.addNode(new PrintDataElement(id, m_curPDEname, m_curPDEvalue.toString(),0, null));
|
||||
}
|
||||
} // endElement
|
||||
|
||||
|
|
|
@ -849,16 +849,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
|||
{
|
||||
td td = new td();
|
||||
tr.addElement(td);
|
||||
Object obj = null;
|
||||
/** START DEVCOFFEE: script column **/
|
||||
if (item.isTypeScript())
|
||||
{
|
||||
obj = m_printData.getNode(item.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = m_printData.getNode(Integer.valueOf(item.getAD_Column_ID()));
|
||||
}
|
||||
Object obj = m_printData.getNodeByPrintFormatItemId(item.getAD_PrintFormatItem_ID());
|
||||
if (obj == null || !isDisplayPFItem(item)){
|
||||
td.addElement(" ");
|
||||
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex]){
|
||||
|
@ -1074,13 +1065,8 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
|||
else
|
||||
{
|
||||
printColIndex++;
|
||||
Object obj = m_printData.getNode(Integer.valueOf(item.getAD_Column_ID()));
|
||||
Object obj = m_printData.getNodeByPrintFormatItemId(item.getAD_PrintFormatItem_ID());
|
||||
String data = "";
|
||||
/** START DEVCOFFEE: script column **/
|
||||
if (item.isTypeScript())
|
||||
{
|
||||
obj = m_printData.getNode(item.getName());
|
||||
}
|
||||
if (obj == null || !isDisplayPFItem(item)){
|
||||
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex]){
|
||||
preValues[printColIndex] = null;
|
||||
|
|
|
@ -1267,7 +1267,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
|
|||
int AD_Column_ID = item.getAD_Column_ID();
|
||||
if (log.isLoggable(Level.INFO)) log.info(format + " - Item=" + item.getName() + " (" + AD_Column_ID + ")");
|
||||
//
|
||||
Object obj = data.getNode(Integer.valueOf(AD_Column_ID));
|
||||
Object obj = data.getNodeByPrintFormatItemId(item.getAD_PrintFormatItem_ID());
|
||||
// Object obj = data.getNode(item.getColumnName()); // slower
|
||||
if (obj == null)
|
||||
{
|
||||
|
@ -1398,7 +1398,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
|
|||
String FieldAlignmentType, boolean isForm)
|
||||
{
|
||||
// Get Data
|
||||
Object obj = m_data.getNode(Integer.valueOf(item.getAD_Column_ID()));
|
||||
Object obj = m_data.getNodeByPrintFormatItemId(item.getAD_PrintFormatItem_ID());
|
||||
if (obj == null)
|
||||
return null;
|
||||
else if (obj instanceof PrintDataElement)
|
||||
|
@ -1514,7 +1514,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
|
|||
*/
|
||||
private PrintElement createImageElement (MPrintFormatItem item, PrintData printData)
|
||||
{
|
||||
Object obj = printData.getNode(Integer.valueOf(item.getAD_Column_ID()));
|
||||
Object obj = printData.getNodeByPrintFormatItem(item);
|
||||
if (obj == null)
|
||||
return null;
|
||||
else if (obj instanceof PrintDataElement)
|
||||
|
@ -1553,7 +1553,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
|
|||
private PrintElement createBarcodeElement (MPrintFormatItem item, PrintData printData)
|
||||
{
|
||||
// Get Data
|
||||
Object obj = printData.getNode(Integer.valueOf(item.getAD_Column_ID()));
|
||||
Object obj = printData.getNodeByPrintFormatItem(item);
|
||||
if (obj == null)
|
||||
return null;
|
||||
else if (obj instanceof PrintDataElement)
|
||||
|
@ -1816,14 +1816,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
|
|||
}
|
||||
else if (item.isTypeField() || item.getPrintFormatType().equals(MPrintFormatItem.PRINTFORMATTYPE_Script))
|
||||
{
|
||||
Object obj = null;
|
||||
if (item.getAD_Column_ID() > 0) // teo_sarca, [ 1673542 ]
|
||||
obj = printData.getNode(Integer.valueOf(item.getAD_Column_ID()));
|
||||
/** START DEVCOFFEE: Script print format type **/
|
||||
if (item.getPrintFormatType().equals(MPrintFormatItem.PRINTFORMATTYPE_Script))
|
||||
{
|
||||
obj = printData.getNode(item.getName());
|
||||
}
|
||||
Object obj = printData.getNodeByPrintFormatItem(item);
|
||||
if (obj == null)
|
||||
;
|
||||
else if (obj instanceof PrintDataElement)
|
||||
|
|
|
@ -133,7 +133,7 @@ public class ReportEngineEx { //extends ReportEngine {
|
|||
{
|
||||
td td = new td();
|
||||
tr.addElement(td);
|
||||
Object obj = m_printData.getNode(Integer.valueOf(item.getAD_Column_ID()));
|
||||
Object obj = m_printData.getNodeByPrintFormatItem(item);
|
||||
if (obj == null)
|
||||
td.addElement(" ");
|
||||
else if (obj instanceof PrintDataElement)
|
||||
|
|
Loading…
Reference in New Issue