summaryrefslogtreecommitdiff
path: root/httemplate/view/legacy_cust_bill.html
blob: 29e4e6ebe38bb3fd0dbfba327f834c2aabfd4b01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<& /elements/header.html, mt('Legacy Invoice View'), menubar(
  emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum",
) &>

% if ( 0 ) { #implement resending of legacy invoices?
% #if ( $curuser->access_right('Resend invoices') ) {

    <A HREF="<% $p %>misc/send-invoice.cgi?method=print;<% $link %>"><% mt('Re-print this invoice') |h %></A>

%   if ( grep { $_ ne 'POST' } $legacy_cust_bill->cust_main->invoicing_list ) { 
        | <A HREF="<% $p %>misc/send-invoice.cgi?method=email;<% $link %>"><% mt('Re-email this invoice') |h %></A>
%   } 

%   if ( $conf->exists('hylafax') && length($legacy_cust_bill->cust_main->fax) ) { 
        | <A HREF="<% $p %>misc/send-invoice.cgi?method=fax;<% $link %>"><% mt('Re-fax this invoice') |h %></A>
%   } 

    <BR><BR>

% } 

% if ( length($legacy_cust_bill->content_pdf) ) {

  <A HREF="<% $p %>view/legacy_cust_bill-pdf.cgi?<% $link %>"><% mt('View typeset invoice PDF') |h %></A>
  <BR><BR>
% } 

<% $legacy_cust_bill->content_html %>

<& /elements/footer.html &>
<%init>

my $curuser = $FS::CurrentUser::CurrentUser;

die "access denied"
  unless $curuser->access_right('View invoices');

my $legacyinvnum;
my($query) = $cgi->keywords;
if ( $query =~ /^(\d+)$/ ) {
  $legacyinvnum = $3;
} else {
  $legacyinvnum = $cgi->param('legacyinvnum');
}

my $conf = new FS::Conf;

my $legacy_cust_bill = qsearchs({
  'select'    => 'legacy_cust_bill.*',
  'table'     => 'legacy_cust_bill',
  'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
  'hashref'   => { 'legacyinvnum' => $legacyinvnum },
  'extra_sql' => ' AND '. $curuser->agentnums_sql,
});
die "Legacy invoice #$legacyinvnum not found!" unless $legacy_cust_bill;

my $custnum = $legacy_cust_bill->custnum;
my $display_custnum = $legacy_cust_bill->cust_main->display_custnum;

my $link = "legacyinvnum=$legacyinvnum";

</%init>