X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=conf%2Finvoice_latex;h=aadd326c50ae74e2344e27ee894741754741410e;hb=fe16cec1c82f4e1f1c2586c8259cd607fcb14d79;hp=d1b471a4bbd3c151086b76cd0ab7be188c219986;hpb=4d77eb68f3501500ae66f84626b3922e2bb52e40;p=freeside.git diff --git a/conf/invoice_latex b/conf/invoice_latex index d1b471a4b..aadd326c5 100644 --- a/conf/invoice_latex +++ b/conf/invoice_latex @@ -19,7 +19,7 @@ \documentclass[letterpaper]{article} -\usepackage{fancyhdr,lastpage,ifthen,longtable,afterpage} +\usepackage{fancyhdr,lastpage,ifthen,longtable,afterpage,caption} \usepackage{graphicx} % required for logo graphic \addtolength{\voffset}{-0.0cm} % top margin to top of header @@ -35,6 +35,8 @@ \setlength{\oddsidemargin}{-0.9cm} % odd page left margin \setlength{\evensidemargin}{-0.9cm} % even page left margin +\LTchunksize=40 + \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{1pt} @@ -86,7 +88,7 @@ \returninset \makebox{ \begin{tabular}{ll} - \includegraphics{[@-- $conf_dir --@]/logo.eps} & + \includegraphics{[@-- $logo_file --@]} & \begin{minipage}[b]{5.5cm} [@-- $returnaddress --@] \end{minipage} @@ -94,17 +96,17 @@ } } { % ... pages - %\includegraphics{[@-- $conf_dir --@]/logo.eps} % Uncomment if you want the logo on all pages. + %\includegraphics{[@-- $logo_file --@]} % Uncomment if you want the logo on all pages. } } \fancyhead[R]{ \ifthenelse{\equal{\thepage}{1}} { % First page - \begin{tabular}{rcl} - Invoice date & & Invoice number \\ + \begin{tabular}{ccc} + Invoice date & Invoice \#& Customer\#\\ \vspace{0.2cm} - \textbf{[@-- $date --@]} & & \textbf{[@-- $invnum --@]} \\\hline + \textbf{[@-- $date --@]} & \textbf{[@-- $invnum --@]} & \textbf{[@-- $custnum --@]} \\\hline \rule{0pt}{5ex} &~~ \huge{\textsc{Invoice}} & \\ \vspace{-0.2cm} & & \\\hline @@ -112,9 +114,9 @@ } { % ... pages \small{ - \begin{tabular}{ll} - Invoice date & Invoice number\\ - \textbf{[@-- $date --@]} & \textbf{[@-- $invnum --@]}\\ + \begin{tabular}{lll} + Invoice date & Invoice \#& Customer\#\\ + \textbf{[@-- $date --@]} & \textbf{[@-- $invnum --@]} & \textbf{[@-- $custnum --@]}\\ \end{tabular} } } @@ -137,17 +139,18 @@ % Commands for freeside description... \newcommand{\FSdesc}[3]{ \multicolumn{1}{c}{\rule{0pt}{2.5ex}\textbf{#1}} & - \textbf{#2} & + \multicolumn{6}{l}{\textbf{#2}} & \multicolumn{1}{r}{\textbf{\dollar #3}}\\ } % ...extended description... \newcommand{\FSextdesc}[1]{ \multicolumn{1}{l}{\rule{0pt}{1.0ex}} & - \multicolumn{2}{l}{\small{~-~#1}}\\ +%% \multicolumn{2}{l}{\small{~-~#1}}\\ + ~-~#1\\ } % ...and total line items. \newcommand{\FStotaldesc}[2]{ - & \multicolumn{1}{l}{#1} & #2\\ + & \multicolumn{6}{l}{#1} & #2\\ } @@ -187,58 +190,90 @@ Terms: [@-- $terms --@]\\ \end{minipage}} \vspace{1.5cm} % -\section*{\textsc{Charges}} -\begin{longtable}{clr} -\hline -\rule{0pt}{2.5ex} -\makebox[1.4cm]{\textbf{Ref}} & -\makebox[12.8cm][l]{\textbf{Description}} & -\makebox[2.5cm][r]{\textbf{Amount}} \\ -\hline -\endfirsthead -\multicolumn{3}{r}{\rule{0pt}{2.5ex}Continued from previous page}\\ -\hline -\rule{0pt}{2.5ex} -\makebox[1.4cm]{\textbf{Ref}} & -\makebox[12.8cm][l]{\textbf{Description}} & -\makebox[2.5cm][r]{\textbf{Amount}} \\ -\hline -\endhead -\multicolumn{3}{r}{\rule{0pt}{2.5ex}Continued on next page...}\\ -\endfoot -\hline +\section*{} [@-- + foreach my $section ( @sections ) { + if ($section->{'pretotal'}) { + $OUT .= '\begin{flushright}'; + $OUT .= '\large\textsc{'. $section->{'pretotal'}. '}\\\\'; + $OUT .= '\\end{flushright}'; + } + $OUT .= '\captionsetup{singlelinecheck=false,justification=raggedright,font={Large,sc,bf}}'; + $OUT .= '\begin{longtable}{cllllllr}'; + $OUT .= '\caption*{ '; + $OUT .= ($section->{'description'}) ? $section->{'description'}: 'Charges'; + $OUT .= '}\\\\'; + $OUT .= '\hline'; + $OUT .= '\rule{0pt}{2.5ex}'; + $OUT .= '\makebox[1.4cm]{\textbf{Ref}} & '; + $OUT .= '\multicolumn{6}{l}{\makebox[12.8cm][l]{\textbf{Description}}} & '; + $OUT .= '\makebox[2.5cm][r]{\textbf{Amount}} \\\\'; + $OUT .= '\hline'; + $OUT .= '\endfirsthead'; + $OUT .= '\multicolumn{7}{r}{\rule{0pt}{2.5ex}Continued from previous page}\\\\'; + $OUT .= '\hline'; + $OUT .= '\rule{0pt}{2.5ex}'; + $OUT .= '\makebox[1.4cm]{\textbf{Ref}} & '; + $OUT .= '\multicolumn{6}{l}{\makebox[12.8cm][l]{\textbf{Description}}} & '; + $OUT .= '\makebox[2.5cm][r]{\textbf{Amount}} \\\\'; + $OUT .= '\hline'; + $OUT .= '\endhead'; + $OUT .= '\multicolumn{7}{r}{\rule{0pt}{2.5ex}Continued on next page...}\\\\'; + $OUT .= '\endfoot'; + $OUT .= '\hline'; - foreach my $line (@total_items) { - $OUT .= '\FStotaldesc{' . $line->{'total_item'} . '}' . - '{' . $line->{'total_amount'} . '}' . "\n"; - } + if (scalar(@sections) > 1) { + $OUT .= '\FStotaldesc{' . $section->{'description'} . ' Total}' . + '{' . $section->{'subtotal'} . '}' . "\n"; + } ---@] -\hline -\endlastfoot -[@-- + if ($section == $sections[$#sections]) { + foreach my $line (@total_items) { + $OUT .= '\FStotaldesc{' . $line->{'total_item'} . '}' . + '{' . $line->{'total_amount'} . '}' . "\n"; + } + } - foreach my $line (@detail_items) { - my $ext_description = $line->{'ext_description'}; + $OUT .= '\hline'; + $OUT .= '\endlastfoot'; - # Don't break-up small packages. - my $rowbreak = @$ext_description < 5 ? '*' : ''; + foreach my $line ( + grep { ( scalar( @sections ) > 1 + ? $section->{'description'} eq $_->{'section'}->{'description'} + : 1 + ) } + @detail_items ) + { + my $ext_description = $line->{'ext_description'}; + + # Don't break-up small packages. + my $rowbreak = @$ext_description < 5 ? '*' : ''; + + $OUT .= "\\hline\n"; + $OUT .= '\FSdesc{' . $line->{'ref'} . '}{' . $line->{'description'} . '}' . + '{' . $line->{'amount'} . "}${rowbreak}\n"; - $OUT .= "\\hline\n"; - $OUT .= '\FSdesc{' . $line->{'ref'} . '}{' . $line->{'description'} . '}' . - '{' . $line->{'amount'} . "}${rowbreak}\n"; + foreach my $ext_desc (@$ext_description) { + if ( $ext_desc !~ /[^\\]&/ ) { + $ext_desc = substr($ext_desc, 0, 80) . '...' + if (length($ext_desc) > 80); + $ext_desc = '\small{'. $ext_desc. '}'; + } + $OUT .= '\FSextdesc{' . $ext_desc . '}' . "${rowbreak}\n"; + } - foreach my $ext_desc (@$ext_description) { - $ext_desc = substr($ext_desc, 0, 80) . '...' - if (length($ext_desc) > 80); - $OUT .= '\FSextdesc{' . $ext_desc . '}' . "${rowbreak}\n"; } + $OUT .= '\end{longtable}'; + + if ($section->{'posttotal'}) { + $OUT .= '\begin{flushright}'; + $OUT .= '\normalfont\large\bfseries\textsc{'. $section->{'posttotal'}. '}\\\\'; + $OUT .= '\\end{flushright}'; + } } --@] -\end{longtable} \vfill [@-- $notes --@] \end{document}