diff options
author | ivan <ivan> | 2008-06-05 05:06:36 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-06-05 05:06:36 +0000 |
commit | d7977d0a346e3e5975c44a75b915bb437be66f4f (patch) | |
tree | fab1f36589dd47ddb27d54edd81a69b35fa92fd1 /httemplate/edit/cust_bill_pay.cgi | |
parent | e77f5d7c3812a65be18c5fc4ede509c42c5e3358 (diff) |
payment and credit applications have separate "apply to refund" choices now, and no auto-refund choice in the invoice dropdown. RT#3545
Diffstat (limited to 'httemplate/edit/cust_bill_pay.cgi')
-rwxr-xr-x | httemplate/edit/cust_bill_pay.cgi | 88 |
1 files changed, 8 insertions, 80 deletions
diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi index b6a064768..532db6a6e 100755 --- a/httemplate/edit/cust_bill_pay.cgi +++ b/httemplate/edit/cust_bill_pay.cgi @@ -1,86 +1,14 @@ -<% include('/elements/header-popup.html', 'Apply Payment') %> - -<% include('/elements/error.html') %> - -<FORM ACTION="<% $p1 %>process/cust_bill_pay.cgi" METHOD=POST> - -Payment #<B><% $paynum %></B> -<INPUT TYPE="hidden" NAME="paynum" VALUE="<% $paynum %>"> - -<BR>Date: <B><% time2str("%D", $cust_pay->_date) %></B> - -<BR>Amount: $<B><% $cust_pay->paid %></B> - -<BR>Unapplied amount: $<B><% $unapplied %></B> - -<SCRIPT TYPE="text/javascript"> -function changed(what) { - cust_bill = what.options[what.selectedIndex].value; - -% foreach my $cust_bill ( @cust_bill ) { - - if ( cust_bill == <% $cust_bill->invnum %> ) { - what.form.amount.value = "<% min($cust_bill->owed, $unapplied) %>"; - } - -% } - - if ( cust_bill == "Refund" ) { - what.form.amount.value = "<% $unapplied %>"; - } -} -</SCRIPT> - -<BR>Invoice #<SELECT NAME="invnum" SIZE=1 onChange="changed(this)"> -<OPTION VALUE=""> - -% foreach my $cust_bill ( @cust_bill ) { - <OPTION<% $cust_bill->invnum eq $invnum ? ' SELECTED' : '' %> VALUE="<% $cust_bill->invnum %>"><% $cust_bill->invnum %> - <% time2str("%D", $cust_bill->_date) %> - $<% $cust_bill->owed %> -% } - -<OPTION VALUE="Refund">Refund -</SELECT> - -<BR>Amount $<INPUT TYPE="text" NAME="amount" VALUE="<% $amount %>" SIZE=8 MAXLENGTH=8> - -<BR> -<CENTER><INPUT TYPE="submit" VALUE="Apply"></CENTER> - -</FORM> - -<% include('/elements/footer.html') %> - +<% include('elements/ApplicationCommon.html', + 'form_action' => 'process/cust_bill_pay.cgi', + 'src_table' => 'cust_pay', + 'src_thing' => 'payment', + 'dst_table' => 'cust_bill', + 'dst_thing' => 'invoice', + ) +%> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('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); - -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 } ); - </%init> |