# wird laufend bei jeder Position neu berechnet
$totals{marge_percent} = $totals{sellprice_total} ? ( ($totals{sellprice_total} - $totals{lastcost_total}) / $totals{sellprice_total} ) * 100 : 0;
- map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(marge_total marge_percent qty);
+ map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(marge_total marge_percent qty sellprice_total lastcost_total);
map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 3) } qw(weight);
- map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, $form->{"decimalplaces"} )} qw(lastcost sellprice sellprice_total lastcost_total);
+ map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, $form->{"decimalplaces"} )} qw(lastcost sellprice);
- my $row = { };
-
- foreach my $column (@columns) {
- $row->{$column} = {
- 'data' => $ar->{$column},
- 'align' => $column_alignment{$column},
- };
- }
-
- $row->{description}->{class} = 'listsortdescription';
-
- $row->{invnumber}->{link} = build_std_url("script=is.pl", 'action=edit')
- . "&id=" . E($ar->{id}) . "&callback=${callback}";
-
# Einzelzeilen nur zeigen wenn l_parts gesetzt ist, nützlich, wenn man nur
# Subtotals und Totals sehen möchte
- my $row_set = $form->{l_parts} ? [ $row ] : [ ];
+ if ($form->{l_parts}) {
+ my %row = (
+ map { ($_ => { data => $ar->{$_}, align => $column_alignment{$_} }) } @columns
+ );
+
+ $row{invnumber}->{link} = build_std_url("script=is.pl", 'action=edit') . "&id=" . E($ar->{id}) . "&callback=${callback}";
+
+ $report->add_data(\%row);
+ }
# hier wird bei l_subtotal nicht differenziert zwischen mainsort und subsort
# macht man l_subtotal_mainsort aus wird l_subtotal_subsort auch nicht ausgeführt