[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3214] trunk/bin/oe.pl



Revision: 3214
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3214&view=rev
Author:   einhverfr
Date:     2011-06-11 01:12:45 +0000 (Sat, 11 Jun 2011)

Log Message:
-----------
Correcting bug 2796818

Modified Paths:
--------------
    trunk/bin/oe.pl

Modified: trunk/bin/oe.pl
===================================================================
--- trunk/bin/oe.pl	2011-06-11 01:03:57 UTC (rev 3213)
+++ trunk/bin/oe.pl	2011-06-11 01:12:45 UTC (rev 3214)
@@ -653,6 +653,7 @@
 }
 
 sub form_footer {
+    _calc_taxes();
 
     $form->{invtotal} = $form->{invsubtotal};
 
@@ -683,22 +684,18 @@
     }
 
     if ( !$form->{taxincluded} ) {
-
-        my @taxes = Tax::init_taxes( $form, $form->{taxaccounts} );
-        foreach my $item (@taxes) {
-            my $taccno = $item->account;
-	    $form->{invtotal} += $form->round_amount( 
-                $form->{"${taccno}_rate"} * $form->{"${taccno}_base"}, 2);
+        foreach $item (keys %{$form->{taxes}}) {
+            my $taccno = $item;
+	    $form->{invtotal} += $form->round_amount($form->{taxes}{$item}, 2);
             $form->{"${taccno}_total"} =
-              $form->format_amount( \%myconfig,
-                $form->{"${taccno}_rate"} * $form->{"${taccno}_base"}, 2 );
-
+                  $form->format_amount( \%myconfig,
+                    $form->round_amount( $form->{taxes}{$item}, 2 ), 2 );
+            next if !$form->{"${taccno}_total"};
             $tax .= qq|
-	      <tr>
-		<th align=right>$form->{"${taccno}_description"}</th>
-		<td align=right>$form->{"${taccno}_total"}</td>
-	      </tr>
-	      | if $form->{"${taccno}_base"};
+        <tr>
+      	<th align="right">$form->{"${taccno}_description"}</th>
+      	<td align="right">$form->{"${taccno}_total"}</td>
+        </tr>|;
         }
 
         $form->{invsubtotal} =
@@ -706,13 +703,12 @@
 
         $subtotal = qq|
 	      <tr>
-		<th align=right>| . $locale->text('Subtotal') . qq|</th>
-		<td align=right>$form->{invsubtotal}</td>
+		<th align="right">| . $locale->text('Subtotal') . qq|</th>
+		<td align="right">$form->{invsubtotal}</td>
 	      </tr>
 |;
 
     }
-
     $form->{oldinvtotal} = $form->{invtotal};
     $form->{invtotal} =
       $form->format_amount( \%myconfig, $form->{invtotal}, 2, 0 );


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.