summaryrefslogtreecommitdiff
path: root/conf/invoice_latex
diff options
context:
space:
mode:
authorjeff <jeff>2008-02-29 17:57:38 +0000
committerjeff <jeff>2008-02-29 17:57:38 +0000
commit162a742110ede26cbb904b1f38c6a99e4b692eef (patch)
tree406b9f557c3f38dcd1d1ec611f53d4efe135f14c /conf/invoice_latex
parent9e6c6f13593dd5137ea920f49d36dc4321c9e99c (diff)
refactor print_*; invoice sections by package class; could still stand some more refactoring
Diffstat (limited to 'conf/invoice_latex')
-rw-r--r--conf/invoice_latex96
1 files changed, 56 insertions, 40 deletions
diff --git a/conf/invoice_latex b/conf/invoice_latex
index 660c4d586..6a81c4c2e 100644
--- a/conf/invoice_latex
+++ b/conf/invoice_latex
@@ -187,58 +187,74 @@ Terms: [@-- $terms --@]\\
\end{minipage}}
\vspace{1.5cm}
%
-\section*{\textsc{Charges}}
-\begin{longtable}{clr}
-\hline
-\rule{0pt}{2.5ex}
-\makebox[1.4cm]{\textbf{Ref}} &
-\makebox[12.8cm][l]{\textbf{Description}} &
-\makebox[2.5cm][r]{\textbf{Amount}} \\
-\hline
-\endfirsthead
-\multicolumn{3}{r}{\rule{0pt}{2.5ex}Continued from previous page}\\
-\hline
-\rule{0pt}{2.5ex}
-\makebox[1.4cm]{\textbf{Ref}} &
-\makebox[12.8cm][l]{\textbf{Description}} &
-\makebox[2.5cm][r]{\textbf{Amount}} \\
-\hline
-\endhead
-\multicolumn{3}{r}{\rule{0pt}{2.5ex}Continued on next page...}\\
-\endfoot
-\hline
[@--
+ foreach my $section ( @sections ) {
+ $OUT .= '\section*{\textsc{';
+ $OUT .= ($section->{'description'}) ? $section->{'description'} : 'Charges';
+ $OUT .= '}}\begin{longtable}{clr}';
+ $OUT .= '\hline';
+ $OUT .= '\rule{0pt}{2.5ex}';
+ $OUT .= '\makebox[1.4cm]{\textbf{Ref}} & ';
+ $OUT .= '\makebox[12.8cm][l]{\textbf{Description}} & ';
+ $OUT .= '\makebox[2.5cm][r]{\textbf{Amount}} \\\\';
+ $OUT .= '\hline';
+ $OUT .= '\endfirsthead';
+ $OUT .= '\multicolumn{3}{r}{\rule{0pt}{2.5ex}Continued from previous page}\\\\';
+ $OUT .= '\hline';
+ $OUT .= '\rule{0pt}{2.5ex}';
+ $OUT .= '\makebox[1.4cm]{\textbf{Ref}} & ';
+ $OUT .= '\makebox[12.8cm][l]{\textbf{Description}} & ';
+ $OUT .= '\makebox[2.5cm][r]{\textbf{Amount}} \\\\';
+ $OUT .= '\hline';
+ $OUT .= '\endhead';
+ $OUT .= '\multicolumn{3}{r}{\rule{0pt}{2.5ex}Continued on next page...}\\\\';
+ $OUT .= '\endfoot';
+ $OUT .= '\hline';
- foreach my $line (@total_items) {
- $OUT .= '\FStotaldesc{' . $line->{'total_item'} . '}' .
- '{' . $line->{'total_amount'} . '}' . "\n";
- }
+ if (scalar(@sections) > 1) {
+ $OUT .= '\FStotaldesc{' . $section->{'description'} . ' Total}' .
+ '{' . $section->{'subtotal'} . '}' . "\n";
+ }
---@]
-\hline
-\endlastfoot
-[@--
+ if ($section == $sections[$#sections]) {
+ foreach my $line (@total_items) {
+ $OUT .= '\FStotaldesc{' . $line->{'total_item'} . '}' .
+ '{' . $line->{'total_amount'} . '}' . "\n";
+ }
+ }
- foreach my $line (@detail_items) {
- my $ext_description = $line->{'ext_description'};
+ $OUT .= '\hline';
+ $OUT .= '\endlastfoot';
- # Don't break-up small packages.
- my $rowbreak = @$ext_description < 5 ? '*' : '';
+ foreach my $line (
+ grep { ( scalar( @sections ) > 1
+ ? $section->{'description'} eq $_->{'section'}->{'description'}
+ : 1
+ ) }
+ @detail_items )
+ {
+ my $ext_description = $line->{'ext_description'};
+
+ # Don't break-up small packages.
+ my $rowbreak = @$ext_description < 5 ? '*' : '';
+
+ $OUT .= "\\hline\n";
+ $OUT .= '\FSdesc{' . $line->{'ref'} . '}{' . $line->{'description'} . '}' .
+ '{' . $line->{'amount'} . "}${rowbreak}\n";
- $OUT .= "\\hline\n";
- $OUT .= '\FSdesc{' . $line->{'ref'} . '}{' . $line->{'description'} . '}' .
- '{' . $line->{'amount'} . "}${rowbreak}\n";
+ foreach my $ext_desc (@$ext_description) {
+ $ext_desc = substr($ext_desc, 0, 80) . '...'
+ if (length($ext_desc) > 80);
+ $OUT .= '\FSextdesc{' . $ext_desc . '}' . "${rowbreak}\n";
+ }
- foreach my $ext_desc (@$ext_description) {
- $ext_desc = substr($ext_desc, 0, 80) . '...'
- if (length($ext_desc) > 80);
- $OUT .= '\FSextdesc{' . $ext_desc . '}' . "${rowbreak}\n";
}
+ $OUT .= '\end{longtable}';
+
}
--@]
-\end{longtable}
\vfill
[@-- $notes --@]
\end{document}