[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2603] trunk/sql/modules/Payment.sql
- Subject: SF.net SVN: ledger-smb:[2603] trunk/sql/modules/Payment.sql
- From: ..hidden..
- Date: Wed, 20 May 2009 04:20:14 +0000
Revision: 2603
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2603&view=rev
Author: einhverfr
Date: 2009-05-20 04:20:14 +0000 (Wed, 20 May 2009)
Log Message:
-----------
Corrected bug where payment reversals are taken into account on payment selection (multiple payment interface only) before approved
Modified Paths:
--------------
trunk/sql/modules/Payment.sql
Modified: trunk/sql/modules/Payment.sql
===================================================================
--- trunk/sql/modules/Payment.sql 2009-05-14 16:36:46 UTC (rev 2602)
+++ trunk/sql/modules/Payment.sql 2009-05-20 04:20:14 UTC (rev 2603)
@@ -320,16 +320,18 @@
ORDER BY transdate
) a ON (a.entity_credit_account = c.id)
JOIN transactions t ON (a.id = t.id)
- JOIN (SELECT trans_id,
+ JOIN (SELECT acc_trans.trans_id,
sum(CASE WHEN in_account_class = 1 THEN amount
WHEN in_account_class = 2
THEN amount * -1
END) AS due
FROM acc_trans
JOIN chart ON (chart.id = acc_trans.chart_id)
+ LEFT JOIN voucher v ON (acc_trans.voucher_id = v.id)
WHERE ((chart.link = 'AP' AND in_account_class = 1)
OR (chart.link = 'AR' AND in_account_class = 2))
- GROUP BY trans_id) p ON (a.id = p.trans_id)
+ AND (approved IS TRUE or v.batch_class = 3)
+ GROUP BY acc_trans.trans_id) p ON (a.id = p.trans_id)
LEFT JOIN "session" s ON (s."session_id" = t.locked_by)
LEFT JOIN users u ON (u.id = s.users_id)
WHERE (a.batch_id = in_batch_id
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.