1 <% include("/elements/header.html",'Invoice View', menubar(
3 "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
7 % if ( $cust_bill->owed > 0
8 % && ( $payby{'BILL'} || $payby{'CASH'} || $payby{'WEST'} || $payby{'MCRD'} )
14 % if ( $payby{'BILL'} ) {
17 <% $s++ ? ' | ' : '' %>
18 <A HREF="<% $p %>edit/cust_pay.cgi?payby=BILL;invnum=<% $invnum %>">check</A>
20 % if ( $payby{'CASH'} ) {
23 <% $s++ ? ' | ' : '' %>
24 <A HREF="<% $p %>edit/cust_pay.cgi?payby=CASH;invnum=<% $invnum %>">cash</A>
26 % if ( $payby{'WEST'} ) {
29 <% $s++ ? ' | ' : '' %>
30 <A HREF="<% $p %>edit/cust_pay.cgi?payby=WEST;invnum=<% $invnum %>">Western Union</A>
32 % if ( $payby{'MCRD'} ) {
35 <% $s++ ? ' | ' : '' %>
36 <A HREF="<% $p %>edit/cust_pay.cgi?payby=MCRD;invnum=<% $invnum %>">manual credit card</A>
40 payment against this invoice<BR>
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 ) {
47 | <A HREF="<% $p %>misc/email-invoice.cgi?<% $link %>">Re-email
50 % if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) {
52 | <A HREF="<% $p %>misc/fax-invoice.cgi?<% $link %>">Re-fax
58 % if ( $conf->exists('invoice_latex') ) {
60 <A HREF="<% $p %>view/cust_bill-pdf.cgi?<% $link %>.pdf">View typeset invoice</A>
65 % if ( $cust_bill->num_cust_event ) { $br++;
66 <A HREF="<%$p%>search/cust_event.html?invnum=<% $cust_bill->invnum %>">( View invoice events )</A>
69 % if ( $cust_bill->num_cust_bill_event ) { $br++;
70 <A HREF="<%$p%>search/cust_bill_event.cgi?invnum=<% $cust_bill->invnum %>">( View deprecated, old-style invoice events )</A>
73 <% $br ? '<BR><BR>' : '' %>
75 % if ( $conf->exists('invoice_html') ) {
77 <% join('', $cust_bill->print_html('', $templatename) ) %>
80 <PRE><% join('', $cust_bill->print_text('', $templatename) ) %></PRE>
83 <% include('/elements/footer.html') %>
87 unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
90 my($query) = $cgi->keywords;
91 $query =~ /^((.+)-)?(\d+)$/;
92 my $templatename = $2;
95 my $conf = new FS::Conf;
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 ))
101 my %payby = map { $_=>1 } @payby;
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,
110 die "Invoice #$invnum not found!" unless $cust_bill;
112 my $custnum = $cust_bill->custnum;
114 #my $printed = $cust_bill->printed;
116 my $link = $templatename ? "$templatename-$invnum" : $invnum;