X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_credit_bill.cgi;h=59a74b279c063a3f1f6b995e746f65993a210e9f;hb=1d920e3661c29398763d05c82bbe3a493a19fbae;hp=3748202a56598952a869c45f3caa6b5d896e686a;hpb=1fd6d8cf5d7854860ef4fd10ed89828e0c04ec39;p=freeside.git diff --git a/httemplate/edit/cust_credit_bill.cgi b/httemplate/edit/cust_credit_bill.cgi index 3748202a5..59a74b279 100755 --- a/httemplate/edit/cust_credit_bill.cgi +++ b/httemplate/edit/cust_credit_bill.cgi @@ -1,5 +1,61 @@ - -<% +<% include('/elements/header-popup.html', 'Apply Credit') %> + +<% include('/elements/error.html') %> + +
+ +Credit #<% $crednum %> + + +
Date: <% time2str("%D", $cust_credit->_date) %> + +
Amount: $<% $cust_credit->amount %> + +
Unapplied amount: $<% $credited %> + +
Reason: <% $cust_credit->reason %> + + + +
Invoice # + +
Amount $ + +
+
+ +
+ + + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Apply credit'); my($crednum, $amount, $invnum); if ( $cgi->param('error') ) { @@ -23,79 +79,15 @@ my $otaker = getotaker; my $p1 = popurl(1); -print header("Apply Credit", ''); -print qq!Error: !, $cgi->param('error'), - "

" - if $cgi->param('error'); -print < -END - my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ); die "credit $crednum not found!" unless $cust_credit; my $credited = $cust_credit->credited; -print "Credit # $crednum". - qq!!. - '
Date: '. time2str("%D", $cust_credit->_date). ''. - '
Amount: $'. $cust_credit->amount. ''. - "
Unapplied amount: \$$credited". - '
Reason: '. $cust_credit->reason. '' - ; - -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_credit->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 < $cust_credit->credited - ? $cust_bill->owed - : $cust_credit->credited; - print < -END - -print qq!
Invoice #"; - -print qq!
Amount \$!; - -print < - -END - -print < - - -END - -%> +