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

SF.net SVN: ledger-smb:[4221] branches/1.3



Revision: 4221
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4221&view=rev
Author:   tshvr
Date:     2011-12-16 12:32:01 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
prepare drop entity_id from ar,ap

Modified Paths:
--------------
    branches/1.3/LedgerSMB/IS.pm
    branches/1.3/sql/modules/Payment.sql

Modified: branches/1.3/LedgerSMB/IS.pm
===================================================================
--- branches/1.3/LedgerSMB/IS.pm	2011-12-15 19:35:03 UTC (rev 4220)
+++ branches/1.3/LedgerSMB/IS.pm	2011-12-16 12:32:01 UTC (rev 4221)
@@ -2074,6 +2074,7 @@
     if ( $form->{id} ) {
 
         # retrieve invoice
+        #HV TODO drop entity_id from ar
         $query = qq|
 			   SELECT a.invnumber, a.ordnumber, a.quonumber,
 			          a.transdate, a.paid,
@@ -2081,7 +2082,7 @@
 			          a.intnotes,
 			          a.duedate, a.taxincluded, a.curr AS currency,
 			          a.person_id, e.name AS employee, a.till, 
-			          a.entity_id, a.reverse,
+			          a.reverse,
 			          a.language_code, a.ponumber,
 			          a.on_hold
 			     FROM ar a

Modified: branches/1.3/sql/modules/Payment.sql
===================================================================
--- branches/1.3/sql/modules/Payment.sql	2011-12-15 19:35:03 UTC (rev 4220)
+++ branches/1.3/sql/modules/Payment.sql	2011-12-16 12:32:01 UTC (rev 4221)
@@ -192,15 +192,17 @@
 		         THEN ex.buy
 		         ELSE ex.sell END)
 		         END) AS exchangerate
-                 FROM  (SELECT id, invnumber, transdate, amount, entity_id,
+                 --TODO HV prepare drop entity_id from ap,ar
+                 --FROM  (SELECT id, invnumber, transdate, amount, entity_id,
+                 FROM  (SELECT id, invnumber, transdate, amount,
 		               1 as invoice_class, paid, curr, 
 		               entity_credit_account, department_id, approved
 		          FROM ap
                          UNION
-		         SELECT id, invnumber, transdate, amount, entity_id,
+		         --SELECT id, invnumber, transdate, amount, entity_id,
+		         SELECT id, invnumber, transdate, amount,
 		               2 AS invoice_class, paid, curr,
 		               entity_credit_account, department_id, approved
-
 		         FROM ar
 		         ) a 
 		JOIN (SELECT trans_id, chart_id, sum(CASE WHEN in_account_class = 1 THEN amount
@@ -211,8 +213,8 @@
 		        GROUP BY trans_id, chart_id) ac ON (ac.trans_id = a.id)
 		        JOIN chart ON (chart.id = ac.chart_id)
 		        LEFT JOIN exchangerate ex ON ( ex.transdate = a.transdate AND ex.curr = a.curr )         
-		        JOIN entity_credit_account c ON (c.id = a.entity_credit_account
-                        OR (a.entity_credit_account IS NULL and a.entity_id = c.entity_id))
+		        JOIN entity_credit_account c ON (c.id = a.entity_credit_account)
+                --        OR (a.entity_credit_account IS NULL and a.entity_id = c.entity_id))
 	 	        WHERE ((chart.link = 'AP' AND in_account_class = 1)
 		              OR (chart.link = 'AR' AND in_account_class = 2))
               	        AND a.invoice_class = in_account_class

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