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