diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/Pg-database.sql | 1 | ||||
-rw-r--r-- | sql/modules/Voucher.sql | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql index b0b42f8f..e1d8251e 100644 --- a/sql/Pg-database.sql +++ b/sql/Pg-database.sql @@ -391,6 +391,7 @@ CREATE TABLE batch ( batch_class_id integer references batch_class(id) not null, control_code text, description text, + default_date date not null, approved_on date default null, approved_by int references entity_employee(entity_id), created_by int references entity_employee(entity_id), diff --git a/sql/modules/Voucher.sql b/sql/modules/Voucher.sql index f4a30595..6ae6a5e2 100644 --- a/sql/modules/Voucher.sql +++ b/sql/modules/Voucher.sql @@ -310,13 +310,16 @@ END; $$ LANGUAGE PLPGSQL; CREATE OR REPLACE FUNCTION batch_create( -in_batch_number text, in_description text, in_batch_class text) RETURNS int AS +in_batch_number text, in_description text, in_batch_class text, +in_batch_date date) +RETURNS int AS $$ BEGIN INSERT INTO - batch (batch_class_id, description, control_code, created_by) + batch (batch_class_id, default_date, description, control_code, + created_by) VALUES ((SELECT id FROM batch_class WHERE class = in_batch_class), - in_description, in_batch_number, + in_batch_date, in_description, in_batch_number, (select entity_id FROM users WHERE username = session_user)); return currval('batch_id_seq'); |