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

SF.net SVN: ledger-smb:[3124] trunk/LedgerSMB/AA.pm



Revision: 3124
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3124&view=rev
Author:   einhverfr
Date:     2011-02-24 22:17:52 +0000 (Thu, 24 Feb 2011)

Log Message:
-----------
Corrects two bugs:
1)  AR Outstanding Summary report shows incorrect paid info
2)  AR/AP Outstanding Summary Report groups by incorrect criteria, sometimes resulting in multiple lines per customer/vendor

Modified Paths:
--------------
    trunk/LedgerSMB/AA.pm

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2011-02-23 22:20:25 UTC (rev 3123)
+++ trunk/LedgerSMB/AA.pm	2011-02-24 22:17:52 UTC (rev 3124)
@@ -822,11 +822,13 @@
 		          sum(a.netamount) as netamount, 
 		          sum(a.amount) as amount, 
 		          sum(a.amount::numeric(20,$p)) 
-                             - sum(acs.amount::numeric(20,$p)) AS paid,
+                             - (sum(acs.amount::numeric(20,$p)) 
+                                * CASE WHEN '$table' = 'ar' THEN -1 ELSE 1 END)
+                          AS paid,
 		          vce.name, vc.meta_number,
 		          a.entity_id, 
-		          d.description AS department, 
-		          a.ponumber
+		          d.description AS department --, 
+		          --a.ponumber
 		     FROM $table a
 		     JOIN entity_credit_account vc ON (a.entity_credit_account = vc.id)
 		     JOIN acc_trans acs ON (acs.trans_id = a.id)
@@ -842,8 +844,9 @@
 			AND a.approved IS TRUE AND acs.approved IS TRUE
 			AND a.force_closed IS NOT TRUE
 		 GROUP BY 
-		          vc.meta_number, a.entity_id, vce.name, d.description,
-		          a.ponumber, a.invoice 
+		          vc.meta_number, a.entity_id, vce.name, 
+                          d.description --,
+		          --a.ponumber, a.invoice 
 		   HAVING abs(sum(a.amount) - (sum(a.amount) - sum(acs.amount))) > 0.000 |;
         } else {
             $query = qq|
@@ -1075,7 +1078,6 @@
         $query .= "WHERE ($approved OR a.approved) AND $where
 			ORDER BY $sortorder";
     }
-
     my $sth = $dbh->prepare($query);
     $sth->execute(@paidargs) || $form->dberror($query);
 


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