4 my($query) = $cgi->keywords;
5 $query =~ /^((.+)-)?(\d+)$/;
9 my $conf = new FS::Conf;
11 my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum});
12 die "Invoice #$invnum not found!" unless $cust_bill;
13 my $custnum = $cust_bill->getfield('custnum');
15 #my $printed = $cust_bill->printed;
17 my $link = $templatename ? "$templatename-$invnum" : $invnum;
20 <%= header('Invoice View', menubar(
22 "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
25 <% if ( $cust_bill->owed > 0 ) { %>
26 <A HREF="<%= $p %>edit/cust_pay.cgi?<%= $invnum %>">Enter payments (check/cash) against this invoice</A> |
29 <A HREF="<%= $p %>misc/print-invoice.cgi?<%= $link %>">Reprint this invoice</A>
31 <% if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { %>
32 | <A HREF="<%= $p %>misc/email-invoice.cgi?<%= $link %>">Re-email
36 <% if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { %>
37 | <A HREF="<%= $p %>misc/fax-invoice.cgi?<%= $link %>">Re-fax
43 <% if ( $conf->exists('invoice_latex') ) { %>
44 <A HREF="<%= $p %>view/cust_bill-pdf.cgi?<%= $link %>.pdf">View typeset invoice</A>
48 <% #false laziness with search/cust_bill_event.cgi
49 unless ( $templatename ) { %>
58 <% foreach my $cust_bill_event (
59 sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event
62 my $status = $cust_bill_event->status;
63 $status .= ': '. encode_entities($cust_bill_event->statustext)
64 if $cust_bill_event->statustext;
65 my $part_bill_event = $cust_bill_event->part_bill_event;
68 <TD><%= $part_bill_event->event %>
71 $part_bill_event->plan eq 'send_alternate'
72 && $part_bill_event->plandata =~ /^(agent_)?templatename (.*)$/m
74 my $alt_templatename = $2;
75 my $alt_link = "$alt_templatename-$invnum";
77 ( <A HREF="<%= $p %>view/cust_bill.cgi?<%= $alt_link %>">view</A>
78 | <A HREF="<%= $p %>view/cust_bill-pdf.cgi?<%= $alt_link %>.pdf">view
80 | <A HREF="<%= $p %>misc/print-invoice.cgi?<%= $alt_link %>">re-print</A>
81 <% if ( grep { $_ ne 'POST' }
82 $cust_bill->cust_main->invoicing_list ) { %>
83 | <A HREF="<%= $p %>misc/email-invoice.cgi?<%= $alt_link %>">re-email</A>
86 <% if ( $conf->exists('hylafax')
87 && length($cust_bill->cust_main->fax) ) { %>
88 | <A HREF="<%= $p %>misc/fax-invoice.cgi?<%= $alt_link %>">re-fax</A>
95 <TD><%= time2str("%a %b %e %T %Y", $cust_bill_event->_date) %></TD>
96 <TD><%= $status %></TD>
105 <% if ( $conf->exists('invoice_html') ) { %>
106 <%= join('', $cust_bill->print_html('', $templatename) ) %>
108 <PRE><%= join('', $cust_bill->print_text('', $templatename) ) %></PRE>