- push @columns, qw(name spoolfile);
- my @column_index = $form->sort_columns(@columns);
- unshift @column_index, "checked";
-
- my %column_header;
- my %column_data;
-
- $column_header{checked} = "<th class=listheading> </th>";
- $column_header{transdate} =
- "<th><a class=listheading href=$href&sort=transdate>"
- . $locale->text('Date')
- . "</a></th>";
- $column_header{invnumber} =
- "<th><a class=listheading href=$href&sort=invnumber>"
- . $locale->text('Invoice')
- . "</a></th>";
- $column_header{ordnumber} =
- "<th><a class=listheading href=$href&sort=ordnumber>"
- . $locale->text('Order')
- . "</a></th>";
- $column_header{quonumber} =
- "<th><a class=listheading href=$href&sort=quonumber>"
- . $locale->text('Quotation')
- . "</a></th>";
- $column_header{name} =
- "<th><a class=listheading href=$href&sort=name>"
- . $locale->text($name)
- . "</a></th>";
- $column_header{spoolfile} =
- "<th class=listheading>" . $locale->text('Spoolfile') . "</th>";
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=bp.pl>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$option</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
-
- map { print "\n$column_header{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-
- # add sort and escape callback, this one we use for the add sub
- $form->{callback} = $callback .= "&sort=$form->{sort}";
-
- # escape callback for href
- $callback = $form->escape($callback);
-
- my $i = 0;
- my $j = 0;
- my $spoolfile;
-
- foreach my $ref (@{ $form->{SPOOL} }) {
-
- $i++;
-
- $form->{"checked_$i"} = "checked" if $form->{"checked_$i"};
-
- if ($ref->{invoice}) {
- $ref->{module} = ($ref->{module} eq 'ar') ? "is" : "ir";
- }
- my $module = "$ref->{module}.pl";
-
- $column_data{transdate} = "<td>$ref->{transdate} </td>";
-
- if ($spoolfile eq $ref->{spoolfile}) {
- $column_data{checked} = qq|<td></td>|;
- } else {
- $column_data{checked} =
- qq|<td><input name=checked_$i type=checkbox style=checkbox $form->{"checked_$i"} $form->{"checked_$i"}></td>|;
- }
-
- $column_data{invnumber} =
- "<td><a href=$module?action=edit&id=$ref->{id}&type=$form->{type}&callback=$callback>$ref->{invnumber}</a></td>";
- $column_data{ordnumber} =
- "<td><a href=$module?action=edit&id=$ref->{id}&type=$form->{type}&callback=$callback>$ref->{ordnumber}</a></td>";
- $column_data{quonumber} =
- "<td><a href=$module?action=edit&id=$ref->{id}&type=$form->{type}&callback=$callback>$ref->{quonumber}</a></td>";
- $column_data{name} = "<td>$ref->{name}</td>";
- $column_data{spoolfile} =
- qq|<td><a href=$main::spool/$ref->{spoolfile}>$ref->{spoolfile}</a></td>
-<input type=hidden name="spoolfile_$i" value=$ref->{spoolfile}>
-|;
-
- $spoolfile = $ref->{spoolfile};
-
- $j++;
- $j %= 2;
- print "
- <tr class=listrow$j>
-";
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-