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>
20 <INPUT TYPE="submit" VALUE="Download"></FORM><BR><BR></TR>
24 % if ( $pay_batch->status eq 'I'
25 % or ( $pay_batch->status eq 'R'
26 % and $curuser->access_right('Reprocess batches')
27 % and $conf->exists('batch-manual_approval')
31 <% include('/elements/form-file_upload.html',
32 'name' => 'FileUpload',
33 'action' => "${p}misc/upload-batch.cgi",
35 'fields' => [ 'batchnum', 'format', 'gatewaynum' ],
36 'url' => $cgi->self_url,
37 'message' => 'Batch results uploaded.',
39 Upload results<BR></TR>
41 <% include('/elements/file-upload.html',
43 'label' => 'Filename',
46 <INPUT TYPE="hidden" NAME="batchnum" VALUE="<% $batchnum %>">
49 % if ( $fixed eq 'td_eft1464' ) { # special case
50 <TR>Upload in format <SELECT NAME="format">
51 <OPTION VALUE="td_eftack264">TD EFT Acknowledgement</OPTION>
52 <OPTION VALUE="td_eftret80">TD EFT Returned Items</OPTION>
56 <INPUT TYPE="hidden" NAME="format" VALUE="<% $fixed %>">
60 <TR>Upload in format <SELECT NAME="format">
61 % foreach ( keys(%upload_formats) ) {
62 <OPTION VALUE="<%$_%>"><% $upload_formats{$_} %></OPTION>
67 <TR><INPUT TYPE="submit" VALUE="Upload"></TR>
72 % if ( $fixed eq 'td_eft1464'
74 % and $payby eq 'CHEK'
75 % and $conf->exists('batch-manual_approval')
77 <TR><INPUT TYPE="button" VALUE="Manually approve" onclick="
78 if ( confirm('Approve all remaining payments in this batch?') )
79 window.location.href='<%$p%>misc/process/pay_batch-approve.cgi?batchnum=<%$batchnum%>';
81 % } # end manual approval
85 Batch is <% $statustext{$status} %><BR>
86 <%$count%> payments batched<BR>
87 <%$money_char%><%$total%> total in batch<BR>
89 <%def .select_gateway>
90 % if ( $show_gateways ) {
92 <& /elements/select-table.html,
94 field => 'gatewaynum',
95 table => 'payment_gateway',
97 value_col => 'gatewaynum',
98 order_by => 'ORDER BY gatewaynum',
100 'gateway_namespace' => 'Business::BatchPayment',
107 my $show_gateways = FS::payment_gateway->count("gateway_namespace = 'Business::BatchPayment' AND disabled IS NULL");
111 my $pay_batch = $opt{'pay_batch'} or return;
112 my $conf = new FS::Conf;
113 my $money_char = $conf->config('money_char') || '$';
114 my $payby = $pay_batch->payby;
115 my $status = $pay_batch->status;
116 my $curuser = $FS::CurrentUser::CurrentUser;
117 my $batchnum = $pay_batch->batchnum;
119 my $fixed = $conf->config("batch-fixed_format-$payby");
121 tie my %download_formats, 'Tie::IxHash', (
122 '' => 'Default batch mode',
123 'NACHA' => '94 byte NACHA',
124 'csv-td_canada_trust-merchant_pc_batch' =>
125 'CSV file for TD Canada Trust Merchant PC Batch',
126 'csv-chase_canada-E-xactBatch' =>
127 'CSV file for Chase Canada E-xactBatch',
128 'PAP' => '80 byte file for TD Canada Trust PAP Batch',
129 'BoM' => 'Bank of Montreal ECA batch',
130 'ach-spiritone' => 'Spiritone ACH batch',
131 'paymentech' => 'XML file for Chase Paymentech',
132 'RBC' => 'Royal Bank of Canada PDS batch',
133 'td_eft1464' => '1464 byte file for TD Commercial Banking EFT',
134 'eft_canada' => 'EFT Canada CSV batch',
135 # insert new batch formats here
138 tie my %upload_formats, 'Tie::IxHash', (
141 'td_eftack' => 'TD EFT Acknowledgement',
142 'td_eftret' => 'TD EFT Returned Items',
144 delete $upload_formats{'td_eft1464'};
145 $upload_formats{'PAP'} = '264 byte results for TD Canada Trust PAP Batch',
147 my %statustext = ( 'O' => 'open', 'I' => 'in transit', 'R' => 'resolved' );
149 my $count_query = "SELECT COUNT(*) FROM cust_pay_batch WHERE batchnum=$batchnum";
150 my $count = FS::Record->scalar_sql($count_query);
151 my $sum_query = "SELECT SUM(amount) FROM cust_pay_batch WHERE batchnum=$batchnum";
152 my $total = sprintf("%.2f", FS::Record->scalar_sql($sum_query));