X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=conf%2Finvoice_latex;h=c1d04d65136f51c32e0c65faea602ba3ae38ba5a;hp=822afcbddea496db1c81906f68530c536c65ce84;hb=88e9a56677d343392416c262f976f069157b06cb;hpb=0b6bd6405107c1abf8f2c5e2bc1b569870a02309 diff --git a/conf/invoice_latex b/conf/invoice_latex index 822afcbdd..c1d04d651 100644 --- a/conf/invoice_latex +++ b/conf/invoice_latex @@ -20,13 +20,27 @@ \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} +[@-- if ( length($watermark) ) { + $OUT .= ' +\usepackage{background} +\backgroundsetup{ + placement=center, + opacity=0.25, + color=black, + angle=0, + contents=' . $watermark . ' +}'; +} +''; +--@] \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 @@ -53,7 +67,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}} @@ -82,7 +96,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{' --@] @@ -111,10 +127,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} } } @@ -177,16 +193,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" : '' @@ -196,14 +229,34 @@ % ...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}} + } \\ +} +% ...call detail (multiple columns already)... +\newcommand{\FScalldetail}[1]{ + \multicolumn{1}{l}{\rule{0pt}{1.0ex}} & + ~~~#1 + \\ } -% ...and total line items. +} +% ...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 @@ -235,7 +288,7 @@ } --@] \begin{flushright} -[@-- $terms ? emt('Terms') .": $terms" : '' --@]\\ +[@-- $terms ? emt('Terms') . ': ' . emt($terms) : '' --@]\\ [@-- $po_line --@]\\ \end{flushright} \end{minipage}} @@ -276,6 +329,8 @@ $OUT .= '}\\\\'; if ($section->{header_generator}) { $OUT .= &{$section->{header_generator}}(); + } elsif ( $section->{usage_section} ) { + $OUT .= '\FSusagehead'; } else { $OUT .= '\FShead'; } @@ -283,6 +338,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'; } @@ -327,12 +384,20 @@ # Don't break-up small packages. my $rowbreak = @$ext_description < 5 ? '*' : ''; - $OUT .= "\\hline\n" if ($line->{'ref'} && $line->{'ref'} ne $lastref); + $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'. - '{}'. #'{' . ( $line->{'ref'} ne $lastref ? $line->{'ref'} : '' ) . '}'. + '{}'. '{' . $line->{'description'} . '}' ; if ( $unitprices and length($line->{'unit_amount'}) ) { # then show the unit amount and quantity @@ -345,20 +410,15 @@ } $OUT .= '{\\dollar' . $line->{'amount'} . "}${rowbreak}\n"; } - $lastref = $line->{'ref'}; + $lastref = $line->{'ref'} || 0; 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"; } }