optimize CDR rating after timed rate perf regression, RT#15739
[freeside.git] / httemplate / view / legacy_cust_bill.html
1 <& /elements/header.html, mt('Legacy Invoice View'), menubar(
2   emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum",
3 ) &>
4
5 % if ( 0 ) { #implement resending of legacy invoices?
6 % #if ( $curuser->access_right('Resend invoices') ) {
7
8     <A HREF="<% $p %>misc/send-invoice.cgi?method=print;<% $link %>"><% mt('Re-print this invoice') |h %></A>
9
10 %   if ( grep { $_ ne 'POST' } $legacy_cust_bill->cust_main->invoicing_list ) { 
11         | <A HREF="<% $p %>misc/send-invoice.cgi?method=email;<% $link %>"><% mt('Re-email this invoice') |h %></A>
12 %   } 
13
14 %   if ( $conf->exists('hylafax') && length($legacy_cust_bill->cust_main->fax) ) { 
15         | <A HREF="<% $p %>misc/send-invoice.cgi?method=fax;<% $link %>"><% mt('Re-fax this invoice') |h %></A>
16 %   } 
17
18     <BR><BR>
19
20 % } 
21
22 % if ( length($legacy_cust_bill->content_pdf) ) {
23
24   <A HREF="<% $p %>view/legacy_cust_bill-pdf.cgi?<% $link %>"><% mt('View typeset invoice PDF') |h %></A>
25   <BR><BR>
26 % } 
27
28 <% $legacy_cust_bill->content_html %>
29
30 <& /elements/footer.html &>
31 <%init>
32
33 my $curuser = $FS::CurrentUser::CurrentUser;
34
35 die "access denied"
36   unless $curuser->access_right('View invoices');
37
38 my $legacyinvnum;
39 my($query) = $cgi->keywords;
40 if ( $query =~ /^(\d+)$/ ) {
41   $legacyinvnum = $3;
42 } else {
43   $legacyinvnum = $cgi->param('legacyinvnum');
44 }
45
46 my $conf = new FS::Conf;
47
48 my $legacy_cust_bill = qsearchs({
49   'select'    => 'legacy_cust_bill.*',
50   'table'     => 'legacy_cust_bill',
51   'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
52   'hashref'   => { 'legacyinvnum' => $legacyinvnum },
53   'extra_sql' => ' AND '. $curuser->agentnums_sql,
54 });
55 die "Legacy invoice #$legacyinvnum not found!" unless $legacy_cust_bill;
56
57 my $custnum = $legacy_cust_bill->custnum;
58 my $display_custnum = $legacy_cust_bill->cust_main->display_custnum;
59
60 my $link = "legacyinvnum=$legacyinvnum";
61
62 </%init>