make HTML invoice more consistent with current typeset invoice: center invoice date...
[freeside.git] / conf / invoice_html
1 <STYLE TYPE="text/css">
2 .invoice { font-family: sans-serif; font-size: 10pt }
3 .invoice_header { font-size: 10pt }
4 .invoice_headerright TH { border-top: 2px solid #000000; border-bottom: 2px solid #000000 }
5 .invoice_headerright TD { font-size: 10pt; empty-cells: show }
6 .invoice_longtable table { cellspacing: none }
7 .invoice_longtable TH { border-top: 2px solid #000000; border-bottom: 1px solid #000000; padding-left: none; padding-right: none; font-size: 10pt }
8 .invoice_desc TD { border-top: 2px solid #000000; font-weight: bold; font-size: 10pt }
9 .invoice_desc_more TD { font-weight: bold; font-size: 10pt }
10 .invoice_extdesc TD { font-size: 8pt }
11 .invoice_totaldesc TD { font-size: 10pt; empty-cells: show }
12 </STYLE>
13
14 <table class="invoice" bgcolor="#ffffff" WIDTH=768 CELLSPACING=8><tr><td>
15
16   <table class="invoice_header" width="100%">
17     <tr>
18      <td><img src="<%= $cid ? "cid:$cid" : "cust_bill-logo.cgi?$template" %>"></td>
19      <td align="left"><%= $returnaddress %></td>
20       <td align="right">
21         <table CLASS="invoice_headerright" cellspacing=0>
22           <tr>
23             <td align="center">
24               Invoice&nbsp;date<BR>
25               <B><%= $date %></B>
26             </td>
27             <td>
28             </td>
29             <td align="center">
30               Invoice&nbsp;#<BR>
31               <B><%= $invnum %></B>
32             </td>
33             <td>
34             </td>
35             <td align="center">
36               Customer #<BR>
37               <B><%= $custnum %></B>
38             </td>
39           </tr>
40           <tr>
41             <th>&nbsp;</th>
42             <th colspan=3 align="center">
43               <FONT SIZE="+3">I</FONT><FONT SIZE="+2">NVOICE</FONT>
44             </th>
45             <th>&nbsp;</th>
46           </tr>
47         </table>
48       </td>
49     </tr>
50
51     <tr>
52       <td>
53       </td>
54       <td align="left">
55         <b><%= $payname %></b><BR>
56         <%= join('<BR>', grep length($_), $company,
57                                           $address1,
58                                           $address2,
59                                           "$city,&nbsp;$state&nbsp;&nbsp;$zip",
60                                           $country,
61                 )
62         %>
63       </td>
64       <%= $ship_enable ? ('<td align="left">'.
65                           join('<BR>',grep length($_), '<b>Service Address</b>',
66                                                        $ship_company,
67                                                        $ship_address1,
68                                                        $ship_address2,
69                                                        "$ship_city,&nbsp;$ship_state&nbsp;$ship_zip",
70                                                        $ship_country,
71                                                        ' ',
72                                                        ' ',
73                               ).
74                            ($agent_custid ? "<b>ID:</b> $agent_custid<BR>" : '').
75                            ($ship_fax ? "<b>Fax:</b> $ship_fax<BR>" : '').
76                            '</td><tr><td></td><td></td>'
77                          )
78                        : ''
79       %>
80       <td align="right">
81         Terms: <%= $terms %><BR>
82         <%= $po_line %>
83       </td>
84     </tr>
85
86   </table>
87
88   <%=
89       foreach my $section ( @sections ) {
90         if ($section->{'pretotal'}) {
91           $OUT .=
92             '<table width="100%"><tr><td>'.
93             '<p align="right"><b><font size="+1">'.
94             uc(substr($section->{'pretotal'},0,1)).
95             '</font><font size="+0">'. uc(substr($section->{'pretotal'},1)).
96             '</font></b>'.
97             '<p>'.
98             '</td></tr></table>';
99         }
100         $OUT .= '<table><tr><td>';
101         if ($section->{'description'}) {
102           $OUT .=
103             '<p><b><font size="+1">'. uc(substr($section->{'description'},0,1)).
104             '</font><font size="+0">'. uc(substr($section->{'description'},1)).
105             '</font></b>'.
106             '<p>';
107         }else{
108           $OUT .=
109             '<p><b><font size="+1">C</font><font size="+0">HARGES</font></b>'.
110             '<p>';
111         }
112         $OUT .= '</td></tr></table>';
113
114         $OUT .=
115           '<table class="invoice_longtable" CELLSPACING=0 WIDTH="100%">'.
116           '<tr>'.
117             '<th align="center">Ref</th>'.
118             '<th align="left">Description</th>'.
119             ( $unitprices 
120                 ? '<th align="left">Unit Price</th>'.
121                   '<th align="left">Quantity</th>'
122                 : ''
123               ).
124             '<th align="right">Amount</th>'.
125           '</tr>';
126
127         my $lastref = 0;
128         foreach my $line (
129           grep { ( scalar(@sections) > 1 
130                  ? $section->{'description'} eq $_->{'section'}->{'description'}
131                  : 1
132                ) }
133           @detail_items )
134         {
135           $OUT .=
136             '<tr class="invoice_desc'.
137               ( ($line->{'ref'} && $line->{'ref'} ne $lastref) ? '' : '_more' ).
138               '">'.
139               '<td align="center">'. 
140               ( $line->{'ref'} ne $lastref ? $line->{'ref'} : '' ). '</td>'.
141               '<td align="left">'. $line->{'description'}. '</td>'.
142               ( $unitprices 
143                   ? '<td align="left">'. $line->{'unit_amount'}. '</td>'.
144                     '<td align="left">'. $line->{'quantity'}. '</td>'
145                   : ''
146               ).
147
148               '<td align="right">'. $line->{'amount'}. '</td>'.
149             '</tr>'
150           ;
151           $lastref = $line->{'ref'};
152           if ( @{$line->{'ext_description'} } ) {
153             $OUT .= '<tr class="invoice_extdesc"><td></td><td';
154             $OUT .= $unitprices ? ' colspan=3>' : '>';
155             $OUT .= '<table width="100%">';
156             foreach my $ext_desc ( @{$line->{'ext_description'} } ) {
157               $OUT .=
158                 '<tr class="invoice_extdesc">'.
159                   '<td align="left">&nbsp;&nbsp;'. $ext_desc. '</td>'.
160                 '</tr>'
161             }
162             $OUT .= '</table></td><td></td></tr>';
163           }
164         }
165
166
167         if (scalar(@sections) > 1) {
168           my $style = 'border-top: 3px solid #000000;'.
169                       'border-bottom: 3px solid #000000;';
170           $OUT .=
171             '<tr class="invoice_totaldesc">'.
172               qq(<td style="$style">&nbsp;</td>).
173               qq(<td align="left" style="$style"). 
174                 ( $unitprices ? ' colspan=3>' : '>' ).
175                 $section->{'description'}. ' Total </td>'.
176               qq(<td align="right" style="$style">).
177                 $section->{'subtotal'}. '</td>'.
178             '</tr>'
179         ;
180         }
181
182         if ($section->{'posttotal'}) {
183           $OUT .= '<tr><td align="right" colspan=5>';
184           $OUT .=
185             '<p><font size="+1">'. $section->{'posttotal'}.
186             '</font>'.
187             '<p>';
188           $OUT .= '</td></tr>';
189         }
190
191       }
192
193       my $style = 'border-top: 3px solid #000000;';
194       my $linenum = 0;
195
196       foreach my $line ( @total_items ) {
197
198         $style .= 'border-bottom: 3px solid #000000;'
199           if ++$linenum == scalar(@total_items);
200
201         $OUT .=
202           '<tr class="invoice_totaldesc">'.
203             qq(<td style="$style">&nbsp;</td>).
204             qq(<td align="left" style="$style").
205             ( $unitprices ? ' colspan=3>' : '>' ).
206               $line->{'total_item'}. '</td>'.
207             qq(<td align="right" style="$style">).
208               $line->{'total_amount'}. '</td>'.
209           '</tr>'
210         ;
211
212         $style='';
213
214       }
215
216     %>
217   </table>
218   <br><br>
219
220 <%= $notes %>
221
222   <hr NOSHADE SIZE=2 COLOR="#000000">
223   <p align="center"><%= $footer %>
224
225 </td></tr></table>