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

SF.net SVN: ledger-smb:[2667] trunk/sql



Revision: 2667
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2667&view=rev
Author:   einhverfr
Date:     2009-06-12 20:25:45 +0000 (Fri, 12 Jun 2009)

Log Message:
-----------
Tax Form/1099 handling merged in better

Modified Paths:
--------------
    trunk/sql/Pg-database.sql
    trunk/sql/modules/Roles.sql

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2009-06-12 20:10:38 UTC (rev 2666)
+++ trunk/sql/Pg-database.sql	2009-06-12 20:25:45 UTC (rev 2667)
@@ -46,6 +46,8 @@
   pricegroup text
 );
 
+-- country and tax form
+
 CREATE TABLE country (
   id serial PRIMARY KEY,
   name text check (name ~ '[[:alnum:]_]') NOT NULL,
@@ -56,6 +58,12 @@
 
 CREATE UNIQUE INDEX country_name_idx on country(lower(name));
 
+create table country_tax_form (                                                    country_id int references country(id) not null,
+   form_name text not null,
+   id serial not null unique,
+   primary key(country_id, form_name)
+);
+
 -- BEGIN new entity management
 CREATE TABLE entity_class (
   id serial primary key,
@@ -164,12 +172,6 @@
 
 -- LOCATION AND COUNTRY
 
-create table country_tax_form (                                                    country_id int references country(id) not null,
-   form_name text not null,
-   id serial not null unique,
-   primary key(country_id, form_name)
-);
-
 CREATE TABLE location_class (
   id serial UNIQUE,
   class text check (class ~ '[[:alnum:]_]') not null,
@@ -366,6 +368,7 @@
     ar_ap_account_id int references account(id),
     cash_account_id int references account(id),
     bank_account int references entity_bank_account(id),
+    taxform_id int references country_tax_form(id)
     PRIMARY KEY(entity_id, meta_number, entity_class)
 );
 
@@ -1197,6 +1200,15 @@
   1, 'Simple'
 );
 
+CREATE TABLE ac_tax_form (
+        entry_id int references acc_trans(entry_id) primary key,
+        reportable bool
+);
+CREATE TABLE invoice_tax_form (
+        invoice_id int references invoice(id) primary key,
+        reportable bool
+);
+
 create index acc_trans_trans_id_key on acc_trans (trans_id);
 create index acc_trans_chart_id_key on acc_trans (chart_id);
 create index acc_trans_transdate_key on acc_trans (transdate);

Modified: trunk/sql/modules/Roles.sql
===================================================================
--- trunk/sql/modules/Roles.sql	2009-06-12 20:10:38 UTC (rev 2666)
+++ trunk/sql/modules/Roles.sql	2009-06-12 20:25:45 UTC (rev 2667)
@@ -1427,6 +1427,9 @@
 GRANT ALL ON transactions, entity_employee, customer, vendor TO public;
 GRANT ALL ON pending_job, payments_queue TO PUBLIC;
 GRANT ALL ON pending_job_id_seq TO public;
+GRANT ALL ON invoice_tax_form TO public;
+GRANT ALL ON ac_tax_form to public;
+GRANT SELECT ON country_tax_form to public;
 --TODO, lock recurring, pending_job, payment_queue down more
 -- Roles with no db permissions:
 CREATE ROLE "lsmb_<?lsmb dbname ?>__draft_edit" WITH INHERIT NOLOGIN;


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