X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_pay.cgi;h=c0a679b03252c5079b5c7a9a4750ce1c4ea1f71d;hb=d1a885c65ac10e19bed0333a380dafeb42c2cef1;hp=a9506c8edb6e2f98aca2c2bbf7dc7bf39c9538f6;hpb=91387f8f489e561deaf1de052d80ef800a4970a3;p=freeside.git diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index a9506c8ed..c0a679b03 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,84 +1,126 @@ + <% -# -use strict; -use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid ); -use Date::Format; -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl); - -$cgi = new CGI; -cgisuidsetup($cgi); +my $conf = new FS::Conf; +my($link, $linknum, $paid, $payby, $payinfo, $quickpay, $_date); if ( $cgi->param('error') ) { - $link = $cgi->param('link'); - $linknum = $cgi->param('linknum'); - $paid = $cgi->param('paid'); - $payby = $cgi->param('payby'); - $payinfo = $cgi->param('payinfo'); + $link = $cgi->param('link'); + $linknum = $cgi->param('linknum'); + $paid = $cgi->param('paid'); + $payby = $cgi->param('payby'); + $payinfo = $cgi->param('payinfo'); + $quickpay = $cgi->param('quickpay'); + $_date = $cgi->param('_date') ? str2time($cgi->param('_date')) : time; } elsif ($cgi->keywords) { my($query) = $cgi->keywords; $query =~ /^(\d+)$/; - $link = 'invnum'; - $linknum = $1; - $paid = ''; - $payby = 'BILL'; - $payinfo = ""; + $link = 'invnum'; + $linknum = $1; + $paid = ''; + $payby = 'BILL'; + $payinfo = ""; + $quickpay = ''; + $_date = time; } elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { - $link = 'custnum'; - $linknum = $1; - $paid = ''; - $payby = 'BILL'; - $payinfo = ''; + $link = 'custnum'; + $linknum = $1; + $paid = ''; + $payby = 'BILL'; + $payinfo = ''; + $quickpay = $cgi->param('quickpay'); + $_date = time; } else { die "illegal query ". $cgi->keywords; } -$_date = time; -$p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Enter payment", ''); +my $paybatch = "webui-$_date-$$-". rand() * 2**32; -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); +my $title = 'Post payment'; +$title .= " against Invoice #$linknum" if $link eq 'invnum'; -print < - - -END +%> -if ( $link eq 'invnum' ) { - print "Invoice #$linknum"; -} elsif ( $link eq 'custnum' ) { - print "Customer #$linknum"; -} +<%= header($title, '') %> + +<% if ( $cgi->param('error') ) { %> +Error: <%= $cgi->param('error') %> +

+<% } %> -print qq!
Date: !, time2str("%D",$_date), qq!!; +<%= ntable("#cccccc",2) %> -print qq!
Amount \$!; + + + + -print qq!
Payby: $payby!; +
+ + + -#payinfo (check # now as payby="BILL" hardcoded.. what to do later?) -print qq!
Check #!; +<% +my $money_char = $conf->config('money_char') || '$'; +my $custnum; +if ( $link eq 'invnum' ) { + my $cust_bill = qsearchs('cust_bill', { 'invnum' => $linknum } ) + or die "unknown invnum $linknum"; + $custnum = $cust_bill->custnum; +} elsif ( $link eq 'custnum' ) { + $custnum = $linknum; +} +%> -#paybatch -print qq!!; +<%= small_custview($custnum, $conf->config('countrydefault')) %> + + + +

+Payment +<%= ntable("#cccccc", 2) %> + + Date + + "> + + + + + + Amount + <%= $money_char %> + + + + Check # + + + + +<% if ( $link eq 'custnum' ) { %> + Auto-apply
to invoices + +<% } elsif ( $link eq 'invnum' ) { %> + Apply to + Invoice #<%= $linknum %> only + +<% } %> + + + + + -print <
-END - -print < -END - -%>