service address on invoice
authorjeff <jeff>
Wed, 4 Jun 2008 13:26:57 +0000 (13:26 +0000)
committerjeff <jeff>
Wed, 4 Jun 2008 13:26:57 +0000 (13:26 +0000)
FS/FS/Conf.pm
FS/FS/Conf_compat17.pm
FS/FS/cust_bill.pm
conf/invoice_latex

index 2750124..16305bf 100644 (file)
@@ -1868,6 +1868,13 @@ worry that config_items is freeside-specific and icky.
   },
 
   {
   },
 
   {
+    'key'         => 'invoice-ship_address',
+    'section'     => 'billing',
+    'description' => 'Enable this switch to include the ship address on the invoice.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'batch-enable',
     'section'     => 'billing',
     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
     'key'         => 'batch-enable',
     'section'     => 'billing',
     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
index 19e2e5d..8286431 100644 (file)
@@ -1940,6 +1940,13 @@ httemplate/docs/config.html
   },
 
   {
   },
 
   {
+    'key'         => 'invoice-ship_address',
+    'section'     => 'billing',
+    'description' => 'Enable this switch to include the ship address on the invoice.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'batch-enable',
     'section'     => 'billing',
     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
     'key'         => 'batch-enable',
     'section'     => 'billing',
     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
index 0ce68ec..aed1f36 100644 (file)
@@ -1826,6 +1826,7 @@ sub print_generic {
     'date'            => time2str($date_format, $self->_date),
     'today'           => time2str('%b %o, %Y', $today),
     'agent'           => &$escape_function($cust_main->agent->agent),
     'date'            => time2str($date_format, $self->_date),
     'today'           => time2str('%b %o, %Y', $today),
     'agent'           => &$escape_function($cust_main->agent->agent),
+    'agent'           => &$escape_function($cust_main->agent_custid),
     'payname'         => &$escape_function($cust_main->payname),
     'company'         => &$escape_function($cust_main->company),
     'address1'        => &$escape_function($cust_main->address1),
     'payname'         => &$escape_function($cust_main->payname),
     'company'         => &$escape_function($cust_main->company),
     'address1'        => &$escape_function($cust_main->address1),
@@ -1842,8 +1843,15 @@ sub print_generic {
     'conf_dir'        => "$FS::UID::conf_dir/conf.$FS::UID::datasrc",
     'page'            => 1,
     'total_pages'     => 1,
     'conf_dir'        => "$FS::UID::conf_dir/conf.$FS::UID::datasrc",
     'page'            => 1,
     'total_pages'     => 1,
+    'ship_enable'     => $conf->exists('invoice-ship_address'),
   );
 
   );
 
+  my $prefix = $cust_main->has_ship_address ? 'ship_' : '';
+  foreach ( qw( contact company address1 address2 city state zip country fax) ){
+    my $method = $prefix.$_;
+    $invoice_data{"ship_$_"} = _latex_escape($cust_main->$method);
+  }
+  
   $invoice_data{'cid'} = $params{'cid'}
     if $params{'cid'};
 
   $invoice_data{'cid'} = $params{'cid'}
     if $params{'cid'};
 
index 7e5ecdd..d17ff8f 100644 (file)
@@ -60,7 +60,7 @@
 \newcommand{\returninset}[1][]{\hspace{-0.25cm}}\r
 \r
 % New command for address lines i.e. skip them if blank\r
 \newcommand{\returninset}[1][]{\hspace{-0.25cm}}\r
 \r
 % New command for address lines i.e. skip them if blank\r
-\newcommand{\addressline}[1]{\ifthenelse{\equal{#1}{}}{}{#1\newline}}\r
+\newcommand{\addressline}[1]{\ifthenelse{\equal{#1}{}}{}{#1\\}}\r
 \r
 % Inserts dollar symbol\r
 \newcommand{\dollar}[1][]{\symbol{36}}\r
 \r
 % Inserts dollar symbol\r
 \newcommand{\dollar}[1][]{\symbol{36}}\r
 %\r
 %\r
 [@-- $coupon ? '\enlargethispage{-\extracouponspace}' : '' --@]\r
 %\r
 %\r
 [@-- $coupon ? '\enlargethispage{-\extracouponspace}' : '' --@]\r
-\begin{tabular}{ll}\r
-\addressinset \rule{0cm}{0cm} &\r
+\addressinset \rule{0.5cm}{0cm} \r
 \makebox{\r
 \begin{minipage}[t]{5.0cm}\r
 \vspace{0.25cm}\r
 \makebox{\r
 \begin{minipage}[t]{5.0cm}\r
 \vspace{0.25cm}\r
 \addressline{[@-- $city --@], [@-- $state --@]~~[@-- $zip --@]}\r
 \addressline{[@-- $country --@]}\r
 \end{minipage}}\r
 \addressline{[@-- $city --@], [@-- $state --@]~~[@-- $zip --@]}\r
 \addressline{[@-- $country --@]}\r
 \end{minipage}}\r
-\end{tabular}\r
 \hfill\r
 \makebox{\r
 \begin{minipage}[t]{6.4cm}\r
 \begin{flushright}\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 .= "\\addressline{$ship_company}";\r
+    $OUT .= "\\addressline{$ship_address1}";\r
+    $OUT .= "\\addressline{$ship_address2}";\r
+    $OUT .= "\\addressline{$ship_city, $ship_state~~$ship_zip}";\r
+    $OUT .= "\\addressline{$ship_country}";\r
+    $OUT .= '~\\\\';\r
+  }else{\r
+    $OUT .= '';\r
+  }\r
+--@]\r
 Terms: [@-- $terms --@]\\\r
 [@-- $po_line --@]\\\r
 \end{flushright}\r
 Terms: [@-- $terms --@]\\\r
 [@-- $po_line --@]\\\r
 \end{flushright}\r