diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-10-03 22:22:16 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-10-03 22:22:16 +0000 |
commit | 78378acad3a0d9173c53ddafc13f764b4eccacc1 (patch) | |
tree | 42716b04699d2a601b6215ed79e9a5663d460644 /sql/modules/Payment.sql | |
parent | 6863c3158f8e0830de004568581e9bcaa11e300f (diff) |
Adding approved check to payment_get_all_contact_invoices. Adding test cases
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2349 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'sql/modules/Payment.sql')
-rw-r--r-- | sql/modules/Payment.sql | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/modules/Payment.sql b/sql/modules/Payment.sql index 8cf67901..34d506cc 100644 --- a/sql/modules/Payment.sql +++ b/sql/modules/Payment.sql @@ -221,7 +221,8 @@ BEGIN JOIN entity_credit_account c ON (e.id = c.entity_id) JOIN (SELECT ap.id, invnumber, transdate, amount, entity_id, paid, curr, 1 as invoice_class, - entity_credit_account, on_hold, v.batch_id + entity_credit_account, on_hold, v.batch_id, + approved FROM ap LEFT JOIN (select * from voucher where batch_class = 1) v ON (ap.id = v.trans_id) @@ -230,7 +231,8 @@ BEGIN UNION SELECT ar.id, invnumber, transdate, amount, entity_id, paid, curr, 2 as invoice_class, - entity_credit_account, on_hold, v.batch_id + entity_credit_account, on_hold, v.batch_id, + approved FROM ar LEFT JOIN (select * from voucher where batch_class = 2) v ON (ar.id = v.trans_id) @@ -251,6 +253,7 @@ BEGIN GROUP BY trans_id) p ON (a.id = p.trans_id) WHERE a.batch_id = in_batch_id OR (a.invoice_class = in_account_class + AND a.approved AND c.business_id = coalesce(in_business_id, c.business_id) AND ((a.transdate >= COALESCE(in_date_from, a.transdate) |