diff options
Diffstat (limited to 'sql/modules/chart.sql')
-rw-r--r-- | sql/modules/chart.sql | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/sql/modules/chart.sql b/sql/modules/chart.sql index 53460766..2e136371 100644 --- a/sql/modules/chart.sql +++ b/sql/modules/chart.sql @@ -20,9 +20,9 @@ DECLARE resultrow record; link_string text; BEGIN IF in_account_class = 1 THEN - link_string := '%AR_paid%'; - ELSE link_string := '%AP_paid%'; + ELSE + link_string := '%AR_paid%'; END IF; FOR resultrow IN @@ -58,3 +58,27 @@ $$ LANGUAGE PLPGSQL; COMMENT ON FUNCTION chart_get_ar_ap(in_account_class int) IS $$ This function returns the cash account acording with in_account_class which must be 1 or 2 $$; + +CREATE OR REPLACE FUNCTION chart_list_overpayment(in_account_class int) +RETURNS SETOF chart AS +$$ +DECLARE resultrow record; + link_string text; +BEGIN + IF in_account_class = 1 THEN + link_string := '%AP_overpayment%'; + ELSE + link_string := '%AR_overpayment%'; + END IF; + + FOR resultrow IN + SELECT * FROM chart + WHERE link LIKE link_string + ORDER BY accno + LOOP + return next resultrow; + END LOOP; +END; +$$ language plpgsql; +COMMENT ON FUNCTION chart_list_cash(in_account_class int) IS +$$ This function returns the overpayment accounts acording with in_account_class which must be 1 or 2 $$; |