IDEMPIERE-2776 List Transaction on financial reports not working for budget and multi-period
This commit is contained in:
parent
0f6e3abacf
commit
9bb61e344f
|
@ -1538,26 +1538,88 @@ public class FinReport extends SvrProcess
|
||||||
for (int col = 0; col < m_columns.length; col++)
|
for (int col = 0; col < m_columns.length; col++)
|
||||||
{
|
{
|
||||||
insert.append(", ");
|
insert.append(", ");
|
||||||
// Only relative Period (not calculation or segment value)
|
// No calculation
|
||||||
if (!(m_columns[col].isColumnTypeRelativePeriod()
|
if (m_columns[col].isColumnTypeCalculation())
|
||||||
&& m_columns[col].getRelativePeriodAsInt() == 0))
|
|
||||||
{
|
{
|
||||||
insert.append("NULL");
|
insert.append("Cast(NULL AS NUMBER)");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Amount Type ... Qty
|
|
||||||
|
// SELECT
|
||||||
|
StringBuffer select = new StringBuffer ("SELECT ");
|
||||||
if (m_lines[line].getPAAmountType() != null) // line amount type overwrites column
|
if (m_lines[line].getPAAmountType() != null) // line amount type overwrites column
|
||||||
insert.append (m_lines[line].getSelectClause (false));
|
select.append (m_lines[line].getSelectClause (false));
|
||||||
else if (m_columns[col].getPAAmountType() != null)
|
else if (m_columns[col].getPAAmountType() != null)
|
||||||
insert.append (m_columns[col].getSelectClause (false));
|
select.append (m_columns[col].getSelectClause (false));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
insert.append("NULL");
|
insert.append("Cast(NULL AS NUMBER)");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p_PA_ReportCube_ID > 0) {
|
||||||
|
select.append(" FROM Fact_Acct_Summary fb WHERE ").append(p_AdjPeriodToExclude).append("DateAcct ");
|
||||||
|
} //report cube
|
||||||
|
else {
|
||||||
|
// Get Period info
|
||||||
|
select.append(" FROM Fact_Acct fb WHERE ").append(p_AdjPeriodToExclude).append("TRUNC(DateAcct) ");
|
||||||
|
}
|
||||||
|
FinReportPeriod frp = getPeriod (m_columns[col].getRelativePeriod());
|
||||||
|
if (m_lines[line].getPAPeriodType() != null) // line amount type overwrites column
|
||||||
|
{
|
||||||
|
if (m_lines[line].isPeriod())
|
||||||
|
select.append(frp.getPeriodWhere());
|
||||||
|
else if (m_lines[line].isYear())
|
||||||
|
select.append(frp.getYearWhere());
|
||||||
|
else if (m_lines[line].isNatural())
|
||||||
|
select.append(frp.getNaturalWhere("fb"));
|
||||||
|
else
|
||||||
|
select.append(frp.getTotalWhere());
|
||||||
|
}
|
||||||
|
else if (m_columns[col].getPAPeriodType() != null)
|
||||||
|
{
|
||||||
|
if (m_columns[col].isPeriod())
|
||||||
|
select.append(frp.getPeriodWhere());
|
||||||
|
else if (m_columns[col].isYear())
|
||||||
|
select.append(frp.getYearWhere());
|
||||||
|
else if (m_columns[col].isNatural())
|
||||||
|
select.append(frp.getNaturalWhere("fb"));
|
||||||
|
else
|
||||||
|
select.append(frp.getTotalWhere());
|
||||||
|
}
|
||||||
|
// Link
|
||||||
|
select.append(" AND fb.Fact_Acct_ID=x.Fact_Acct_ID");
|
||||||
|
// PostingType
|
||||||
|
if (!m_lines[line].isPostingType()) // only if not defined on line
|
||||||
|
{
|
||||||
|
String PostingType = m_columns[col].getPostingType();
|
||||||
|
if (PostingType != null && PostingType.length() > 0)
|
||||||
|
select.append(" AND fb.PostingType='").append(PostingType).append("'");
|
||||||
|
// globalqss - CarlosRuiz
|
||||||
|
if (MReportColumn.POSTINGTYPE_Budget.equals(PostingType)) {
|
||||||
|
if (m_columns[col].getGL_Budget_ID() > 0)
|
||||||
|
select.append(" AND GL_Budget_ID=" + m_columns[col].getGL_Budget_ID());
|
||||||
|
}
|
||||||
|
// end globalqss
|
||||||
|
}
|
||||||
|
// Report Where
|
||||||
|
String s = m_report.getWhereClause();
|
||||||
|
if (s != null && s.length() > 0)
|
||||||
|
select.append(" AND ").append(s);
|
||||||
|
// Limited Segment Values
|
||||||
|
if (m_columns[col].isColumnTypeSegmentValue())
|
||||||
|
select.append(m_columns[col].getWhereClause(p_PA_Hierarchy_ID));
|
||||||
|
|
||||||
|
// Parameter Where
|
||||||
|
select.append(m_parameterWhere);
|
||||||
|
if (log.isLoggable(Level.FINEST))
|
||||||
|
log.finest("Col=" + col + ", Line=" + line + ": " + select);
|
||||||
|
//
|
||||||
|
insert.append("(").append(select).append(")");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
insert.append(" FROM Fact_Acct WHERE ")
|
insert.append(" FROM Fact_Acct x WHERE ")
|
||||||
.append(m_lines[line].getWhereClause(p_PA_Hierarchy_ID)); // (sources, posting type)
|
.append(m_lines[line].getWhereClause(p_PA_Hierarchy_ID)); // (sources, posting type)
|
||||||
// Report Where
|
// Report Where
|
||||||
String s = m_report.getWhereClause();
|
String s = m_report.getWhereClause();
|
||||||
|
@ -1569,24 +1631,6 @@ public class FinReport extends SvrProcess
|
||||||
if (p_PA_ReportCube_ID > 0)
|
if (p_PA_ReportCube_ID > 0)
|
||||||
whereClause = whereClause.replaceAll(" AND PA_ReportCube_ID=" + p_PA_ReportCube_ID, "");
|
whereClause = whereClause.replaceAll(" AND PA_ReportCube_ID=" + p_PA_ReportCube_ID, "");
|
||||||
insert.append(whereClause); // IDEMPIERE-130
|
insert.append(whereClause); // IDEMPIERE-130
|
||||||
|
|
||||||
// Period restriction
|
|
||||||
FinReportPeriod frp = getPeriod (0);
|
|
||||||
insert.append(" AND TRUNC(DateAcct) ")
|
|
||||||
.append(frp.getPeriodWhere());
|
|
||||||
// PostingType ??
|
|
||||||
// if (!m_lines[line].isPostingType()) // only if not defined on line
|
|
||||||
// {
|
|
||||||
// String PostingType = m_columns[col].getPostingType();
|
|
||||||
// if (PostingType != null && PostingType.length() > 0)
|
|
||||||
// insert.append(" AND PostingType='").append(PostingType).append("'");
|
|
||||||
// // globalqss - CarlosRuiz
|
|
||||||
// if (PostingType.equals(MReportColumn.POSTINGTYPE_Budget)) {
|
|
||||||
// if (m_columns[col].getGL_Budget_ID() > 0)
|
|
||||||
// select.append(" AND GL_Budget_ID=" + m_columns[col].getGL_Budget_ID());
|
|
||||||
// }
|
|
||||||
// // end globalqss
|
|
||||||
// }
|
|
||||||
|
|
||||||
int no = DB.executeUpdate(insert.toString(), get_TrxName());
|
int no = DB.executeUpdate(insert.toString(), get_TrxName());
|
||||||
if (log.isLoggable(Level.FINEST)) log.finest("Trx #=" + no + " - " + insert);
|
if (log.isLoggable(Level.FINEST)) log.finest("Trx #=" + no + " - " + insert);
|
||||||
|
|
Loading…
Reference in New Issue