move invoice_latex templating to Text::Template, with special sauce^W^Wbackwards...
[freeside.git] / conf / invoice_latex
index 195f8fb..e7f6d08 100644 (file)
@@ -5,7 +5,7 @@
 %% Asplen Management Ltd\r
 %% www.asplen.co.uk\r
 %%\r
-%% Modified for Freeside by Ivan Kohler\r
+%% Modified for Freeside by Ivan Kohler and Kristian Hoffman\r
 %%\r
 %% Changes\r
 %%     0.1     4/12/00 Created\r
@@ -61,7 +61,7 @@
 %%     Headers and footers defined for the first page\r
 \fancyfoot[CO,CE]{\small{\r
 \begin{tabular}{c}\r
-$footer\r
+[@-- $footer --@]\r
 \end{tabular}}}\r
 %\r
 %%     The LH Heading comprising logo\r
@@ -76,7 +76,7 @@ $footer
 \begin{tabular}{rcl}\r
 Invoice date & & Invoice number \\\r
 \vspace{0.2cm}\r
-\textbf{$date} & & \textbf{$invnum} \\\hline\r
+\textbf{[@-- $date --@]} & & \textbf{[@-- $invnum --@]} \\\hline\r
 \rule{0pt}{5ex} &~~ \huge{\textsc{Invoice}}& \\\r
 \vspace{-0.2cm}\r
  & & \\\hline\r
@@ -85,71 +85,76 @@ Invoice date & & Invoice number \\
 %%     Header & footer changes for subsequent pages\r
 %\r
 \afterpage{ \fancyfoot[RO,RE]{\small{\thepage\ of \pageref{LastPage}}} }\r
-\afterpage{ \fancyfoot[CO,CE]{\small{$smallfooter}} }\r
+\afterpage{ \fancyfoot[CO,CE]{\small{[@-- $smallfooter --@]}} }\r
 \afterpage{ \fancyhead[LO,LE]{\small{}} }\r
 \afterpage{ \fancyhead[RO,RE]{\small{\r
 \begin{tabular}{ll}\r
 Invoice date & Invoice number\\\r
-\textbf{$date} & \textbf{$invnum}\\\r
+\textbf{[@-- $date --@]} & \textbf{[@-- $invnum --@]}\\\r
 \end{tabular}}} }\r
 %\r
 %\r
 \makebox{\r
 \begin{minipage}[t]{2.9in}\r
 \vspace{0.20in}\r
-\textbf{$payname}\\\r
-\addressline{$company}\r
-\addressline{$address1}\r
-\addressline{$address2}\r
-\addressline{$city, $state  $zip}\r
-\addressline{$country}\r
+\textbf{[@-- $payname --@]}\\\r
+\addressline{[@-- $company --@]}\r
+\addressline{[@-- $address1 --@]}\r
+\addressline{[@-- $address2 --@]}\r
+\addressline{[@-- $city --@], [@-- $state --@]  [@-- $zip --@]}\r
+\addressline{[@-- $country --@]}\r
 \end{minipage}}\r
 \hfill\r
 \makebox{\r
 \begin{minipage}[t]{2.5in}\r
 \begin{flushright}\r
-Terms: $terms\\\r
-$po_line\\\r
+Terms: [@-- $terms --@]\\\r
+[@-- $po_line --@]\\\r
 \end{flushright}\r
 \end{minipage}}\r
 \vspace{0.5cm}\r
 %\r
 \section*{\textsc{Charges}}\r
-\begin{longtable}{|c|l|c|r|r|}\r
+\begin{longtable}{|c|l|r|}\r
 \hline\r
 \rule{0pt}{2.5ex}\r
 \makebox[1.4cm]{\textbf{Ref}} & \r
-\makebox[7.9cm][l]{\textbf{Description}} & \r
-\makebox[1.3cm][c]{\textbf{Quantity}} & \r
-\makebox[2.5cm][r]{\textbf{Unit Price}} & \r
-\makebox[2.5cm][r]{\textbf{Amount}} \\\r
+\makebox[13cm][l]{\textbf{Description}} & \r
+\makebox[2cm][r]{\textbf{Amount}} \\\r
 \hline\r
 \endfirsthead\r
-\multicolumn{5}{r}{\rule{0pt}{2.5ex}Continued from previous page}\\\r
+\multicolumn{3}{r}{\rule{0pt}{2.5ex}Continued from previous page}\\\r
 \hline\r
 \rule{0pt}{2.5ex}\r
 \makebox[1.4cm]{\textbf{Ref}} & \r
-\makebox[7.9cm][l]{\textbf{Description}} & \r
-\makebox[1.3cm][c]{\textbf{Quantity}} & \r
-\makebox[2.5cm][r]{\textbf{Unit Price}} & \r
-\makebox[2.5cm][r]{\textbf{Amount}} \\\r
+\makebox[13cm][l]{\textbf{Description}} & \r
+\makebox[2cm][r]{\textbf{Amount}} \\\r
 \hline\r
 \endhead\r
-\multicolumn{5}{r}{\rule{0pt}{2.5ex}/cont...}\\\r
+\multicolumn{3}{r}{\rule{0pt}{2.5ex}/cont...}\\\r
 \endfoot\r
-%%TotalDetails\r
- & \multicolumn{3}{l}{$total_item}    & $total_amount\\\r
-%%EndTotalDetails\r
+[@--\r
+\r
+  foreach my $line (@total_items) {\r
+    $OUT .= ' & \multicolumn{1}{l}{' . $line->{'total_item'} . '} & ' .\r
+            $line->{'total_amount'} . '\\\\' . "\n";\r
+  }\r
+\r
+--@]\r
 \hline\r
 \endlastfoot\r
-%%Detail\r
-\rule{0pt}{2.5ex}$ref & \r
-\begin{tabular}{l}\r
-$description\tabularnewline\r
-\end{tabular}\r
-& $quantity & \dollar $amount & \dollar $amount\\\hline\r
-%%EndDetail\r
+[@--\r
+\r
+  foreach my $line (@detail_items) {\r
+    $OUT .= '\rule{0pt}{2.5ex}' . $line->{'ref'} . ' &' . "\n".\r
+            '\begin{tabular}{l}' . "\n".\r
+            $line->{'description'} . '\tabularnewline' . "\n".\r
+            '\end{tabular}' . "\n".\r
+            '& \dollar ' . $line->{'amount'} . '\\\\\\hline' . "\n";\r
+  }\r
+\r
+--@]\r
 \end{longtable}\r
 \vfill\r
-$notes\r
+[@-- $notes --@]\r
 \end{document}\r