1 <% include('/search/elements/search.html',
3 "Batch $batchnum closed." :
4 "Invoice Batch $batchnum",
5 'menubar' => ['All batches' => $p.'search/bill_batch.cgi'],
7 'query' => { 'table' => 'cust_bill_batch',
10 FS::UI::Web::cust_sql_fields(),
11 'cust_main.custnum AS cust_main_custnum',
15 'LEFT JOIN cust_bill USING ( invnum ) '.
16 'LEFT JOIN cust_main USING ( custnum )',
17 'extra_sql' => " WHERE batchnum = $batchnum",
19 'count_query' => "SELECT COUNT(*) FROM cust_bill_batch WHERE batchnum = $batchnum",
20 'html_init' => $html_init,
21 'header' => [ 'Invoice #',
26 'fields' => [ sub { shift->cust_bill->display_invnum },
27 sub { sprintf($money_char.'%.2f',
28 shift->cust_bill->charged ) },
29 sub { time2str('%b %d %Y',
30 shift->cust_bill->_date ) },
31 sub { shift->cust_bill->cust_main->name },
34 'links' => [ ($link) x 3, $clink,
36 'really_disable_download' => 1,
41 unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
43 my $conf = new FS::Conf;
45 my $batchnum = $cgi->param('batchnum');
47 $batch = FS::bill_batch->by_key($batchnum);
48 die "Batch '$batchnum' not found!\n" if !$batch;
50 my $close = $cgi->param('close');
51 $batch->close if $close;
53 my $html_init = qq!<FORM NAME="OneTrueForm">
54 <INPUT TYPE="hidden" NAME="batchnum" VALUE="$batchnum">! .
55 include('/elements/progress-init.html',
58 $p.'misc/process/bill_batch-print.html',
59 { url => $p.'misc/download-bill_batch.html?'.$batchnum }
61 '<A HREF="#" onclick="process();">Download this batch</A></FORM><BR>';
62 if ( $batch->status eq 'O' ) {
63 $cgi->param('close' => 1);
64 $html_init .= '<A HREF="'.$cgi->self_url.'">Close this batch</A><BR>';
68 my $link = [ "$p/view/cust_bill.cgi?", 'invnum' ];
69 my $clink = [ "$p/view/cust_main.cgi?", 'custnum' ];
70 my $money_char = $conf->config('money_char') || '$';