summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-14 01:20:42 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-14 01:20:42 +0000
commit7e8a9ca77a4b2fc626d2b6e179053ef984e2a4c6 (patch)
tree7f85140c6cbaed7ef4926d1756dafe9c538cfe21
parentde5d7fc852074c99f60327b078944cfb34840e41 (diff)
Adding discount_terms and threshold to entity_credit_account
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1594 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r--sql/Pg-database.sql2
-rw-r--r--sql/modules/Customer.sql18
-rw-r--r--sql/modules/Vendor.sql15
3 files changed, 26 insertions, 9 deletions
diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql
index 9b0d66d1..18cfb1d2 100644
--- a/sql/Pg-database.sql
+++ b/sql/Pg-database.sql
@@ -477,6 +477,7 @@ CREATE TABLE entity_credit_account (
entity_id int not null references entity(id) ON DELETE CASCADE,
entity_class int not null references entity_class(id) check ( entity_class in (1,2) ),
discount numeric,
+ discount_terms int default 0,
taxincluded bool default 'f',
creditlimit NUMERIC default 0,
terms int2 default 0,
@@ -489,6 +490,7 @@ CREATE TABLE entity_credit_account (
curr char(3),
startdate date DEFAULT CURRENT_DATE,
enddate date,
+ threshold numeric default 0,
PRIMARY KEY(entity_id, meta_number)
);
diff --git a/sql/modules/Customer.sql b/sql/modules/Customer.sql
index f59c1ae1..c0a5d640 100644
--- a/sql/modules/Customer.sql
+++ b/sql/modules/Customer.sql
@@ -27,6 +27,7 @@ CREATE OR REPLACE FUNCTION customer_save (
in_id int,
in_discount numeric, in_taxincluded bool, in_creditlimit numeric,
+ in_discount_terms int,
in_terms int, in_meta_number varchar(32), in_cc text, in_bcc text,
in_business_id int, in_language varchar(6), in_pricegroup_id int,
in_curr char, in_startdate date, in_enddate date,
@@ -35,7 +36,8 @@ CREATE OR REPLACE FUNCTION customer_save (
in_notes text,
- in_name text, in_tax_id TEXT
+ in_name text, in_tax_id TEXT,
+ in_threshold
) returns INT as $$
@@ -78,7 +80,9 @@ CREATE OR REPLACE FUNCTION customer_save (
pricegroup_id,
curr,
startdate,
- enddate
+ enddate,
+ discountterms,
+ threshold
)
VALUES (
new_entity_id,
@@ -95,7 +99,9 @@ CREATE OR REPLACE FUNCTION customer_save (
in_pricegroup_id,
in_curr,
in_startdate,
- in_enddate
+ in_enddate,
+ in_discount_terms,
+ in_threashold
);
INSERT INTO entity_bank_account (
entity_id,
@@ -127,7 +133,9 @@ CREATE OR REPLACE FUNCTION customer_save (
pricegroup_id = in_pricegroup_id,
curr = in_curr,
startdate = in_startdate,
- enddate = in_enddate
+ enddate = in_enddate,
+ threshold = in_threshold,
+ discount_terms = in_discount_terms
where entity_id = v_row.entity_id;
UPDATE entity_bank_account SET
@@ -209,4 +217,4 @@ CREATE OR REPLACE FUNCTION customer_next_customer_id() returns int as $$
select nextval('company_id_seq');
-$$ language 'sql';ƒ \ No newline at end of file
+$$ language 'sql';ƒ
diff --git a/sql/modules/Vendor.sql b/sql/modules/Vendor.sql
index 2026fffa..aac2f4a2 100644
--- a/sql/modules/Vendor.sql
+++ b/sql/modules/Vendor.sql
@@ -27,6 +27,7 @@ CREATE OR REPLACE FUNCTION vendor_save (
in_id int,
in_discount numeric, in_taxincluded bool, in_creditlimit numeric,
+ in_discount_terms int, in_threshold numeric,
in_terms int, in_vendornumber varchar(32), in_cc text, in_bcc text,
in_business_id int, in_language varchar(6), in_pricegroup_id int,
in_curr char, in_startdate date, in_enddate date,
@@ -78,7 +79,9 @@ CREATE OR REPLACE FUNCTION vendor_save (
curr,
startdate,
enddate,
- meta_number
+ meta_number,
+ discount_terms,
+ threshold
)
VALUES (
new_entity_id,
@@ -95,7 +98,9 @@ CREATE OR REPLACE FUNCTION vendor_save (
in_curr,
in_startdate,
in_enddate,
- in_vendornumber
+ in_vendornumber,
+ in_discount_terms,
+ in_threshold
);
INSERT INTO entity_bank_account (
entity_id,
@@ -127,7 +132,9 @@ CREATE OR REPLACE FUNCTION vendor_save (
curr = in_curr,
startdate = in_startdate,
enddate = in_enddate,
- meta_number = in_vendornumber
+ meta_number = in_vendornumber,
+ threshold = in_threshold,
+ discount_terms = in_discount_terms
where entity_id = v_row.entity_id;
UPDATE entity_bank_account SET
@@ -277,4 +284,4 @@ CREATE OR REPLACE FUNCTION vendor_next_vendor_id() returns int as $$
select nextval('company_id_seq');
-$$ language 'sql'; \ No newline at end of file
+$$ language 'sql';