diff options
-rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
-rw-r--r-- | FS/FS/cust_bill.pm | 16 | ||||
-rw-r--r-- | conf/invoice_latex | 19 |
3 files changed, 38 insertions, 4 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 4a1760fd1..87897c32c 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1952,6 +1952,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/cust_bill.pm b/FS/FS/cust_bill.pm index 8c53e7f83..7f2c18572 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -1796,6 +1796,7 @@ sub print_latex { 'date' => time2str('%b %o, %Y', $self->_date), 'today' => time2str('%b %o, %Y', $today), 'agent' => _latex_escape($cust_main->agent->agent), + 'agent_custid' => _latex_escape($cust_main->agent_custid), 'payname' => _latex_escape($cust_main->payname), 'company' => _latex_escape($cust_main->company), 'address1' => _latex_escape($cust_main->address1), @@ -1812,8 +1813,15 @@ sub print_latex { #'notes' => join("\n", $conf->config('invoice_latexnotes') ), 'conf_dir' => "$FS::UID::conf_dir/conf.$FS::UID::datasrc", 'balance' => $balance_due, + '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); + } + my $countrydefault = $conf->config('countrydefault') || 'US'; if ( $cust_main->country eq $countrydefault ) { $invoice_data{'country'} = ''; @@ -2173,6 +2181,7 @@ sub print_html { 'date' => time2str('%b %o, %Y', $self->_date), 'today' => time2str('%b %o, %Y', $today), 'agent' => encode_entities($cust_main->agent->agent), + 'agent_custid' => encode_entities($cust_main->agent_custid), 'payname' => encode_entities($cust_main->payname), 'company' => encode_entities($cust_main->company), 'address1' => encode_entities($cust_main->address1), @@ -2184,9 +2193,16 @@ sub print_html { || 'Payable upon receipt', 'cid' => $cid, 'template' => $template, + 'ship_enable' => $conf->exists('invoice-ship_address'), # 'conf_dir' => "$FS::UID::conf_dir/conf.$FS::UID::datasrc", ); + 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_$_"} = encode_entities($cust_main->$method); + } + if ( defined( $conf->config_orbase('invoice_htmlreturnaddress', $template) ) && length( $conf->config_orbase('invoice_htmlreturnaddress', $template) ) diff --git a/conf/invoice_latex b/conf/invoice_latex index 442965a3c..19b351acc 100644 --- a/conf/invoice_latex +++ b/conf/invoice_latex @@ -58,7 +58,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}}
@@ -186,8 +186,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}
@@ -198,11 +197,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}
|