From b85dd91eabe25cd1bb56248b0e11cfd21a36adfa Mon Sep 17 00:00:00 2001 From: einhverfr Date: Mon, 17 Sep 2007 17:24:00 +0000 Subject: Adding project list stored procedure git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1622 4979c152-3d1c-0410-bac9-87ea11338e46 --- sql/modules/Payment.sql | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sql/modules/Payment.sql b/sql/modules/Payment.sql index 8f7f052c..61a68940 100644 --- a/sql/modules/Payment.sql +++ b/sql/modules/Payment.sql @@ -228,3 +228,24 @@ approved: False, for a voucher. This function posts the payment or saves the payment voucher. $$; + + +-- Move this to the projects module when we start on that. CT +CREATE OR REPLACE FUNCTION project_list_open(in_date date) +RETURNS SETOF project AS +$$ +DECLARE out_project project%ROWTYPE; +BEGIN + FOR out_project IN + SELECT * from project + WHERE startdate <= in_date AND enddate >= in_date + AND completed = 0 + LOOP + return next out_project; + END LOOP; +END; +$$ language plpgsql; + +comment on function project_list_open(in_date date) is +$$ This function returns all projects that were open as on the date provided as +the argument.$$; -- cgit v1.2.3