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