typeset tear-off remittance coupon
authorjeff <jeff>
Mon, 2 Jun 2008 11:16:09 +0000 (11:16 +0000)
committerjeff <jeff>
Mon, 2 Jun 2008 11:16:09 +0000 (11:16 +0000)
FS/FS/Conf.pm
FS/FS/Conf_compat17.pm
FS/FS/cust_bill.pm
conf/invoice_latex
conf/invoice_latexcoupon [new file with mode: 0644]

index 2b47bf0..2750124 100644 (file)
@@ -533,21 +533,7 @@ worry that config_items is freeside-specific and icky.
                    invoice_latexfooter
                    invoice_latexsmallfooter
                    invoice_latexnotes
-                   invoice_html
-                   invoice_htmlreturnaddress
-                   invoice_htmlfooter
-                   invoice_htmlnotes
-                   logo.png
-                   logo.eps
-                 );
-
-@base_items = qw (
-                   invoice_template
-                   invoice_latex
-                   invoice_latexreturnaddress
-                   invoice_latexfooter
-                   invoice_latexsmallfooter
-                   invoice_latexnotes
+                   invoice_latexcoupon
                    invoice_html
                    invoice_htmlreturnaddress
                    invoice_htmlfooter
@@ -830,6 +816,13 @@ worry that config_items is freeside-specific and icky.
   },
 
   {
+    '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.',
index e9e25bb..19e2e5d 100644 (file)
@@ -693,6 +693,13 @@ httemplate/docs/config.html
   },
 
   {
+    '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.',
index 1f837de..69c5722 100644 (file)
@@ -1671,6 +1671,7 @@ sub print_generic {
                  'footer'        => sub { map "$_", @_ },
                  'smallfooter'   => sub { map "$_", @_ },
                  'returnaddress' => sub { map "$_", @_ },
+                 'coupon'        => sub { map "$_", @_ },
                },
     'html'  => {
                  'notes' =>
@@ -1702,6 +1703,7 @@ sub print_generic {
                        $_;
                      }  @_
                    },
+                 'coupon'        => sub { "" },
                },
     'template' => {
                  'notes' =>
@@ -1731,6 +1733,7 @@ sub print_generic {
                        $_;
                      }  @_
                    },
+                 'coupon'        => sub { "" },
                },
   );
 
@@ -1872,8 +1875,17 @@ sub print_generic {
   push @address, ''
     while (scalar(@address) < 5);
 
+  $invoice_data{'logo_file'} = $params{'logo_file'}
+    if $params{'logo_file'};
+
+  my( $pr_total, @pr_cust_bill ) = $self->previous; #previous balance
+#  my( $cr_total, @cr_cust_credit ) = $self->cust_credit; #credits
+  #my $balance_due = $self->owed + $pr_total - $cr_total;
+  my $balance_due = $self->owed + $pr_total;
+  $invoice_data{'balance'} = $balance_due;
+
   #do variable substitution in notes, footer, smallfooter
-  foreach my $include (qw( notes footer smallfooter )) {
+  foreach my $include (qw( notes footer smallfooter coupon )) {
 
     my $inc_file = $conf->key_orbase("invoice_${format}$include", $template);
     my @inc_src;
@@ -1919,11 +1931,6 @@ sub print_generic {
       ? &$escape_function("Purchase Order #". $cust_main->payinfo)
       : $nbsp;
 
-  my( $pr_total, @pr_cust_bill ) = $self->previous; #previous balance
-#  my( $cr_total, @cr_cust_credit ) = $self->cust_credit; #credits
-  #my $balance_due = $self->owed + $pr_total - $cr_total;
-  my $balance_due = $self->owed + $pr_total;
-
   my %money_chars = ( 'latex'    => '',
                       'html'     => $conf->config('money_char') || '$',
                       'template' => '',
@@ -2233,9 +2240,6 @@ sub print_generic {
     }
   }
 
-  $invoice_data{'logo_file'} = $params{'logo_file'}
-    if $params{'logo_file'};
-
   $invoice_lines = 0;
   my $wasfunc = 0;
   foreach ( grep /invoice_lines\(\d*\)/, @invoice_template ) { #kludgy
index aadd326..7e5ecdd 100644 (file)
@@ -19,7 +19,7 @@
 \r
 \documentclass[letterpaper]{article}\r
 \r
-\usepackage{fancyhdr,lastpage,ifthen,longtable,afterpage,caption}\r
+\usepackage{fancyhdr,lastpage,ifthen,longtable,afterpage,caption,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
@@ -227,12 +248,12 @@ Terms: [@-- $terms --@]\\
               '{' . $section->{'subtotal'} . '}' . "\n";\r
     }\r
 \r
-    if ($section == $sections[$#sections]) {\r
-      foreach my $line (@total_items) {\r
+    #if ($section == $sections[$#sections]) {\r
+      foreach my $line (grep {$_->{section}->{description} eq $section->{description}} @total_items) {\r
         $OUT .= '\FStotaldesc{' . $line->{'total_item'} . '}' .\r
                 '{' . $line->{'total_amount'} . '}' . "\n";\r
       }\r
-    }\r
+    #}\r
 \r
     $OUT .= '\hline';\r
     $OUT .= '\endlastfoot';\r
diff --git a/conf/invoice_latexcoupon b/conf/invoice_latexcoupon
new file mode 100644 (file)
index 0000000..8cbdb52
--- /dev/null
@@ -0,0 +1,33 @@
+Detach and return this remittance form with your your payment.\\\r
+\begin{tabular}{ll}\r
+\returninset\r
+\begin{tabular}{ll}\r
+  \makebox{ \includegraphics{[@-- $logo_file --@]}} &\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