This commit was generated by cvs2svn to compensate for changes in r6252,
[freeside.git] / httemplate / view / cust_bill.cgi
1 <% include("/elements/header.html",'Invoice View', menubar(
2   "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
3 )) %>
4
5
6 % if ( $cust_bill->owed > 0
7 %        && ( $payby{'BILL'} || $payby{'CASH'} || $payby{'WEST'} || $payby{'MCRD'} )
8 %      )
9 %   {
10 %     my $s = 0;
11
12   Post 
13 % if ( $payby{'BILL'} ) { 
14
15   
16     <% $s++ ? ' | ' : '' %>
17     <A HREF="<% $p %>edit/cust_pay.cgi?payby=BILL;invnum=<% $invnum %>">check</A>
18 % } 
19 % if ( $payby{'CASH'} ) { 
20
21   
22     <% $s++ ? ' | ' : '' %>
23     <A HREF="<% $p %>edit/cust_pay.cgi?payby=CASH;invnum=<% $invnum %>">cash</A>
24 % } 
25 % if ( $payby{'WEST'} ) { 
26
27   
28     <% $s++ ? ' | ' : '' %>
29     <A HREF="<% $p %>edit/cust_pay.cgi?payby=WEST;invnum=<% $invnum %>">Western Union</A>
30 % } 
31 % if ( $payby{'MCRD'} ) { 
32
33   
34     <% $s++ ? ' | ' : '' %>
35     <A HREF="<% $p %>edit/cust_pay.cgi?payby=MCRD;invnum=<% $invnum %>">manual credit card</A>
36 % } 
37
38
39   payment against this invoice<BR>
40 % } 
41
42
43 <A HREF="<% $p %>misc/print-invoice.cgi?<% $link %>">Re-print this invoice</A>
44 % if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { 
45
46   | <A HREF="<% $p %>misc/email-invoice.cgi?<% $link %>">Re-email
47       this invoice</A>
48 % } 
49 % if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { 
50
51   | <A HREF="<% $p %>misc/fax-invoice.cgi?<% $link %>">Re-fax
52       this invoice</A>
53 % } 
54
55
56 <BR><BR>
57 % if ( $conf->exists('invoice_latex') ) { 
58
59   <A HREF="<% $p %>view/cust_bill-pdf.cgi?<% $link %>.pdf">View typeset invoice</A>
60   <BR><BR>
61 % } 
62
63 % my $br = 0;
64 % if ( $cust_bill->num_cust_event ) { $br++;
65 <A HREF="<%$p%>search/cust_event.html?invnum=<% $cust_bill->invnum %>">(&nbsp;View invoice events&nbsp;)</A> 
66 % } 
67
68 % if ( $cust_bill->num_cust_bill_event ) { $br++;
69 <A HREF="<%$p%>search/cust_bill_event.cgi?invnum=<% $cust_bill->invnum %>">(&nbsp;View deprecated, old-style invoice events&nbsp;)</A> 
70 % }
71
72 <% $br ? '<BR><BR>' : '' %>
73
74 % if ( $conf->exists('invoice_html') ) { 
75
76   <% join('', $cust_bill->print_html('', $templatename) ) %>
77 % } else { 
78
79   <PRE><% join('', $cust_bill->print_text('', $templatename) ) %></PRE>
80 % } 
81
82 <% include('/elements/footer.html') %>
83 <%init>
84
85 die "access denied"
86   unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
87
88 #untaint invnum
89 my($query) = $cgi->keywords;
90 $query =~ /^((.+)-)?(\d+)$/;
91 my $templatename = $2;
92 my $invnum = $3;
93
94 my $conf = new FS::Conf;
95
96 my @payby =  grep /\w/, $conf->config('payby');
97 #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP ))
98 @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
99   unless @payby;
100 my %payby = map { $_=>1 } @payby;
101
102 my $cust_bill = qsearchs({
103   'select'    => 'cust_bill.*',
104   'table'     => 'cust_bill',
105   'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
106   'hashref'   => { 'invnum' => $invnum },
107   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
108 });
109 die "Invoice #$invnum not found!" unless $cust_bill;
110
111 my $custnum = $cust_bill->custnum;
112
113 #my $printed = $cust_bill->printed;
114
115 my $link = $templatename ? "$templatename-$invnum" : $invnum;
116
117 </%init>
118
119