Menu

#2660 FinReport wrong LineSource when PostingType on ReportLine

open
nobody
9
2011-07-26
2011-07-26
No

Hi,

we found a bug into Financial Report when you print the line source and you have PostingType setted on ReportLine, it will not filter PostingType at column level resulting in considering every type of Fact, so the sum of source lines differ from the line total.

This is an example of the generated query the first is for the line total, the second for the source

SELECT SUM(acctBalance(Account_ID,AmtAcctDr,AmtAcctCr)) SALDO FROM Fact_Acct fa WHERE TRUNC(DateAcct) <= TO_DATE('2010-12-31','YYYY-MM-DD') AND ( Account_ID=1000136 OR Account_ID=1000137 OR Account_ID=1000138 OR Account_ID=1000140 OR Account_ID=1000144 OR Account_ID=1000141 OR Account_ID=1000142 OR Account_ID=1000541 OR Account_ID=1000147 OR Account_ID=1000148 ) AND PostingType='A' AND C_AcctSchema_ID=1000000

SELECT 1016641,1000048,Account_ID,0,-1 , (SELECT SUM(acctBalance(Account_ID,AmtAcctDr,AmtAcctCr)) FROM Fact_Acct fb WHERE TRUNC(DateAcct) <= TO_DATE('2010-12-31','YYYY-MM-DD') AND fb.Account_ID=x.Account_ID AND C_AcctSchema_ID=1000000) SALDO FROM Fact_Acct x WHERE ( Account_ID=1000136 OR Account_ID=1000137 OR Account_ID=1000138 OR Account_ID=1000140 OR Account_ID=1000144 OR Account_ID=1000141 OR Account_ID=1000142 OR Account_ID=1000541 OR Account_ID=1000147 OR Account_ID=1000148 ) AND PostingType='A' AND C_AcctSchema_ID=1000000 AND Account_ID IS NOT NULL GROUP BY 1016641, 1000048, Account_ID, 0, -1

As you can see in the second query the postingtype is tested outside of the nested subquery which therefore return every fact_acct for the specified account/period/schema regardless of the postingtype

I think we should either put PostingType='A' inside every subquery (but always taking it from the line as per m_lines[line].isPostingType()) or put a fb.PostingType=x.PostingType in the subquery and in the group by clause

Regards,
Angelo Dabala'

Discussion


Log in to post a comment.