diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-09-12 23:14:13 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-09-12 23:14:13 +0000 |
commit | 8cf90bc4e677ea04ea73b718b64d59f83c2ec01c (patch) | |
tree | ef1edc0474e2a4b5c22447bbb5455a70d95fc4d7 /sql | |
parent | e6b2f50939b78d5f181070b3aedcd528f5393833 (diff) |
Adding control code and account description to multiple payment interface.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2322 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'sql')
-rw-r--r-- | sql/modules/Payment.sql | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/modules/Payment.sql b/sql/modules/Payment.sql index 19e8530d..24d1d730 100644 --- a/sql/modules/Payment.sql +++ b/sql/modules/Payment.sql @@ -169,6 +169,8 @@ Returns all open invoices for the entity in question. $$; CREATE TYPE payment_contact_invoice AS ( contact_id int, + econtrol_code text, + eca_description text, contact_name text, account_number text, total_due numeric, @@ -185,7 +187,9 @@ $$ DECLARE payment_item payment_contact_invoice; BEGIN FOR payment_item IN - SELECT c.id AS contact_id, e.name AS contact_name, + SELECT c.id AS contact_id, e.control_code as econtrol_code, + c.description as eca_description, + e.name AS contact_name, c.meta_number AS account_number, sum (coalesce(p.due, 0) - CASE WHEN c.discount_terms @@ -268,7 +272,8 @@ BEGIN WHERE accno = in_ar_ap_accno) )) - GROUP BY c.id, e.name, c.meta_number, c.threshold + GROUP BY c.id, e.name, c.meta_number, c.threshold, + e.control_code, c.description HAVING (in_meta_number IS NULL OR in_meta_number = c.meta_number) AND (sum(p.due) > c.threshold |