diff options
Diffstat (limited to 'sql')
-rwxr-xr-x | sql/Canada-French_General-chart.sql | 2 | ||||
-rwxr-xr-x | sql/Pg-tables.sql | 12 | ||||
-rw-r--r-- | sql/Pg-upgrade-2.6.18-2.6.19.sql | 20 |
3 files changed, 31 insertions, 3 deletions
diff --git a/sql/Canada-French_General-chart.sql b/sql/Canada-French_General-chart.sql index 647dd121..add09a73 100755 --- a/sql/Canada-French_General-chart.sql +++ b/sql/Canada-French_General-chart.sql @@ -73,6 +73,6 @@ INSERT INTO chart (accno,description,charttype,category,link,gifi_accno) VALUES INSERT INTO chart (accno,description,charttype,category,link,gifi_accno) VALUES ('5800', 'Taxes d''affaires, droits d''adhésion et permis', 'A', 'E', 'AP_amount', '8760'); -- insert into tax (chart_id,rate) values ((select id from chart where accno = '2310'),0.06); -insert into tax (chart_id,rate) values ((select id from chart where accno = '2320'),0.08025); +insert into tax (chart_id,rate,pass) values ((select id from chart where accno = '2320'),0.08,1); -- update defaults set inventory_accno_id = (select id from chart where accno = '1520'), income_accno_id = (select id from chart where accno = '4020'), expense_accno_id = (select id from chart where accno = '5010'), fxgain_accno_id = (select id from chart where accno = '4450'), fxloss_accno_id = (select id from chart where accno = '4450'), curr = 'CAD:USD:EUR', weightunit = 'kg'; diff --git a/sql/Pg-tables.sql b/sql/Pg-tables.sql index 42471a15..40a81af8 100755 --- a/sql/Pg-tables.sql +++ b/sql/Pg-tables.sql @@ -12,7 +12,7 @@ CREATE SEQUENCE jcitemsid; SELECT nextval ('jcitemsid'); -- -create table transactions ( +CREATE TABLE transactions ( id int PRIMARY KEY, table_name text ); @@ -243,12 +243,20 @@ CREATE TABLE partstax ( PRIMARY KEY (parts_id, chart_id) ); -- +CREATE TABLE taxmodule ( + taxmodule_id serial PRIMARY KEY, + taxmodulename text NOT NULL +}; +-- CREATE TABLE tax ( chart_id int PRIMARY KEY, rate numeric, taxnumber text, validto date, - FOREIGN KEY (chart_id) REFERENCES chart (id) + pass integer DEFAULT 0 NOT NULL, + taxmodule_id int, + FOREIGN KEY (chart_id) REFERENCES chart (id), + FOREIGN KEY (taxmodule_id) REFERENCES taxmodule (taxmodule_id) ); -- CREATE TABLE customertax ( diff --git a/sql/Pg-upgrade-2.6.18-2.6.19.sql b/sql/Pg-upgrade-2.6.18-2.6.19.sql index 07541bde..d8e304f3 100644 --- a/sql/Pg-upgrade-2.6.18-2.6.19.sql +++ b/sql/Pg-upgrade-2.6.18-2.6.19.sql @@ -120,3 +120,23 @@ SET DEFAULT nextval('shipto_entry_id_seq'); UPDATE shipto SET entry_id = nextval('shipto_entry_id_seq'); ALTER TABLE shipto ADD PRIMARY KEY (entry_id); + +CREATE TABLE taxmodule ( + taxmodule_id serial PRIMARY KEY, + taxmodulename text NOT NULL +); + +INSERT INTO taxmodule ( + taxmodule_id, taxmodulename + ) VALUES ( + 1, 'Simple' +); + +LOCK tax IN EXCLUSIVE MODE; +ALTER TABLE tax ADD COLUMN pass int DEFAULT 0; +UPDATE tax SET pass = 0; +ALTER TABLE tax ALTER COLUMN pass SET NOT NULL; + +ALTER TABLE tax ADD COLUMN taxmodule_id int REFERENCES taxmodule DEFAULT 1; +UPDATE tax SET taxmodule_id = 1; +ALTER TABLE tax ALTER COLUMN taxmodule_id SET NOT NULL; |