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>
94 % if ( $cust_pay->order_number ) {
96 <TD ALIGN="right"><% mt('Order #') |h %></TD>
97 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->order_number %></B></TD>
103 % if ( $cust_pay->payby eq 'CASH' && $cust_pay->payinfo ) {
105 <TD ALIGN="right"><% mt('Bank') |h %></TD>
106 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->bank %></B></TD>
110 <TD ALIGN="right"><% mt('Teller #') |h %></TD>
111 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->teller %></B></TD>
115 <TD ALIGN="right"><% mt('Depositor') |h %></TD>
116 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->depositor %></B></TD>
120 <TD ALIGN="right"><% mt('Account #') |h %></TD>
121 <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->account %></B></TD>
125 % if ( $conf->exists('pkg-balances') && $cust_pay->pkgnum ) {
126 % my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay->pkgnum } );
128 <TD ALIGN="right"><% mt('For package') |h %></TD>
129 <TD BGCOLOR="#FFFFFF"><B><% $cust_pkg->pkg_label_long %></B></TD>
136 % if ( $link eq 'print' ) {
138 <SCRIPT TYPE="text/javascript">
142 % } elsif ( $link eq 'email' ) {
144 <SCRIPT TYPE="text/javascript">
145 window.top.location.reload();
149 % if ( $link =~ /^(popup|print|email)$/ ) {
153 <& /elements/footer.html &>
158 my $curuser = $FS::CurrentUser::CurrentUser;
161 unless $curuser->access_right('View invoices') #remove this in 2.5 (2.7?)
162 || $curuser->access_right('View payments');
164 $cgi->param('paynum') =~ /^(\d+)$/ or die "no paynum";
168 if ( $cgi->param('link') =~ /^(\w+)$/ ) {
172 my $void = $cgi->param('void') ? 1 : 0;
173 my $thing = $void ? 'Voided Payment' : 'Payment';
174 my $table = $void ? 'cust_pay_void' : 'cust_pay';
176 my $cust_pay = qsearchs({
177 'select' => "$table.*",
179 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
180 'hashref' => { 'paynum' => $paynum },
181 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
183 die "$thing #$paynum not found!" unless $cust_pay;
185 my $cust_main = $cust_pay->cust_main;
187 my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum;void=$void";
188 my $email_link = "${p}view/cust_pay.html?link=email;paynum=$paynum;void=$void";
190 my $custnum = $cust_pay->custnum;
191 my $display_custnum = $cust_main->display_custnum;
193 my $conf = new FS::Conf;
195 my $money_char = $conf->config('money_char') || '$';
197 tie my %payby, 'Tie::IxHash', FS::payby->payby2longname;
201 if ( $link eq 'email' ) {
202 $email_error = $cust_pay->send_receipt(
204 'cust_main' => $cust_main,
207 warn "can't send payment receipt/statement: $email_error" if $email_error;