DNS, RT#8933
[freeside.git] / httemplate / view / cust_refund.html
1 % if ( $link eq 'popup' ) { 
2
3   <% include('/elements/header-popup.html', "Refund Receipt" ) %>
4
5   <CENTER><A HREF="javascript:self.parent.location = '<% $pr_link %>'">Print</A></CENTER><BR>
6
7 % } elsif ( $link eq 'print' ) { 
8
9   <% include('/elements/header-popup.html', "Refund Receipt" ) %>
10   
11 % #it would be nice if the menubar could be hidden for print, but better to
12 % # have it available than not, otherwise the user winds up at a dead end
13   <% menubar(
14        "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum",
15      )
16   %>
17   <BR><BR>
18
19 % } else { 
20
21   <% include('/elements/header.html', "Refund Receipt", menubar(
22        "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum",
23        'Print receipt' => $pr_link,
24      ))
25   %>
26
27 % }
28
29 % unless ($link eq 'popup' ) {
30   <% include('/elements/small_custview.html',
31                $custnum,
32                scalar($conf->config('countrydefault')),
33                1, #no balance
34             )
35   %>
36   <BR><BR>
37 % } 
38
39 <% ntable("#cccccc", 2) %>
40
41 <TR>
42   <TD ALIGN="right">Refund#</TD>
43   <TD BGCOLOR="#FFFFFF"><B><% $cust_refund->refundnum %></B></TD>
44 </TR>
45
46 <TR>
47   <TD ALIGN="right">Date</TD>
48   <TD BGCOLOR="#FFFFFF"><B><% time2str"%a&nbsp;%b&nbsp;%o,&nbsp;%Y&nbsp;%r", $cust_refund->_date %></B></TD>
49 </TR>
50
51 <TR>
52   <TD ALIGN="right">Amount</TD>
53   <TD BGCOLOR="#FFFFFF"><B><% $money_char. $cust_refund->refund %></B></TD>
54 </TR>
55
56 <TR>
57   <TD ALIGN="right">Reason</TD>
58   <TD BGCOLOR="#FFFFFF"><B><% $cust_refund->reason %></B></TD>
59 </TR>
60
61 <TR>
62   <TD ALIGN="right">Refund method</TD>
63   <TD BGCOLOR="#FFFFFF"><B><% $cust_refund->payby_name %><% $cust_refund->paymask ? ' #'.$cust_refund->paymask : '' %></B></TD>
64 </TR>
65
66 % if ( $cust_refund->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_refund->paybatch ) { 
67
68     <TR>
69       <TD ALIGN="right">Processor</TD>
70       <TD BGCOLOR="#FFFFFF"><B><% $cust_refund->processor %></B></TD>
71     </TR>
72
73     <TR>
74       <TD ALIGN="right">Authorization#</TD>
75       <TD BGCOLOR="#FFFFFF"><B><% $cust_refund->authorization %></B></TD>
76     </TR>
77
78 %   if ( $cust_refund->order_number ) {
79       <TR>
80         <TD ALIGN="right">Order#</TD>
81         <TD BGCOLOR="#FFFFFF"><B><% $cust_refund->order_number %></B></TD>
82       </TR>
83 %   }
84
85 % }
86
87 </TABLE>
88
89 % if ( $link eq 'print' ) {
90
91   <SCRIPT TYPE="text/javascript">
92     window.print();
93   </SCRIPT>
94
95 % }
96
97 % if ( $link =~ /^(popup|print)$/ ) { 
98     </BODY>
99   </HTML>
100 % } else {
101   <% include('/elements/footer.html') %>
102 % }
103
104 <%init>
105
106 my $curuser = $FS::CurrentUser::CurrentUser;
107
108 die "access denied"
109   unless $curuser->access_right('View invoices') #remove this in 1.9 EVENTUALLY
110       || $curuser->access_right('View customer payments');
111       #'View customer refunds' ???
112
113
114 $cgi->param('refundnum') =~ /^(\d+)$/ or die "no refundnum";
115 my $refundnum = $1;
116
117 my $link = '';
118 if ( $cgi->param('link') =~ /^(\w+)$/ ) {
119   $link = $1;
120 }
121
122 my $cust_refund = qsearchs({
123   'select'    => 'cust_refund.*',
124   'table'     => 'cust_refund',
125   'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
126   'hashref'   => { 'refundnum' => $refundnum },
127   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
128 });
129 die "Refund #$refundnum not found!" unless $cust_refund;
130
131 my $pr_link = "${p}view/cust_refund.html?link=print;refundnum=$refundnum";
132
133 my $custnum = $cust_refund->custnum;
134 my $display_custnum = $cust_refund->cust_main->display_custnum;
135
136 my $conf = new FS::Conf;
137
138 my $money_char = $conf->config('money_char') || '$';
139
140 tie my %payby, 'Tie::IxHash', FS::payby->payby2longname;
141
142 </%init>