3a84b9e0e1f5946dc3f64ac8387c017e391c3700
[freeside.git] / httemplate / view / cust_main / payment_history / invoice.html
1 <% $link %><% $invoice %><% $link ? '</A>' : '' %><% "$email$void$under" %>
2 <%init>
3
4 my( $cust_bill, %opt ) = @_;
5
6 my $invoice = emt("Invoice #[_1] (Balance [_2])",$cust_bill->display_invnum,$cust_bill->owed);
7
8 my $under = '';
9 if ( $cust_bill->owed > 0 ) {
10   $invoice = '<B><FONT SIZE="+1" COLOR="#FF0000">' .
11     emt("Open Invoice #[_1] (Balance [_2])",$cust_bill->display_invnum,$cust_bill->owed) .
12     '</FONT></B>';
13   if ( $cust_bill->promised_date ) {
14     $under .= '<BR>'. emt('Payment promised on [_1]',
15         time2str($opt{'date_format'}, $cust_bill->promised_date));
16   }
17 } #if $cust_bill->owed
18
19 my $invnum = $cust_bill->invnum;
20
21 my $link = $opt{'View invoices'}
22              ? qq!<A HREF="${p}view/cust_bill.cgi?$invnum">!
23              : '';
24
25 my $void = '';
26 if ( $cust_bill->closed !~ /^Y/i && $opt{'Void invoices'} ) {
27   $void =
28     ' ('. include('/elements/popup_link.html',
29                     'label'     => emt('void'),
30                     'action'    => "${p}misc/void-cust_bill.html?;invnum=".
31                                     $cust_bill->invnum,
32                     'actionlabel' => emt('Void Invoice'),
33                  ).
34      ')';
35 }
36
37 my $email = ($opt{'has_email_address'} && $opt{'Resend invoices'}) ? 
38   q! (<A HREF="javascript:void(0)" ONCLICK="areyousure_popup('Send email copy of invoice #!.
39   $cust_bill->invnum.
40   q! to customer?','!.
41   "${p}misc/send-invoice.cgi?method=email;notice_name=Invoice;popup=1;invnum=".
42   $cust_bill->invnum.
43   q!','Email Invoice Receipt')" TITLE="Send email invoice">email</A>)!
44   : '';
45
46 my $events = '';
47 if ( $cust_bill->num_cust_event
48      && ($opt{'Billing event reports'} || $opt{'View customer billing events'})
49    )
50 {
51   $under .=
52     qq!<BR><A HREF="${p}search/cust_event.html?invnum=$invnum">( !.
53       emt('View invoice events').' )</A>';
54 }
55 $under = '<FONT SIZE="-1">'.$under.'</FONT>' if length($under);
56
57 </%init>