X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=conf%2Finvoice_latex;h=fd0f952109feac02e15d728f3700dd8cb14d4468;hp=b169b617f1df28122dd22c75dbbff69d0ebb0dda;hb=a983ba996fbd3d432443eff8afc4b09bb48ec443;hpb=a1a1fbca688fda6c737bf016f6f3565b5192497b diff --git a/conf/invoice_latex b/conf/invoice_latex index b169b617f..fd0f95210 100644 --- a/conf/invoice_latex +++ b/conf/invoice_latex @@ -23,10 +23,23 @@ \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 +66,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 +95,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 +126,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} } } @@ -176,22 +191,35 @@ \newcommand{\FShead}{ \hline \rule{0pt}{2.5ex} - \makebox[1.4cm]{\textbf{Ref}} & + \makebox[1.4cm]{} & \multicolumn{\FSdescriptioncolumncount}{l}{\makebox[\FSdescriptionlength][l]{\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}{ + \makebox[\FSdescriptionlength][l]{\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}} & -[@-- $unitprices ? ' \multicolumn{1}{r}{\textbf{\dollar #3}} &'."\n". +[@-- $unitprices ? ' \multicolumn{1}{r}{\textbf{#3}} &'."\n". ' \multicolumn{1}{r}{\textbf{#4}} &'."\n" : '' --@] - \multicolumn{1}{r}{\textbf{\dollar #5}}\\ + \multicolumn{1}{r}{\textbf{#5}}\\ } % ...extended description... \newcommand{\FSextdesc}[1]{ @@ -204,6 +232,15 @@ & \multicolumn{6}{l}{#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 +272,7 @@ } --@] \begin{flushright} -[@-- $terms ? emt('Terms') .": $terms" : '' --@]\\ +[@-- $terms ? emt('Terms') . ': ' . emt($terms) : '' --@]\\ [@-- $po_line --@]\\ \end{flushright} \end{minipage}} @@ -258,10 +295,26 @@ if $coupon; $OUT .= '\begin{longtable}{cllllllr}'; $OUT .= '\caption*{ '; - $OUT .= ($section->{'description'}) ? $section->{'description'}: emt('Charges'); + if ($section->{'location'}) { + $OUT .= $section->{'location'}{'label_prefix'}. ': ' + if length($section->{'location'}{'label_prefix'}); + $OUT .= $section->{'location'}{'address1'}; + $OUT .= ', ' . $section->{'location'}{'address2'} + if length($section->{'location'}{'address2'}); + $OUT .= ', ' . + $section->{'location'}{'city'} . ', ' . + $section->{'location'}{'state'} . '~' . + $section->{'location'}{'zip'}; + } elsif ( $section->{'description'} ) { + $OUT .= ($section->{'description'}); + } else { + $OUT .= emt('Charges'); + } $OUT .= '}\\\\'; if ($section->{header_generator}) { $OUT .= &{$section->{header_generator}}(); + } elsif ( $section->{usage_section} ) { + $OUT .= '\FSusagehead'; } else { $OUT .= '\FShead'; } @@ -269,6 +322,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'; } @@ -313,18 +368,33 @@ # 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'} . '}' . - '{' . ( $unitprices ? $line->{'unit_amount'} : '' ) . '}'. - '{' . ( $unitprices ? $line->{'quantity'} : '' ) . '}' . - '{' . $line->{'amount'} . "}${rowbreak}\n"; + '{}'. + '{' . $line->{'description'} . '}' ; + if ( $unitprices and length($line->{'unit_amount'}) ) { + # then show the unit amount and quantity + $OUT .= + '{\\dollar' . $line->{'unit_amount'} . '}'. + '{' . $line->{'quantity'} . '}'; + } else { + # leave those columns blank + $OUT .= '{}{}'; + } + $OUT .= '{\\dollar' . $line->{'amount'} . "}${rowbreak}\n"; } - $lastref = $line->{'ref'}; + $lastref = $line->{'ref'} || 0; foreach my $ext_desc (@$ext_description) { if ($section->{extended_description_generator}) {