-%>
-<%= include( 'elements/search.html',
- 'title' => 'Invoice Search Results',
- 'name' => 'invoices',
- 'query' => $sql_query,
- 'count_query' => $count_query,
- 'count_addl' => [ '$%.2f total invoiced',
- '$%.2f total outstanding balance',
- ],
- 'redirect' => $link,
- 'header' =>
- [ 'Invoice #', qw(Balance Amount Date), 'Contact name',
- 'Company' ],
- 'fields' => [
- 'invnum',
- sub { sprintf('$%.2f', shift->get('owed') ) },
- sub { sprintf('$%.2f', shift->charged ) },
- sub { time2str('%b %d %Y', shift->_date ) },
- sub { my $cust_main = shift->cust_main;
- $cust_main
- ? $cust_main->get('last'). ', '. $cust_main->first
- : "WARNING: can't find cust_main.custnum ".
- shift->custnum. ' (cust_bill.invnum '.
- shift->invnum. ')';
- },
- sub { my $cust_main = shift->cust_main;
- $cust_main ? $cust_main->company : '';
- },
- ],
- 'links' => [
- $link,
- $link,
- $link,
- $link,
- $clink,
- $clink,
- ],
-
- )
+ my $conf = new FS::Conf;
+ my $money_char = $conf->config('money_char') || '$';
+
+ my $html_init = join("\n", map {
+ ( my $action = $_ ) =~ s/_$//;
+ include('/elements/progress-init.html',
+ $_.'form',
+ [ 'begin', 'end', 'agentnum', 'open', 'days', 'newest_percust' ],
+ "../misc/${_}invoices.cgi",
+ { 'message' => "Invoices re-${action}ed" }, #would be nice to show the number of them, but...
+ $_, #key
+ ),
+ qq!<FORM NAME="${_}form">!,
+ qq!<INPUT TYPE="hidden" NAME="begin" VALUE="$begin">!,
+ qq!<INPUT TYPE="hidden" NAME="end" VALUE="$end">!,
+ qq!<INPUT TYPE="hidden" NAME="agentnum" VALUE="$agentnum">!,
+ qq!<INPUT TYPE="hidden" NAME="open" VALUE="$open">!,
+ qq!<INPUT TYPE="hidden" NAME="days" VALUE="$days">!,
+ qq!</FORM>!
+ } qw( print_ email_ fax_ ) );
+
+ my $menubar = [
+ 'Main menu' => $p,
+ 'Print these invoices' =>
+ "javascript:print_process()",
+ 'Email these invoices' =>
+ "javascript:email_process()",
+ ];
+
+ push @$menubar, 'Fax these invoices' =>
+ "javascript:fax_process()"
+ if $conf->exists('hylafax');
+
+%><%= include( 'elements/search.html',
+ 'title' => 'Invoice Search Results',
+ 'html_init' => $html_init,
+ 'menubar' => $menubar,
+ 'name' => 'invoices',
+ 'query' => $sql_query,
+ 'count_query' => $count_query,
+ 'count_addl' => $count_addl,
+ 'redirect' => $link,
+ 'header' => [ 'Invoice #',
+ 'Balance',
+ 'Amount',
+ 'Date',
+ FS::UI::Web::cust_header(),
+ ],
+ 'fields' => [
+ 'invnum',
+ sub { sprintf($money_char.'%.2f', shift->get('owed') ) },
+ sub { sprintf($money_char.'%.2f', shift->charged ) },
+ sub { time2str('%b %d %Y', shift->_date ) },
+ \&FS::UI::Web::cust_fields,
+ ],
+ 'align' => 'rrrrll',
+ 'links' => [
+ $link,
+ $link,
+ $link,
+ $link,
+ ( map { $clink } FS::UI::Web::cust_header() ),
+ ],
+
+ )