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

SF.net SVN: ledger-smb:[5509] addons/1.3/report_framework/trunk



Revision: 5509
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5509&view=rev
Author:   einhverfr
Date:     2013-01-07 13:40:20 +0000 (Mon, 07 Jan 2013)
Log Message:
-----------
Removing backported cash income statements since they depend on business units.  This reduces the PNL backport to eca's, parts, and invoices

Modified Paths:
--------------
    addons/1.3/report_framework/trunk/patches/reporting_unified.patch
    addons/1.3/report_framework/trunk/sql/modules/PNL.sql

Modified: addons/1.3/report_framework/trunk/patches/reporting_unified.patch
===================================================================
--- addons/1.3/report_framework/trunk/patches/reporting_unified.patch	2013-01-07 13:17:58 UTC (rev 5508)
+++ addons/1.3/report_framework/trunk/patches/reporting_unified.patch	2013-01-07 13:40:20 UTC (rev 5509)
@@ -1,6 +1,6 @@
 Index: LedgerSMB/DBObject.pm
 ===================================================================
---- LedgerSMB/DBObject.pm	(revision 5294)
+--- LedgerSMB/DBObject.pm	(revision 5496)
 +++ LedgerSMB/DBObject.pm	(working copy)
 @@ -12,7 +12,7 @@
  
@@ -40,7 +40,7 @@
      return $self;
 Index: LedgerSMB/Template/HTML.pm
 ===================================================================
