[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2476] trunk
- Subject: SF.net SVN: ledger-smb:[2476] trunk
- From: ..hidden..
- Date: Wed, 04 Mar 2009 23:08:13 +0000
Revision: 2476
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2476&view=rev
Author: einhverfr
Date: 2009-03-04 23:08:13 +0000 (Wed, 04 Mar 2009)
Log Message:
-----------
Correcting format-safety issues
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/Payment.pm
trunk/sql/modules/Reconciliaton.sql
trunk/sql/modules/test/data/Reconciliation.sql
Modified: trunk/LedgerSMB/DBObject/Payment.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Payment.pm 2009-03-04 22:02:17 UTC (rev 2475)
+++ trunk/LedgerSMB/DBObject/Payment.pm 2009-03-04 23:08:13 UTC (rev 2476)
@@ -516,7 +516,8 @@
? $self->{"net_$invoice_id"}
: $self->{"payment_$invoice_id"};
next if ! $pay_amount;
- $pay_amount = $pay_amount * 1;
+ $pay_amount = $self->parse_amount(amount => $pay_amount);
+ $pay_amount = $self->format_amount({amount => $pay_amount, format => '1000.00'});
my $invoice_subarray = "{$invoice_id,$pay_amount}";
if ($invoice_subarray !~ /^\{\d+\,\-?\d*\.?\d+\}$/){
$self->error("Invalid subarray: $invoice_subarray");
Modified: trunk/sql/modules/Reconciliaton.sql
===================================================================
--- trunk/sql/modules/Reconciliaton.sql 2009-03-04 22:02:17 UTC (rev 2475)
+++ trunk/sql/modules/Reconciliaton.sql 2009-03-04 23:08:13 UTC (rev 2476)
@@ -67,7 +67,12 @@
sum(ac.amount) END
FROM chart c
JOIN acc_trans ac ON (ac.chart_id = c.id)
- WHERE c.id = $1 AND ac.cleared is true
+ JOIN (select id from ar where approved
+ union
+ select id from ap where approved
+ union
+ select id from gl where approved) g on (g.id = ac.trans_id)
+ WHERE c.id = $1 AND ac.cleared is true and ac.approved is true
GROUP BY c.id, c.category;
$$ LANGUAGE sql;
Modified: trunk/sql/modules/test/data/Reconciliation.sql
===================================================================
--- trunk/sql/modules/test/data/Reconciliation.sql 2009-03-04 22:02:17 UTC (rev 2475)
+++ trunk/sql/modules/test/data/Reconciliation.sql 2009-03-04 23:08:13 UTC (rev 2476)
@@ -26,6 +26,8 @@
INSERT INTO gl (id, reference, transdate) values (-212, 'Cleared gl trans', '1000-01-03');
INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, source) values (-200, -200, '1000-01-01', -10, '1');
+INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, source, cleared, approved) values (-200, -200, '1000-01-01', -10, '1', true, false);
+INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, source, cleared, approved) values (-200, -201, '1000-01-01', 10, '1', true, false);
INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, source) values (-200, -201, '1000-01-01', 10, '1');
INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, source) values (-201, -200, '1000-01-03', -10, '1');
INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, source) values (-201, -201, '1000-01-03', 10, '1');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.