]> wagnertech.de Git - mfinanz.git/blobdiff - bin/mozilla/ar.pl
...und das gemoddete Templating
[mfinanz.git] / bin / mozilla / ar.pl
index 305b6aaade5245bac75ae6ea1e70ad5abea8ea1e..11a12e440dbc75f9a594d3ab07fc406c323bbe53 100644 (file)
@@ -1518,7 +1518,7 @@ sub ar_transactions {
   # escape callback for href
   $callback = $form->escape($href);
 
-  my @subtotal_columns = qw(netamount amount paid due marge_total);
+  my @subtotal_columns = qw(netamount amount paid due marge_total marge_percent);
 
   my %totals    = map { $_ => 0 } @subtotal_columns;
   my %subtotals = map { $_ => 0 } @subtotal_columns;
@@ -1532,6 +1532,9 @@ sub ar_transactions {
     map { $subtotals{$_} += $ar->{$_};
           $totals{$_}    += $ar->{$_} } @subtotal_columns;
 
+    $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);
 
     my $is_storno  = $ar->{storno} && !$ar->{storno_id};