diff options
-rwxr-xr-x | LedgerSMB/Tax.pm | 8 | ||||
-rwxr-xr-x | bin/arapprn.pl | 1 | ||||
-rwxr-xr-x | bin/ic.pl | 3 | ||||
-rwxr-xr-x | bin/io.pl | 5 | ||||
-rwxr-xr-x | bin/ir.pl | 3 | ||||
-rwxr-xr-x | bin/is.pl | 6 |
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"); @@ -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); } @@ -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}) } @@ -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)); } @@ -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); } |