summaryrefslogtreecommitdiff
path: root/conf/invoice_html
blob: 9d97243e4d0b41e4b98bb0ed9888d4d3b9016ddf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<STYLE TYPE="text/css">
.invoice { font-family: sans-serif; font-size: 10pt }
.invoice_header { font-size: 10pt }
.invoice_headerright TH { border-top: 2px solid #000000; border-bottom: 2px solid #000000 }
.invoice_headerright TD { font-size: 10pt; empty-cells: show }
.invoice_longtable table { cellspacing: none }
.invoice_longtable TH { border-top: 2px solid #000000; border-bottom: 1px solid #000000; padding-left: none; padding-right: none; font-size: 10pt }
.invoice_desc TD { border-top: 2px solid #000000; font-weight: bold; font-size: 10pt }
.invoice_extdesc TD { font-size: 8pt }
.invoice_totaldesc TD { font-size: 10pt; empty-cells: show }
</STYLE>

<table class="invoice" bgcolor="#ffffff" WIDTH=768 CELLSPACING=8><tr><td>

  <table class="invoice_header" width="100%">
    <tr>
     <td><img src="<%= $cid ? "cid:$cid" : "cust_bill-logo.cgi?$template" %>"></td>
     <td align="left"><%= $returnaddress %></td>
      <td align="right">
        <table CLASS="invoice_headerright" cellspacing=0>
          <tr>
            <td align="right">
              Invoice&nbsp;date<BR>
              <B><%= $date %></B>
            </td>
            <td>
            </td>
            <td align="center">
              Invoice&nbsp;#<BR>
              <B><%= $invnum %></B>
            </td>
            <td>
            </td>
            <td align="center">
              Customer #<BR>
              <B><%= $custnum %></B>
            </td>
          </tr>
          <tr>
            <th>&nbsp;</th>
            <th colspan=3 align="center">
              <FONT SIZE="+3">I</FONT><FONT SIZE="+2">NVOICE</FONT>
            </th>
            <th>&nbsp;</th>
          </tr>
        </table>
      </td>
    </tr>

    <tr>
      <td>
      </td>
      <td align="left">
        <b><%= $payname %></b><BR>
        <%= join('<BR>', grep length($_), $company,
                                          $address1,
                                          $address2,
                                          "$city,&nbsp;$state&nbsp;&nbsp;$zip",
                                          $country,
                )
        %>
      </td>
      <td align="right">
        Terms: <%= $terms %><BR>
        <%= $po_line %>
      </td>
    </tr>

  </table>

  <%=
      foreach my $section ( @sections ) {
        $OUT .= '<table><tr><td>';
        if ($section->{'description'}) {
          $OUT .=
            '<p><b><font size="+1">'. uc(substr($section->{'description'},0,1)).
            '</font><font size="+0">'. uc(substr($section->{'description'},1)).
            '</font></b>'.
            '<p>';
        }else{
          $OUT .=
            '<p><b><font size="+1">C</font><font size="+0">HARGES</font></b>'.
            '<p>';
        }
        $OUT .= '</td></tr></table>';

        $OUT .=
          '<table class="invoice_longtable" CELLSPACING=0 WIDTH="100%">'.
          '<tr>'.
            '<th align="center">Ref</th>'.
            '<th align="left">Description</th>'.
            '<th align="right">Amount</th>'.
          '</tr>';

        foreach my $line (
          grep { ( scalar(@sections) > 1 
                 ? $section->{'description'} eq $_->{'section'}->{'description'}
                 : 1
               ) }
          @detail_items )
        {
          $OUT .=
            '<tr class="invoice_desc">'.
              '<td align="center">'. $line->{'ref'}. '</td>'.
              '<td align="left">'. $line->{'description'}. '</td>'.
              '<td align="right">'. $line->{'amount'}. '</td>'.
            '</tr>'
          ;
          foreach my $ext_desc ( @{$line->{'ext_description'} } ) {
            $OUT .=
              '<tr class="invoice_extdesc">'.
                '<td></td>'.
                '<td align="left">-&nbsp;'. $ext_desc. '</td>'.
                '<td></td>'.
              '</tr>'
          }
        }


        if (scalar(@sections) > 1) {
          my $style = 'border-top: 3px solid #000000;'.
                      'border-bottom: 3px solid #000000;';
          $OUT .=
            '<tr class="invoice_totaldesc">'.
              qq(<td style="$style">&nbsp;</td>).
              qq(<td align="left" style="$style">).
                $section->{'description'}. ' Total </td>'.
              qq(<td align="right" style="$style">).
                $section->{'subtotal'}. '</td>'.
            '</tr>'
        ;
        }
      }

      my $style = 'border-top: 3px solid #000000;';
      my $linenum = 0;

      foreach my $line ( @total_items ) {

        $style .= 'border-bottom: 3px solid #000000;'
          if ++$linenum == scalar(@total_items);

        $OUT .=
          '<tr class="invoice_totaldesc">'.
            qq(<td style="$style">&nbsp;</td>).
            qq(<td align="left" style="$style">).
              $line->{'total_item'}. '</td>'.
            qq(<td align="right" style="$style">).
              $line->{'total_amount'}. '</td>'.
          '</tr>'
        ;

        $style='';

      }

    %>
  </table>
  <br><br>

<%= $notes %>

  <hr NOSHADE SIZE=2 COLOR="#000000">
  <p align="center"><%= $footer %>

</td></tr></table>