+ @columns =
+ qw(transdate id type invnumber ordnumber name netamount tax amount paid
+ datepaid due duedate transaction_description notes salesman employee shippingpoint shipvia
+ marge_total marge_percent globalprojectnumber customernumber country ustid taxzone payment_terms charts);
+
+ my @hidden_variables = map { "l_${_}" } @columns;
+ push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber transaction_description notes project_id transdatefrom transdateto);
+
+ $href = build_std_url('action=ar_transactions', grep { $form->{$_} } @hidden_variables);
+
+ my %column_defs = (
+ 'transdate' => { 'text' => $locale->text('Date'), },
+ 'id' => { 'text' => $locale->text('ID'), },
+ 'type' => { 'text' => $locale->text('Type'), },
+ 'invnumber' => { 'text' => $locale->text('Invoice'), },
+ 'ordnumber' => { 'text' => $locale->text('Order'), },
+ 'name' => { 'text' => $locale->text('Customer'), },
+ 'netamount' => { 'text' => $locale->text('Amount'), },
+ 'tax' => { 'text' => $locale->text('Tax'), },
+ 'amount' => { 'text' => $locale->text('Total'), },
+ 'paid' => { 'text' => $locale->text('Paid'), },
+ 'datepaid' => { 'text' => $locale->text('Date Paid'), },
+ 'due' => { 'text' => $locale->text('Amount Due'), },
+ 'duedate' => { 'text' => $locale->text('Due Date'), },
+ 'transaction_description' => { 'text' => $locale->text('Transaction description'), },
+ 'notes' => { 'text' => $locale->text('Notes'), },
+ 'salesman' => { 'text' => $locale->text('Salesperson'), },
+ 'employee' => { 'text' => $locale->text('Employee'), },
+ 'shippingpoint' => { 'text' => $locale->text('Shipping Point'), },
+ 'shipvia' => { 'text' => $locale->text('Ship via'), },
+ 'globalprojectnumber' => { 'text' => $locale->text('Project Number'), },
+ 'marge_total' => { 'text' => $locale->text('Ertrag'), },
+ 'marge_percent' => { 'text' => $locale->text('Ertrag prozentual'), },
+ 'customernumber' => { 'text' => $locale->text('Customer Number'), },
+ 'country' => { 'text' => $locale->text('Country'), },
+ 'ustid' => { 'text' => $locale->text('USt-IdNr.'), },
+ 'taxzone' => { 'text' => $locale->text('Steuersatz'), },
+ 'payment_terms' => { 'text' => $locale->text('Payment Terms'), },
+ 'charts' => { 'text' => $locale->text('Buchungskonto'), },
+ );
+
+ foreach my $name (qw(id transdate duedate invnumber ordnumber name datepaid employee shippingpoint shipvia transaction_description)) {
+ my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir};
+ $column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir";
+ }
+
+ my %column_alignment = map { $_ => 'right' } qw(netamount tax amount paid due);
+
+ $form->{"l_type"} = "Y";
+ map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns;
+
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
+
+ $report->set_export_options('ar_transactions', @hidden_variables, qw(sort sortdir));
+
+ $report->set_sort_indicator($form->{sort}, $form->{sortdir});
+
+ my @options;