---- LedgerSMB/Template/HTML.pm	(revision 5294)
+--- LedgerSMB/Template/HTML.pm	(revision 5496)
 +++ LedgerSMB/Template/HTML.pm	(working copy)
 @@ -63,10 +63,15 @@
  sub preprocess {
@@ -60,9 +60,9 @@
              push @{$vars}, preprocess( $_ );
 Index: bin/aa.pl
 ===================================================================
---- bin/aa.pl	(revision 5294)
+--- bin/aa.pl	(revision 5496)
 +++ bin/aa.pl	(working copy)
-@@ -1050,6 +1050,7 @@
+@@ -1014,6 +1014,7 @@
      }
      if ($form->{id}){
          print qq|
@@ -72,9 +72,9 @@
  <th colspan="4">| . $locale->text('Attached and Linked Files') . qq|</th>
 Index: bin/ir.pl
 ===================================================================
---- bin/ir.pl	(revision 5294)
+--- bin/ir.pl	(revision 5496)
 +++ bin/ir.pl	(working copy)
-@@ -903,6 +903,7 @@
+@@ -918,6 +918,7 @@
      if ($form->{id}){
          IR->get_files($form, $locale);
          print qq|
@@ -84,9 +84,9 @@
  <th colspan="4">| . $locale->text('Attached and Linked Files') . qq|</th>
 Index: bin/is.pl
 ===================================================================
---- bin/is.pl	(revision 5294)
+--- bin/is.pl	(revision 5496)
 +++ bin/is.pl	(working copy)
-@@ -1024,6 +1024,7 @@
+@@ -1037,6 +1037,7 @@
      if ($form->{id}){
          IS->get_files($form, $locale);
          print qq|

Modified: addons/1.3/report_framework/trunk/sql/modules/PNL.sql
===================================================================
--- addons/1.3/report_framework/trunk/sql/modules/PNL.sql	2013-01-07 13:17:58 UTC (rev 5508)
+++ addons/1.3/report_framework/trunk/sql/modules/PNL.sql	2013-01-07 13:40:20 UTC (rev 5509)
@@ -25,14 +25,6 @@
 (in_from_date date, in_to_date date, in_parts_id int, in_business_units int[])
 RETURNS SETOF pnl_line AS 
 $$
-WITH RECURSIVE bu_tree (id, parent, path) AS (
-      SELECT id, null, row(array[id])::tree_record FROM business_unit
-       WHERE id = any($4)
-      UNION ALL
-      SELECT bu.id, parent, row((path).t || bu.id)::tree_record
-        FROM business_unit bu
-        JOIN bu_tree ON bu.parent_id = bu_tree.id
-)
    SELECT a.id, a.accno, a.description, a.category, ah.id, ah.accno,
           ah.description, 
           sum(ac.amount) * -1 
@@ -42,16 +34,11 @@
      JOIN invoice i ON i.id = ac.invoice_id
      JOIN account_link l ON l.account_id = a.id
      JOIN ar ON ar.id = ac.trans_id
-LEFT JOIN (select as_array(bu.path) as bu_ids, entry_id
-             from business_unit_inv bui 
-             JOIN bu_tree bu ON bui.bu_id = bu.id
-         GROUP BY entry_id) bui ON bui.entry_id = i.id
     WHERE i.parts_id = $3
           AND (ac.transdate >= $1 OR $1 IS NULL) 
           AND (ac.transdate <= $2 OR $2 IS NULL)
           AND ar.approved
           AND l.description = 'IC_expense'
-          AND ($4 is null or $4 = '{}' OR in_tree($4, bu_ids))
  GROUP BY a.id, a.accno, a.description, a.category, ah.id, ah.accno,
           ah.description
     UNION
@@ -64,92 +51,15 @@
      JOIN account a ON p.income_accno_id = a.id
      JOIN ar ON ar.id = ac.trans_id
      JOIN account_heading ah on a.heading = ah.id
-LEFT JOIN (select as_array(bu.path) as bu_ids, entry_id
-             from business_unit_inv bui 
-             JOIN bu_tree bu ON bui.bu_id = bu.id
-         GROUP BY entry_id) bui ON bui.entry_id = i.id
     WHERE i.parts_id = $3
           AND (ac.transdate >= $1 OR $1 IS NULL) 
           AND (ac.transdate <= $2 OR $2 IS NULL)
           AND ar.approved
-          AND ($4 is null or $4 = '{}' OR in_tree($4, bu_ids))
  GROUP BY a.id, a.accno, a.description, a.category, ah.id, ah.accno,
           ah.description
 $$ language SQL;
 
 
-CREATE OR REPLACE FUNCTION pnl__income_statement_accrual
-(in_from_date date, in_to_date date, in_business_units int[])
-RETURNS SETOF pnl_line AS
-$$
-WITH RECURSIVE bu_tree (id, parent, path) AS (
-      SELECT id, null, row(array[id])::tree_record FROM business_unit
-       WHERE id = any($3)
-      UNION ALL
-      SELECT bu.id, parent, row((path).t || bu.id)::tree_record
-        FROM business_unit bu
-        JOIN bu_tree ON bu.parent_id = bu_tree.id
-)
-   SELECT a.id, a.accno, a.description, a.category, ah.id, ah.accno,
-          ah.description, 
-          CASE WHEN a.category = 'E' THEN -1 ELSE 1 END * sum(ac.amount)
-     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
-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
-        GROUP BY buac.entry_id) bu
-          ON (ac.entry_id = bu.entry_id)
-    WHERE ac.approved is true 
-          AND ($1 IS NULL OR ac.transdate >= $1) 
-          AND ($2 IS NULL OR ac.transdate <= $2)
-          AND ($3 = '{}' 
-              OR $3 is null or in_tree($3, bu_ids))
-          AND a.category IN ('I', 'E')
- GROUP BY a.id, a.accno, a.description, a.category, 
-          ah.id, ah.accno, ah.description
- ORDER BY a.category DESC, a.accno ASC;
-$$ LANGUAGE SQL;
-
-CREATE OR REPLACE FUNCTION pnl__income_statement_cash
-(in_from_date date, in_to_date date, in_business_units int[])
-RETURNS SETOF pnl_line AS
-$$
-WITH RECURSIVE bu_tree (id, parent, path) AS (
-      SELECT id, null, row(array[id])::tree_record FROM business_unit
-       WHERE id = any($3)
-      UNION ALL
-      SELECT bu.id, parent, row((path).t || bu.id)::tree_record
-        FROM business_unit bu
-        JOIN bu_tree ON bu.parent_id = bu_tree.id
-)
-   SELECT a.id, a.accno, a.description, a.category, ah.id, ah.accno,
-          ah.description, 
-          CASE WHEN a.category = 'E' THEN -1 ELSE 1 END 
-               * sum(ac.amount * ca.portion)
-     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 cash_impact ca ON gl.id = ca.id
-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
-         GROUP BY entry_id) bu 
-          ON (ac.entry_id = bu.entry_id)
-    WHERE ac.approved is true 
-          AND ($3 = '{}' 
-              OR $3 is null or in_tree($3, bu_ids))
-          AND ($1 IS NULL OR ac.transdate >= $1) 
-          AND ($2 IS NULL OR ac.transdate <= $2)
-          AND a.category IN ('I', 'E')
- GROUP BY a.id, a.accno, a.description, a.category, 
-          ah.id, ah.accno, ah.description
- ORDER BY a.category DESC, a.accno ASC;
-$$ LANGUAGE SQL;
-
 CREATE OR REPLACE FUNCTION pnl__invoice(in_id int) RETURNS SETOF pnl_line AS
 $$
 SELECT a.id, a.accno, a.description, a.category, 

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