[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3334] trunk
- Subject: SF.net SVN: ledger-smb:[3334] trunk
- From: ..hidden..
- Date: Sat, 25 Jun 2011 15:51:55 +0000
Revision: 3334
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3334&view=rev
Author: einhverfr
Date: 2011-06-25 15:51:54 +0000 (Sat, 25 Jun 2011)
Log Message:
-----------
Tax report data now shows properly.
Modified Paths:
--------------
trunk/LedgerSMB/RP.pm
trunk/UI/rp-search-generate_tax_report.html
Modified: trunk/LedgerSMB/RP.pm
===================================================================
--- trunk/LedgerSMB/RP.pm 2011-06-25 15:10:51 UTC (rev 3333)
+++ trunk/LedgerSMB/RP.pm 2011-06-25 15:51:54 UTC (rev 3334)
@@ -1947,13 +1947,15 @@
SELECT gl.transdate, gl.id, gl.invnumber, e.name, e.id as entity_id,
eca.id as credit_id, eca.meta_number, gl.netamount,
- sum(ac.amount) as tax, gl.netamount + sum(ac.amount) as total
+ sum(CASE WHEN a.id IS NOT NULL then ac.amount ELSE 0 END) as tax,
+ gl.invoice, gl.netamount
+ + sum(CASE WHEN a.id IS NOT NULL then ac.amount ELSE 0 END) as total
FROM (select id, transdate, amount, netamount, entity_credit_account,
- invnumber
+ invnumber, invoice
from ar where ? = 2
UNION
select id, transdate, amount, netamount, entity_credit_account,
- invnumber
+ invnumber, invoice
from ap where ? = 1) gl
JOIN entity_credit_account eca ON eca.id = gl.entity_credit_account
JOIN entity e ON eca.entity_id = e.id
@@ -1967,9 +1969,11 @@
AND (gl.transdate >= ? or ? is null)
AND (gl.transdate <= ? or ? is null)
GROUP BY gl.transdate, gl.id, gl.invnumber, e.name, e.id, eca.id,
- eca.meta_number, gl.amount, gl.netamount
- HAVING (sum(ac.amount) <> 0 AND ? IS NOT NULL)
- OR (? IS NULL and sum(ac.amount) = 0)|;
+ eca.meta_number, gl.amount, gl.netamount, gl.invoice
+ HAVING (sum(CASE WHEN a.id is not null then ac.amount else 0 end)
+ <> 0 AND ? IS NOT NULL)
+ OR (? IS NULL and sum(CASE WHEN a.id is not null then ac.amount
+ ELSE 0 END) = 0)|;
my $sth = $dbh->prepare($query);
$sth->execute($account_class, $account_class,
Modified: trunk/UI/rp-search-generate_tax_report.html
===================================================================
--- trunk/UI/rp-search-generate_tax_report.html 2011-06-25 15:10:51 UTC (rev 3333)
+++ trunk/UI/rp-search-generate_tax_report.html 2011-06-25 15:51:54 UTC (rev 3334)
@@ -156,7 +156,7 @@
checked => 'checked',
} -?>
</td><td><?lsmb text('Amount') ?></td>
-<?lsmb IF form.report.matches('^tax_') ?>
+<?lsmb IF form.report.match('^tax_') ?>
<td>
<?lsmb PROCESS input element_data={
name => 'l_tax',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.