alignment of unit price column, #18959
[freeside.git] / conf / invoice_latex
index d37eeba..533e834 100644 (file)
 \r
 \documentclass[letterpaper]{article}\r
 \r
-\usepackage{fancyhdr,lastpage,ifthen,array,fslongtable,afterpage,caption,multirow,bigstrut}\r
+\usepackage{fancyhdr,lastpage,ifthen,array,longtable,afterpage,caption,multirow,bigstrut}\r
 \usepackage{graphicx}                  % required for logo graphic\r
+\usepackage[utf8]{inputenc}             % multilanguage support\r
+\usepackage[T1]{fontenc}\r
 \r
 \addtolength{\voffset}{-0.0cm}         % top margin to top of header\r
 \addtolength{\hoffset}{-0.6cm}         % left margin on page\r
-\addtolength{\topmargin}{-1.25cm}      % top margin to top of header\r
+\addtolength{\topmargin}{[@-- defined($topmargin) ? $topmargin : '-1.25cm' --@]}\r
 \setlength{\headheight}{2.0cm}                 % height of header\r
-\setlength{\headsep}{1.0cm}            % between header and text\r
+\setlength{\headsep}{[@-- defined($headsep) ? $headsep : '1.0cm' --@]}\r
 \setlength{\footskip}{1.0cm}           % bottom of footer from bottom of text\r
 \r
 %\addtolength{\textwidth}{2.1in}       % width of text\r
 \setlength{\textwidth}{19.5cm}\r
-\setlength{\textheight}{19.5cm}\r
+\setlength{\textheight}{[@-- defined($textheight) ? $textheight : '19.5cm' --@]}\r
 \setlength{\oddsidemargin}{-0.9cm}     % odd page left margin\r
 \setlength{\evensidemargin}{-0.9cm}    % even page left margin\r
 \r
@@ -51,7 +53,7 @@
   }\r
 }\r
 \r
-\newcommand{\extracouponspace}{3.6cm}\r
+\newcommand{\extracouponspace}{[@-- defined($extracouponspace) ? $extracouponspace : '3.6cm' --@]}\r
 \r
 % Adjust the inset of the mailing address\r
 \newcommand{\addressinset}[1][]{\hspace{1.0cm}}\r
@@ -80,6 +82,7 @@
     $OUT .= '\vspace{-\extracouponspace}';\r
     $OUT .= '\rule[0.5em]{\textwidth}{\footrulewidth}\\\\';\r
     $OUT .= $coupon;\r
