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

SF.net SVN: ledger-smb: [2134] branches/1.2/sql/fixes/ amount_blank_ap_transactions.sql



Revision: 2134
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2134&view=rev
Author:   einhverfr
Date:     2008-05-12 11:43:21 -0700 (Mon, 12 May 2008)

Log Message:
-----------
Adding fix for amount blank on AR/AP transaction report

Added Paths:
-----------
    branches/1.2/sql/fixes/amount_blank_ap_transactions.sql

Added: branches/1.2/sql/fixes/amount_blank_ap_transactions.sql
===================================================================
--- branches/1.2/sql/fixes/amount_blank_ap_transactions.sql	                        (rev 0)
+++ branches/1.2/sql/fixes/amount_blank_ap_transactions.sql	2008-05-12 18:43:21 UTC (rev 2134)
@@ -0,0 +1,29 @@
+BEGIN;
+
+UPDATE ap 
+SET netamount = 
+	(select sum(amount) from acc_trans 
+	where trans_id = ap.id 
+		AND ((chart_id IN (select id from chart where link = 'AP')
+			     AND amount > 0)
+			OR (chart_id IN 
+				(select id from chart where link like '%tax%')
+			)
+		)
+	)
+WHERE netamount IS NULL;
+
+UPDATE ar
+SET netamount = -1 *
+	(select sum(amount) from acc_trans 
+	where trans_id = ap.id 
+		AND ((chart_id IN (select id from chart where link = 'AP')
+			     AND amount < 0)
+			OR (chart_id IN 
+				(select id from chart where link like '%tax%')
+			)
+		)
+	)
+WHERE netamount IS NULL;
+
+commit;


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