summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xhttemplate/edit/cust_bill_pay.cgi2
-rwxr-xr-xhttemplate/edit/cust_credit.cgi4
-rwxr-xr-xhttemplate/edit/cust_credit_bill.cgi8
-rw-r--r--httemplate/misc/download-batch.cgi44
4 files changed, 39 insertions, 19 deletions
diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi
index 90292eb..498d477 100755
--- a/httemplate/edit/cust_bill_pay.cgi
+++ b/httemplate/edit/cust_bill_pay.cgi
@@ -36,7 +36,6 @@ function changed(what) {
<BR>Invoice #<SELECT NAME="invnum" SIZE=1 onChange="changed(this)">
<OPTION VALUE="">
-% foreach my $cust_bill ( @cust_bill ) {
% foreach my $cust_bill ( @cust_bill ) {
<OPTION<% $cust_bill->invnum eq $invnum ? ' SELECTED' : '' %> VALUE="<% $cust_bill->invnum %>"><% $cust_bill->invnum %> - <% time2str("%D", $cust_bill->_date) %> - $<% $cust_bill->owed %>
@@ -84,4 +83,3 @@ my @cust_bill = sort { $a->_date <=> $b->_date
qsearch('cust_bill', { 'custnum' => $cust_pay->custnum } );
</%init>
-
diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi
index 803798e..13d062c 100755
--- a/httemplate/edit/cust_credit.cgi
+++ b/httemplate/edit/cust_credit.cgi
@@ -25,9 +25,6 @@ Credit
<TD ALIGN="right">Amount</TD>
<TD BGCOLOR="#ffffff">$<INPUT TYPE="text" NAME="amount" VALUE="<% $amount %>" SIZE=8 MAXLENGTH=8></TD>
</TR>
-%
-%#print qq! <INPUT TYPE="checkbox" NAME="refund" VALUE="$refund">Also post refund!;
-%
%
%#print qq! <INPUT TYPE="checkbox" NAME="refund" VALUE="$refund">Also post refund!;
@@ -81,4 +78,3 @@ my $otaker = getotaker;
my $p1 = popurl(1);
</%init>
-
diff --git a/httemplate/edit/cust_credit_bill.cgi b/httemplate/edit/cust_credit_bill.cgi
index 26c1126..249ba31 100755
--- a/httemplate/edit/cust_credit_bill.cgi
+++ b/httemplate/edit/cust_credit_bill.cgi
@@ -21,12 +21,6 @@ Credit #<B><% $crednum %></B>
<SCRIPT>
function changed(what) {
cust_bill = what.options[what.selectedIndex].value;
-% foreach my $cust_bill ( @cust_bill ) {
-% my $invnum = $cust_bill->invnum;
-% my $changeto = $cust_bill->owed < $cust_credit->credited
-% ? $cust_bill->owed
-% : $cust_credit->credited;
-%
% foreach my $cust_bill ( @cust_bill ) {
@@ -44,7 +38,6 @@ function changed(what) {
<BR>Invoice #<SELECT NAME="invnum" SIZE=1 onChange="changed(this)">
<OPTION VALUE="">
-% foreach my $cust_bill ( @cust_bill ) {
% foreach my $cust_bill ( @cust_bill ) {
<OPTION<% $cust_bill->invnum eq $invnum ? ' SELECTED' : '' %> VALUE="<% $cust_bill->invnum %>"><% $cust_bill->invnum %> - <% time2str("%D",$cust_bill->_date) %> - $<% $cust_bill->owed %>
@@ -97,4 +90,3 @@ my @cust_bill = sort { $a->_date <=> $b->_date
qsearch('cust_bill', { 'custnum' => $cust_credit->custnum } );
</%init>
-
diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi
index ad88092..038aa20 100644
--- a/httemplate/misc/download-batch.cgi
+++ b/httemplate/misc/download-batch.cgi
@@ -1,9 +1,17 @@
%
+%
%my $conf=new FS::Conf;
%
%#http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes
%http_header('Content-Type' => 'text/plain' );
%
+%my $batchnum;
+%if ( $cgi->param('batchnum') =~ /^(\d+)$/ ) {
+% $batchnum = $1;
+%} else {
+% die "No batch number (bad URL) \n";
+%}
+%
%my $format;
%if ( $cgi->param('format') =~ /^([\w\- ]+)$/ ) {
% $format = $1;
@@ -15,11 +23,12 @@
%local $FS::UID::AutoCommit = 0;
%my $dbh = dbh;
%
-%my $pay_batch = qsearchs('pay_batch', {'status'=>''} );
+%my $pay_batch = qsearchs('pay_batch', {'batchnum'=>$batchnum, 'status'=>'O'} );
%die "No pending batch. \n" unless $pay_batch;
%
%my %batchhash = $pay_batch->hash;
%$batchhash{'status'} = 'I';
+%$batchhash{'download'} = time unless $batchhash{'download'};
%my $new = new FS::pay_batch \%batchhash;
%my $error = $new->replace($pay_batch);
%die "error updating batch status: $error\n" if $error;
@@ -27,8 +36,10 @@
%my $batchtotal=0;
%my $batchcount=0;
%
-%my (@date)=localtime();
-%my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7]);
+%my (@date)=localtime($new->download);
+%my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7] + 1);
+%my $cdate = sprintf("%02d", $date[3]).sprintf("%02d", $date[4] + 1).
+% sprintf("%02d", $date[5] % 100);
%
%if ($format eq "BoM") {
%
@@ -40,6 +51,16 @@
%>
%
%
+%}elsif ($format eq "PAP"){
+%
+% my($origid,$datacenter,$typecode,$shortname,$longname,$mybank,$myacct) =
+% $conf->config("batchconfig-$format");
+%
+<% sprintf( "H%10sD%3s%06u%-15s%09u%-12s%04u%19s\n",$origid,$typecode,$cdate,$shortname,$mybank,$myacct,$pay_batch->batchnum,"")
+
+ %>
+%
+%
%}elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){
%# 1;
%}else{
@@ -63,7 +84,14 @@
%
% my( $account, $aba ) = split( '@', $cust_pay_batch->payinfo );
%
-<% sprintf( "D%010u%09u%-12s%-29s%-19s\n",$cust_pay_batch->amount*100,$aba,$account,$cust_pay_batch->payname,$cust_pay_batch->invnum %>
+<% sprintf( "D%010.0f%09u%-12s%-29s%-19s\n",$cust_pay_batch->amount*100,$aba,$account,$cust_pay_batch->payname,$cust_pay_batch->paybatchnum) %>
+%
+%
+% } elsif ($format eq "PAP"){
+%
+% my( $account, $aba ) = split( '@', $cust_pay_batch->payinfo );
+%
+<% sprintf( "D%-23s%06u%-19s%09u%-12s%010.0f\n",$cust_pay_batch->payname,$cdate,$cust_pay_batch->paybatchnum,$aba,$account,$cust_pay_batch->amount*100) %>
%
%
% } elsif ($format eq "csv-td_canada_trust-merchant_pc_batch") {
@@ -81,10 +109,16 @@
%if ($format eq "BoM") {
%
%
-<% sprintf( "YD%08u%014u%56s\n",$batchcount,$batchtotal*100,"" ).
+<% sprintf( "YD%08u%014.0f%56s\n",$batchcount,$batchtotal*100,"" ).
sprintf( "Z%014u%05u%014u%05u%41s\n",$batchtotal*100,$batchcount,"0","0","" ) %>
%
%
+%} elsif ($format eq "PAP"){
+%
+%
+<% sprintf( "T%08u%014.0f%57s\n",$batchcount,$batchtotal*100,"" ) %>
+%
+%
%} elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){
% #1;
%} else {