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 % if ( $cust_main->invoicing_list_emailonly ) {
8 | <A HREF="javascript:self.location = '<% $email_link %>'"><% mt('Re-email') |h %></A>
12 % } elsif ( $link eq 'print' ) {
14 <& /elements/header-popup.html, mt("$thing Receipt") &>
16 % #it would be nice if the menubar could be hidden for print, but better to
17 % # have it available than not, otherwise the user winds up at a dead end
19 emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum",
23 % } elsif ( $link eq 'email' ) {
24 % if ( $email_error ) {
25 <& /elements/header-popup.html, mt("Error re-emailing receipt: [_1]", $email_error) &>
27 <& /elements/header-popup.html, mt("Re-emailed receipt") &>
31 <& /elements/header.html, mt("$thing Receipt"), menubar(
32 emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum",
33 emt('Print receipt') => $pr_link,
39 % unless ($link =~ /^(popup|email)$/ ) {
40 <& /elements/small_custview.html,
42 scalar($conf->config('countrydefault')),
48 <% ntable("#cccccc", 2) %>
51 <TD ALIGN="right"><% mt('Payment #') |h %></TD>
52 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->paynum %></B></TD>
56 <TD ALIGN="right"><% mt('Date') |h %></TD>
57 <TD BGCOLOR="#FFFFFF"><B><% time2str"%a %b %o, %Y %r", $cust_pay->_date %></B></TD>
63 <TD ALIGN="right"><% mt('Void Date') |h %></TD>
64 <TD BGCOLOR="#FFFFFF"><B><% time2str"%a %b %o, %Y %r", $cust_pay->void_date %></B></TD>
68 %# <TD ALIGN="right"><% mt('Void reason') |h %></TD>
69 %# <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->reason %></B></TD>
74 <TD ALIGN="right"><% mt('Amount') |h %></TD>
75 <TD BGCOLOR="#FFFFFF"><B><% $money_char. $cust_pay->paid %></B></TD>
78 <TD ALIGN="right"><% mt('Payment method') |h %></TD>
79 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->payby_name %> #<% $cust_pay->paymask %></B></TD>
82 % if ( $cust_pay->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_pay->processor ) {
85 <TD ALIGN="right"><% mt('Processor') |h %></TD>
86 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->processor %></B></TD>
90 <TD ALIGN="right"><% mt('Authorization #') |h %></TD>
91 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->auth %></B></TD>
96 % # API allows setting this for any payby
97 % if ( $cust_pay->order_number ) {
99 <TD ALIGN="right"><% mt('Order #') |h %></TD>
100 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->order_number %></B></TD>
104 % if ( $cust_pay->payby eq 'CASH' && $cust_pay->payinfo ) {
106 <TD ALIGN="right"><% mt('Bank') |h %></TD>
107 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->bank %></B></TD>
111 <TD ALIGN="right"><% mt('Teller #') |h %></TD>
112 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->teller %></B></TD>
116 <TD ALIGN="right"><% mt('Depositor') |h %></TD>
117 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->depositor %></B></TD>
121 <TD ALIGN="right"><% mt('Account #') |h %></TD>
122 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->account %></B></TD>
126 % if ( $conf->exists('pkg-balances') && $cust_pay->pkgnum ) {
127 % my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay->pkgnum } );
129 <TD ALIGN="right"><% mt('For package') |h %></TD>
130 <TD BGCOLOR="#FFFFFF"><B><% $cust_pkg->pkg_label_long %></B></TD>
137 % if ( $link eq 'print' ) {
139 <SCRIPT TYPE="text/javascript">
143 % } elsif ( $link eq 'email' ) {
145 <SCRIPT TYPE="text/javascript">
146 window.top.location.reload();
150 % if ( $link =~ /^(popup|print|email)$/ ) {
154 <& /elements/footer.html &>
159 my $curuser = $FS::CurrentUser::CurrentUser;
162 unless $curuser->access_right('View invoices') #remove this in 2.5 (2.7?)
163 || $curuser->access_right('View payments');
165 $cgi->param('paynum') =~ /^(\d+)$/ or die "no paynum";
169 if ( $cgi->param('link') =~ /^(\w+)$/ ) {
173 my $void = $cgi->param('void') ? 1 : 0;
174 my $thing = $void ? 'Voided Payment' : 'Payment';
175 my $table = $void ? 'cust_pay_void' : 'cust_pay';
177 my $cust_pay = qsearchs({
178 'select' => "$table.*",
180 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
181 'hashref' => { 'paynum' => $paynum },
182 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
184 die "$thing #$paynum not found!" unless $cust_pay;
186 my $cust_main = $cust_pay->cust_main;
188 my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum;void=$void";
189 my $email_link = "${p}view/cust_pay.html?link=email;paynum=$paynum;void=$void";
191 my $custnum = $cust_pay->custnum;
192 my $display_custnum = $cust_main->display_custnum;
194 my $conf = new FS::Conf;
196 my $money_char = $conf->config('money_char') || '$';
198 tie my %payby, 'Tie::IxHash', FS::payby->payby2longname;
202 if ( $link eq 'email' ) {
203 $email_error = $cust_pay->send_receipt(
205 'cust_main' => $cust_main,
208 warn "can't send payment receipt/statement: $email_error" if $email_error;