From 68399771603d9a2d084a9eaca480f17016801fe6 Mon Sep 17 00:00:00 2001 From: tetragon Date: Sun, 8 Oct 2006 20:47:38 +0000 Subject: First round of tax code replacement, adds cumulative tax support git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@195 4979c152-3d1c-0410-bac9-87ea11338e46 --- bin/mozilla/pos.pl | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'bin/mozilla/pos.pl') diff --git a/bin/mozilla/pos.pl b/bin/mozilla/pos.pl index f7f817ea..ef2fbd92 100755 --- a/bin/mozilla/pos.pl +++ b/bin/mozilla/pos.pl @@ -40,6 +40,7 @@ # #===================================================================== +use LedgerSMB::Tax; 1; # end @@ -376,19 +377,22 @@ 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, 0); - - $tax .= qq| - - $form->{"${_}_description"} - $form->{"${_}_total"} - -|; - } + my @taxes = Tax::init_taxes($form, $form->{taxaccounts}); + $form->{invtotal} += Tax::calculate_taxes(\@taxes, $form, + $form->{invsubtotal}, 0); + + foreach my $item (@taxes) { + my $taccno = $item->account; + + $form->{"${taccno}_total"} = $form->format_amount(\%myconfig, + $item->value, 2, 0); + + $tax .= qq| + + $form->{"${taccno}_description"} + $form->{"${taccno}_total"} + + | if $item->value; } $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0); -- cgit v1.2.3