]> wagnertech.de Git - mfinanz.git/blobdiff - SL/DB/Helper/PriceTaxCalculator.pm
Nur dann steuern aufsummieren, wenn ein Steuerbetrag da ist und ein Steuerkonto ...
[mfinanz.git] / SL / DB / Helper / PriceTaxCalculator.pm
index 63dde450a618a5bcfad3b697b69d024f3760844a..a2d338122096140047433e417c8a5c5e5f9fc8e2 100644 (file)
@@ -109,8 +109,12 @@ sub _calculate_item {
     $tax_amount = $linetotal * $tax_rate;
   }
 
-  $data->{taxes}->{ $taxkey->tax->chart_id } ||= 0;
-  $data->{taxes}->{ $taxkey->tax->chart_id }  += $tax_amount;
+  if ($taxkey->tax->chart_id) {
+    $data->{taxes}->{ $taxkey->tax->chart_id } ||= 0;
+    $data->{taxes}->{ $taxkey->tax->chart_id }  += $tax_amount;
+  } elsif ($tax_amount) {
+    die "tax_amount != 0 but no chart_id for taxkey " . $taxkey->id . " tax " . $taxkey->tax->id;
+  }
 
   $self->netamount($self->netamount + $sellprice * $item->qty / $item->price_factor);