'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),
#'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'} = '';
'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),
|| '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) )
\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
%\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
\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
+[@--\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