diff options
-rw-r--r-- | UI/payments/payments_detail.html | 5 | ||||
-rw-r--r-- | sql/modules/Payment.sql | 9 |
2 files changed, 10 insertions, 4 deletions
diff --git a/UI/payments/payments_detail.html b/UI/payments/payments_detail.html index 6fabf8ca..b63b696a 100644 --- a/UI/payments/payments_detail.html +++ b/UI/payments/payments_detail.html @@ -162,7 +162,7 @@ </div> <table id="payments_table"> <tr class="listheading"> - <th class="account_number"><?lsmb text('Account_number') ?></th> + <th class="account"><?lsmb text('Account') ?></th> <th class="entity_name"><?lsmb text('Name') ?></th> <th class="invoice"><?lsmb text('Invoice Total') ?></th> <th class="payment"><?lsmb text('Payment') ?></th> @@ -191,7 +191,8 @@ checked = (r.unselected) ? undef : "checked" } ?> - <?lsmb r.account_number ?> + <?lsmb r.econtrol_code ?> -- + <?lsmb r.account_number ?> -- <?lsmb r.eca_description ?> </td> <td class="entity_name"><span class="<?lsmb IF r.has_vouchers; 'name_has_vouchers' ; 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 |