X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_pay.cgi;h=38654e98d2bfde8cde7147e163cd3f062057bc5a;hp=c83f585d1a23b31d2b2520283316cfdd86956daa;hb=f91771606ce8a2bb4f2fa44e7bf54c9b7c945db6;hpb=fbcb45dfe5a1bce7981fe4527176b9fdf2ec54b7 diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index c83f585d1..38654e98d 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,13 +1,16 @@ <% -# +# use strict; -use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid ); +use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid $quickpay ); use Date::Format; use CGI; use CGI::Carp qw(fatalsToBrowser); +use FS::Conf; use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl); +use FS::CGI qw(header popurl ntable small_custview); + +my $conf = new FS::Conf; $cgi = new CGI; cgisuidsetup($cgi); @@ -18,6 +21,7 @@ if ( $cgi->param('error') ) { $paid = $cgi->param('paid'); $payby = $cgi->param('payby'); $payinfo = $cgi->param('payinfo'); + $quickpay = $cgi->param('quickpay'); } elsif ($cgi->keywords) { my($query) = $cgi->keywords; $query =~ /^(\d+)$/; @@ -26,56 +30,105 @@ if ( $cgi->param('error') ) { $paid = ''; $payby = 'BILL'; $payinfo = ""; + $quickpay = ''; } elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { $link = 'custnum'; $linknum = $1; $paid = ''; $payby = 'BILL'; $payinfo = ''; + $quickpay = $cgi->param('quickpay'); } else { die "illegal query ". $cgi->keywords; } $_date = time; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Enter payment", ''); +print header("Post payment", ''); print qq!Error: !, $cgi->param('error'), - "" + "

" if $cgi->param('error'); -print < + END +my $custnum; if ( $link eq 'invnum' ) { - print "Invoice #$linknum"; + + my $cust_bill = qsearchs('cust_bill', { 'invnum' => $linknum } ) + or die "unknown invnum $linknum"; + print "Invoice #$linknum". ntable("#cccccc",2). + 'Date'. + time2str("%D", $cust_bill->_date). ''. + 'Items'; + foreach ( $cust_bill->cust_bill_pkg ) { #false laziness with FS::cust_bill + if ( $_->pkgnum ) { + + my($cust_pkg)=qsearchs('cust_pkg', { 'pkgnum', $_->pkgnum } ); + my($part_pkg)=qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->pkgpart}); + my($pkg)=$part_pkg->pkg; + + if ( $_->setup != 0 ) { + print "$pkg Setup
"; # $money_char. sprintf("%10.2f",$_->setup); + print join('
', + map { " ". $_->[0]. ": ". $_->[1] } $cust_pkg->labels + ). '
'; + } + + if ( $_->recur != 0 ) { + print + "$pkg (" . time2str("%x",$_->sdate) . " - " . + time2str("%x",$_->edate) . ")
"; + #$money_char. sprintf("%10.2f",$_->recur) + print join('
', + map { '--->'. $_->[0]. ": ". $_->[1] } $cust_pkg->labels + ). '
'; + } + + } else { #pkgnum Tax + print "Tax
" # $money_char. sprintf("%10.2f",$_->setup) + if $_->setup != 0; + } + + } + print ''; + + $custnum = $cust_bill->custnum; + } elsif ( $link eq 'custnum' ) { - print "Customer #$linknum"; + $custnum = $linknum; } -print qq!
Date: !, time2str("%D",$_date), qq!!; +print small_custview($custnum, $conf->config('countrydefault')); + +print qq!!; +print qq!!; + +print '

Payment'. ntable("#cccccc", 2). + 'Date'. + time2str("%D",$_date). ''; -print qq!
Amount \$!; +print qq!Amount\$!; -print qq!
Payby: $payby!; +print qq!Payby$payby!; #payinfo (check # now as payby="BILL" hardcoded.. what to do later?) -print qq!
Check #!; +print qq!Check #!; + +print qq!Auto-apply
to invoices!; #paybatch print qq!!; print < +
-END - -print <