1 <% include("/elements/header.html",'Invoice View', menubar(
2 "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
6 % if ( $cust_bill->owed > 0
7 % && scalar( grep $payby{$_}, qw(BILL CASH WEST MCRD) )
8 % && $FS::CurrentUser::CurrentUser->access_right('Post payment')
15 % if ( $payby{'BILL'} ) {
16 <% $s++ ? ' | ' : '' %>
17 <A HREF="<% $p %>edit/cust_pay.cgi?payby=BILL;invnum=<% $invnum %>">check</A>
20 % if ( $payby{'CASH'} ) {
21 <% $s++ ? ' | ' : '' %>
22 <A HREF="<% $p %>edit/cust_pay.cgi?payby=CASH;invnum=<% $invnum %>">cash</A>
25 % if ( $payby{'WEST'} ) {
26 <% $s++ ? ' | ' : '' %>
27 <A HREF="<% $p %>edit/cust_pay.cgi?payby=WEST;invnum=<% $invnum %>">Western Union</A>
30 % if ( $payby{'MCRD'} ) {
31 <% $s++ ? ' | ' : '' %>
32 <A HREF="<% $p %>edit/cust_pay.cgi?payby=MCRD;invnum=<% $invnum %>">manual credit card</A>
35 payment against this invoice<BR><BR>
40 % if ( $FS::CurrentUser::CurrentUser->access_right('Resend invoices') ) {
42 <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 | <A HREF="<% $p %>misc/email-invoice.cgi?<% $link %>">Re-email this invoice</A>
48 % if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) {
49 | <A HREF="<% $p %>misc/fax-invoice.cgi?<% $link %>">Re-fax this invoice</A>
57 % if ( $conf->exists('invoice_latex') ) {
59 <A HREF="<% $p %>view/cust_bill-pdf.cgi?<% $link %>.pdf">View typeset invoice</A>
64 % if ( $cust_bill->num_cust_event ) { $br++;
65 <A HREF="<%$p%>search/cust_event.html?invnum=<% $cust_bill->invnum %>">( View invoice events )</A>
68 % if ( $cust_bill->num_cust_bill_event ) { $br++;
69 <A HREF="<%$p%>search/cust_bill_event.cgi?invnum=<% $cust_bill->invnum %>">( View deprecated, old-style invoice events )</A>
72 <% $br ? '<BR><BR>' : '' %>
74 % if ( $conf->exists('invoice_html') ) {
76 <% join('', $cust_bill->print_html('', $templatename) ) %>
79 <PRE><% join('', $cust_bill->print_text('', $templatename) ) %></PRE>
82 <% include('/elements/footer.html') %>
86 unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
89 my($query) = $cgi->keywords;
90 $query =~ /^((.+)-)?(\d+)$/;
91 my $templatename = $2;
94 my $conf = new FS::Conf;
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 ))
100 my %payby = map { $_=>1 } @payby;
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,
109 die "Invoice #$invnum not found!" unless $cust_bill;
111 my $custnum = $cust_bill->custnum;
113 #my $printed = $cust_bill->printed;
115 my $link = $templatename ? "$templatename-$invnum" : $invnum;