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 mt("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") &>
24 % warn "Error re-emailing receipt: $email_error";
26 <& /elements/header-popup.html, mt("Re-emailed receipt") &>
30 <& /elements/header.html, mt("$thing Receipt"), menubar(
31 mt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum",
32 mt('Print receipt') => $pr_link,
38 % unless ($link =~ /^(popup|email)$/ ) {
39 <& /elements/small_custview.html,
41 scalar($conf->config('countrydefault')),
47 <% ntable("#cccccc", 2) %>
50 <TD ALIGN="right"><% mt('Payment #') |h %></TD>
51 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->paynum %></B></TD>
55 <TD ALIGN="right"><% mt('Date') |h %></TD>
56 <TD BGCOLOR="#FFFFFF"><B><% time2str"%a %b %o, %Y %r", $cust_pay->_date %></B></TD>
62 <TD ALIGN="right"><% mt('Void Date') |h %></TD>
63 <TD BGCOLOR="#FFFFFF"><B><% time2str"%a %b %o, %Y %r", $cust_pay->void_date %></B></TD>
67 %# <TD ALIGN="right"><% mt('Void reason') |h %></TD>
68 %# <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->reason %></B></TD>
73 <TD ALIGN="right"><% mt('Amount') |h %></TD>
74 <TD BGCOLOR="#FFFFFF"><B><% $money_char. $cust_pay->paid %></B></TD>
77 <TD ALIGN="right"><% mt('Payment method') |h %></TD>
78 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->payby_name %> #<% $cust_pay->paymask %></B></TD>
81 % if ( $cust_pay->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_pay->paybatch ) {
84 <TD ALIGN="right"><% mt('Processor') |h %></TD>
85 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->processor %></B></TD>
89 <TD ALIGN="right"><% mt('Authorization #') |h %></TD>
90 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->authorization %></B></TD>
93 % if ( $cust_pay->order_number ) {
95 <TD ALIGN="right"><% mt('Order #') |h %></TD>
96 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->order_number %></B></TD>
102 % if ( $conf->exists('pkg-balances') && $cust_pay->pkgnum ) {
103 % my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay->pkgnum } );
105 <TD ALIGN="right"><% mt('For package') |h %></TD>
106 <TD BGCOLOR="#FFFFFF"><B><% $cust_pkg->pkg_label_long %></B></TD>
113 % if ( $link eq 'print' ) {
115 <SCRIPT TYPE="text/javascript">
119 % } elsif ( $link eq 'email' ) {
121 <SCRIPT TYPE="text/javascript">
122 window.top.location.reload();
126 % if ( $link =~ /^(popup|print|email)$/ ) {
130 <& /elements/footer.html &>
135 my $curuser = $FS::CurrentUser::CurrentUser;
138 unless $curuser->access_right('View invoices') #remove this in 1.9 EVENTUALLY
139 || $curuser->access_right('View customer payments');
141 $cgi->param('paynum') =~ /^(\d+)$/ or die "no paynum";
145 if ( $cgi->param('link') =~ /^(\w+)$/ ) {
149 my $void = $cgi->param('void') ? 1 : 0;
150 my $thing = $void ? 'Voided Payment' : 'Payment';
151 my $table = $void ? 'cust_pay_void' : 'cust_pay';
153 my $cust_pay = qsearchs({
154 'select' => "$table.*",
156 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
157 'hashref' => { 'paynum' => $paynum },
158 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
160 die "$thing #$paynum not found!" unless $cust_pay;
162 my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum;void=$void";
163 my $email_link = "${p}view/cust_pay.html?link=email;paynum=$paynum;void=$void";
165 my $custnum = $cust_pay->custnum;
166 my $display_custnum = $cust_pay->cust_main->display_custnum;
168 my $conf = new FS::Conf;
170 my $money_char = $conf->config('money_char') || '$';
172 tie my %payby, 'Tie::IxHash', FS::payby->payby2longname;
176 if ( $link eq 'email' ) {
177 my $email_error = $cust_pay->send_receipt(
181 warn "can't send payment receipt/statement: $email_error" if $email_error;