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}
\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 % Adjust the inset of the mailing address
\r
42 \newcommand{\addressinset}[1][]{\hspace{1.0cm}}
\r
44 % Adjust the inset of the return address and logo
\r
45 \newcommand{\returninset}[1][]{\hspace{-0.25cm}}
\r
47 % New command for address lines i.e. skip them if blank
\r
48 \newcommand{\addressline}[1]{\ifthenelse{\equal{#1}{}}{}{#1\newline}}
\r
50 % Inserts dollar symbol
\r
51 \newcommand{\dollar}[1][]{\symbol{36}}
\r
53 % Remove plain style header/footer
\r
54 \fancypagestyle{plain}{
\r
59 % Define fancy header/footer for first and subsequent pages
\r
61 \ifthenelse{\equal{\thepage}{1}}
\r
69 [@-- $smallfooter --@]
\r
75 \ifthenelse{\equal{\thepage}{1}}
\r
79 \small{\thepage\ of \pageref{LastPage}}
\r
84 \ifthenelse{\equal{\thepage}{1}}
\r
89 \includegraphics{[@-- $conf_dir --@]/logo.eps} &
\r
90 \begin{minipage}[b]{5.5cm}
\r
91 [@-- $returnaddress --@]
\r
97 %\includegraphics{[@-- $conf_dir --@]/logo.eps} % Uncomment if you want the logo on all pages.
\r
102 \ifthenelse{\equal{\thepage}{1}}
\r
104 \begin{tabular}{rcl}
\r
105 Invoice date & & Invoice number \\
\r
107 \textbf{[@-- $date --@]} & & \textbf{[@-- $invnum --@]} \\\hline
\r
108 \rule{0pt}{5ex} &~~ \huge{\textsc{Invoice}} & \\
\r
115 \begin{tabular}{ll}
\r
116 Invoice date & Invoice number\\
\r
117 \textbf{[@-- $date --@]} & \textbf{[@-- $invnum --@]}\\
\r
126 %% Font options are:
\r
127 %% bch Bitsream Charter
\r
129 %% phv Adobe Helvetica
\r
130 %% pnc New Century Schoolbook
\r
134 \renewcommand{\familydefault}{phv}
\r
137 % Commands for freeside description...
\r
138 \newcommand{\FSdesc}[3]{
\r
139 \multicolumn{1}{c}{\rule{0pt}{2.5ex}\textbf{#1}} &
\r
141 \multicolumn{1}{r}{\textbf{\dollar #3}}\\
\r
143 % ...extended description...
\r
144 \newcommand{\FSextdesc}[1]{
\r
145 \multicolumn{1}{l}{\rule{0pt}{1.0ex}} &
\r
146 \multicolumn{2}{l}{\small{~-~#1}}\\
\r
148 % ...and total line items.
\r
149 \newcommand{\FStotaldesc}[2]{
\r
150 & \multicolumn{1}{l}{#1} & #2\\
\r
156 %% Headers and footers defined for the first page
\r
158 %% The LH Heading comprising logo
\r
159 %% UNCOMMENT the following FOUR lines and change the path if necssary to provide a logo
\r
161 %% The Heading comprising isue date, customer ref & INVOICE name
\r
163 %% Header & footer changes for subsequent pages
\r
167 \begin{tabular}{ll}
\r
168 \addressinset \rule{0cm}{0cm} &
\r
170 \begin{minipage}[t]{5.0cm}
\r
172 \textbf{[@-- $payname --@]}\\
\r
173 \addressline{[@-- $company --@]}
\r
174 \addressline{[@-- $address1 --@]}
\r
175 \addressline{[@-- $address2 --@]}
\r
176 \addressline{[@-- $city --@], [@-- $state --@]~~[@-- $zip --@]}
\r
177 \addressline{[@-- $country --@]}
\r
182 \begin{minipage}[t]{6.4cm}
\r
184 Terms: [@-- $terms --@]\\
\r
185 [@-- $po_line --@]\\
\r
190 \section*{\textsc{Charges}}
\r
191 \begin{longtable}{clr}
\r
194 \makebox[1.4cm]{\textbf{Ref}} &
\r
195 \makebox[12.8cm][l]{\textbf{Description}} &
\r
196 \makebox[2.5cm][r]{\textbf{Amount}} \\
\r
199 \multicolumn{3}{r}{\rule{0pt}{2.5ex}Continued from previous page}\\
\r
202 \makebox[1.4cm]{\textbf{Ref}} &
\r
203 \makebox[12.8cm][l]{\textbf{Description}} &
\r
204 \makebox[2.5cm][r]{\textbf{Amount}} \\
\r
207 \multicolumn{3}{r}{\rule{0pt}{2.5ex}Continued on next page...}\\
\r
212 foreach my $line (@total_items) {
\r
213 $OUT .= '\FStotaldesc{' . $line->{'total_item'} . '}' .
\r
214 '{' . $line->{'total_amount'} . '}' . "\n";
\r
222 foreach my $line (@detail_items) {
\r
223 my $ext_description = $line->{'ext_description'};
\r
225 # Don't break-up small packages.
\r
226 my $rowbreak = @$ext_description < 5 ? '*' : '';
\r
228 $OUT .= "\\hline\n";
\r
229 $OUT .= '\FSdesc{' . $line->{'ref'} . '}{' . $line->{'description'} . '}' .
\r
230 '{' . $line->{'amount'} . "}${rowbreak}\n";
\r
232 foreach my $ext_desc (@$ext_description) {
\r
233 $ext_desc = substr($ext_desc, 0, 80) . '...'
\r
234 if (length($ext_desc) > 80);
\r
235 $OUT .= '\FSextdesc{' . $ext_desc . '}' . "${rowbreak}\n";
\r