1 % if ( $link eq 'popup' ) {
3 <% include('/elements/header-popup.html', "$thing Receipt" ) %>
6 <A HREF="javascript:self.parent.location = '<% $pr_link %>'">Print</A> |
7 <A HREF="javascript:self.location = '<% $email_link %>'">Re-email</A>
10 % } elsif ( $link eq 'print' ) {
12 <% include('/elements/header-popup.html', "$thing Receipt" ) %>
14 % #it would be nice if the menubar could be hidden for print, but better to
15 % # have it available than not, otherwise the user winds up at a dead end
17 "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum",
21 % } elsif ( $link eq 'email' ) {
22 % if ( $email_error ) {
23 <% include('/elements/header-popup.html', "Error re-emailing receipt: $email_error" ) %>
25 <% include('/elements/header-popup.html', "Re-emailed receipt" ) %>
29 <% include('/elements/header.html', "$thing Receipt", menubar(
30 "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum",
31 'Print receipt' => $pr_link,
37 % unless ($link =~ /^(popup|email)$/ ) {
38 <% include('/elements/small_custview.html',
40 scalar($conf->config('countrydefault')),
47 <% ntable("#cccccc", 2) %>
50 <TD ALIGN="right">Payment#</TD>
51 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->paynum %></B></TD>
55 <TD ALIGN="right">Date</TD>
56 <TD BGCOLOR="#FFFFFF"><B><% time2str"%a %b %o, %Y %r", $cust_pay->_date %></B></TD>
62 <TD ALIGN="right">Void Date</TD>
63 <TD BGCOLOR="#FFFFFF"><B><% time2str"%a %b %o, %Y %r", $cust_pay->void_date %></B></TD>
67 %# <TD ALIGN="right">Void reason</TD>
68 %# <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->reason %></B></TD>
74 <TD ALIGN="right">Amount</TD>
75 <TD BGCOLOR="#FFFFFF"><B><% $money_char. $cust_pay->paid %></B></TD>
79 <TD ALIGN="right">Payment method</TD>
80 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->payby_name %> #<% $cust_pay->paymask %></B></TD>
83 % if ( $cust_pay->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_pay->paybatch ) {
86 <TD ALIGN="right">Processor</TD>
87 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->processor %></B></TD>
91 <TD ALIGN="right">Authorization#</TD>
92 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->authorization %></B></TD>
95 % if ( $cust_pay->order_number ) {
97 <TD ALIGN="right">Order#</TD>
98 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->order_number %></B></TD>
104 % if ( $conf->exists('pkg-balances') && $cust_pay->pkgnum ) {
105 % my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay->pkgnum } );
107 <TD ALIGN="right">For package</TD>
108 <TD BGCOLOR="#FFFFFF"><B><% $cust_pkg->pkg_label_long %></B></TD>
115 % if ( $link eq 'print' ) {
117 <SCRIPT TYPE="text/javascript">
121 % } elsif ( $link eq 'email' ) {
123 <SCRIPT TYPE="text/javascript">
124 window.top.location.reload();
128 % if ( $link =~ /^(popup|print|email)$/ ) {
132 <% include('/elements/footer.html') %>
137 my $curuser = $FS::CurrentUser::CurrentUser;
140 unless $curuser->access_right('View invoices') #remove this in 1.9 EVENTUALLY
141 || $curuser->access_right('View customer payments');
143 $cgi->param('paynum') =~ /^(\d+)$/ or die "no paynum";
147 if ( $cgi->param('link') =~ /^(\w+)$/ ) {
151 my $void = $cgi->param('void') ? 1 : 0;
152 my $thing = $void ? 'Voided Payment' : 'Payment';
153 my $table = $void ? 'cust_pay_void' : 'cust_pay';
155 my $cust_pay = qsearchs({
156 'select' => "$table.*",
158 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
159 'hashref' => { 'paynum' => $paynum },
160 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
162 die "$thing #$paynum not found!" unless $cust_pay;
164 my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum;void=$void";
165 my $email_link = "${p}view/cust_pay.html?link=email;paynum=$paynum;void=$void";
167 my $custnum = $cust_pay->custnum;
168 my $display_custnum = $cust_pay->cust_main->display_custnum;
170 my $conf = new FS::Conf;
172 my $money_char = $conf->config('money_char') || '$';
174 tie my %payby, 'Tie::IxHash', FS::payby->payby2longname;
178 if ( $link eq 'email' ) {
179 my $email_error = $cust_pay->send_receipt(
183 warn "can't send payment receipt/statement: $email_error" if $email_error;