[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[5748] trunk/sql/modules/PNL.sql



Revision: 5748
          http://sourceforge.net/p/ledger-smb/code/5748
Author:   einhverfr
Date:     2013-05-05 10:07:07 +0000 (Sun, 05 May 2013)
Log Message:
-----------
Correcting accrual PNL picking up unapproved transactions, item 778

Modified Paths:
--------------
    trunk/sql/modules/PNL.sql

Modified: trunk/sql/modules/PNL.sql
===================================================================
--- trunk/sql/modules/PNL.sql	2013-05-04 10:01:35 UTC (rev 5747)
+++ trunk/sql/modules/PNL.sql	2013-05-05 10:07:07 UTC (rev 5748)
@@ -97,7 +97,7 @@
      FROM account a
      JOIN account_heading ah on a.heading = ah.id
      JOIN acc_trans ac ON a.id = ac.chart_id AND ac.approved
-     JOIN tx_report gl ON ac.trans_id = gl.id
+     JOIN tx_report gl ON ac.trans_id = gl.id AND gl.approved
 LEFT JOIN (select array_agg(path) as bu_ids, entry_id
              FROM business_unit_ac buac
              JOIN bu_tree ON bu_tree.id = buac.bu_id
@@ -142,7 +142,7 @@
      FROM account a
      JOIN account_heading ah on a.heading = ah.id
      JOIN acc_trans ac ON a.id = ac.chart_id AND ac.approved
-     JOIN tx_report gl ON ac.trans_id = gl.id
+     JOIN tx_report gl ON ac.trans_id = gl.id AND gl.approved
      JOIN (SELECT id, sum(portion) as portion
              FROM cash_impact ca 
             WHERE ($1 IS NULL OR ca.transdate >= $1)

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.