1 % if ( $link eq 'popup' ) {
3 <& /elements/header-popup.html, mt('Refund Receipt') &>
5 <CENTER><A HREF="javascript:self.parent.location = '<% $pr_link %>'"><% mt('Print') |h %></A></CENTER><BR>
7 % } elsif ( $link eq 'print' ) {
9 <& /elements/header-popup.html, mt('Refund Receipt') &>
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
14 emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum",
21 <& /elements/header.html, mt('Refund Receipt'), menubar(
22 emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum",
23 emt('Print receipt') => $pr_link,
29 % unless ($link eq 'popup' ) {
30 <& /elements/small_custview.html,
32 scalar($conf->config('countrydefault')),
38 <% ntable("#cccccc", 2) %>
41 <TD ALIGN="right"><% mt('Refund #') |h %></TD>
42 <TD BGCOLOR="#FFFFFF"><B><% $cust_refund->refundnum %></B></TD>
46 <TD ALIGN="right"><% mt('Date') |h %></TD>
47 <TD BGCOLOR="#FFFFFF"><B><% time2str"%a %b %o, %Y %r", $cust_refund->_date %></B></TD>
51 <TD ALIGN="right"><% mt('Amount') |h %></TD>
52 <TD BGCOLOR="#FFFFFF"><B><% $money_char. $cust_refund->refund %></B></TD>
56 <TD ALIGN="right"><% mt('Reason') |h %></TD>
57 <TD BGCOLOR="#FFFFFF"><B><% $cust_refund->reason %></B></TD>
61 <TD ALIGN="right"><% mt('Refund method') |h %></TD>
62 <TD BGCOLOR="#FFFFFF"><B><% $cust_refund->payby_name %><% $cust_refund->paymask ? ' #'.$cust_refund->paymask : '' %></B></TD>
65 % if ( $cust_refund->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_refund->paybatch ) {
68 <TD ALIGN="right"><% mt('Processor') |h %></TD>
69 <TD BGCOLOR="#FFFFFF"><B><% $cust_refund->processor %></B></TD>
73 <TD ALIGN="right"><% mt('Authorization #') |h %></TD>
74 <TD BGCOLOR="#FFFFFF"><B><% $cust_refund->authorization %></B></TD>
77 % if ( $cust_refund->order_number ) {
79 <TD ALIGN="right"><% mt('Order #') |h %></TD>
80 <TD BGCOLOR="#FFFFFF"><B><% $cust_refund->order_number %></B></TD>
88 % if ( $link eq 'print' ) {
90 <SCRIPT TYPE="text/javascript">
96 % if ( $link =~ /^(popup|print)$/ ) {
100 <& /elements/footer.html &>
105 my $curuser = $FS::CurrentUser::CurrentUser;
108 unless $curuser->access_right('View invoices') #remove this in 2.5 (2.7?)
109 || $curuser->access_right('View refunds');
111 $cgi->param('refundnum') =~ /^(\d+)$/ or die "no refundnum";
115 if ( $cgi->param('link') =~ /^(\w+)$/ ) {
119 my $cust_refund = qsearchs({
120 'select' => 'cust_refund.*',
121 'table' => 'cust_refund',
122 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
123 'hashref' => { 'refundnum' => $refundnum },
124 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
126 die "Refund #$refundnum not found!" unless $cust_refund;
128 my $pr_link = "${p}view/cust_refund.html?link=print;refundnum=$refundnum";
130 my $custnum = $cust_refund->custnum;
131 my $display_custnum = $cust_refund->cust_main->display_custnum;
133 my $conf = new FS::Conf;
135 my $money_char = $conf->config('money_char') || '$';
137 tie my %payby, 'Tie::IxHash', FS::payby->payby2longname;