summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-09 20:37:21 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-09 20:37:21 +0000
commit9717f09801fa4c963f338a97123b2fbbe9260f02 (patch)
treeba92c16e1f40e73f0900c60e58c32eca9c00e02f
parentd3f27376d7ec8e8c157021189787dd1dff302479 (diff)
All sales tax bugs fixed
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1045 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB/Tax.pm8
-rwxr-xr-xbin/arapprn.pl1
-rwxr-xr-xbin/ic.pl3
-rwxr-xr-xbin/io.pl5
-rwxr-xr-xbin/ir.pl3
-rwxr-xr-xbin/is.pl6
6 files changed, 13 insertions, 13 deletions
diff --git a/LedgerSMB/Tax.pm b/LedgerSMB/Tax.pm
index 6ff21459..1996f23c 100755
--- a/LedgerSMB/Tax.pm
+++ b/LedgerSMB/Tax.pm
@@ -38,15 +38,12 @@ sub init_taxes {
my @tmpaccounts = @accounts;
$#accounts = 0;
for my $acct (split / /, $taxaccounts2){
- if ($taxaccounts =~ /$acct/){
+ if ($taxaccounts =~ /\s$acct\s/){
push @accounts, $acct;
}
}
}
- if (! scalar @accounts){
- return @accounts;
- }
my $query = qq|SELECT t.taxnumber, c.description,
t.rate, t.chart_id, t.pass, m.taxmodulename
FROM tax t INNER JOIN chart c ON (t.chart_id = c.id)
@@ -55,6 +52,9 @@ sub init_taxes {
my $sth = $dbh->prepare($query);
foreach $taxaccount (@accounts) {
next if (! defined $taxaccount);
+ if (defined $taxaccounts2){
+ next if $taxaccount !~ /$taxaccounts2/;
+ }
$sth->execute($taxaccount) || $form->dberror($query);
my $ref = $sth->fetchrow_hashref;
diff --git a/bin/arapprn.pl b/bin/arapprn.pl
index 2b554980..b6bdda14 100755
--- a/bin/arapprn.pl
+++ b/bin/arapprn.pl
@@ -322,7 +322,6 @@ sub print_transaction {
$form->{subtotal} += $form->parse_amount(\%myconfig, $form->{"amount_$i"});
}
-
foreach $accno (split / /, $form->{taxaccounts}) {
if ($form->{"tax_$accno"}) {
$form->format_string("${accno}_description");
diff --git a/bin/ic.pl b/bin/ic.pl
index c1a5b27d..6e223a77 100755
--- a/bin/ic.pl
+++ b/bin/ic.pl
@@ -2982,7 +2982,8 @@ sub save {
$amount = $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) * $form->{"qty_$i"};
for (split / /, $form->{"taxaccounts_$i"}) { $form->{"${_}_base"} += $amount }
if (!$form->{taxincluded}) {
- my @taxlist= Tax::init_taxes($form, $form->{"taxaccounts_$i"});
+ my @taxlist= Tax::init_taxes($form, $form->{"taxaccounts_$i"},
+ $form->{taxaccounts});
$amount += Tax::calculate_taxes(\@taxlist, $form, $amount, 0);
}
diff --git a/bin/io.pl b/bin/io.pl
index 8dc422fc..54ae3b24 100755
--- a/bin/io.pl
+++ b/bin/io.pl
@@ -508,7 +508,8 @@ sub item_selected {
$amount = $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) * $form->{"qty_$i"};
for (split / /, $form->{"taxaccounts_$i"}) { $form->{"${_}_base"} += $amount }
if (!$form->{taxincluded}) {
- my @taxlist= Tax::init_taxes($form, $form->{"taxaccounts_$i"});
+ my @taxlist= Tax::init_taxes($form, $form->{"taxaccounts_$i"},
+ $form->{taxaccounts});
$amount += Tax::calculate_taxes(\@taxlist, $form, $amount, 0);
}
@@ -1222,7 +1223,6 @@ sub print {
sub print_form {
my ($old_form) = @_;
-
$inv = "inv";
$due = "due";
@@ -1370,7 +1370,6 @@ sub print_form {
} else {
IS->invoice_details(\%myconfig, \%$form);
}
-
if (exists $form->{longformat}) {
$form->{"${due}date"} = $duedate;
for ("${inv}date", "${due}date", "shippingdate", "transdate") { $form->{$_} = $locale->date(\%myconfig, $form->{$_}, $form->{longformat}) }
diff --git a/bin/ir.pl b/bin/ir.pl
index 01c194b1..425c7935 100755
--- a/bin/ir.pl
+++ b/bin/ir.pl
@@ -804,7 +804,8 @@ sub update {
for (split / /, $form->{taxaccounts}) { $form->{"${_}_base"} = 0 }
for (split / /, $form->{"taxaccounts_$i"}) { $form->{"${_}_base"} += $amount }
if (!$form->{taxincluded}) {
- my @taxes = Tax::init_taxes($form, $form->{"taxaccounts_$i"});
+ my @taxes = Tax::init_taxes($form, $form->{"taxaccounts_$i"},
+ $form->{"taxaccounts"});
$amount += (Tax::calculate_taxes(\@taxes, $form, $amount, 0));
}
diff --git a/bin/is.pl b/bin/is.pl
index fa1a6c19..60cadbb3 100755
--- a/bin/is.pl
+++ b/bin/is.pl
@@ -470,14 +470,13 @@ sub form_footer {
}
if (!$form->{taxincluded}) {
-
my @taxes = Tax::init_taxes($form, $form->{taxaccounts});
$form->{invtotal} += Tax::calculate_taxes(\@taxes, $form,
$form->{invsubtotal}, 0);
foreach $item (@taxes) {
my $taccno = $item->account;
$form->{"${taccno}_total"} = $form->format_amount(\%myconfig,
- $item->value, 2);
+ $form->{"${taccno}_rate"} * $form->{"${taccno}_base"}, 2);
$tax .= qq|
<tr>
<th align=right>$form->{"${taccno}_description"}</th>
@@ -818,7 +817,8 @@ sub update {
for (split / /, $form->{taxaccounts}) { $form->{"${_}_base"} = 0 }
for (split / /, $form->{"taxaccounts_$i"}) { $form->{"${_}_base"} += $amount }
if (!$form->{taxincluded}) {
- my @taxes = Tax::init_taxes($form, $form->{"taxaccounts_$i"});
+ my @taxes = Tax::init_taxes($form, $form->{"taxaccounts_$i"},
+ $form->{taxaccounts});
$amount += Tax::calculate_taxes(\@taxes, $form, $amount, 0);
}