[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1895] branches/1.2/LedgerSMB/Tax.pm



Revision: 1895
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1895&view=rev
Author:   einhverfr
Date:     2007-11-23 20:53:18 -0800 (Fri, 23 Nov 2007)

Log Message:
-----------
Bug 875350 solved.  Please review.

Modified Paths:
--------------
    branches/1.2/LedgerSMB/Tax.pm

Modified: branches/1.2/LedgerSMB/Tax.pm
===================================================================
--- branches/1.2/LedgerSMB/Tax.pm	2007-11-23 03:23:17 UTC (rev 1894)
+++ branches/1.2/LedgerSMB/Tax.pm	2007-11-24 04:53:18 UTC (rev 1895)
@@ -34,6 +34,7 @@
     my $dbh = $form->{dbh};
     @taxes = ();
     my @accounts = split / /, $taxaccounts;
+    my $transdate = $form->{transdate} || 'now()';
     if ( defined $taxaccounts2 ) {
         my @tmpaccounts = @accounts;
         $#accounts = -1;
@@ -48,14 +49,15 @@
 			t.rate, t.chart_id, t.pass, m.taxmodulename
 			FROM tax t INNER JOIN chart c ON (t.chart_id = c.id)
 			INNER JOIN taxmodule m ON (t.taxmodule_id = m.taxmodule_id)
-			WHERE c.accno = ?|;
+			WHERE c.accno = ? AND coalesce(validto, 'now()') >= ? 
+			ORDER BY coalesce(validto, now()) DESC|;
     my $sth = $dbh->prepare($query);
     foreach $taxaccount (@accounts) {
         next if ( !defined $taxaccount );
         if ( defined $taxaccounts2 ) {
             next if $taxaccounts2 !~ /\b$taxaccount\b/;
         }
-        $sth->execute($taxaccount) || $form->dberror($query);
+        $sth->execute($taxaccount, $transdate) || $form->dberror($query);
         my $ref = $sth->fetchrow_hashref;
 
         my $module = $ref->{'taxmodulename'};


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.