+ push @options, $period;
+
+ $form->{print_date} = $locale->text('Create Date') . " " . $locale->date(\%myconfig, $form->current_date(\%myconfig), 0);
+ push (@options, $form->{print_date});
+
+ $form->{company} = $locale->text('Company') . " " . $myconfig{company};
+ push (@options, $form->{company});
+
+ my @columns = qw(transdate reference description gegenkonto debit credit ustkonto ustrate balance);
+ my %column_defs = (
+ 'transdate' => { 'text' => $locale->text('Date'), },
+ 'reference' => { 'text' => $locale->text('Reference'), },
+ 'description' => { 'text' => $locale->text('Description'), },
+ 'debit' => { 'text' => $locale->text('Debit'), },
+ 'credit' => { 'text' => $locale->text('Credit'), },
+ 'gegenkonto' => { 'text' => $locale->text('Gegenkonto'), },
+ 'ustkonto' => { 'text' => $locale->text('USt-Konto'), },
+ 'balance' => { 'text' => $locale->text('Balance'), },
+ 'ustrate' => { 'text' => $locale->text('Satz %'), },
+ );
+
+ my @hidden_variables = qw(accno fromdate todate description accounttype l_heading subtotal department projectnumber project_id sort);
+
+ my $link = build_std_url('action=list_transactions', grep { $form->{$_} } @hidden_variables);
+
+ $form->{callback} = $link . '&sort=' . E($form->{sort});
+
+ my %column_alignment = map { $_ => 'right' } qw(debit credit);
+
+ my @custom_headers = ();
+ # Zeile 1:
+ push @custom_headers, [
+ { 'text' => 'Letzte Buchung', },
+ { 'text' => 'EB-Wert', },
+ { 'text' => 'Saldo alt', 'colspan' => 2, },
+ { 'text' => 'Jahresverkehrszahlen alt', 'colspan' => 2, },
+ { 'text' => '', 'colspan' => 2, },
+ ];
+ push @custom_headers, [
+ { 'text' => $form->{last_transaction}, },
+ { 'text' => $eb_string, },
+ { 'text' => $saldo_old, 'colspan' => 2, },
+ { 'text' => $form->format_amount(\%myconfig, abs($form->{old_balance_debit}), 2) . " S", },
+ { 'text' => $form->format_amount(\%myconfig, $form->{old_balance_credit}, 2) . " H", },
+ { 'text' => '', 'colspan' => 2, },
+ ];
+ # Zeile 2:
+ push @custom_headers, [
+ { 'text' => $locale->text('Date'), 'link' => $link . "&sort=transdate", },
+ { 'text' => $locale->text('Reference'), 'link' => $link . "&sort=reference", },
+ { 'text' => $locale->text('Description'), 'link' => $link . "&sort=description", },
+ { 'text' => $locale->text('Gegenkonto'), },
+ { 'text' => $locale->text('Debit'), },
+ { 'text' => $locale->text('Credit'), },
+ { 'text' => $locale->text('USt-Konto'), },
+ { 'text' => $locale->text('Satz %'), },
+ { 'text' => $locale->text('Balance'), },
+ ];
+
+
+
+
+
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
+ $report->set_custom_headers(@custom_headers);
+
+ $report->set_options('top_info_text' => join("\n", @options),
+ 'output_format' => 'HTML',
+ 'title' => $form->{title},
+ 'attachment_basename' => $locale->text('list_of_transactions') . strftime('_%Y%m%d', localtime time),
+ 'std_column_visibility' => 1,
+ );
+ $report->set_options_from_form();
+
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
+
+ $report->set_export_options('list_transactions', @hidden_variables);
+
+ $report->set_sort_indicator($form->{sort}, 1);
+
+ $column_defs{balance}->{visible} = 1;
+
+ my $ml = ($form->{category} =~ /(A|E)/) ? -1 : 1;
+
+
+ my $idx = 0;
+ my %totals = ( 'debit' => 0, 'credit' => 0 );
+ my %subtotals = ( 'debit' => 0, 'credit' => 0 );
+ my ($previous_index, $row_set);
+
+ foreach my $ca (@{ $form->{CA} }) {
+
+ foreach (qw(debit credit)) {
+ $subtotals{$_} += $ca->{$_};
+ $totals{$_} += $ca->{$_};
+ if ($_ =~ /debit.*/) {
+ $ml = -1;
+ } else {
+ $ml = 1;
+ }
+ $form->{balance}= $form->{balance} + $ca->{$_} * $ml;
+ $ca->{$_} = $form->format_amount(\%myconfig, $ca->{$_}, 2) if ($ca->{$_} != 0);
+ }