refactor payment history slightly, add refund receipts, have "unapplied" refunds...
[freeside.git] / httemplate / view / cust_main / payment_history / refund.html
1 <% $pre %>Refund<% $post %>
2 (<% $payby. $payinfo %>)
3 by <% $cust_refund->otaker %><% $view %><% $delete %>
4 <%init>
5
6 my( $cust_refund, %opt ) = @_;
7
8 my $conf = new FS::Conf;
9 my $curuser = $FS::CurrentUser::CurrentUser;
10
11 my $payby = $cust_refund->payby;
12 my $payinfo = $payby eq 'CARD'
13                 ? $cust_refund->paymask
14                 : $cust_refund->payinfo;
15
16 $payby =~ s/^BILL$/Check #/ if $payinfo;
17 $payby =~ s/^CHEK$/Electronic check /;
18 $payby =~ s/^(CARD|COMP)$/$1 /;
19
20 my($pre, $post) = ('', '');
21 if ( $cust_refund->unapplied > 0 ) {
22   $pre = '<B><FONT COLOR="#FF0000">Unapplied ';
23   $post = '</FONT></B>';
24 }
25
26 my $view =
27   ' ('. include('/elements/popup_link.html',
28                   'label'     => 'view receipt',
29                   'action'    => "${p}view/cust_refund.html?link=popup;".
30                                  'refundnum='. $cust_refund->refundnum,
31                   'actionlabel' => 'Payment Receipt',
32                ).
33    ')';
34
35
36 my $delete = '';
37 if ( $cust_refund->closed !~ /^Y/i
38      && $conf->exists('deleterefunds')
39      && $curuser->access_right('Delete refund')
40    )
41 {
42   $delete = qq! (<A HREF="javascript:areyousure('!.
43             qq!${p}misc/delete-cust_refund.cgi?!. $cust_refund->refundnum.
44             qq!', 'Are you sure you want to delete this refund?')"!.
45             qq! TITLE="Delete this refund from the database completely - not recommended"!.
46             qq!>delete</A>)!;
47 }
48
49 </%init>
50