X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=conf%2Finvoice_latex;h=478405ebd82eb8a78f594708e2b3a22672fc852f;hb=3e6b291920daf5546efa5355e3ea6199e875d9db;hp=c7c696b5d33257c880a32d6b3ccfbf0509e49272;hpb=9aee669886202be7035e6c6049fc71bc99dd3013;p=freeside.git diff --git a/conf/invoice_latex b/conf/invoice_latex index c7c696b5d..478405ebd 100644 --- a/conf/invoice_latex +++ b/conf/invoice_latex @@ -20,6 +20,7 @@ \documentclass[letterpaper]{article} \usepackage{fancyhdr,lastpage,ifthen,array,longtable,afterpage,caption,multirow,bigstrut} +\usepackage[breakwords]{truncate} % to avoid overflowing boxes \usepackage{graphicx} % required for logo graphic \usepackage[utf8]{inputenc} % multilanguage support \usepackage[T1]{fontenc} @@ -37,9 +38,19 @@ ''; --@] +\catcode`\{=1 +\catcode`\}=2 +\special{ps:% + SDict begin [ + /Title (Invoice \#[@-- $invnum --@]) + /DOCINFO pdfmark + end +} +\end + \addtolength{\voffset}{-0.0cm} % top margin to top of header \addtolength{\hoffset}{-0.6cm} % left margin on page -\addtolength{\topmargin}{[@-- defined($topmargin) ? $topmargin : '-1.25cm' --@]} +\addtolength{\topmargin}{[@-- defined($topmargin) ? $topmargin : '-1.00cm' --@]} \setlength{\headheight}{2.0cm} % height of header \setlength{\headsep}{[@-- defined($headsep) ? $headsep : '1.0cm' --@]} \setlength{\footskip}{1.0cm} % bottom of footer from bottom of text @@ -52,6 +63,10 @@ \LTchunksize=40 + +\begin{document} + + \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{1pt} @@ -66,7 +81,7 @@ } } -\newcommand{\extracouponspace}{[@-- defined($extracouponspace) ? $extracouponspace : '3.6cm' --@]} +\newcommand{\extracouponspace}{[@-- defined($extracouponspace) ? $extracouponspace : '2.7in' --@]} % Adjust the inset of the mailing address \newcommand{\addressinset}[1][]{\hspace{1.0cm}} @@ -95,7 +110,9 @@ $OUT .= '\vspace{-\extracouponspace}'; $OUT .= '\rule[0.5em]{\textwidth}{\footrulewidth}\\\\'; $OUT .= $coupon; - $OUT .= '\vspace{'. $couponfootsep. '}' if defined($couponfootsep); + $OUT .= '\vspace{'. + (defined($couponfootsep) ? $couponfootsep : '0.2in') . + '}'; } ''; --@] [@-- $smallerfooter ? '\scriptsize{' : '\small{' --@] @@ -114,7 +131,7 @@ { % First page } { % ... pages - \small{\thepage\ of \pageref{LastPage}} + \small{\thepage~[@-- emt('of') --@]~\pageref{LastPage}} } } @@ -124,10 +141,10 @@ \returninset \makebox{ \begin{tabular}{ll} - \includegraphics{[@-- $logo_file --@]} & [@-- $verticalreturnaddress ? '\\\\' : '' --@] \begin{minipage}[b]{5.5cm} [@-- $returnaddress --@] - \end{minipage}\\ + \end{minipage} & + \includegraphics{[@-- $logo_file --@]}\\ \end{tabular} } } @@ -190,16 +207,33 @@ \hline \rule{0pt}{2.5ex} \makebox[1.4cm]{} & - \multicolumn{\FSdescriptioncolumncount}{l}{\makebox[\FSdescriptionlength][l]{\textbf{[@-- emt('Description') --@]}}}& + \multicolumn{\FSdescriptioncolumncount}{l}{ + \truncate{\FSdescriptionlength}{\textbf{[@-- emt('Description') --@]}} + } & \FSunitcolumns \makebox[1.6cm][r]{\textbf{[@-- emt('Amount') --@]}} \\ \hline } +\newcommand{\FSusagehead}{ + \hline + \rule{0pt}{2.5ex} + \makebox[1.4cm]{} & + \multicolumn{4}{l}{ + \truncate{\FSdescriptionlength}{\textbf{[@-- emt('Description') --@]}} + } & + \textbf{~~[@-- emt('Calls') --@]} & + \textbf{~~[@-- emt('Duration') --@]} & + \textbf{~~[@-- emt('Amount') --@]} \\ + \hline +} + % ...description... \newcommand{\FSdesc}[5]{ \multicolumn{1}{c}{\rule{0pt}{2.5ex}\textbf{#1}} & - \multicolumn{[@-- $unitprices ? '4' : '6' --@]}{l}{\textbf{#2}} & + \multicolumn{[@-- $unitprices ? '4' : '6' --@]}{l}{ + \truncate{\FSdescriptionlength}{\textbf{#2}} + } & [@-- $unitprices ? ' \multicolumn{1}{r}{\textbf{#3}} &'."\n". ' \multicolumn{1}{r}{\textbf{#4}} &'."\n" : '' @@ -209,16 +243,35 @@ % ...extended description... \newcommand{\FSextdesc}[1]{ \multicolumn{1}{l}{\rule{0pt}{1.0ex}} & -%% \multicolumn{2}{l}{\small{~-~#1}}\\ -#1\\ + \multicolumn{6}{l}{ + \truncate{12.8cm}{\small{~~~#1}} + } \\ } -% ...and total line items. +% ...call detail (multiple columns already)... +\newcommand{\FScalldetail}[1]{ + \multicolumn{1}{l}{\rule{0pt}{1.0ex}} & + ~~~#1 + \\ +} +} +% ...and total line items (which use the full 12.8cm length, ignoring +% unitprice/quantity \newcommand{\FStotaldesc}[2]{ - & \multicolumn{6}{l}{#1} & #2\\ + & \multicolumn{6}{l}{ + \truncate{12.8cm}{#1} + } & #2\\ } +% ...usage class summary +\newcommand{\FSusagedesc}[4]{ + \multicolumn{1}{c}{\rule{0pt}{2.5ex}} & + \multicolumn{4}{l}{\textbf{#1}} & + \multicolumn{1}{r}{\textbf{#2}} & + \multicolumn{1}{r}{\textbf{#3}} & + \multicolumn{1}{r}{\textbf{#4}} + \\ +} -\begin{document} % Headers and footers defined for the first page \addressinset \rule{0.5cm}{0cm} \makebox{ @@ -248,7 +301,7 @@ } --@] \begin{flushright} -[@-- $terms ? emt('Terms') .": $terms" : '' --@]\\ +[@-- $terms ? emt('Terms') . ': ' . emt($terms) : '' --@]\\ [@-- $po_line --@]\\ \end{flushright} \end{minipage}} @@ -289,6 +342,8 @@ $OUT .= '}\\\\'; if ($section->{header_generator}) { $OUT .= &{$section->{header_generator}}(); + } elsif ( $section->{usage_section} ) { + $OUT .= '\FSusagehead'; } else { $OUT .= '\FShead'; } @@ -296,6 +351,8 @@ $OUT .= '\multicolumn{7}{r}{\rule{0pt}{2.5ex}'.emt('Continued from previous page').'}\\\\'; if ($section->{header_generator}) { $OUT .= &{$section->{header_generator}}(); + } elsif ( $section->{usage_section} ) { + $OUT .= '\FSusagehead'; } else { $OUT .= '\FShead'; } @@ -343,6 +400,14 @@ $OUT .= "\\hline\n" if (($line->{'ref'} || 0) ne $lastref); if ($section->{description_generator}) { $OUT .= &{$section->{description_generator}}($line); + } elsif ($section->{usage_section}) { + my $minutes = sprintf('%d', $line->{'duration'} / 60); + my $seconds = $line->{'duration'} % 60; + $OUT .= '\FSusagedesc + {' . $line->{'description'} . '} + {' . $line->{'quantity'} . '} + {' . $minutes . 'm ' . $seconds . 's' . '} + {' . $line->{'amount'} . '}'; } else { $OUT .= '\FSdesc'. '{}'. @@ -363,15 +428,10 @@ foreach my $ext_desc (@$ext_description) { if ($section->{extended_description_generator}) { $OUT .= &{$section->{extended_description_generator}}($ext_desc); - } else { - if ( $ext_desc !~ /[^\\]&/ ) { - $ext_desc = substr($ext_desc, 0, 80) . '...' - if (length($ext_desc) > 80); - $ext_desc = '\multicolumn{6}{l}{\small{~~~'. $ext_desc. '}}'; - }else{ - $ext_desc = "~~~$ext_desc"; - } - $OUT .= '\FSextdesc{' . $ext_desc . '}' . "${rowbreak}\n"; + } elsif ( $ext_desc !~ /[^\\]&/ ) { + $OUT .= '\FSextdesc{' . $ext_desc . "}$rowbreak\n"; + } else { # call detail + $OUT .= '\FScalldetail{' . $ext_desc . "}$rowbreak\n"; } } @@ -387,6 +447,64 @@ } --@] +[@-- + + my @location_summary_sections = + grep { + ref $_->{location} + && $_->{locationnum} + && $_->{description} + && $_->{description} ne $finance_section + } @sections; + if ( $multisection eq 'location' && scalar(@location_summary_sections) > 1 ) { + +$OUT .= ' + \hline + \section*{} + \captionsetup{singlelinecheck=false,justification=raggedright,font={Large,sc,bf}} + \ifthenelse{\equal{\thepage}{1}}{\setlength{\LTextracouponspace}{\extracouponspace}}{\setlength{\LTextracouponspace}{0pt}} + + \begin{longtable}{cllllllr} + \caption*{ '. emt('Summary of New Charges by Location') .' } + \\\\ + + \hline + \rule{0pt}{2.5ex} + \makebox[1.4cm]{} & + \multicolumn{6}{l}{ + \truncate{13.0cm}{\textbf{'. emt('Location') .'}} + } & + \makebox[1.6cm][r]{\textbf{'. emt('Amount') .'}} \\\\ + \hline + + \endfirsthead + \multicolumn{7}{r}{\rule{0pt}{2.5ex}'. emt('Continued from previous page') .'} + \\ + \FShead + \endhead + \multicolumn{7}{r}{\rule{0pt}{2.5ex}'. emt('Continued on next page...') .'} + \\ + \endfoot + \hline + \endlastfoot + \hline + '; + + for my $section (@location_summary_sections) { + $OUT.= ' + \rule{0pt}{2.5ex} + \makebox[1.4cm]{} & + \multicolumn{6}{l}{ + \truncate{12.0cm}{\textbf{'. $section->{description} .'}} + } & + \makebox[1.6cm][r]{\textbf{'. $section->{subtotal} .'}} \\\\ + '; + } + + $OUT .= '\end{longtable}'; + } +--@] + \vfill \begin{minipage}[t]{\textwidth} [@-- length($summary)