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