+    $OUT .= '\vspace{'. $couponfootsep. '}' if defined($couponfootsep);\r
   }\r
   '';\r
 --@] [@-- $smallerfooter ? '\scriptsize{' : '\small{' --@]\r
     \returninset\r
     \makebox{\r
       \begin{tabular}{ll}\r
-        \includegraphics{[@-- $logo_file --@]} &\r
+        \includegraphics{[@-- $logo_file --@]} & [@-- $verticalreturnaddress ? '\\\\' : '' --@]\r
         \begin{minipage}[b]{5.5cm}\r
 [@-- $returnaddress --@]\r
-        \end{minipage}\r
+        \end{minipage}\\\r
       \end{tabular}\r
     }\r
   }\r
   \ifthenelse{\equal{\thepage}{1}}\r
   { % First page\r
     \begin{tabular}{ccc}\r
-    Invoice date & Invoice \#& Customer\#\\\r
+    [@-- join(' & ', emt('Invoice date'), emt('Invoice #'), emt('Customer #') ) --@]\\\r
     \vspace{0.2cm}\r
     \textbf{[@-- $date --@]} & \textbf{[@-- $invnum --@]} & \textbf{[@-- $custnum --@]} \\\hline\r
-    \rule{0pt}{5ex} &~~ \huge{\textsc{[@-- $notice_name || 'Invoice' --@]}} & \\\r
+    \rule{0pt}{5ex} &~~ \huge{\textsc{[@-- emt($notice_name) --@]}} & \\\r
     \vspace{-0.2cm}\r
      & & \\\hline\r
     \end{tabular}\r
   { % ... pages\r
     \small{\r
       \begin{tabular}{lll}\r
-      Invoice date & Invoice \#& Customer\#\\\r
+      [@-- join(' & ', emt('Invoice date'), emt('Invoice #'), emt('Customer #') ) --@]\\\r
       \textbf{[@-- $date --@]} & \textbf{[@-- $invnum --@]} & \textbf{[@-- $custnum --@]}\\\r
       \end{tabular}\r
     }\r
 \r
 \newcommand{\FSdescriptionlength} { [@-- $unitprices ? '8.2cm' : '12.8cm' --@] }\r
 \newcommand{\FSdescriptioncolumncount} { [@-- $unitprices ? '4' : '6' --@] }\r
-\newcommand{\FSunitcolumns}{ [@-- $unitprices ? '\makebox[2.5cm][l]{\textbf{~~Unit Price}}&\makebox[1.4cm]{\textbf{~Quantity}}&' : '' --@] }\r
+\newcommand{\FSunitcolumns}{ [@-- \r
+  $unitprices\r
+  ? '\makebox[2.5cm][r]{\textbf{~~' . emt('Unit Price') . '}} &' .\r
+    '\makebox[1.4cm]{\textbf{~' . emt('Quantity') . '}} & ' \r
+  : '' --@] }\r
 \r
 \newcommand{\FShead}{\r
   \hline\r
   \rule{0pt}{2.5ex}\r
   \makebox[1.4cm]{\textbf{Ref}} &\r
-%  \makebox[2.9cm][l]{\textbf{Description}}&\r
-%  \makebox[1.4cm][l]{}&\r
-%  \makebox[1.4cm][l]{}&\r
-%  \makebox[2.5cm][l]{}&\r
-  \multicolumn{\FSdescriptioncolumncount}{l}{\makebox[\FSdescriptionlength][l]{\textbf{Description}}}&\r
+  \multicolumn{\FSdescriptioncolumncount}{l}{\makebox[\FSdescriptionlength][l]{\textbf{[@-- emt('Description') --@]}}}&\r
   \FSunitcolumns\r
-  \makebox[1.6cm][r]{\textbf{Amount}} \\\r
+  \makebox[1.6cm][r]{\textbf{[@-- emt('Amount') --@]}} \\\r
   \hline\r
 }\r
 \r
 % ...description...\r
 \newcommand{\FSdesc}[5]{\r
   \multicolumn{1}{c}{\rule{0pt}{2.5ex}\textbf{#1}} &\r
-  \multicolumn{4}{l}{\textbf{#2}} &\r
-  \multicolumn{1}{l}{\textbf{#3}} &\r
-  \multicolumn{1}{r}{\textbf{#4}} &\r
+  \multicolumn{[@-- $unitprices ? '4' : '6' --@]}{l}{\textbf{#2}} &\r
+[@-- $unitprices ? '  \multicolumn{1}{r}{\textbf{\dollar #3}} &'."\n".\r
+                   '  \multicolumn{1}{r}{\textbf{#4}} &'."\n"\r
+                 : ''\r
+--@]\r
   \multicolumn{1}{r}{\textbf{\dollar #5}}\\\r
 }\r
 % ...extended description...\r
 \addressinset \rule{0.5cm}{0cm} \r
 \makebox{\r
 \begin{minipage}[t]{7.0cm}\r
-\vspace{0.25cm}\r
+\vspace{[@-- defined($addresssep) ? $addresssep : '0.25cm' --@]}\r
 \textbf{[@-- $payname --@]}\\\r
 \addressline{[@-- $company --@]}\r
 \addressline{[@-- $address1 --@]}\r
 \begin{minipage}[t]{6.4cm}\r
 [@--\r
   if ($ship_enable) {\r
-    $OUT .= '\textbf{Service Address}\\\\';\r
+    $OUT .= '\textbf{' . emt('Service Address') . '}\\\\';\r
     $OUT .= "\\addressline{$ship_company}";\r
     $OUT .= "\\addressline{$ship_address1}";\r
     $OUT .= "\\addressline{$ship_address2}";\r
   }\r
 --@]\r
 \begin{flushright}\r
-Terms: [@-- $terms --@]\\\r
+[@-- $terms ? emt('Terms') .": $terms" : '' --@]\\\r
 [@-- $po_line --@]\\\r
 \end{flushright}\r
 \end{minipage}}\r
@@ -249,7 +254,7 @@ Terms: [@-- $terms --@]\\
         if $coupon;\r
       $OUT .= '\begin{longtable}{cllllllr}';\r
       $OUT .= '\caption*{ ';\r
-      $OUT .= ($section->{'description'}) ? $section->{'description'}: 'Charges';\r
+      $OUT .= ($section->{'description'}) ? $section->{'description'}: emt('Charges');\r
       $OUT .= '}\\\\';\r
       if ($section->{header_generator}) {\r
         $OUT .= &{$section->{header_generator}}();\r
@@ -257,18 +262,18 @@ Terms: [@-- $terms --@]\\
         $OUT .= '\FShead';\r
       }\r
       $OUT .= '\endfirsthead';\r
-      $OUT .= '\multicolumn{7}{r}{\rule{0pt}{2.5ex}Continued from previous page}\\\\';\r
+      $OUT .= '\multicolumn{7}{r}{\rule{0pt}{2.5ex}'.emt('Continued from previous page').'}\\\\';\r
       if ($section->{header_generator}) {\r
         $OUT .= &{$section->{header_generator}}();\r
       } else {\r
         $OUT .= '\FShead';\r
       }\r
       $OUT .= '\endhead';\r
-      $OUT .= '\multicolumn{7}{r}{\rule{0pt}{2.5ex}Continued on next page...}\\\\';\r
+      $OUT .= '\multicolumn{7}{r}{\rule{0pt}{2.5ex}'.emt('Continued on next page...').'}\\\\';\r
       $OUT .= '\endfoot';\r
       $OUT .= '\hline';\r
 \r
-      if (scalar(@sections) > 1) {\r
+      if (scalar(@sections) > 1 and !$section->{no_subtotal}) {\r
         if ($section->{total_generator}) {\r
           $OUT .= &{$section->{total_generator}}($section);\r
         } else {\r