Merge von 788 aus unstable: Bugfix 260
[kivitendo-erp.git] / SL / AR.pm
index e3e3631..76cea55 100644 (file)
--- a/SL/AR.pm
+++ b/SL/AR.pm
@@ -84,7 +84,8 @@ sub post_transaction {
   $form->{amount} = $form->{netamount};
 
   $form->{tax} = 0;
-
+  $form->{netamount} = 0;
+  $form->{total_tax} = 0;
   # taxincluded doesn't make sense if there is no amount
 
   $form->{taxincluded} = 0 if ($form->{amount} == 0);
@@ -113,8 +114,8 @@ sub post_transaction {
         $form->{netamount} += $form->{"amount_$i"};
       } else {
         $form->{"tax_$i"} = $form->{"amount_$i"} * $form->{"taxrate_$i"};
-        $form->{"tax_$i"} =
-          $form->round_amount($form->{"tax_$i"} * $form->{exchangerate}, 2);
+        $form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"} * $form->{exchangerate}, 2);
+        $form->{netamount} += $form->{"amount_$i"};
       }
     }
     $form->{total_tax} += $form->{"tax_$i"};