X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_bill_pay.cgi;h=b6a0647682a9aa26fd237f3fb563798f7c4c72bc;hb=95ce32b3b4d3957a90ad0e999f75396063c22b94;hp=24bce308a85bc8efe63781f2c04ad06929d85125;hpb=2041a9143fac20b79ead4a1ae01224dedf5b27c2;p=freeside.git
diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi
index 24bce308a..b6a064768 100755
--- a/httemplate/edit/cust_bill_pay.cgi
+++ b/httemplate/edit/cust_bill_pay.cgi
@@ -1,5 +1,59 @@
-
-<%
+<% include('/elements/header-popup.html', 'Apply Payment') %>
+
+<% include('/elements/error.html') %>
+
+
+
+<% include('/elements/footer.html') %>
+
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Apply payment');
my($paynum, $amount, $invnum);
if ( $cgi->param('error') ) {
@@ -18,78 +72,15 @@ my $otaker = getotaker;
my $p1 = popurl(1);
-print header("Apply Payment", '');
-print qq!Error: !, $cgi->param('error'),
- "
"
- if $cgi->param('error');
-print <
-END
-
my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } );
die "payment $paynum not found!" unless $cust_pay;
my $unapplied = $cust_pay->unapplied;
-print "Payment # $paynum".
- qq!!.
- '
Date: '. time2str("%D", $cust_pay->_date). ''.
- '
Amount: $'. $cust_pay->paid. ''.
- "
Unapplied amount: \$$unapplied"
- ;
-
-my @cust_bill = grep $_->owed != 0,
+my @cust_bill = sort { $a->_date <=> $b->_date
+ or $a->invnum <=> $b->invnum
+ }
+ grep { $_->owed != 0 }
qsearch('cust_bill', { 'custnum' => $cust_pay->custnum } );
-print <
-function changed(what) {
- cust_bill = what.options[what.selectedIndex].value;
-END
-
-foreach my $cust_bill ( @cust_bill ) {
- my $invnum = $cust_bill->invnum;
- my $changeto = $cust_bill->owed < $unapplied
- ? $cust_bill->owed
- : $unapplied;
- print <
-END
-
-print qq!
Invoice #";
-
-print qq!
Amount \$!;
-
-print <
-
-END
-
-print <
-