From b7bd72857455c40598035b2a7ff1726d0a07f2aa Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 28 Dec 2007 18:22:43 +0000 Subject: [PATCH] adding acq budget tracking tables and IDL info git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8289 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/fm_IDL.xml | 35 ++++++++++++++++++++++++++++++++++ Open-ILS/src/sql/Pg/200.schema.acq.sql | 25 +++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 2d6fe3d792..bbe75c7814 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -2426,6 +2426,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index f9a14a23da..ac9719d72b 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -10,7 +10,7 @@ CREATE TABLE acq.currency_type ( ); INSERT INTO acq.currency_type (code, label) VALUES ('USD','US Dollars'); -INSERT INTO acq.currency_type (code, label) VALUES ('CAN','Canadian Dollars'); +INSERT INTO acq.currency_type (code, label) VALUES ('CAD','Canadian Dollars'); INSERT INTO acq.currency_type (code, label) VALUES ('EUR','Euros'); CREATE TABLE acq.exchange_rate ( @@ -68,4 +68,27 @@ CREATE TABLE acq.fund_debit ( encumberance BOOL NOT NULL DEFAULT TRUE ); +CREATE TABLE acq.budget ( + id SERIAL PRIMARY KEY, + org INT NOT NULL REFERENCES actor.org_unit (id) ON UPDATE CASCADE ON DELETE CASCADE, + name TEXT NOT NULL, + year INT NOT NULL DEFAULT EXTRACT( YEAR FROM NOW() ), + CONSTRAINT name_once_per_org_year UNIQUE (org,name,year) +); + +CREATE TABLE acq.budget_allocation ( + id SERIAL PRIMARY KEY, + fund INT NOT NULL REFERENCES acq.fund (id) ON UPDATE CASCADE ON DELETE CASCADE, + budget INT NOT NULL REFERENCES acq.budget (id) ON UPDATE CASCADE ON DELETE CASCADE, + amount NUMERIC, + percent NUMERIC CHECK (percent IS NULL OR percent BETWEEN 0.0 AND 100.0), + allocator INT NOT NULL REFERENCES actor.usr (id), + note TEXT, + CONSTRAINT allocation_amount_or_percent CHECK ((percent IS NULL AND amount IS NOT NULL) OR (percent IS NOT NULL AND amount IS NULL)) +); + COMMIT; + + + + -- 2.11.0