]> wagnertech.de Git - kivitendo-erp.git/blobdiff - bin/mozilla/ar.pl
Vermeiden, dass versucht wird, durch 0 zu teilen.
[kivitendo-erp.git] / bin / mozilla / ar.pl
index 161dde9a01803165409f124cc9ae591895cd5ae2..11a12e440dbc75f9a594d3ab07fc406c323bbe53 100644 (file)
@@ -1532,8 +1532,8 @@ sub ar_transactions {
     map { $subtotals{$_} += $ar->{$_};
           $totals{$_}    += $ar->{$_} } @subtotal_columns;
 
-    $subtotals{marge_percent} = $subtotals{marge_total} / $subtotals{netamount} * 100;
-    $totals{marge_percent} = $totals{marge_total} / $totals{netamount} * 100;
+    $subtotals{marge_percent} = $subtotals{netamount} ? ($subtotals{marge_total} * 100 / $subtotals{netamount}) : 0;
+    $totals{marge_percent}    = $totals{netamount}    ? ($totals{marge_total}    * 100 / $totals{netamount}   ) : 0;
 
     map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(netamount tax amount paid due marge_total marge_percent);