- $employee = $locale->text('Employee');
- $name = $locale->text('Customer');
- }
-
- $column_header{id} =
- qq|<th><a class=listheading href=$href&sort=id>|
- . $locale->text('ID')
- . qq|</a></th>|;
- $column_header{transdate} =
- qq|<th><a class=listheading href=$href&sort=transdate>|
- . $locale->text('Date')
- . qq|</a></th>|;
- $column_header{reqdate} =
- qq|<th><a class=listheading href=$href&sort=reqdate>|
- . $locale->text('Required by')
- . qq|</a></th>|;
- $column_header{ordnumber} =
- qq|<th><a class=listheading href=$href&sort=ordnumber>|
- . $locale->text('Order')
- . qq|</a></th>|;
- $column_header{quonumber} =
- qq|<th><a class=listheading href=$href&sort=quonumber>|
- . ($form->{"type"} eq "request_quotation" ?
- $locale->text('RFQ') :
- $locale->text('Quotation'))
- . qq|</a></th>|;
- $column_header{name} =
- qq|<th><a class=listheading href=$href&sort=name>$name</a></th>|;
- $column_header{netamount} =
- qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
- $column_header{tax} =
- qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
- $column_header{amount} =
- qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
- $column_header{curr} =
- qq|<th class=listheading>| . $locale->text('Curr') . qq|</th>|;
- $column_header{shipvia} =
- qq|<th><a class=listheading href=$href&sort=shipvia>|
- . $locale->text('Ship via')
- . qq|</a></th>|;
- $column_header{globalprojectnumber} =
- qq|<th class="listheading">| . $locale->text('Project Number') . qq|</th>|;
- $column_header{open} =
- qq|<th class=listheading>| . $locale->text('O') . qq|</th>|;
- $column_header{closed} =
- qq|<th class=listheading>| . $locale->text('C') . qq|</th>|;
- $column_header{"delivered"} =
- qq|<th class="listheading">| . $locale->text("Delivered") . qq|</th>|;
-
- $column_header{employee} =
- qq|<th><a class=listheading href=$href&sort=employee>$employee</a></th>|;
- $column_header{transaction_description} =
- qq|<th><a class=listheading href="$href&sort=transaction_description">|
- . $locale->text("Transaction description") . qq|</a></th>|;
-
- $column_header{ids} = qq|<th></th>|;
-
- if ($form->{ $form->{vc} }) {
- $option = $locale->text(ucfirst $form->{vc});
- $option .= " : $form->{$form->{vc}}";
+ }
+
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
+
+ my @hidden_variables = map { "l_${_}" } @columns;
+ push @hidden_variables, "l_subtotal", $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered ordnumber quonumber
+ transaction_description transdatefrom transdateto type vc employee_id);
+
+ my $href = build_std_url('action=orders', grep { $form->{$_} } @hidden_variables);
+
+ my %column_defs = (
+ 'ids' => { 'text' => '', },
+ 'transdate' => { 'text' => $locale->text('Date'), },
+ 'reqdate' => { 'text' => $locale->text('Required by'), },
+ 'id' => { 'text' => $locale->text('ID'), },
+ 'ordnumber' => { 'text' => $locale->text('Order'), },
+ 'quonumber' => { 'text' => $form->{type} eq "request_quotation" ? $locale->text('RFQ') : $locale->text('Quotation'), },
+ 'name' => { 'text' => $form->{vc} eq 'customer' ? $locale->text('Customer') : $locale->text('Vendor'), },
+ 'netamount' => { 'text' => $locale->text('Amount'), },
+ 'tax' => { 'text' => $locale->text('Tax'), },
+ 'amount' => { 'text' => $locale->text('Total'), },
+ 'curr' => { 'text' => $locale->text('Curr'), },
+ 'employee' => { 'text' => $locale->text('Salesperson'), },
+ 'shipvia' => { 'text' => $locale->text('Ship via'), },
+ 'globalprojectnumber' => { 'text' => $locale->text('Project Number'), },
+ 'transaction_description' => { 'text' => $locale->text('Transaction description'), },
+ 'open' => { 'text' => $locale->text('Open'), },
+ 'delivered' => { 'text' => $locale->text('Delivered'), },
+ 'marge_total' => { 'text' => $locale->text('Ertrag'), },
+ 'marge_percent' => { 'text' => $locale->text('Ertrag prozentual'), }
+ );
+
+ foreach my $name (qw(id transdate reqdate quonumber ordnumber name employee shipvia)) {
+ $column_defs{$name}->{link} = $href . "&sort=$name";
+ }
+
+ my %column_alignment = map { $_ => 'right' } qw(netamount tax amount curr);
+
+ $form->{"l_type"} = "Y";
+ map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns;
+ $column_defs{ids}->{visible} = $allow_multiple_orders ? 'HTML' : 0;
+
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
+
+ $report->set_export_options('orders', @hidden_variables);
+
+ $report->set_sort_indicator($form->{sort}, 1);
+
+ my @options;
+ if ($form->{customer}) {
+ push @options, $locale->text('Customer') . " : $form->{customer}";
+ }
+ if ($form->{vendor}) {
+ push @options, $locale->text('Vendor') . " : $form->{vendor}";