$query = qq|SELECT * FROM shipto WHERE (trans_id = ?)|;
$form->{SHIPTO} = selectall_hashref_query($form, $dbh, $query, $vc_id);
+ if ($vc eq 'customer') {
+ $query = qq|SELECT * FROM additional_billing_addresses WHERE (customer_id = ?)|;
+ $form->{ADDITIONAL_BILLING_ADDRESSES} = selectall_hashref_query($form, $dbh, $query, $vc_id);
+ }
+
$query = qq|SELECT * FROM contacts WHERE (cp_cv_id = ?)|;
$form->{CONTACTS} = selectall_hashref_query($form, $dbh, $query, $vc_id);
use SL::MIME;
use SL::Util qw(trim);
use SL::YAML;
+use SL::DB::AdditionalBillingAddress;
use SL::DB::History;
use SL::DB::Order;
use SL::DB::Default;
$self->js->hide('#shipto_selection');
}
+ if ($cv_method eq 'customer') {
+ my $show_hide = scalar @{ $self->order->customer->additional_billing_addresses } > 0 ? 'show' : 'hide';
+ $self->js->$show_hide('#billing_address_row');
+ }
+
$self->js->val( '#order_salesman_id', $self->order->salesman_id) if $self->order->is_sales;
$self->js
- ->replaceWith('#order_cp_id', $self->build_contact_select)
- ->replaceWith('#order_shipto_id', $self->build_shipto_select)
- ->replaceWith('#shipto_inputs ', $self->build_shipto_inputs)
- ->replaceWith('#business_info_row', $self->build_business_info_row)
- ->val( '#order_taxzone_id', $self->order->taxzone_id)
- ->val( '#order_taxincluded', $self->order->taxincluded)
- ->val( '#order_currency_id', $self->order->currency_id)
- ->val( '#order_payment_id', $self->order->payment_id)
- ->val( '#order_delivery_term_id', $self->order->delivery_term_id)
- ->val( '#order_intnotes', $self->order->intnotes)
- ->val( '#order_language_id', $self->order->$cv_method->language_id)
+ ->replaceWith('#order_cp_id', $self->build_contact_select)
+ ->replaceWith('#order_shipto_id', $self->build_shipto_select)
+ ->replaceWith('#shipto_inputs ', $self->build_shipto_inputs)
+ ->replaceWith('#order_billing_address_id', $self->build_billing_address_select)
+ ->replaceWith('#business_info_row', $self->build_business_info_row)
+ ->val( '#order_taxzone_id', $self->order->taxzone_id)
+ ->val( '#order_taxincluded', $self->order->taxincluded)
+ ->val( '#order_currency_id', $self->order->currency_id)
+ ->val( '#order_payment_id', $self->order->payment_id)
+ ->val( '#order_delivery_term_id', $self->order->delivery_term_id)
+ ->val( '#order_intnotes', $self->order->intnotes)
+ ->val( '#order_language_id', $self->order->$cv_method->language_id)
->focus( '#order_' . $self->cv . '_id')
->run('kivi.Order.update_exchangerate');
$details{payment_terms} = $cv->payment->description if $cv->payment;
$details{pricegroup} = $cv->pricegroup->pricegroup if $is_customer && $cv->pricegroup;
+ foreach my $entry (@{ $cv->additional_billing_addresses }) {
+ push @{ $details{ADDITIONAL_BILLING_ADDRESSES} }, { map { $_ => $entry->$_ } @{$entry->meta->columns} };
+ }
foreach my $entry (@{ $cv->shipto }) {
push @{ $details{SHIPTO} }, { map { $_ => $entry->$_ } @{$entry->meta->columns} };
}
);
}
+# build the selection box for the additional billing address
+#
+# Needed, if customer/vendor changed.
+sub build_billing_address_select {
+ my ($self) = @_;
+
+ select_tag('order.billing_address_id',
+ [ {displayable_id => '', id => ''}, $self->order->{$self->cv}->additional_billing_addresses ],
+ value_key => 'id',
+ title_key => 'displayable_id',
+ default => $self->order->billing_address_id,
+ with_empty => 0,
+ style => 'width: 300px',
+ );
+}
+
# build the selection box for shiptos
#
# Needed, if customer/vendor changed.
$order->intnotes($order->customervendor->notes);
- if ($order->is_sales) {
- $order->salesman_id($order->customer->salesman_id || SL::DB::Manager::Employee->current->id);
- $order->taxincluded(defined($order->customer->taxincluded_checked)
- ? $order->customer->taxincluded_checked
- : $::myconfig{taxincluded_checked});
- }
+ return if !$order->is_sales;
+
+ $order->salesman_id($order->customer->salesman_id || SL::DB::Manager::Employee->current->id);
+ $order->taxincluded(defined($order->customer->taxincluded_checked)
+ ? $order->customer->taxincluded_checked
+ : $::myconfig{taxincluded_checked});
+ my $address = $order->customer->default_billing_address;;
+ $order->billing_address_id($address ? $address->id : undef);
}
# setup custom shipto from form
use strict;
+use List::Util qw(first);
use Rose::DB::Object::Helpers qw(as_tree);
use SL::Locale::String qw(t8);
return $self->create_zugferd_invoices;
}
+sub default_billing_address {
+ my $self = shift;
+
+ die 'not an accessor' if @_ > 1;
+ return first { $_->default_address } @{ $self->additional_billing_addresses };
+}
+
1;
}
my %args = ( map({ ( $_ => $source->$_ ) } qw(cp_id currency_id customer_id cusordnumber delivery_term_id department_id employee_id globalproject_id intnotes language_id notes
- ordnumber payment_id reqdate salesman_id shippingpoint shipvia taxincluded taxzone_id transaction_description vendor_id
+ ordnumber payment_id reqdate salesman_id shippingpoint shipvia taxincluded taxzone_id transaction_description vendor_id billing_address_id
)),
closed => 0,
is_sales => !!$source->customer_id,
$terms = $source->customer->payment_terms if !defined $terms && $source->customer;
my %args = ( map({ ( $_ => $source->$_ ) } qw(customer_id taxincluded shippingpoint shipvia notes intnotes salesman_id cusordnumber ordnumber department_id
- cp_id language_id taxzone_id tax_point globalproject_id transaction_description currency_id delivery_term_id), @columns),
+ cp_id language_id taxzone_id tax_point globalproject_id transaction_description currency_id delivery_term_id
+ billing_address_id), @columns),
transdate => $params{transdate} // DateTime->today_local,
gldate => DateTime->today_local,
duedate => $terms ? $terms->calc_date(reference_date => DateTime->today_local) : DateTime->today_local,
my %args = ( map({ ( $_ => $source->$_ ) } qw(amount cp_id currency_id cusordnumber customer_id delivery_customer_id delivery_term_id delivery_vendor_id
department_id exchangerate globalproject_id intnotes marge_percent marge_total language_id netamount notes
ordnumber payment_id quonumber reqdate salesman_id shippingpoint shipvia taxincluded tax_point taxzone_id
- transaction_description vendor_id
+ transaction_description vendor_id billing_address_id
)),
quotation => !!($destination_type =~ m{quotation$}),
closed => 0,
donumber = ?, ordnumber = ?, cusordnumber = ?, transdate = ?, vendor_id = ?,
customer_id = ?, reqdate = ?, tax_point = ?,
shippingpoint = ?, shipvia = ?, notes = ?, intnotes = ?, closed = ?,
- delivered = ?, department_id = ?, language_id = ?, shipto_id = ?,
+ delivered = ?, department_id = ?, language_id = ?, shipto_id = ?, billing_address_id = ?,
globalproject_id = ?, employee_id = ?, salesman_id = ?, cp_id = ?, transaction_description = ?,
is_sales = ?, taxzone_id = ?, taxincluded = ?, payment_id = ?, currency_id = (SELECT id FROM currencies WHERE name = ?),
delivery_term_id = ?
conv_date($form->{reqdate}), conv_date($form->{tax_point}), $form->{shippingpoint}, $form->{shipvia},
$restricter->process($form->{notes}), $form->{intnotes},
$form->{closed} ? 't' : 'f', $form->{delivered} ? "t" : "f",
- conv_i($form->{department_id}), conv_i($form->{language_id}), conv_i($form->{shipto_id}),
+ conv_i($form->{department_id}), conv_i($form->{language_id}), conv_i($form->{shipto_id}), conv_i($form->{billing_address_id}),
conv_i($form->{globalproject_id}), conv_i($form->{employee_id}),
conv_i($form->{salesman_id}), conv_i($form->{cp_id}),
$form->{transaction_description},
dord.${vc}_id, cv.name AS ${vc},
dord.closed, dord.reqdate, dord.department_id, dord.cusordnumber,
d.description AS department, dord.language_id,
- dord.shipto_id,
+ dord.shipto_id, dord.billing_address_id,
dord.itime, dord.mtime,
dord.globalproject_id, dord.delivered, dord.transaction_description,
dord.taxzone_id, dord.taxincluded, dord.payment_id, (SELECT cu.name FROM currencies cu WHERE cu.id=dord.currency_id) AS currency,
shipvia = ?, notes = ?, intnotes = ?,
currency_id = (SELECT id FROM currencies WHERE name = ?),
department_id = ?, payment_id = ?, taxincluded = ?,
- type = ?, language_id = ?, taxzone_id = ?, shipto_id = ?,
+ type = ?, language_id = ?, taxzone_id = ?, shipto_id = ?, billing_address_id = ?,
employee_id = ?, salesman_id = ?, storno_id = ?, storno = ?,
cp_id = ?, marge_total = ?, marge_percent = ?,
globalproject_id = ?, delivery_customer_id = ?,
conv_date($form->{"duedate"}), conv_date($form->{"deliverydate"}), '1', $form->{"shippingpoint"},
$form->{"shipvia"}, $restricter->process($form->{"notes"}), $form->{"intnotes"},
$form->{"currency"}, conv_i($form->{"department_id"}), conv_i($form->{"payment_id"}), $form->{"taxincluded"} ? 't' : 'f',
- $form->{"type"}, conv_i($form->{"language_id"}), conv_i($form->{"taxzone_id"}), conv_i($form->{"shipto_id"}),
+ $form->{"type"}, conv_i($form->{"language_id"}), conv_i($form->{"taxzone_id"}), conv_i($form->{"shipto_id"}), conv_i($form->{billing_address_id}),
conv_i($form->{"employee_id"}), conv_i($form->{"salesman_id"}), conv_i($form->{storno_id}), $form->{"storno"} ? 't' : 'f',
conv_i($form->{"cp_id"}), 1 * $form->{marge_total} , 1 * $form->{marge_percent},
conv_i($form->{"globalproject_id"}), conv_i($form->{"delivery_customer_id"}),
a.transdate AS invdate, a.deliverydate, a.tax_point, a.paid, a.storno, a.storno_id, a.gldate,
a.shippingpoint, a.shipvia, a.notes, a.intnotes, a.taxzone_id,
a.duedate, a.taxincluded, (SELECT cu.name FROM currencies cu WHERE cu.id=a.currency_id) AS currency, a.shipto_id, a.cp_id,
+ a.billing_address_id,
a.employee_id, a.salesman_id, a.payment_id,
a.mtime, a.itime,
a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type,
c.street, c.zipcode, c.city, c.country,
c.notes AS intnotes, c.pricegroup_id as customer_pricegroup_id, c.taxzone_id, c.salesman_id, cu.name AS curr,
c.taxincluded_checked, c.direct_debit,
+ (SELECT aba.id
+ FROM additional_billing_addresses aba
+ WHERE aba.default_address
+ LIMIT 1) AS default_billing_address_id,
b.discount AS tradediscount, b.description AS business
FROM customer c
LEFT JOIN business b ON (b.id = c.business_id)
customer_id = ?, amount = ?, netamount = ?, reqdate = ?, tax_point = ?, taxincluded = ?,
shippingpoint = ?, shipvia = ?, notes = ?, intnotes = ?, currency_id = (SELECT id FROM currencies WHERE name=?), closed = ?,
delivered = ?, proforma = ?, quotation = ?, department_id = ?, language_id = ?,
- taxzone_id = ?, shipto_id = ?, payment_id = ?, delivery_vendor_id = ?, delivery_customer_id = ?,delivery_term_id = ?,
+ taxzone_id = ?, shipto_id = ?, billing_address_id = ?, payment_id = ?, delivery_vendor_id = ?, delivery_customer_id = ?,delivery_term_id = ?,
globalproject_id = ?, employee_id = ?, salesman_id = ?, cp_id = ?, transaction_description = ?, marge_total = ?, marge_percent = ?
, order_probability = ?, expected_billing_date = ?
WHERE id = ?|;
$form->{delivered} ? "t" : "f", $form->{proforma} ? 't' : 'f',
$quotation, conv_i($form->{department_id}),
conv_i($form->{language_id}), conv_i($form->{taxzone_id}),
- conv_i($form->{shipto_id}), conv_i($form->{payment_id}),
+ conv_i($form->{shipto_id}), conv_i($form->{billing_address_id}), conv_i($form->{payment_id}),
conv_i($form->{delivery_vendor_id}),
conv_i($form->{delivery_customer_id}),
conv_i($form->{delivery_term_id}),
o.closed, o.reqdate, o.tax_point, o.quonumber, o.department_id, o.cusordnumber,
o.mtime, o.itime,
d.description AS department, o.payment_id, o.language_id, o.taxzone_id,
- o.delivery_customer_id, o.delivery_vendor_id, o.proforma, o.shipto_id,
+ o.delivery_customer_id, o.delivery_vendor_id, o.proforma, o.shipto_id, o.billing_address_id,
o.globalproject_id, o.delivered, o.transaction_description, o.delivery_term_id,
o.itime::DATE AS insertdate, o.order_probability, o.expected_billing_date
FROM oe o
$form->{show_details} = $::myconfig{show_form_details};
$form->{callback} = build_std_url('action=add', 'type', 'vc') unless ($form->{callback});
- order_links();
+ order_links(is_new => 1);
prepare_order();
display_form();
check_do_access();
+ my %params = @_;
my $form = $main::form;
my %myconfig = %main::myconfig;
} else {
IS->get_customer(\%myconfig, \%$form);
$form->{discount} = $form->{customer_discount};
+ $form->{billing_address_id} = $form->{default_billing_address_id} if $params{is_new};
}
$form->restore_vars(qw(payment_id language_id taxzone_id intnotes cp_id delivery_term_id));
if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
$::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
- IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
- IR->get_vendor(\%myconfig, $form) if $vc eq 'vendor';
+ if ($vc eq 'customer') {
+ IS->get_customer(\%myconfig, $form);
+ $::form->{billing_address_id} = $::form->{default_billing_address_id};
+ } else {
+ IR->get_vendor(\%myconfig, $form);
+ }
}
$form->{discount} = $form->{"$form->{vc}_discount"} if defined $form->{"$form->{vc}_discount"};
if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
$::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
- IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
- IR->get_vendor(\%myconfig, $form) if $vc eq 'vendor';
+ if ($vc eq 'customer') {
+ IS->get_customer(\%myconfig, $form);
+ $::form->{billing_address_id} = $::form->{default_billing_address_id};
+ } else {
+ IR->get_vendor(\%myconfig, $form);
+ }
update();
$::dispatcher->end_request;
$form->{callback} = "$form->{script}?action=add&type=$form->{type}" unless $form->{callback};
- &invoice_links;
+ invoice_links(is_new => 1);
&prepare_invoice;
&display_form;
# Delay access check to after the invoice's been loaded so that
# project-specific invoice rights can be evaluated.
+ my %params = @_;
my $form = $main::form;
my %myconfig = %main::myconfig;
IS->get_customer(\%myconfig, \%$form);
+ $form->{billing_address_id} = $form->{default_billing_address_id} if $params{is_new};
+
$form->restore_vars(qw(id));
IS->retrieve_invoice(\%myconfig, \%$form);
$::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
IS->get_customer(\%myconfig, $form);
+ $::form->{billing_address_id} = $::form->{default_billing_address_id};
}
$form->{taxincluded} ||= $taxincluded;
$form->{show_details} = $::myconfig{show_form_details};
- &order_links;
+ order_links(is_new => 1);
&prepare_order;
&display_form;
sub order_links {
$main::lxdebug->enter_sub();
+ my (%params) = @_;
+
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
$form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes shipto_id delivery_term_id currency));
# get customer / vendor
- IR->get_vendor(\%myconfig, \%$form) if $form->{type} =~ /(purchase_order|request_quotation)/;
- IS->get_customer(\%myconfig, \%$form) if $form->{type} =~ /sales_(order|quotation)/;
+ if ($form->{type} =~ /(purchase_order|request_quotation)/) {
+ IR->get_vendor(\%myconfig, \%$form);
+ } else {
+ IS->get_customer(\%myconfig, \%$form);
+ $form->{billing_address_id} = $form->{default_billing_address_id} if $params{is_new};
+ }
$form->restore_vars(qw(payment_id language_id taxzone_id intnotes cp_id shipto_id delivery_term_id));
$form->restore_vars(qw(currency)) if $form->{id};
if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
$::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
- IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
- IR->get_vendor(\%myconfig, $form) if $vc eq 'vendor';
+ if ($vc eq 'customer') {
+ IS->get_customer(\%myconfig, $form);
+ $::form->{billing_address_id} = $::form->{default_billing_address_id};
+ } else {
+ IR->get_vendor(\%myconfig, $form);
+ }
}
if (!$form->{forex}) { # read exchangerate from input field (not hidden)
IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
IR->get_vendor(\%myconfig, $form) if $vc eq 'vendor';
+ $::form->{billing_address_id} = $::form->{default_billing_address_id};
+
update();
$::dispatcher->end_request;
}
if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
$::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
- IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
- IR->get_vendor(\%myconfig, $form) if $vc eq 'vendor';
+ if ($vc eq 'customer') {
+ IS->get_customer(\%myconfig, $form);
+ $::form->{billing_address_id} = $::form->{default_billing_address_id};
+
+ } else {
+ IR->get_vendor(\%myconfig, $form);
+ }
update();
$::dispatcher->end_request;
'Added sections and function blocks: #1' => 'Hinzugefügte Abschnitte und Funktionsblöcke: #1',
'Added text blocks: #1' => 'Hinzugefügte Textblöcke: #1',
'Addition' => 'Zusatz',
+ 'Additional Billing Address' => 'Zusätzliche Rechnungsadresse',
'Additional Billing Addresses' => 'Zusätzliche Rechnungsadressen',
'Additional articles' => 'Zusätzliche Artikel',
'Additional articles actions' => 'Aktionen zu zusätzlichen Artikeln',
'Current version' => 'Aktuelle Version',
'Current year' => 'Aktuelles Jahr',
'Currently #1 delivery orders can be converted into invoices and printed.' => 'Momentan können #1 Lieferscheine in Rechnungen umgewandelt werden.',
+ 'Custom Billing Address' => 'Abweichende Rechnungsadresse',
'Custom CSV format' => 'Eigenes CSV-Format',
'Custom Variables' => 'Benutzerdefinierte Variablen',
'Custom data export' => 'Benutzerdefinierter Datenexport',
[%- USE T8 %]
-[% USE HTML %]
+[% USE HTML %][%- USE LxERP -%]
<h1>[% IF is_customer %][% 'Customer details' | $T8 %][% ELSE %][% 'Vendor details' | $T8 %][% END %] "[% HTML.escape(name) %]"</h1>
[% BLOCK jump_block %]
[%- IF SHIPTO.size || CONTACTS.size %]
<p>
[% 'Jump to' | $T8 %] <a href="#billing">[% 'Billing Address' | $T8 %]</a>
+ [%- FOREACH additional_billing_addresses = ADDITIONAL_BILLING_ADDRESSES %]
+ ,
+ <a href="#additional_billing_address[% loop.count %]">
+ [% 'Additional Billing Address' | $T8 %]
+ "[% HTML.escape(additional_billing_addresses.name) %]"
+ </a>
+ [%- END %]
[%- FOREACH shipto = SHIPTO %]
,
<a href="#shipping[% loop.count %]">
[%- END %]
[% END %]
- [%- INCLUDE jump_block CONTACTS = CONTACTS, SHIPTO = SHIPTO %]
+ [%- INCLUDE jump_block CONTACTS = CONTACTS, SHIPTO = SHIPTO, ADDITIONAL_BILLING_ADDRESSES = ADDITIONAL_BILLING_ADDRESSES %]
<a name="billing"><h1>[% 'Billing Address' | $T8 %]</h1></a>
</table>
+ [% FOREACH row = ADDITIONAL_BILLING_ADDRESSES %]
+
+ <hr>
+
+ [%- INCLUDE jump_block CONTACTS = CONTACTS, SHIPTO = SHIPTO, ADDITIONAL_BILLING_ADDRESSES = ADDITIONAL_BILLING_ADDRESSES %]
+
+ <a name="additional_billing_address[% loop.count %]"><h1>[% 'Additional Billing Address' | $T8 %] "[% HTML.escape(row.name) %]"</h1></a>
+
+ <table>
+ <tr>
+ <td align="right">[% 'Default Billing Address' | $T8 %]</td>
+ <td>[% row.default_address ? LxERP.t8('yes') : LxERP.t8('no') %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% 'Name' | $T8 %]</td>
+ <td>[% HTML.escape(row.name) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% 'Department' | $T8 %]</td>
+ <td>[% HTML.escape(row.department_1) %][% IF row.department_2 %][% IF row.department_1 %]; [% END %][% HTML.escape(row.department_2) %][% END %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% 'Street' | $T8 %]</td>
+ <td>[% HTML.escape(row.street) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% 'Zip, City' | $T8 %]</td>
+ <td>[% HTML.escape(row.zipcode) %] [% HTML.escape(row.city) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% 'Country' | $T8 %]</td>
+ <td>[% HTML.escape(row.country) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% 'GLN' | $T8 %]</td>
+ <td>[% HTML.escape(row.gln) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% 'Contact' | $T8 %]</td>
+ <td>[% HTML.escape(row.contact) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% 'Phone' | $T8 %]</td>
+ <td>[% HTML.escape(row.phone) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% 'Fax' | $T8 %]</td>
+ <td>[% HTML.escape(row.fax) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% 'E-mail' | $T8 %]</td>
+ <td>[% HTML.escape(row.email) %]</td>
+ </tr>
+
+ </table>
+ [% END %]
[% FOREACH row = SHIPTO %]
<hr>
- [%- INCLUDE jump_block CONTACTS = CONTACTS, SHIPTO = SHIPTO %]
+ [%- INCLUDE jump_block CONTACTS = CONTACTS, SHIPTO = SHIPTO, ADDITIONAL_BILLING_ADDRESSES = ADDITIONAL_BILLING_ADDRESSES %]
<a name="shipping[% loop.count %]"><h1>[% 'Shipping Address' | $T8 %] "[% HTML.escape(row.shiptoname) %]"</h1></a>
<hr>
- [%- INCLUDE jump_block CONTACTS = CONTACTS, SHIPTO = SHIPTO %]
+ [%- INCLUDE jump_block CONTACTS = CONTACTS, SHIPTO = SHIPTO, ADDITIONAL_BILLING_ADDRESSES = ADDITIONAL_BILLING_ADDRESSES %]
<a name="contact[% loop.count %]"><h1>[% 'Contact Person' | $T8 %] "[% HTML.escape(row.cp_name) %]"</h1></a>
</td>
</tr>
+ [%- IF (vc == 'customer') && VC_OBJ.additional_billing_addresses.as_list.size %]
+ <tr>
+ <th align="right">[% 'Custom Billing Address' | $T8 %]</th>
+ <td>
+ [% L.select_tag('billing_address_id', VC_OBJ.additional_billing_addresses,
+ with_empty=1, default=billing_address_id, value_key='id', title_key='displayable_id', style='width: 250px') %]
+ </td>
+ </tr>
+ [%- END %]
+
[%- IF business %]
<tr>
<th align="right">[% IF is_customer %][% 'Customer type' | $T8 %][% ELSE %][% 'Vendor type' | $T8 %][% END %]</th>
[% L.button_tag("kivi.SalesPurchase.edit_custom_shipto()", LxERP.t8("Custom shipto")) %]
</td>
</tr>
+
+[%- IF customer_obj.additional_billing_addresses.as_list.size %]
+ <tr>
+ <th align="right">[% 'Custom Billing Address' | $T8 %]</th>
+ <td>
+ [% L.select_tag('billing_address_id', customer_obj.additional_billing_addresses,
+ with_empty=1, default=billing_address_id, value_key='id', title_key='displayable_id', style='width: 250px') %]
+ </td>
+ </tr>
+[%- END %]
+
<tr>
<td align="right">[% 'Credit Limit' | $T8 %]</td>
<td>
[% L.button_tag("kivi.SalesPurchase.edit_custom_shipto()", LxERP.t8("Custom shipto")) %]
</td>
</tr>
+
+[%- IF is_sales && vc_obj.additional_billing_addresses.as_list.size %]
+ <tr>
+ <th align="right">[% 'Custom Billing Address' | $T8 %]</th>
+ <td>
+ [% L.select_tag('billing_address_id', vc_obj.additional_billing_addresses,
+ with_empty=1, default=billing_address_id, value_key='id', title_key='displayable_id', style='width: 250px') %]
+ </td>
+ </tr>
+[%- END %]
+
[%- IF is_order %]
<tr>
<td align="right">[% 'Credit Limit' | $T8 %]</td>
</td>
</tr>
+ [%- IF SELF.cv == "customer" %]
+ <tr id="billing_address_row"[% IF !SELF.order.customer.additional_billing_addresses.as_list.size %] style="display:none"[% END %]>
+ <th align="right">[% 'Custom Billing Address' | $T8 %]</th>
+ <td>
+ [% L.select_tag('order.billing_address_id',
+ SELF.order.customer.additional_billing_addresses,
+ default=SELF.order.billing_address_id,
+ title_key='displayable_id',
+ value_key='id',
+ with_empty=1,
+ style='width: 300px') %]
+ </td>
+ </tr>
+ [%- END %]
+
[%- PROCESS order/tabs/_business_info_row.html SELF=SELF %]
<tr>