1 <% $pay_batch->export_batch(%opt) %><%init>
3 #http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes
4 http_header('Content-Type' => 'text/plain' ); # not necessarily correct...
8 if ( $cgi->param('batchnum') =~ /^(\d+)$/ ) {
11 die "No batch number (bad URL) \n";
15 if ( $cgi->param('gatewaynum') =~ /^(\d+)$/ ) {
16 my $gateway = FS::payment_gateway->by_key($1);
17 die "gatewaynum $1 not found" unless $gateway;
18 $opt{'gateway'} = $gateway;
20 elsif ( $cgi->param('format') =~ /^([\w\- ]+)$/ ) {
24 my $credit_transactions = "EXISTS (SELECT 1 FROM cust_pay_batch WHERE batchnum = $batchnum AND paycode = 'C') AS arecredits";
25 my $pay_batch = qsearchs({ 'select' => "*, $credit_transactions",
26 'table' => 'pay_batch',
27 'hashref' => { batchnum => $batchnum },
29 die "Batch not found: '$batchnum'" if !$pay_batch;