cdrs can be in separate invoice section, after total, summarized inline, with hints...
[freeside.git] / conf / invoice_latex
index 8d48677..fe910b2 100644 (file)
 \newcommand{\FSextdesc}[1]{\r
   \multicolumn{1}{l}{\rule{0pt}{1.0ex}} &\r
 %%  \multicolumn{2}{l}{\small{~-~#1}}\\\r
-  ~~~#1\\\r
+#1\\\r
 }\r
 % ...and total line items.\r
 \newcommand{\FStotaldesc}[2]{\r
 \hfill\r
 \makebox{\r
 \begin{minipage}[t]{6.4cm}\r
-\begin{flushright}\r
 [@--\r
   if ($ship_enable) {\r
     $OUT .= '\textbf{Service Address}\\\\';\r
     $OUT .= '';\r
   }\r
 --@]\r
+\begin{flushright}\r
 Terms: [@-- $terms --@]\\\r
 [@-- $po_line --@]\\\r
 \end{flushright}\r
@@ -235,6 +235,7 @@ Terms: [@-- $terms --@]\\
       $OUT .= '\large\textsc{'. $section->{'pretotal'}. '}\\\\';\r
       $OUT .= '\\end{flushright}';\r
     }\r
+    $OUT .= '\pagebreak' if $section{'post_total'};\r
     $OUT .= '\captionsetup{singlelinecheck=false,justification=raggedright,font={Large,sc,bf}}';\r
     $OUT .= '\begin{longtable}{cllllllr}';\r
     $OUT .= '\caption*{ ';\r
@@ -284,6 +285,7 @@ Terms: [@-- $terms --@]\\
     $OUT .= '\hline';\r
     $OUT .= '\endlastfoot';\r
 \r
+    my $lastref = 0;\r
     foreach my $line (\r
       grep { ( scalar( @sections ) > 1 \r
              ? $section->{'description'} eq $_->{'section'}->{'description'}\r
@@ -296,17 +298,22 @@ Terms: [@-- $terms --@]\\
       # Don't break-up small packages.\r
       my $rowbreak = @$ext_description < 5 ? '*' : '';\r
   \r
-      $OUT .= "\\hline\n";\r
-      $OUT .= '\FSdesc{' . $line->{'ref'} . '}{' . $line->{'description'} . '}' .\r
+      $OUT .= "\\hline\n" if ($line->{'ref'} && $line->{'ref'} ne $lastref);\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
+      $lastref = $line->{'ref'};\r
 \r
       foreach my $ext_desc (@$ext_description) {\r
         if ( $ext_desc !~ /[^\\]&/ ) {\r
           $ext_desc = substr($ext_desc, 0, 80) . '...'\r
             if (length($ext_desc) > 80);\r
-          $ext_desc = '\small{'. $ext_desc. '}';\r
+          $ext_desc = '\multicolumn{6}{l}{\small{~~~'. $ext_desc. '}}';\r
+        }else{\r
+          $ext_desc = "~~~$ext_desc";\r
         }\r
         $OUT .= '\FSextdesc{' . $ext_desc . '}' . "${rowbreak}\n";\r
       }\r