+
+my $download_id = int(rand(1000000));
+
+sub download_link {
+ my $batch = shift;
+ my $batchnum = $batch->batchnum;
+ my $close = ($batch->status eq 'O' ? ';close=1' : '');
+ my $html = qq!<FORM NAME="Download$batchnum" STYLE="display:inline">
+ <INPUT TYPE="hidden" NAME="batchnum" VALUE="$batchnum">
+ <INPUT TYPE="hidden" NAME="close" VALUE="1">
+ !;
+ $html .= include('/elements/progress-init.html',
+ "Download$batchnum",
+ [ 'batchnum', 'close' ],
+ $p.'misc/process/bill_batch-print.html',
+ { url => $p."search/bill_batch.cgi?download=$batchnum" },
+ "batch$batchnum" #key
+ );
+ $html .= '<A href="#" onclick="batch'.$batchnum.'process();">' .
+ ($batch->status eq 'O' ? '<B>Download and close</B>' : 'Download');
+ $html .= '</A></FORM>';
+ return $html;
+}
+