summaryrefslogtreecommitdiff
path: root/LedgerSMB/Tax.pm
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-11-24 04:53:18 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-11-24 04:53:18 +0000
commitfe5bc02eaaa596afadada71754afa84edd8910c8 (patch)
treee59061a32165567960b11dfb6cfa7d41536db3d3 /LedgerSMB/Tax.pm
parent5475344a9df26261a23098d52fff5b21084d8627 (diff)
Bug 875350 solved. Please review.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1895 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/Tax.pm')
-rwxr-xr-xLedgerSMB/Tax.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/LedgerSMB/Tax.pm b/LedgerSMB/Tax.pm
index 01bff4d4..9de046bf 100755
--- a/LedgerSMB/Tax.pm
+++ b/LedgerSMB/Tax.pm
@@ -34,6 +34,7 @@ sub init_taxes {
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 @@ sub init_taxes {
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'};