7cadd7c37df0a62a65b2ab6c86a9213b138058e0
[freeside.git] / conf / invoice_html
1 <STYLE TYPE="text/css">
2 .invoice {
3   font-family: sans-serif;
4   font-size: 10pt;
5   display: inline-block;
6   padding: 4pt;
7   border: 1px solid black;
8   background-color: white;
9   min-width: 625px;
10   position: relative;
11 }
12 .invoice_header {
13   font-size: 10pt;
14   border-spacing: 4pt;
15 }
16 .invoice_headerright TH { border-top: 2px solid #000000; border-bottom: 2px solid #000000 }
17 .invoice_headerright TD { font-size: 10pt; empty-cells: show }
18 .invoice_summary TH { border-bottom: 2px solid #000000 }
19 .invoice_summary TD { font-size: 10pt; empty-cells: show }
20 .invoice_longtable table { cellspacing: none }
21 .invoice_longtable TH { border-top: 2px solid #000000; border-bottom: 1px solid #000000; padding-left: none; padding-right: none; font-size: 10pt }
22 .invoice_desc TD { border-top: 2px solid #000000; font-weight: bold; font-size: 10pt }
23 .invoice_desc_more TD { font-weight: bold; font-size: 10pt }
24 .invoice_extdesc TD { font-size: 8pt }
25 .invoice_totaldesc TD { font-size: 10pt; empty-cells: show }
26 .allcaps { text-transform:uppercase; font-size: 12pt }
27 .watermark-box {
28   z-index: 10;
29   position: absolute;
30   text-align: center;
31   padding: 0;
32   filter: alpha(opacity=25);
33   opacity: 0.25;
34   width: 100%;
35   height: 100%;
36   display: table;
37 }
38 .watermark-content {
39   display: table-cell;
40   vertical-align: middle;
41   font-size: 96pt;
42 }
43 </STYLE>
44
45 <div class="invoice">
46
47   <DIV CLASS="watermark-box"><DIV CLASS="watermark-content">
48       <%= $watermark %>
49   </DIV></DIV>
50
51   <table class="invoice_header" width="100%">
52     <tr>
53      <td><img src="<%= $cid ? "cid:$cid" : "cust_bill-logo.cgi?invnum=$invnum;template=$template" %>"></td>
54      <td align="left"><%= $returnaddress %></td>
55       <td align="right">
56         <table CLASS="invoice_headerright" cellspacing=0>
57           <tr>
58             <td align="center">
59               <%= emt('Invoice date') %><BR>
60               <B><%= $date %></B>
61             </td>
62             <td>
63             </td>
64             <td align="center">
65               <%= emt('Invoice #') %><BR>
66               <B><%= $invnum %></B>
67             </td>
68             <td>
69             </td>
70             <td align="center">
71               <%= emt('Customer #') %><BR>
72               <B><%= $custnum %></B>
73             </td>
74           </tr>
75           <tr>
76             <th>&nbsp;</th>
77             <th colspan=3 align="center" class="allcaps">
78               <FONT SIZE="+3"><%= substr(emt($notice_name),0,1) %></FONT><FONT SIZE="+2"><%= substr(emt($notice_name),1) %></FONT>
79             </th>
80             <th>&nbsp;</th>
81           </tr>
82         </table>
83       </td>
84     </tr>
85
86     <tr>
87       <td>
88       </td>
89       <td align="left">
90         <b><%= $payname %></b><BR>
91         <%= join('<BR>', grep length($_), $company,
92                                           $address1,
93                                           $address2,
94                                           "$city,&nbsp;$state&nbsp;&nbsp;$zip",
95                                           $country,
96                 )
97         %>
98       </td>
99       <%= $ship_enable ? ('<td align="left">'.
100                           join('<BR>',grep length($_), '<b>'.emt('Service Address').'</b>',
101                                                        $ship_company,
102                                                        $ship_address1,
103                                                        $ship_address2,
104                                                        "$ship_city,&nbsp;$ship_state&nbsp;$ship_zip",
105                                                        $ship_country,
106                                                        ' ',
107                                                        ' ',
108                               ).
109                            '</td><tr><td></td><td></td>'
110                          )
111                        : ''
112       %>
113       <td align="right">
114     <%=
115         if($barcode_cid) {
116             $OUT .= qq! <img src="cid:$barcode_cid"><br> !;
117         }
118         elsif($barcode_img) {
119             $OUT .= qq! <img src="cust_bill-barcode.cgi?invnum=$invnum;template=$template"><br> !;
120         }
121     %>
122         <%= $terms ? emt('Terms') . ": $terms" : '' %><BR>
123         <%= $po_line %>
124       </td>
125     </tr>
126
127   </table>
128   <%= $summary %>
129   <%=
130       my $notfirst = 0;
131       my $columncount = $unitprices ? 5 : 3;
132       foreach my $section ( grep { !$summary || $_->{description} ne $finance_section } @sections ) {
133         if ($section->{'pretotal'} && !$summary) {
134           $OUT .= '</table>' if $notfirst;
135           $OUT .=
136             '<table width="100%"><tr><td>'.
137             '<p align="right"><b><font size="+1">'.
138             uc(substr($section->{'pretotal'},0,1)).
139             '</font><font size="+0">'. uc(substr($section->{'pretotal'},1)).
140             '</font></b>'.
141             '<p>'.
142             '</td></tr>';
143         }
144         unless ($section->{'summarized'}) {
145           $OUT .= '</table>' if ( $notfirst || $section->{'pretotal'} && !$summary );
146           $OUT .= '<table><tr><td>';
147           $OUT .= '<p class="allcaps"><b>';
148           my $sectionhead;
149           if ( $section->{'location'} ) {
150             $sectionhead .= $section->{'location'}{'label_prefix'}. ': '
151               if length($section->{'location'}{'label_prefix'});
152             $sectionhead = $section->{'location'}{'address1'};
153             $sectionhead .= ', '.$section->{'location'}{'address2'}
154               if length($section->{'location'}{'address2'});
155             $sectionhead .= ', ' .
156                             $section->{'location'}{'city'} . ', ' .
157                             $section->{'location'}{'state'} . ' ' .
158                             $section->{'location'}{'zip'};
159             $OUT .= $sectionhead;
160           } else {
161             $sectionhead = $section->{'description'} || emt('Charges');
162             $OUT .= '<font size="+1">'. substr($sectionhead,0,1).
163               '</font><font size="+0">'. substr($sectionhead,1).
164           
165               '</font>';
166           }
167           $OUT .= '</b></p></td></tr></table>';
168
169           $OUT .=
170             '<table class="invoice_longtable" CELLSPACING=0 WIDTH="100%">'.
171             '<tr>';
172
173           if ($section->{header_generator}) {
174             my $header = &{$section->{header_generator}}();
175             $OUT .= $header;
176             $columncount = scalar(my @array = split /<\/th><th/i, $header);
177           } else {
178             $OUT .=  '<th align="center"></th>'.
179                      '<th align="left">' . emt('Description') . '</th>'.
180                      ( $unitprices 
181                        ? '<th align="right">' . emt('Unit Price') . '</th>'.
182                          '<th align="right">' . emt('Quantity') . '</th>'
183                         : '' ).
184                      '<th align="right">' . emt('Amount') . '</th>';
185           }
186             $OUT .= '</tr>';
187
188           my $lastref = 0;
189           foreach my $line (
190             grep { ( scalar(@sections) > 1 
191                    ? $section->{'description'} eq $_->{'section'}->{'description'}
192                    : 1
193                  ) }
194             @detail_items )
195           {
196             if ( $section->{description_generator} ) {
197               $OUT .= '<tr class="invoice_desc' .
198                       &{$section->{description_generator}}($line);
199             } else {
200               my $class = 'invoice_desc_more';
201               if ( ($line->{'ref'} || 0) ne $lastref ) {
202                 # then it's a new package (not a continuation)
203                 $class = 'invoice_desc';
204               }
205               $OUT .= '<tr class="'.$class.'">
206                        <td align="center">';
207               $OUT .= '</td>
208                        <td align="left">'. $line->{'description'}. '</td>';
209               if ( $unitprices ) {
210                 $OUT .= 
211                   '<td align="right">'. $line->{'unit_amount'}. '</td>'.
212                   '<td align="right">'. $line->{'quantity'}. '</td>';
213               }
214               $OUT .= '<td align="right">'. $line->{'amount'}. '</td>';
215             }
216             $OUT .= '</tr>';
217             $lastref = $line->{'ref'} || 0;
218             if ( @{$line->{'ext_description'} } ) {
219               unless ( $section->{description_generator} ) {
220                 $OUT .= '<tr class="invoice_extdesc"><td></td><td';
221                 $OUT .= $unitprices ? ' colspan=3' : '';
222                 $OUT .= '><table width="100%">';
223               }
224               foreach my $ext_desc ( @{$line->{'ext_description'} } ) {
225                 $OUT .=
226                   '<tr class="invoice_extdesc">'.
227                     ( $section->{'description_generator'} ? '<td></td>' : '' ).
228                     '<td align="left" '.
229                          ( $ext_desc =~ /<\/?TD>/i ? '' : 'colspan=99' ). '>'.
230                       '&nbsp;&nbsp;'. $ext_desc.
231                     '</td>'.
232                   '</tr>'
233               }
234               unless ( $section->{description_generator} ) {
235                 $OUT .= '</table></td><td></td>';
236               }
237               $OUT .= '</tr>';
238             }
239           }
240
241
242           if ($section->{'description'} || $multisection and !$section->{no_subtotal}) {
243             my $style = 'border-top: 3px solid #000000;'.
244                         'border-bottom: 3px solid #000000;';
245             $OUT .=
246               '<tr class="invoice_totaldesc">'.
247               qq(<td style="$style">&nbsp;</td>);
248             if ($section->{total_generator}) {
249               $OUT .= &{$section->{total_generator}}($section);
250             } else {
251               $OUT .= qq(<td align="left" style="$style"). 
252                       ( $unitprices ? ' colspan=3>' : '>' ).
253                       $section->{'description'}. ' ' . emt('Total') . '</td>'.
254                       qq(<td align="right" style="$style">).
255                       $section->{'subtotal'}. '</td>';
256             }
257             $OUT .= '</tr>';
258           }
259         } 
260         if ($section->{'posttotal'}) {
261           $OUT .= '<tr><td align="right" colspan='. $columncount. '>';
262           $OUT .=
263             '<p><font size="+1">'. $section->{'posttotal'}.
264             '</font>'.
265             '<p>';
266           $OUT .= '</td></tr>';
267         }
268
269         $notfirst++;
270
271       }
272
273       my $style = 'border-top: 3px solid #000000;';
274       my $linenum = 0;
275
276       foreach my $line ( @total_items ) {
277
278         $style .= 'border-bottom: 3px solid #000000;'
279           if ++$linenum == scalar(@total_items) - ( $balance_due_below_line ? 1 : 0 );
280
281         $OUT .=
282           '<tr class="invoice_totaldesc">';
283         if ($section->{total_line_generator}) {
284           $OUT .= &{$section->{total_line_generator}}($line);
285         } else {
286           $OUT .= qq(<td style="$style">&nbsp;</td>).
287                   qq(<td align="left" style="$style" colspan=").
288                     ( $columncount - 2 ). '">'.
289                     $line->{'total_item'}. '</td>'.
290                   qq(<td align="right" style="$style">).
291                     $line->{'total_amount'}. '</td>';
292         }
293         $OUT .= '</tr>';
294
295         $style='';
296
297       }
298
299     %>
300   </table>
301   <br><br>
302
303 <%= length($summary)
304       ? ''
305       : ( $smallernotes
306             ? '<FONT SIZE="-1">'.$notes.'</FONT>'
307             : $notes
308         )
309 %>
310
311   <hr NOSHADE SIZE=2 COLOR="#000000">
312   <p align="center" <%= $smallerfooter ? 'STYLE="font-size:75%;"' : '' %>><%= $footer %>
313
314 </div>