From 9c236c52118ead925e960571f0532fa064fd81bf Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 4 Jun 2008 13:26:57 +0000 Subject: [PATCH] service address on invoice --- FS/FS/Conf.pm | 7 +++++++ FS/FS/Conf_compat17.pm | 7 +++++++ FS/FS/cust_bill.pm | 8 ++++++++ conf/invoice_latex | 19 +++++++++++++++---- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 2750124ed..16305bf43 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -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.', diff --git a/FS/FS/Conf_compat17.pm b/FS/FS/Conf_compat17.pm index 19e2e5d41..8286431a5 100644 --- a/FS/FS/Conf_compat17.pm +++ b/FS/FS/Conf_compat17.pm @@ -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.', diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 0ce68ec1a..aed1f3630 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -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), + '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), @@ -1842,8 +1843,15 @@ sub print_generic { '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'}; diff --git a/conf/invoice_latex b/conf/invoice_latex index 7e5ecdd81..d17ff8f6d 100644 --- a/conf/invoice_latex +++ b/conf/invoice_latex @@ -60,7 +60,7 @@ \newcommand{\returninset}[1][]{\hspace{-0.25cm}} % New command for address lines i.e. skip them if blank -\newcommand{\addressline}[1]{\ifthenelse{\equal{#1}{}}{}{#1\newline}} +\newcommand{\addressline}[1]{\ifthenelse{\equal{#1}{}}{}{#1\\}} % Inserts dollar symbol \newcommand{\dollar}[1][]{\symbol{36}} @@ -188,8 +188,7 @@ % % [@-- $coupon ? '\enlargethispage{-\extracouponspace}' : '' --@] -\begin{tabular}{ll} -\addressinset \rule{0cm}{0cm} & +\addressinset \rule{0.5cm}{0cm} \makebox{ \begin{minipage}[t]{5.0cm} \vspace{0.25cm} @@ -200,11 +199,23 @@ \addressline{[@-- $city --@], [@-- $state --@]~~[@-- $zip --@]} \addressline{[@-- $country --@]} \end{minipage}} -\end{tabular} \hfill \makebox{ \begin{minipage}[t]{6.4cm} \begin{flushright} +[@-- + if ($ship_enable) { + $OUT .= '\textbf{Service Address}\\\\'; + $OUT .= "\\addressline{$ship_company}"; + $OUT .= "\\addressline{$ship_address1}"; + $OUT .= "\\addressline{$ship_address2}"; + $OUT .= "\\addressline{$ship_city, $ship_state~~$ship_zip}"; + $OUT .= "\\addressline{$ship_country}"; + $OUT .= '~\\\\'; + }else{ + $OUT .= ''; + } +--@] Terms: [@-- $terms --@]\\ [@-- $po_line --@]\\ \end{flushright} -- 2.11.0