},
{
+ 'key' => 'invoice_latexcoupon',
+ 'section' => 'billing',
+ 'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.',
+ 'type' => 'textarea',
+ },
+
+ {
'key' => 'invoice_latexreturnaddress',
'section' => 'billing',
'description' => 'Return address for LaTeX typeset PostScript invoices.',
'terms' => $conf->config('invoice_default_terms') || 'Payable upon receipt',
#'notes' => join("\n", $conf->config('invoice_latexnotes') ),
'conf_dir' => "$FS::UID::conf_dir/conf.$FS::UID::datasrc",
+ 'balance' => $balance_due,
);
my $countrydefault = $conf->config('countrydefault') || 'US';
warn "invoice notes: ". $invoice_data{'notes'}. "\n"
if $DEBUG;
+ #do variable substitution in coupon
+ foreach my $include (qw( coupon )) {
+
+ my @inc_src = $conf->config_orbase("invoice_latex$include", $template);
+
+ my $inc_tt = new Text::Template (
+ TYPE => 'ARRAY',
+ SOURCE => [ map "$_\n", @inc_src ],
+ DELIMITERS => [ '[@--', '--@]' ],
+ ) or die "Can't create new Text::Template object: $Text::Template::ERROR";
+
+ unless ( $inc_tt->compile() ) {
+ my $error = "Can't compile $include template: $Text::Template::ERROR\n";
+ warn $error. "Template:\n". join('', map "$_\n", @inc_src);
+ die $error;
+ }
+
+ $invoice_data{$include} = $inc_tt->fill_in( HASH => \%invoice_data );
+
+ $invoice_data{$include} =~ s/\n+$//
+ }
+
$invoice_data{'footer'} =~ s/\n+$//;
$invoice_data{'smallfooter'} =~ s/\n+$//;
$invoice_data{'notes'} =~ s/\n+$//;
\r
\documentclass[letterpaper]{article}\r
\r
-\usepackage{fancyhdr,lastpage,ifthen,longtable,afterpage}\r
+\usepackage{fancyhdr,lastpage,ifthen,longtable,afterpage,multirow,bigstrut}\r
\usepackage{graphicx} % required for logo graphic\r
\r
\addtolength{\voffset}{-0.0cm} % top margin to top of header\r
\renewcommand{\headrulewidth}{0pt}\r
\renewcommand{\footrulewidth}{1pt}\r
\r
+\renewcommand{\footrule}{\r
+[@--\r
+ $coupon ? '\ifthenelse{\equal{\thepage}{1}}' : '';\r
+--@]\r
+ {\r
+ }\r
+ {\r
+ \vbox to 0pt{\rule{\headwidth}{\footrulewidth}\vss}\r
+ }\r
+}\r
+\r
+\newcommand{\extracouponspace}{4.8cm}\r
+\r
% Adjust the inset of the mailing address\r
\newcommand{\addressinset}[1][]{\hspace{1.0cm}}\r
\r
\fancyfoot[C]{\r
\ifthenelse{\equal{\thepage}{1}}\r
{ % First page\r
- \small{\r
+[@--\r
+ if ($coupon) {\r
+ $OUT .= '\vspace{-\extracouponspace}';\r
+ $OUT .= '\rule[0.5em]{\textwidth}{\footrulewidth}\\\\';\r
+ $OUT .= $coupon;\r
+ }\r
+ '';\r
+--@] \small{\r
[@-- $footer --@]\r
- }\r
+ }[@-- $coupon ? '\vspace{\extracouponspace}' : '' --@]\r
}\r
{ % ... pages\r
\small{\r
%\r
%\r
%\r
+[@-- $coupon ? '\enlargethispage{-\extracouponspace}' : '' --@]\r
\begin{tabular}{ll}\r
\addressinset \rule{0cm}{0cm} &\r
\makebox{\r
--- /dev/null
+Detach and return this remittance form with your your payment.\\\r
+\begin{tabular}{ll}\r
+\returninset\r
+\begin{tabular}{ll}\r
+ \makebox{ \includegraphics{[@-- $conf_dir --@]/logo.eps}} &\r
+ \begin{minipage}[b]{5.5cm}\r
+[@-- $returnaddress --@]\r
+ \end{minipage}\r
+\end{tabular}&\r
+\begin{tabular}{r@{: }lr}\r
+Invoice date & \textbf{[@-- $date --@]} & \multirow{4}*{\r
+\makebox{\r
+\begin{minipage}[t]{5.0cm}\r
+\textbf{[@-- $payname --@]}\\\r
+\addressline{[@-- $company --@]}\r
+\addressline{[@-- $address1 --@]}\r
+\addressline{[@-- $address2 --@]}\r
+\addressline{[@-- $city --@], [@-- $state --@]~~[@-- $zip --@]}\r
+\addressline{[@-- $country --@]}\r
+\end{minipage}}}\\\r
+Customer\#& \textbf{[@-- $custnum --@]} & \\\r
+Total Due & \textbf{[@-- $balance --@]} & \\\r
+\rule{0pt}{2.25em}Amount Enclosed & \rule{2cm}{1pt}& \\\r
+\end{tabular}\\\r
+\rule{0pt}{1cm} &\\\r
+\begin{tabular}{ll}\r
+\addressinset \rule{0.5cm}{0cm} &\r
+\makebox{\r
+\begin{minipage}[t]{5.0cm}\r
+[@-- $returnaddress --@]\r
+\end{minipage}}\r
+\end{tabular}\\\r
+\end{tabular}\\\r