X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_bill_pay.cgi;h=498d477cde581f07b0a249efb1a9f15e2f2f246b;hb=a5ca508ed3bf1bcb03df26d35d1316b3c313820a;hp=9d3bdd8cb14522f233be6d78adc6d389ac125de8;hpb=2c757d7db4cb6a7b9655de13206fcc84fb7ce61f;p=freeside.git diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi index 9d3bdd8cb..498d477cd 100755 --- a/httemplate/edit/cust_bill_pay.cgi +++ b/httemplate/edit/cust_bill_pay.cgi @@ -1,70 +1,35 @@ -<% +<% header("Apply Payment", '') %> -my($paynum, $amount, $invnum); -if ( $cgi->param('error') ) { - $paynum = $cgi->param('paynum'); - $amount = $cgi->param('amount'); - $invnum = $cgi->param('invnum'); -} else { - my($query) = $cgi->keywords; - $query =~ /^(\d+)$/; - $paynum = $1; - $amount = ''; - $invnum = ''; -} - -my $otaker = getotaker; - -my $p1 = popurl(1); - -%><%= header("Apply Payment", '') %> - -<% if ( $cgi->param('error') ) { %> - Error: <%= $cgi->param('error') %> +% if ( $cgi->param('error') ) { + Error: <% $cgi->param('error') %>

-<% } %> - -
- -<% -my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } ); -die "payment $paynum not found!" unless $cust_pay; +% } -my $unapplied = $cust_pay->unapplied; -%> - -Payment #<%= $paynum %> - + -
Date: <%= time2str("%D", $cust_pay->_date) %> +Payment #<% $paynum %> + -
Amount: $<%= $cust_pay->paid %> +
Date: <% time2str("%D", $cust_pay->_date) %> -
Unapplied amount: $<%= $unapplied %> - -<% -my @cust_bill = grep $_->owed != 0, - qsearch('cust_bill', { 'custnum' => $cust_pay->custnum } ); +
Amount: $<% $cust_pay->paid %> -%> +
Unapplied amount: $<% $unapplied %> - @@ -72,21 +37,49 @@ function changed(what) {
Invoice # -
Amount $ +
Amount $
- + +<%init> +my($paynum, $amount, $invnum); +if ( $cgi->param('error') ) { + $paynum = $cgi->param('paynum'); + $amount = $cgi->param('amount'); + $invnum = $cgi->param('invnum'); +} else { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $paynum = $1; + $amount = ''; + $invnum = ''; +} + +my $otaker = getotaker; + +my $p1 = popurl(1); + +my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } ); +die "payment $paynum not found!" unless $cust_pay; + +my $unapplied = $cust_pay->unapplied; + +my @cust_bill = sort { $a->_date <=> $b->_date + or $a->invnum <=> $b->invnum + } + grep { $_->owed != 0 } + qsearch('cust_bill', { 'custnum' => $cust_pay->custnum } ); + +