Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / conf / invoice_latex
index 70b36b1..c7c696b 100644 (file)
 \usepackage{graphicx}                  % required for logo graphic\r
 \usepackage[utf8]{inputenc}             % multilanguage support\r
 \usepackage[T1]{fontenc}\r
+[@-- if ( length($watermark) ) {\r
+  $OUT .= '\r
+\usepackage{background}\r
+\backgroundsetup{\r
+  placement=center,\r
+  opacity=0.25,\r
+  color=black,\r
+  angle=0,\r
+  contents=' . $watermark . '\r
+}';\r
+}\r
+'';\r
+--@]\r
 \r
 \addtolength{\voffset}{-0.0cm}         % top margin to top of header\r
 \addtolength{\hoffset}{-0.6cm}         % left margin on page\r
 \newcommand{\FShead}{\r
   \hline\r
   \rule{0pt}{2.5ex}\r
-  \makebox[1.4cm]{\textbf{Ref}} &\r
+  \makebox[1.4cm]{} &\r
   \multicolumn{\FSdescriptioncolumncount}{l}{\makebox[\FSdescriptionlength][l]{\textbf{[@-- emt('Description') --@]}}}&\r
   \FSunitcolumns\r
   \makebox[1.6cm][r]{\textbf{[@-- emt('Amount') --@]}} \\\r
 \newcommand{\FSdesc}[5]{\r
   \multicolumn{1}{c}{\rule{0pt}{2.5ex}\textbf{#1}} &\r
   \multicolumn{[@-- $unitprices ? '4' : '6' --@]}{l}{\textbf{#2}} &\r
-[@-- $unitprices ? '  \multicolumn{1}{r}{\textbf{\dollar #3}} &'."\n".\r
+[@-- $unitprices ? '  \multicolumn{1}{r}{\textbf{#3}} &'."\n".\r
                    '  \multicolumn{1}{r}{\textbf{#4}} &'."\n"\r
                  : ''\r
 --@]\r
-  \multicolumn{1}{r}{\textbf{\dollar #5}}\\\r
+  \multicolumn{1}{r}{\textbf{#5}}\\\r
 }\r
 % ...extended description...\r
 \newcommand{\FSextdesc}[1]{\r
       $OUT .= '\begin{longtable}{cllllllr}';\r
       $OUT .= '\caption*{ ';\r
       if ($section->{'location'}) {\r
+        $OUT .= $section->{'location'}{'label_prefix'}. ': '\r
+          if length($section->{'location'}{'label_prefix'});\r
         $OUT .= $section->{'location'}{'address1'};\r
         $OUT .= ', ' . $section->{'location'}{'address2'}\r
           if length($section->{'location'}{'address2'});\r
         # Don't break-up small packages.\r
         my $rowbreak = @$ext_description < 5 ? '*' : '';\r
   \r
-        $OUT .= "\\hline\n" if ($line->{'ref'} && $line->{'ref'} ne $lastref);\r
+        $OUT .= "\\hline\n" if (($line->{'ref'} || 0) ne $lastref);\r
         if ($section->{description_generator}) {\r
           $OUT .= &{$section->{description_generator}}($line);\r
         } else {\r
           $OUT .= '\FSdesc'.\r
-                  '{' . ( $line->{'ref'} ne $lastref ? $line->{'ref'} : '' ) . '}'.\r
-                  '{' . $line->{'description'} . '}' .\r
-                  '{' . ( $unitprices ? $line->{'unit_amount'} : '' ) . '}'.\r
-                  '{' . ( $unitprices ? $line->{'quantity'} : ''  ) . '}' .\r
-                  '{' . $line->{'amount'} . "}${rowbreak}\n";\r
+                  '{}'.\r
+                  '{' . $line->{'description'} . '}' ;\r
+          if ( $unitprices and length($line->{'unit_amount'}) ) {\r
+            # then show the unit amount and quantity\r
+            $OUT .= \r
+                '{\\dollar' . $line->{'unit_amount'} . '}'.\r
+                '{'         . $line->{'quantity'}    . '}';\r
+          } else {\r
+            # leave those columns blank\r
+            $OUT .= '{}{}';\r
+          }\r
+          $OUT .= '{\\dollar' . $line->{'amount'} . "}${rowbreak}\n";\r
         }\r
-        $lastref = $line->{'ref'};\r
+        $lastref = $line->{'ref'} || 0;\r
 \r
         foreach my $ext_desc (@$ext_description) {\r
           if ($section->{extended_description_generator}) {\r