X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_pay.cgi;h=c0a679b03252c5079b5c7a9a4750ce1c4ea1f71d;hb=673b9a458d9138523026963df6fa3b4683e09bae;hp=dfef3c54292b86c32ea47ed6ad65dee73189f728;hpb=c6b853b4f0516450b3e27acd281f667eadaec9f4;p=freeside.git diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index dfef3c542..c0a679b03 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,177 +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::Conf; -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl ntable); my $conf = new FS::Conf; -my $countrydefault = $conf->config('countrydefault') || 'US'; - -$cgi = new CGI; -cgisuidsetup($cgi); - +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 header("Enter payment", ''); +my $paybatch = "webui-$_date-$$-". rand() * 2**32; + +my $title = 'Post payment'; +$title .= " against Invoice #$linknum" if $link eq 'invnum'; + +%> + +<%= header($title, '') %> -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); +<% if ( $cgi->param('error') ) { %> +Error: <%= $cgi->param('error') %> +

+<% } %> -print < - - -END +<%= ntable("#cccccc",2) %> + + + + + +
+ + + + +<% +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"; - 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' ) { $custnum = $linknum; } +%> -print "

Customer #$custnum". ntable('#e8e8e8'); -my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) - or die "unknown custnum $custnum"; - -print ''. ntable("#cccccc",2). - 'Billing'. - $cust_main->getfield('last'). ', '. $cust_main->first. '
'; -print $cust_main->company. '
' if $cust_main->company; -print $cust_main->address1. '
'; -print $cust_main->address2. '
' if $cust_main->address2; -print $cust_main->city. ', '. $cust_main->state. ' '. $cust_main->zip. '
'; -print $cust_main->country. '
' if $cust_main->country - && $cust_main->country ne $countrydefault; - -print ''. - ''; - -if ( defined $cust_main->dbdef_table->column('ship_last') ) { - - my $pre = $cust_main->ship_last ? 'ship_' : ''; - - print ''. ntable("#cccccc",2). - 'Service'. - $cust_main->get("${pre}last"). ', '. - $cust_main->get("${pre}first"). '
'; - print $cust_main->get("${pre}company"). '
' - if $cust_main->get("${pre}company"); - print $cust_main->get("${pre}address1"). '
'; - print $cust_main->get("${pre}address2"). '
' - if $cust_main->get("${pre}address2"); - print $cust_main->get("${pre}city"). ', '. - $cust_main->get("${pre}state"). ' '. - $cust_main->get("${pre}ship_zip"). '
'; - print $cust_main->get("${pre}country"). '
' - if $cust_main->get("${pre}country") - && $cust_main->get("${pre}country") ne $countrydefault; - - print ''. - ''; -} - -print ''; - - -print '

Payment'. ntable("#cccccc", 2). - 'Date'. - time2str("%D",$_date). ''. - qq!!; - -print qq!Amount\$!; - -print qq!Payby$payby!; +<%= 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 + +<% } %> + -#payinfo (check # now as payby="BILL" hardcoded.. what to do later?) -print qq!Check #!; + -#paybatch -print qq!!; + -print <
-END - -print < -END - -%>