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

SF.net SVN: ledger-smb:[3178] trunk/sql/modules/Company.sql



Revision: 3178
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3178&view=rev
Author:   einhverfr
Date:     2011-05-25 04:32:02 +0000 (Wed, 25 May 2011)

Log Message:
-----------
Ian's patch for sales taxes, patch 2953425

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

Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql	2011-05-25 04:24:02 UTC (rev 3177)
+++ trunk/sql/modules/Company.sql	2011-05-25 04:32:02 UTC (rev 3178)
@@ -77,7 +77,7 @@
                       UNION ALL
                       SELECT * FROM company
                        WHERE in_legal_name IS NULL) c ON (e.id = c.entity_id)
-		JOIN (SELECT * FROM entity_credit_account 
+		LEFT JOIN (SELECT * FROM entity_credit_account 
                        WHERE meta_number = in_meta_number
                       UNION ALL
                       SELECT * from entity_credit_account
@@ -153,13 +153,16 @@
 BEGIN
      SELECT * FROM entity_credit_account into eca WHERE id = in_credit_id;
 
+
      IF eca.entity_class = 1 then
+        DELETE FROM customertax WHERE customer_id = in_credit_id;
         FOR iter in array_lower(in_tax_ids, 1) .. array_upper(in_tax_ids, 1)
         LOOP
              INSERT INTO customertax (customer_id, chart_id)
              values (in_credit_id, in_tax_ids[iter]);
         END LOOP;
      ELSIF eca.entity_class = 2 then
+        DELETE FROM vendortax WHERE vendor_id = in_credit_id;
         FOR iter in array_lower(in_tax_ids, 1) .. array_upper(in_tax_ids, 1)
         LOOP
              INSERT INTO vendortax (vendor_id, chart_id)


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