1 % if ( $link eq 'popup' ) {
3 <& /elements/header-popup.html, mt("$thing Receipt") &>
6 <A HREF="javascript:self.parent.location = '<% $pr_link %>'"><% mt('Print') |h %></A> |
7 <A HREF="javascript:self.location = '<% $email_link %>'"><% mt('Re-email') |h %></A>
10 % } elsif ( $link eq 'print' ) {
12 <& /elements/header-popup.html, mt("$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 emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum",
21 % } elsif ( $link eq 'email' ) {
22 % if ( $email_error ) {
23 <& /elements/header-popup.html, mt("Error re-emailing receipt: [_1]", $email_error) &>
25 <& /elements/header-popup.html, mt("Re-emailed receipt") &>
29 <& /elements/header.html, mt("$thing Receipt"), menubar(
30 emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum",
31 emt('Print receipt') => $pr_link,
37 % unless ($link =~ /^(popup|email)$/ ) {
38 <& /elements/small_custview.html,
40 scalar($conf->config('countrydefault')),
46 <% ntable("#cccccc", 2) %>
49 <TD ALIGN="right"><% mt('Payment #') |h %></TD>
50 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->paynum %></B></TD>
54 <TD ALIGN="right"><% mt('Date') |h %></TD>
55 <TD BGCOLOR="#FFFFFF"><B><% time2str"%a %b %o, %Y %r", $cust_pay->_date %></B></TD>
61 <TD ALIGN="right"><% mt('Void Date') |h %></TD>
62 <TD BGCOLOR="#FFFFFF"><B><% time2str"%a %b %o, %Y %r", $cust_pay->void_date %></B></TD>
66 %# <TD ALIGN="right"><% mt('Void reason') |h %></TD>
67 %# <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->reason %></B></TD>
72 <TD ALIGN="right"><% mt('Amount') |h %></TD>
73 <TD BGCOLOR="#FFFFFF"><B><% $money_char. $cust_pay->paid %></B></TD>
76 <TD ALIGN="right"><% mt('Payment method') |h %></TD>
77 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->payby_name %> #<% $cust_pay->paymask %></B></TD>
80 % if ( $cust_pay->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_pay->paybatch ) {
83 <TD ALIGN="right"><% mt('Processor') |h %></TD>
84 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->processor %></B></TD>
88 <TD ALIGN="right"><% mt('Authorization #') |h %></TD>
89 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->authorization %></B></TD>
92 % if ( $cust_pay->order_number ) {
94 <TD ALIGN="right"><% mt('Order #') |h %></TD>
95 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->order_number %></B></TD>
101 % if ( $conf->exists('pkg-balances') && $cust_pay->pkgnum ) {
102 % my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay->pkgnum } );
104 <TD ALIGN="right"><% mt('For package') |h %></TD>
105 <TD BGCOLOR="#FFFFFF"><B><% $cust_pkg->pkg_label_long %></B></TD>
112 % if ( $link eq 'print' ) {
114 <SCRIPT TYPE="text/javascript">
118 % } elsif ( $link eq 'email' ) {
120 <SCRIPT TYPE="text/javascript">
121 window.top.location.reload();
125 % if ( $link =~ /^(popup|print|email)$/ ) {
129 <& /elements/footer.html &>
134 my $curuser = $FS::CurrentUser::CurrentUser;
137 unless $curuser->access_right('View invoices') #remove this in 1.9 EVENTUALLY
138 || $curuser->access_right('View customer payments');
140 $cgi->param('paynum') =~ /^(\d+)$/ or die "no paynum";
144 if ( $cgi->param('link') =~ /^(\w+)$/ ) {
148 my $void = $cgi->param('void') ? 1 : 0;
149 my $thing = $void ? 'Voided Payment' : 'Payment';
150 my $table = $void ? 'cust_pay_void' : 'cust_pay';
152 my $cust_pay = qsearchs({
153 'select' => "$table.*",
155 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
156 'hashref' => { 'paynum' => $paynum },
157 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
159 die "$thing #$paynum not found!" unless $cust_pay;
161 my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum;void=$void";
162 my $email_link = "${p}view/cust_pay.html?link=email;paynum=$paynum;void=$void";
164 my $custnum = $cust_pay->custnum;
165 my $display_custnum = $cust_pay->cust_main->display_custnum;
167 my $conf = new FS::Conf;
169 my $money_char = $conf->config('money_char') || '$';
171 tie my %payby, 'Tie::IxHash', FS::payby->payby2longname;
175 if ( $link eq 'email' ) {
176 my $email_error = $cust_pay->send_receipt(
180 warn "can't send payment receipt/statement: $email_error" if $email_error;