1 <% include( 'elements/search.html',
2 'title' => 'Invoice Batches',
3 'name_singular' => 'batch',
4 'query' => { 'table' => 'bill_batch',
6 'extra_sql' => $extra_sql.
7 'ORDER BY batchnum DESC',
9 'count_query' => "$count_query $extra_sql",
10 'header' => [ 'Batch',
16 'fields' => [ 'batchnum',
18 my $st = "SELECT COUNT(*) from cust_bill_batch WHERE batchnum=" . shift->batchnum;
19 my $sth = dbh->prepare($st)
20 or die dbh->errstr. "doing $st";
22 or die "Error executing \"$st\": ". $sth->errstr;
23 $sth->fetchrow_arrayref->[0];
26 $statusmap{shift->status};
28 sub { shift->status eq 'O' ?
29 'Download and close' : 'Download'
42 sub { shift->status eq 'O' ? "b" : '' },
44 'really_disable_download' => 1,
51 unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
53 my %statusmap = ('O'=>'Open', 'R'=>'Closed');
55 my $count_query = 'SELECT COUNT(*) FROM bill_batch';
57 my $extra_sql = ''; # may add something here later
58 my $link = [ "${p}view/bill_batch.cgi?batchnum=", 'batchnum' ];
60 [ "${p}view/bill_batch.cgi?magic=print;".
61 (shift->status eq 'O' ? 'close=1;' : '').