[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[6752] branches/1.3
- Subject: SF.net SVN: ledger-smb:[6752] branches/1.3
- From: ..hidden..
- Date: Wed, 5 Feb 2014 09:37:09 +0000
Revision: 6752
http://sourceforge.net/p/ledger-smb/code/6752
Author: einhverfr
Date: 2014-02-05 09:37:07 +0000 (Wed, 05 Feb 2014)
Log Message:
-----------
Correcting display of negative overpayments, bug 926
Modified Paths:
--------------
branches/1.3/Changelog
branches/1.3/sql/modules/Payment.sql
Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog 2014-02-05 09:35:40 UTC (rev 6751)
+++ branches/1.3/Changelog 2014-02-05 09:37:07 UTC (rev 6752)
@@ -10,6 +10,7 @@
* Fixed language change on order to invoice conversion (Chris T, 896)
* Fixed ar/ap tax check inconsistency (Chris T, 919)
* Fixed inputs ignored for email addresses sending statements (Chris T, 920)
+* Fixed negative overpayments showing as positive (Chris T, 926)
Changelog for 1.3.37
* 1.3-1.2 downgrade now drops extensions (Chris T, 943)
Modified: branches/1.3/sql/modules/Payment.sql
===================================================================
--- branches/1.3/sql/modules/Payment.sql 2014-02-05 09:35:40 UTC (rev 6751)
+++ branches/1.3/sql/modules/Payment.sql 2014-02-05 09:37:07 UTC (rev 6752)
@@ -510,7 +510,7 @@
RAISE EXCEPTION 'Approved Batch';
ELSIF t_batch.locked_by IS NOT NULL THEN
RAISE EXCEPTION 'Locked Batch';
- END;
+ END IF;
INSERT INTO voucher (batch_id, batch_class, trans_id)
values (in_batch_id,
(SELECT batch_class_id FROM batch WHERE id = in_batch_id),
@@ -1428,7 +1428,9 @@
CREATE VIEW overpayments AS
SELECT p.id as payment_id, p.reference as payment_reference, p.payment_class, p.closed as payment_closed,
p.payment_date, ac.chart_id, c.accno, c.description as chart_description,
- p.department_id, abs(sum(ac.amount)) as available, cmp.legal_name,
+ p.department_id,
+ sum(ac.amount) * CASE WHEN eca.entity_class = 1 THEN -1 ELSE 1 END
+ as available, cmp.legal_name,
eca.id as entity_credit_id, eca.entity_id, eca.discount, eca.meta_number
FROM payment p
JOIN payment_links pl ON (pl.payment_id=p.id)
@@ -1441,7 +1443,7 @@
AND c.link LIKE '%overpayment%'
GROUP BY p.id, c.accno, p.reference, p.payment_class, p.closed, p.payment_date,
ac.chart_id, chart_description, p.department_id, legal_name, eca.id,
- eca.entity_id, eca.discount, eca.meta_number;
+ eca.entity_id, eca.discount, eca.meta_number, eca.entity_class;
CREATE OR REPLACE FUNCTION payment_get_open_overpayment_entities(in_account_class int)
returns SETOF payment_vc_info AS
@@ -1520,12 +1522,11 @@
DECLARE out_overpayment payment_overpayments_available_amount;
BEGIN
FOR out_overpayment IN
- SELECT chart_id, accno, chart_description, abs(sum(available))
+ SELECT chart_id, accno, chart_description, available
FROM overpayments
WHERE payment_class = in_account_class
AND entity_credit_id = in_entity_credit_id
AND available <> 0
- GROUP BY chart_id, accno, chart_description
LOOP
RETURN NEXT out_overpayment;
END LOOP;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits