3 % or ( $status eq 'I' and $curuser->access_right('Reprocess batches') )
4 % or ( $status eq 'R' and $curuser->access_right('Redownload resolved batches') )
7 <TR><FORM ACTION="<%$p%>misc/download-batch.cgi" METHOD="POST">
8 <INPUT TYPE="hidden" NAME="batchnum" VALUE="<%$batchnum%>">
10 <INPUT TYPE="hidden" NAME="format" VALUE="<%$fixed%>">
13 Download batch in format <SELECT NAME="format">
14 % foreach ( keys %download_formats ) {
15 <OPTION VALUE="<%$_%>"><% $download_formats{$_} %></OPTION>
19 <INPUT TYPE="submit" VALUE="Download"></FORM><BR><BR></TR>
23 % if ( $pay_batch->status eq 'I'
24 % or ( $pay_batch->status eq 'R'
25 % and $curuser->access_right('Reprocess batches')
26 % and $conf->exists('batch-manual_approval')
30 <% include('/elements/form-file_upload.html',
31 'name' => 'FileUpload',
32 'action' => "${p}misc/upload-batch.cgi",
34 'fields' => [ 'batchnum', 'format' ],
35 'message' => 'Batch results uploaded.',
37 Upload results<BR></TR>
39 <% include('/elements/file-upload.html',
41 'label' => 'Filename',
44 <INPUT TYPE="hidden" NAME="batchnum" VALUE="<% $batchnum %>">
47 % if ( $fixed eq 'td_eft1464' ) { # special case
48 <TR>Format <SELECT NAME="format">
49 <OPTION VALUE="td_eftack264">TD EFT Acknowledgement</OPTION>
50 <OPTION VALUE="td_eftret80">TD EFT Returned Items</OPTION>
54 <INPUT TYPE="hidden" NAME="format" VALUE="<% $fixed %>">
58 <TR>Format <SELECT NAME="format">
59 % foreach ( keys(%upload_formats) ) {
60 <OPTION VALUE="<%$_%>"><% $upload_formats{$_} %></OPTION>
63 <TR><INPUT TYPE="submit" VALUE="Upload"></TR>
68 % if ( $fixed eq 'td_eft1464'
70 % and $payby eq 'CHEK'
71 % and $conf->exists('batch-manual_approval')
73 <TR><INPUT TYPE="button" VALUE="Manually approve" onclick="
74 if ( confirm('Approve all remaining payments in this batch?') )
75 window.location.href='<%$p%>misc/process/pay_batch-approve.cgi?batchnum=<%$batchnum%>';
77 % } # end manual approval
81 Batch is <% $statustext{$status} %><BR>
82 <%$count%> payments batched<BR>
83 <%$money_char%><%$total%> total in batch<BR>
87 my $pay_batch = $opt{'pay_batch'} or return;
88 my $conf = new FS::Conf;
89 my $money_char = $conf->config('money_char') || '$';
90 my $payby = $pay_batch->payby;
91 my $status = $pay_batch->status;
92 my $curuser = $FS::CurrentUser::CurrentUser;
93 my $batchnum = $pay_batch->batchnum;
95 my $fixed = $conf->config("batch-fixed_format-$payby");
97 tie my %download_formats, 'Tie::IxHash', (
98 '' => 'Default batch mode',
99 'csv-td_canada_trust-merchant_pc_batch' =>
100 'CSV file for TD Canada Trust Merchant PC Batch',
101 'csv-chase_canada-E-xactBatch' =>
102 'CSV file for Chase Canada E-xactBatch',
103 'PAP' => '80 byte file for TD Canada Trust PAP Batch',
104 'BoM' => 'Bank of Montreal ECA batch',
105 'ach-spiritone' => 'Spiritone ACH batch',
106 'paymentech' => 'XML file for Chase Paymentech',
107 'RBC' => 'Royal Bank of Canada PDS batch',
108 'td_eft1464' => '1464 byte file for TD Commercial Banking EFT',
109 'eft_canada' => 'EFT Canada CSV batch',
110 # insert new batch formats here
113 tie my %upload_formats, 'Tie::IxHash', (
116 'td_eftack' => 'TD EFT Acknowledgement',
117 'td_eftret' => 'TD EFT Returned Items',
119 delete $upload_formats{'td_eft1464'};
120 $upload_formats{'PAP'} = '264 byte results for TD Canada Trust PAP Batch',
122 my %statustext = ( 'O' => 'open', 'I' => 'in transit', 'R' => 'resolved' );
124 my $count_query = "SELECT COUNT(*) FROM cust_pay_batch WHERE batchnum=$batchnum";
125 my $count = FS::Record->scalar_sql($count_query);
126 my $sum_query = "SELECT SUM(amount) FROM cust_pay_batch WHERE batchnum=$batchnum";
127 my $total = sprintf("%.2f", FS::Record->scalar_sql($sum_query));