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 'message' => 'Batch results uploaded.',
38 Upload results<BR></TR>
40 <% include('/elements/file-upload.html',
42 'label' => 'Filename',
45 <INPUT TYPE="hidden" NAME="batchnum" VALUE="<% $batchnum %>">
48 % if ( $fixed eq 'td_eft1464' ) { # special case
49 <TR>Upload in format <SELECT NAME="format">
50 <OPTION VALUE="td_eftack264">TD EFT Acknowledgement</OPTION>
51 <OPTION VALUE="td_eftret80">TD EFT Returned Items</OPTION>
55 <INPUT TYPE="hidden" NAME="format" VALUE="<% $fixed %>">
59 <TR>Upload in format <SELECT NAME="format">
60 % foreach ( keys(%upload_formats) ) {
61 <OPTION VALUE="<%$_%>"><% $upload_formats{$_} %></OPTION>
66 <TR><INPUT TYPE="submit" VALUE="Upload"></TR>
71 % if ( $fixed eq 'td_eft1464'
73 % and $payby eq 'CHEK'
74 % and $conf->exists('batch-manual_approval')
76 <TR><INPUT TYPE="button" VALUE="Manually approve" onclick="
77 if ( confirm('Approve all remaining payments in this batch?') )
78 window.location.href='<%$p%>misc/process/pay_batch-approve.cgi?batchnum=<%$batchnum%>';
80 % } # end manual approval
84 Batch is <% $statustext{$status} %><BR>
85 <%$count%> payments batched<BR>
86 <%$money_char%><%$total%> total in batch<BR>
88 <%def .select_gateway>
89 % if ( $show_gateways ) {
91 <& /elements/select-table.html,
93 field => 'gatewaynum',
94 table => 'payment_gateway',
96 value_col => 'gatewaynum',
97 order_by => 'ORDER BY gatewaynum',
99 'gateway_namespace' => 'Business::BatchPayment',
106 my $show_gateways = FS::payment_gateway->count("gateway_namespace = 'Business::BatchPayment'");
110 my $pay_batch = $opt{'pay_batch'} or return;
111 my $conf = new FS::Conf;
112 my $money_char = $conf->config('money_char') || '$';
113 my $payby = $pay_batch->payby;
114 my $status = $pay_batch->status;
115 my $curuser = $FS::CurrentUser::CurrentUser;
116 my $batchnum = $pay_batch->batchnum;
118 my $fixed = $conf->config("batch-fixed_format-$payby");
120 tie my %download_formats, 'Tie::IxHash', (
121 '' => 'Default batch mode',
122 'csv-td_canada_trust-merchant_pc_batch' =>
123 'CSV file for TD Canada Trust Merchant PC Batch',
124 'csv-chase_canada-E-xactBatch' =>
125 'CSV file for Chase Canada E-xactBatch',
126 'PAP' => '80 byte file for TD Canada Trust PAP Batch',
127 'BoM' => 'Bank of Montreal ECA batch',
128 'ach-spiritone' => 'Spiritone ACH batch',
129 'paymentech' => 'XML file for Chase Paymentech',
130 'RBC' => 'Royal Bank of Canada PDS batch',
131 'td_eft1464' => '1464 byte file for TD Commercial Banking EFT',
132 'eft_canada' => 'EFT Canada CSV batch',
133 # insert new batch formats here
136 tie my %upload_formats, 'Tie::IxHash', (
139 'td_eftack' => 'TD EFT Acknowledgement',
140 'td_eftret' => 'TD EFT Returned Items',
142 delete $upload_formats{'td_eft1464'};
143 $upload_formats{'PAP'} = '264 byte results for TD Canada Trust PAP Batch',
145 my %statustext = ( 'O' => 'open', 'I' => 'in transit', 'R' => 'resolved' );
147 my $count_query = "SELECT COUNT(*) FROM cust_pay_batch WHERE batchnum=$batchnum";
148 my $count = FS::Record->scalar_sql($count_query);
149 my $sum_query = "SELECT SUM(amount) FROM cust_pay_batch WHERE batchnum=$batchnum";
150 my $total = sprintf("%.2f", FS::Record->scalar_sql($sum_query));