289ada1da1dafe73d4535950ccba7239c626d5bd
[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_summary TH { border-bottom: 2px solid #000000 }
7 .invoice_summary TD { font-size: 10pt; empty-cells: show }
8 .invoice_longtable table { cellspacing: none }
9 .invoice_longtable TH { border-top: 2px solid #000000; border-bottom: 1px solid #000000; padding-left: none; padding-right: none; font-size: 10pt }
10 .invoice_desc TD { border-top: 2px solid #000000; font-weight: bold; font-size: 10pt }
11 .invoice_desc_more TD { font-weight: bold; font-size: 10pt }
12 .invoice_extdesc TD { font-size: 8pt }
13 .invoice_totaldesc TD { font-size: 10pt; empty-cells: show }
14 </STYLE>
15
16 <table class="invoice" bgcolor="#ffffff" WIDTH=625 CELLSPACING=8><tr><td>
17
18   <table class="invoice_header" width="100%">
19     <tr>
20      <td><img src="<%= $cid ? "cid:$cid" : "cust_bill-logo.cgi?invnum=$invnum;template=$template" %>"></td>
21      <td align="left"><%= $returnaddress %></td>
22       <td align="right">
23         <table CLASS="invoice_headerright" cellspacing=0>
24           <tr>
25             <td align="center">
26               Invoice&nbsp;date<BR>
27               <B><%= $date %></B>
28             </td>
29             <td>
30             </td>
31             <td align="center">
32               Invoice&nbsp;#<BR>
33               <B><%= $invnum %></B>
34             </td>
35             <td>
36             </td>
37             <td align="center">
38               Customer&nbsp;#<BR>
39               <B><%= $custnum %></B>
40             </td>
41           </tr>
42           <tr>
43             <th>&nbsp;</th>
44             <th colspan=3 align="center">
45               <FONT SIZE="+3"><%= $notice_name ? substr($notice_name, 0, 1) : 'I' %></FONT><FONT SIZE="+2"><%= $notice_name ? uc(substr($notice_name, 1)) : 'NVOICE' %></FONT>
46             </th>
47             <th>&nbsp;</th>
48           </tr>
49         </table>
50       </td>
51     </tr>
52
53     <tr>
54       <td>
55       </td>
56       <td align="left">
57         <b><%= $payname %></b><BR>
58         <%= join('<BR>', grep length($_), $company,
59                                           $address1,
60                                           $address2,
61                                           "$city,&nbsp;$state&nbsp;&nbsp;$zip",
62                                           $country,
63                 )
64         %>
65       </td>
66       <%= $ship_enable ? ('<td align="left">'.
67                           join('<BR>',grep length($_), '<b>Service Address</b>',
68                                                        $ship_company,
69                                                        $ship_address1,
70                                                        $ship_address2,
71                                                        "$ship_city,&nbsp;$ship_state&nbsp;$ship_zip",
72                                                        $ship_country,
73                                                        ' ',
74                                                        ' ',
75                               ).
76                            '</td><tr><td></td><td></td>'
77                          )
78                        : ''
79       %>
80       <td align="right">
81     <%=
82         if($barcode_cid) {
83             $OUT .= qq! <img src="cid:$barcode_cid"><br> !;
84         }
85         elsif($barcode_img) {
86             $OUT .= qq! <img src="cust_bill-barcode.cgi?invnum=$invnum;template=$template"><br> !;
87         }
88     %>
89         <%= $terms ? "Terms: $terms" : '' %><BR>
90         <%= $po_line %>
91       </td>
92     </tr>
93
94   </table>
95   <%= $summary %>
96   <%=
97       my $notfirst = 0;
98       my $columncount = $unitprices ? 5 : 3;
99       foreach my $section ( grep { !$summary || $_->{description} ne $finance_section } @sections ) {
100         if ($section->{'pretotal'} && !$summary) {
101           $OUT .= '</table>' if $notfirst;
102           $OUT .=
103             '<table width="100%"><tr><td>'.
104             '<p align="right"><b><font size="+1">'.
105             uc(substr($section->{'pretotal'},0,1)).
106             '</font><font size="+0">'. uc(substr($section->{'pretotal'},1)).
107             '</font></b>'.
108             '<p>'.
109             '</td></tr>';
110         }
111         unless ($section->{'summarized'}) {
112           $OUT .= '</table>' if ( $notfirst || $section->{'pretotal'} && !$summary );
113           $OUT .= '<table><tr><td>';
114           if ($section->{'description'}) {
115             $OUT .=
116               '<p><b><font size="+1">'. uc(substr($section->{'description'},0,1)).
117               '</font><font size="+0">'. uc(substr($section->{'description'},1)).
118               '</font></b>'.
119               '<p>';
120           }else{
121             $OUT .=
122               '<p><b><font size="+1">C</font><font size="+0">HARGES</font></b>'.
123               '<p>';
124           }
125           $OUT .= '</td></tr></table>';
126
127           $OUT .=
128             '<table class="invoice_longtable" CELLSPACING=0 WIDTH="100%">'.
129             '<tr>';
130
131           if ($section->{header_generator}) {
132             my $header = &{$section->{header_generator}}();
133             $OUT .= $header;
134             $columncount = scalar(my @array = split /<\/th><th/i, $header);
135           } else {
136             $OUT .=  '<th align="center">Ref</th>'.
137                      '<th align="left">Description</th>'.
138                         ( $unitprices 
139                           ? '<th align="left">Unit Price</th>'.
140                             '<th align="left">Quantity</th>'
141                           : ''
142                         ). 
143                       '<th align="right">Amount</th>';
144           }
145             $OUT .= '</tr>';
146
147           my $lastref = 0;
148           foreach my $line (
149             grep { ( scalar(@sections) > 1 
150                    ? $section->{'description'} eq $_->{'section'}->{'description'}
151                    : 1
152                  ) }
153             @detail_items )
154           {
155             $OUT .=
156               '<tr class="invoice_desc';
157             if ( $section->{description_generator} ) {
158               $OUT .= &{$section->{description_generator}}($line);
159             } else {
160               $OUT .=  ( ($line->{'ref'} && $line->{'ref'} ne $lastref) ? '' : '_more' ).
161                        '">'.
162                        '<td align="center">'. 
163                        ( $line->{'ref'} ne $lastref ? $line->{'ref'} : '' ). '</td>'.
164                        '<td align="left">'. $line->{'description'}. '</td>'.
165                        ( $unitprices 
166                            ? '<td align="left">'. $line->{'unit_amount'}. '</td>'.
167                              '<td align="left">'. $line->{'quantity'}. '</td>'
168                            : ''
169                        ).
170
171                        '<td align="right">'. $line->{'amount'}. '</td>';
172             }
173             $OUT .= '</tr>';
174             $lastref = $line->{'ref'};
175             if ( @{$line->{'ext_description'} } ) {
176               unless ( $section->{description_generator} ) {
177                 $OUT .= '<tr class="invoice_extdesc"><td></td><td';
178                 $OUT .= $unitprices ? ' colspan=3' : '';
179                 $OUT .= '><table width="100%">';
180               }
181               foreach my $ext_desc ( @{$line->{'ext_description'} } ) {
182                 $OUT .=
183                   '<tr class="invoice_extdesc">'.
184                     ( $section->{'description_generator'} ? '<td></td>' : '' ).
185                     '<td align="left" '.
186                          ( $ext_desc =~ /<\/?TD>/i ? '' : 'colspan=99' ). '>'.
187                       '&nbsp;&nbsp;'. $ext_desc.
188                     '</td>'.
189                   '</tr>'
190               }
191               unless ( $section->{description_generator} ) {
192                 $OUT .= '</table></td><td></td>';
193               }
194               $OUT .= '</tr>';
195             }
196           }
197
198
199           if ($section->{'description'} || $multisection) {
200             my $style = 'border-top: 3px solid #000000;'.
201                         'border-bottom: 3px solid #000000;';
202             $OUT .=
203               '<tr class="invoice_totaldesc">'.
204               qq(<td style="$style">&nbsp;</td>);
205             if ($section->{total_generator}) {
206               $OUT .= &{$section->{total_generator}}($section);
207             } else {
208               $OUT .= qq(<td align="left" style="$style"). 
209                       ( $unitprices ? ' colspan=3>' : '>' ).
210                       $section->{'description'}. ' Total </td>'.
211                       qq(<td align="right" style="$style">).
212                       $section->{'subtotal'}. '</td>';
213             }
214             $OUT .= '</tr>';
215           }
216         } 
217         if ($section->{'posttotal'}) {
218           $OUT .= '<tr><td align="right" colspan='. $columncount. '>';
219           $OUT .=
220             '<p><font size="+1">'. $section->{'posttotal'}.
221             '</font>'.
222             '<p>';
223           $OUT .= '</td></tr>';
224         }
225
226         $notfirst++;
227
228       }
229
230       my $style = 'border-top: 3px solid #000000;';
231       my $linenum = 0;
232
233       foreach my $line ( @total_items ) {
234
235         $style .= 'border-bottom: 3px solid #000000;'
236           if ++$linenum == scalar(@total_items) - ( $balance_due_below_line ? 1 : 0 );
237
238         $OUT .=
239           '<tr class="invoice_totaldesc">';
240         if ($section->{total_line_generator}) {
241           $OUT .= &{$section->{total_line_generator}}($line);
242         } else {
243           $OUT .= qq(<td style="$style">&nbsp;</td>).
244                   qq(<td align="left" style="$style" colspan=").
245                     ( $columncount - 2 ). '">'.
246                     $line->{'total_item'}. '</td>'.
247                   qq(<td align="right" style="$style">).
248                     $line->{'total_amount'}. '</td>';
249         }
250         $OUT .= '</tr>';
251
252         $style='';
253
254       }
255
256     %>
257   </table>
258   <br><br>
259
260 <%= length($summary)
261       ? ''
262       : ( $smallernotes
263             ? '<FONT SIZE="-1">'.$notes.'</FONT>'
264             : $notes
265         )
266 %>
267
268   <hr NOSHADE SIZE=2 COLOR="#000000">
269   <p align="center" <%= $smallerfooter ? 'STYLE="font-size:75%;"' : '' %>><%= $footer %>
270
271 </td></tr></table>