1 %% file: Standard Multipage.tex
\r
2 %% Purpose: Multipage bill template for e-Bills
\r
4 %% Created by Mark Asplen-Taylor
\r
5 %% Asplen Management Ltd
\r
8 %% Modified for Freeside by Kristian Hoffman
\r
11 %% 0.1 4/12/00 Created
\r
12 %% 0.2 18/10/01 More fields added
\r
13 %% 1.0 16/11/01 RELEASED
\r
14 %% 1.2 16/10/02 Invoice number added
\r
15 %% 1.3 2/12/02 Logo graphic added
\r
16 %% 1.4 7/2/03 Multipage headers/footers added
\r
17 %% n/a forked for Freeside; checked into CVS
\r
20 \documentclass[letterpaper]{article}
\r
22 \usepackage{fancyhdr,lastpage,ifthen,longtable,afterpage,multirow,bigstrut}
\r
23 \usepackage{graphicx} % required for logo graphic
\r
25 \addtolength{\voffset}{-0.0cm} % top margin to top of header
\r
26 \addtolength{\hoffset}{-0.6cm} % left margin on page
\r
27 \addtolength{\topmargin}{-1.25cm} % top margin to top of header
\r
28 \setlength{\headheight}{2.0cm} % height of header
\r
29 \setlength{\headsep}{1.0cm} % between header and text
\r
30 \setlength{\footskip}{1.0cm} % bottom of footer from bottom of text
\r
32 %\addtolength{\textwidth}{2.1in} % width of text
\r
33 \setlength{\textwidth}{19.5cm}
\r
34 \setlength{\textheight}{19.5cm}
\r
35 \setlength{\oddsidemargin}{-0.9cm} % odd page left margin
\r
36 \setlength{\evensidemargin}{-0.9cm} % even page left margin
\r
38 \renewcommand{\headrulewidth}{0pt}
\r
39 \renewcommand{\footrulewidth}{1pt}
\r
41 \renewcommand{\footrule}{
\r
43 $coupon ? '\ifthenelse{\equal{\thepage}{1}}' : '';
\r
48 \vbox to 0pt{\rule{\headwidth}{\footrulewidth}\vss}
\r
52 \newcommand{\extracouponspace}{3.6cm}
\r
54 % Adjust the inset of the mailing address
\r
55 \newcommand{\addressinset}[1][]{\hspace{1.0cm}}
\r
57 % Adjust the inset of the return address and logo
\r
58 \newcommand{\returninset}[1][]{\hspace{-0.25cm}}
\r
60 % New command for address lines i.e. skip them if blank
\r
61 \newcommand{\addressline}[1]{\ifthenelse{\equal{#1}{}}{}{#1\\}}
\r
63 % Inserts dollar symbol
\r
64 \newcommand{\dollar}[1][]{\symbol{36}}
\r
66 % Remove plain style header/footer
\r
67 \fancypagestyle{plain}{
\r
72 % Define fancy header/footer for first and subsequent pages
\r
74 \ifthenelse{\equal{\thepage}{1}}
\r
78 $OUT .= '\vspace{-\extracouponspace}';
\r
79 $OUT .= '\rule[0.5em]{\textwidth}{\footrulewidth}\\\\';
\r
85 }[@-- $coupon ? '\vspace{\extracouponspace}' : '' --@]
\r
89 [@-- $smallfooter --@]
\r
95 \ifthenelse{\equal{\thepage}{1}}
\r
99 \small{\thepage\ of \pageref{LastPage}}
\r
104 \ifthenelse{\equal{\thepage}{1}}
\r
108 \begin{tabular}{ll}
\r
109 \includegraphics{[@-- $conf_dir --@]/logo.eps} &
\r
110 \begin{minipage}[b]{5.5cm}
\r
111 [@-- $returnaddress --@]
\r
117 %\includegraphics{[@-- $conf_dir --@]/logo.eps} % Uncomment if you want the logo on all pages.
\r
122 \ifthenelse{\equal{\thepage}{1}}
\r
124 \begin{tabular}{ccc}
\r
125 Invoice date & Invoice \#& Customer\#\\
\r
127 \textbf{[@-- $date --@]} & \textbf{[@-- $invnum --@]} & \textbf{[@-- $custnum --@]} \\\hline
\r
128 \rule{0pt}{5ex} &~~ \huge{\textsc{Invoice}} & \\
\r
135 \begin{tabular}{lll}
\r
136 Invoice date & Invoice \#& Customer\#\\
\r
137 \textbf{[@-- $date --@]} & \textbf{[@-- $invnum --@]} & \textbf{[@-- $custnum --@]}\\
\r
146 %% Font options are:
\r
147 %% bch Bitsream Charter
\r
149 %% phv Adobe Helvetica
\r
150 %% pnc New Century Schoolbook
\r
154 \renewcommand{\familydefault}{phv}
\r
157 % Commands for freeside table header...
\r
158 \newcommand{\FShead}{
\r
161 \makebox[1.4cm]{\textbf{Ref}} &
\r
162 \makebox[2.9cm][l]{\textbf{Description}}&
\r
163 \makebox[1.4cm][l]{}&
\r
164 \makebox[1.4cm][l]{}&
\r
165 \makebox[2.5cm][l]{}&
\r
166 \makebox[2.5cm][l]{\textbf{[@-- $unitprices ? '~~Unit Price' : '' --@]}}&
\r
167 \makebox[1.4cm]{\textbf{[@-- $unitprices ? '~Quantity' : '' --@]}}&
\r
168 \makebox[1.6cm][r]{\textbf{Amount}} \\
\r
172 % ...description...
\r
173 \newcommand{\FSdesc}[5]{
\r
174 \multicolumn{1}{c}{\rule{0pt}{2.5ex}\textbf{#1}} &
\r
175 \multicolumn{4}{l}{\textbf{#2}} &
\r
176 \multicolumn{1}{l}{\textbf{#3}} &
\r
177 \multicolumn{1}{r}{\textbf{#4}} &
\r
178 \multicolumn{1}{r}{\textbf{\dollar #5}}\\
\r
180 % ...extended description...
\r
181 \newcommand{\FSextdesc}[1]{
\r
182 \multicolumn{1}{l}{\rule{0pt}{1.0ex}} &
\r
183 %% \multicolumn{2}{l}{\small{~-~#1}}\\
\r
186 % ...and total line items.
\r
187 \newcommand{\FStotaldesc}[2]{
\r
188 & \multicolumn{6}{l}{#1} & #2\\
\r
194 %% Headers and footers defined for the first page
\r
196 %% The LH Heading comprising logo
\r
197 %% UNCOMMENT the following FOUR lines and change the path if necssary to provide a logo
\r
199 %% The Heading comprising isue date, customer ref & INVOICE name
\r
201 %% Header & footer changes for subsequent pages
\r
205 [@-- $coupon ? '\enlargethispage{-\extracouponspace}' : '' --@]
\r
206 \addressinset \rule{0.5cm}{0cm}
\r
208 \begin{minipage}[t]{5.0cm}
\r
210 \textbf{[@-- $payname --@]}\\
\r
211 \addressline{[@-- $company --@]}
\r
212 \addressline{[@-- $address1 --@]}
\r
213 \addressline{[@-- $address2 --@]}
\r
214 \addressline{[@-- $city --@], [@-- $state --@]~~[@-- $zip --@]}
\r
215 \addressline{[@-- $country --@]}
\r
219 \begin{minipage}[t]{6.4cm}
\r
221 if ($ship_enable) {
\r
222 $OUT .= '\textbf{Service Address}\\\\';
\r
223 $OUT .= "\\addressline{$ship_company}";
\r
224 $OUT .= "\\addressline{$ship_address1}";
\r
225 $OUT .= "\\addressline{$ship_address2}";
\r
226 $OUT .= "\\addressline{$ship_city, $ship_state~~$ship_zip}";
\r
227 $OUT .= "\\addressline{$ship_country}";
\r
229 $OUT .= "\\textbf{ID:}~~$agent_custid\\\\" if $agent_custid;
\r
230 $OUT .= "\\textbf{Fax:}~~$ship_fax\\\\" if $ship_fax;
\r
231 $OUT .= '~\\\\' if ($ship_fax or $agent_custid);
\r
237 Terms: [@-- $terms --@]\\
\r
238 [@-- $po_line --@]\\
\r
243 \section*{\textsc{Charges}}
\r
244 \begin{longtable}{cllllllr}
\r
247 \multicolumn{7}{r}{\rule{0pt}{2.5ex}Continued from previous page}\\
\r
250 \multicolumn{7}{r}{\rule{0pt}{2.5ex}Continued on next page...}\\
\r
255 foreach my $line (@total_items) {
\r
256 $OUT .= '\FStotaldesc{' . $line->{'total_item'} . '}' .
\r
257 '{' . $line->{'total_amount'} . '}' . "\n";
\r
265 foreach my $line (@detail_items) {
\r
266 my $ext_description = $line->{'ext_description'};
\r
268 # Don't break-up small packages.
\r
269 my $rowbreak = @$ext_description < 5 ? '*' : '';
\r
271 $OUT .= "\\hline\n";
\r
272 $OUT .= '\FSdesc{' . $line->{'ref'} . '}{' . $line->{'description'} . '}' .
\r
273 '{' . ( $unitprices ? $line->{'unit_amount'} : '' ) . '}'.
\r
274 '{' . ( $unitprices ? $line->{'quantity'} : '' ) . '}' .
\r
275 '{' . $line->{'amount'} . "}${rowbreak}\n";
\r
277 foreach my $ext_desc (@$ext_description) {
\r
278 if ( $ext_desc !~ /[^\\]&/ ) {
\r
279 $ext_desc = substr($ext_desc, 0, 80) . '...'
\r
280 if (length($ext_desc) > 80);
\r
281 $ext_desc = '\multicolumn{6}{l}{\small{~~~'. $ext_desc. '}}';
\r
283 $ext_desc = "~~~$ext_desc";
\r
285 $OUT .= '\FSextdesc{' . $ext_desc . '}' . "${rowbreak}\n";
\r