diff options
Diffstat (limited to 'bin/mozilla/is.pl')
-rwxr-xr-x | bin/mozilla/is.pl | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 5696dd11..c93c2337 100755 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -46,6 +46,7 @@ use LedgerSMB::IS; use LedgerSMB::PE; +use LedgerSMB::Tax; require "$form->{path}/arap.pl"; require "$form->{path}/io.pl"; @@ -470,19 +471,19 @@ sub form_footer { if (!$form->{taxincluded}) { - for (split / /, $form->{taxaccounts}) { - if ($form->{"${_}_base"}) { - $form->{"${_}_total"} = $form->round_amount($form->{"${_}_base"} * $form->{"${_}_rate"}, 2); - $form->{invtotal} += $form->{"${_}_total"}; - $form->{"${_}_total"} = $form->format_amount(\%myconfig, $form->{"${_}_total"}, 2); - - $tax .= qq| - <tr> - <th align=right>$form->{"${_}_description"}</th> - <td align=right>$form->{"${_}_total"}</td> - </tr> -|; - } + 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); + $tax .= qq| + <tr> + <th align=right>$form->{"${taccno}_description"}</th> + <td align=right>$form->{"${taccno}_total"}</td> + </tr> + | if $item->value; } $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0); @@ -813,7 +814,8 @@ sub update { for (split / /, $form->{taxaccounts}) { $form->{"${_}_base"} = 0 } for (split / /, $form->{"taxaccounts_$i"}) { $form->{"${_}_base"} += $amount } if (!$form->{taxincluded}) { - for (split / /, $form->{"taxaccounts_$i"}) { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } + my @taxes = Tax::init_taxes($form, $form->{"taxaccounts_$i"}); + $amount += Tax::calculate_taxes(\@taxes, $form, $amount, 0); } $form->{creditremaining} -= $amount; |