qq|c_vendor_id = ?, | .
qq|klass = ?, | .
qq|currency_id = (SELECT id FROM currencies WHERE name = ?), | .
- qq|taxincluded_checked = ? | .
+ qq|taxincluded_checked = ?, | .
+ qq|delivery_term_id = ? | .
qq|WHERE id = ?|;
my @values = (
$form->{customernumber},
conv_i($form->{klass}),
$form->{currency},
$form->{taxincluded_checked} ne '' ? $form->{taxincluded_checked} : undef,
+ conv_i($form->{delivery_term_id}),
$form->{id}
);
do_query( $form, $dbh, $query, @values );
qq| username = ?, | .
qq| user_password = ?, | .
qq| v_customer_id = ?, | .
- qq| currency_id = (SELECT id FROM currencies WHERE name = ?) | .
+ qq| currency_id = (SELECT id FROM currencies WHERE name = ?), | .
+ qq| delivery_term_id = ? | .
qq|WHERE id = ?|;
my @values = (
$form->{vendornumber},
$form->{user_password},
$form->{v_customer_id},
$form->{currency},
+ conv_i($form->{delivery_term_id}),
$form->{id}
);
do_query($form, $dbh, $query, @values);
vc.*,
pt.description AS payment_terms,
b.description AS business,
- l.description AS language
+ l.description AS language,
+ dt.description AS delivery_terms
FROM ${vc} vc
LEFT JOIN payment_terms pt ON (vc.payment_id = pt.id)
LEFT JOIN business b ON (vc.business_id = b.id)
LEFT JOIN language l ON (vc.language_id = l.id)
+ LEFT JOIN delivery_terms dt ON (vc.delivery_term_id = dt.id)
WHERE vc.id = ?|;
my $ref = selectfirst_hashref_query($form, $dbh, $query, $vc_id);
use SL::DB::Customer;
use SL::DB::Language;
use SL::DB::PaymentTerm;
+use SL::DB::DeliveryTerm;
use SL::DB::Vendor;
use SL::DB::Contact;
use SL::DB::History;
use Rose::Object::MakeMethods::Generic
(
scalar => [ qw(controller file csv test_run save_with_cascade) ],
- 'scalar --get_set_init' => [ qw(profile displayable_columns existing_objects class manager_class cvar_columns all_cvar_configs all_languages payment_terms_by all_vc vc_by) ],
+ 'scalar --get_set_init' => [ qw(profile displayable_columns existing_objects class manager_class cvar_columns all_cvar_configs all_languages payment_terms_by delivery_terms_by all_vc vc_by) ],
);
sub run {
return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $all_payment_terms } } ) } qw(id description) };
}
+sub init_delivery_terms_by {
+ my ($self) = @_;
+
+ my $all_delivery_terms = SL::DB::Manager::DeliveryTerm->get_all;
+ return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $all_delivery_terms } } ) } qw(id description) };
+}
+
sub init_all_vc {
my ($self) = @_;
return 1;
}
+sub check_delivery_term {
+ my ($self, $entry) = @_;
+
+ my $object = $entry->{object};
+
+ # Check whether or not delivery term ID is valid.
+ if ($object->delivery_term_id && !$self->delivery_terms_by->{id}->{ $object->delivery_term_id }) {
+ push @{ $entry->{errors} }, $::locale->text('Error: Invalid delivery terms');
+ return 0;
+ }
+
+ # Map name to ID if given.
+ if (!$object->delivery_term_id && $entry->{raw_data}->{delivery_term}) {
+ my $terms = $self->delivery_terms_by->{description}->{ $entry->{raw_data}->{delivery_term} };
+
+ if (!$terms) {
+ push @{ $entry->{errors} }, $::locale->text('Error: Invalid delivery terms');
+ return 0;
+ }
+
+ $object->delivery_term_id($terms->id);
+ }
+
+ return 1;
+}
+
sub save_objects {
my ($self, %params) = @_;
$self->check_language($entry);
$self->check_business($entry);
$self->check_payment($entry);
+ $self->check_delivery_term($entry);
$self->check_currency($entry, take_default => 1);
$self->handle_cvars($entry);
$i++;
}
- $self->add_columns(map { "${_}_id" } grep { exists $self->controller->data->[0]->{raw_data}->{$_} } qw(language business payment));
+ $self->add_columns(map { "${_}_id" } grep { exists $self->controller->data->[0]->{raw_data}->{$_} } qw(language business payment delivery_term));
$self->add_cvar_raw_data_columns;
}
my ($self) = @_;
my $profile = $self->SUPER::init_profile;
- delete @{$profile}{qw(business datevexport language payment salesman salesman_id taxincluded terms)};
+ delete @{$profile}{qw(business datevexport language payment delivery_term salesman salesman_id taxincluded terms)};
return $profile;
}
{ name => 'customernumber', description => $::locale->text('Customer Number') },
{ name => 'department_1', description => $::locale->text('Department 1') },
{ name => 'department_2', description => $::locale->text('Department 2') },
+ { name => 'delivery_term_id', description => $::locale->text('Delivery terms (database ID)') },
+ { name => 'delivery_term', description => $::locale->text('Delivery terms (name)') },
{ name => 'direct_debit', description => $::locale->text('direct debit') },
{ name => 'discount', description => $::locale->text('Discount') },
{ name => 'email', description => $::locale->text('E-mail') },
{ name => 'currency_id', description => $::locale->text('Currency (database ID)') },
{ name => 'cusordnumber', description => $::locale->text('Customer Order Number') },
{ name => 'delivered', description => $::locale->text('Delivered') },
+ { name => 'delivery_term_id', description => $::locale->text('Delivery terms (database ID)') },
+ { name => 'delivery_term', description => $::locale->text('Delivery terms (name)') },
{ name => 'employee_id', description => $::locale->text('Employee (database ID)') },
{ name => 'intnotes', description => $::locale->text('Internal Notes') },
{ name => 'marge_percent', description => $::locale->text('Margepercent') },
{ header => $::locale->text('Customer/Vendor'), method => 'vc_name' });
# Todo: access via ->[0] ok? Better: search first order column and use this
$self->add_columns($self->_order_column,
- map { "${_}_id" } grep { exists $self->controller->data->[0]->{raw_data}->{$_} } qw(payment language department globalproject taxzone cp currency));
+ map { "${_}_id" } grep { exists $self->controller->data->[0]->{raw_data}->{$_} } qw(payment delivery_term language department globalproject taxzone cp currency));
$self->add_columns($self->_order_column, 'globalproject_id') if exists $self->controller->data->[0]->{raw_data}->{globalprojectnumber};
$self->add_columns($self->_order_column, 'cp_id') if exists $self->controller->data->[0]->{raw_data}->{contact};
$self->check_contact($entry);
$self->check_language($entry);
$self->check_payment($entry);
+ $self->check_delivery_term($entry);
$self->check_department($entry);
$self->check_project($entry, global => 1);
$self->check_ct_shipto($entry);
$self->{all_payment_terms} = SL::DB::Manager::PaymentTerm->get_all();
+ $self->{all_delivery_terms} = SL::DB::Manager::DeliveryTerm->get_all();
+
$self->{all_pricegroups} = SL::DB::Manager::Pricegroup->get_all();
$query =
--- /dev/null
+package SL::Controller::DeliveryTerm;
+
+use strict;
+
+use parent qw(SL::Controller::Base);
+
+use SL::DB::DeliveryTerm;
+use SL::Helper::Flash;
+
+use Rose::Object::MakeMethods::Generic
+(
+ scalar => [ qw(delivery_term) ],
+);
+
+__PACKAGE__->run_before('check_auth');
+__PACKAGE__->run_before('load_delivery_term', only => [ qw(edit update destroy) ]);
+
+
+#
+# actions
+#
+
+sub action_list {
+ my ($self) = @_;
+
+ $self->render('delivery_term/list',
+ title => $::locale->text('Delivery terms'),
+ DELIVERY_TERMS => SL::DB::Manager::DeliveryTerm->get_all_sorted);
+}
+
+sub action_new {
+ my ($self) = @_;
+
+ $self->{delivery_term} = SL::DB::DeliveryTerm->new;
+ $self->render('delivery_term/form', title => $::locale->text('Create a new delivery term'));
+}
+
+sub action_edit {
+ my ($self) = @_;
+ $self->render('delivery_term/form', title => $::locale->text('Edit delivery term'));
+}
+
+sub action_create {
+ my ($self) = @_;
+
+ $self->{delivery_term} = SL::DB::DeliveryTerm->new;
+ $self->create_or_update;
+}
+
+sub action_update {
+ my ($self) = @_;
+ $self->create_or_update;
+}
+
+sub action_destroy {
+ my ($self) = @_;
+
+ if (eval { $self->{delivery_term}->delete; 1; }) {
+ flash_later('info', $::locale->text('The delivery term has been deleted.'));
+ } else {
+ flash_later('error', $::locale->text('The delivery term is in use and cannot be deleted.'));
+ }
+
+ $self->redirect_to(action => 'list');
+}
+
+sub action_reorder {
+ my ($self) = @_;
+
+ SL::DB::DeliveryTerm->reorder_list(@{ $::form->{delivery_term_id} || [] });
+
+ $self->render(\'', { type => 'json' }); # ' make Emacs happy
+}
+
+#
+# filters
+#
+
+sub check_auth {
+ $::auth->assert('config');
+}
+
+#
+# helpers
+#
+
+sub create_or_update {
+ my $self = shift;
+ my $is_new = !$self->{delivery_term}->id;
+ my $params = delete($::form->{delivery_term}) || { };
+
+ $self->{delivery_term}->assign_attributes(%{ $params });
+
+ my @errors = $self->{delivery_term}->validate;
+
+ if (@errors) {
+ flash('error', @errors);
+ $self->render('delivery_term/form', title => $is_new ? $::locale->text('Create a new delivery term') : $::locale->text('Edit delivery term'));
+ return;
+ }
+
+ $self->{delivery_term}->save;
+ foreach my $language (@{ $self->{languages} }) {
+ $self->{delivery_term}->save_attribute_translation('description_long', $language, $::form->{"translation_" . $language->id});
+ }
+
+ flash_later('info', $is_new ? $::locale->text('The delivery term has been created.') : $::locale->text('The delivery term has been saved.'));
+ $self->redirect_to(action => 'list');
+}
+
+sub load_delivery_term {
+ my ($self) = @_;
+ $self->{delivery_term} = SL::DB::DeliveryTerm->new(id => $::form->{id})->load;
+}
+
+1;
--- /dev/null
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::DeliveryTerm;
+
+use strict;
+
+use SL::DB::MetaSetup::DeliveryTerm;
+use SL::DB::Manager::DeliveryTerm;
+use SL::DB::Helper::ActsAsList;
+
+
+sub validate {
+ my ($self) = @_;
+
+ my @errors;
+ push @errors, $::locale->text('The description is missing.') if !$self->description;
+ push @errors, $::locale->text('The long description is missing.') if !$self->description_long;
+
+ return @errors;
+}
+
+1;
use SL::DB::DeliveryOrder;
use SL::DB::DeliveryOrderItem;
use SL::DB::DeliveryOrderItemsStock;
+use SL::DB::DeliveryTerm;
use SL::DB::Department;
use SL::DB::Draft;
use SL::DB::Dunning;
_copy($self, $form, '', '', 0, qw(id type taxzone_id ordnumber quonumber invnumber donumber cusordnumber taxincluded shippingpoint shipvia notes intnotes cp_id
employee_id salesman_id closed department_id language_id payment_id delivery_customer_id delivery_vendor_id shipto_id proforma
globalproject_id delivered transaction_description container_type accepted_by_customer invoice terms storno storno_id dunning_config_id
- orddate quodate reqdate gldate duedate deliverydate datepaid transdate));
+ orddate quodate reqdate gldate duedate deliverydate datepaid transdate delivery_term_id));
$form->{currency} = $form->{curr} = $self->currency_id ? $self->currency->name || '' : '';
if (_has($self, 'transdate')) {
my %args = ( map({ ( $_ => $source->$_ ) } qw(customer_id taxincluded shippingpoint shipvia notes intnotes salesman_id cusordnumber ordnumber quonumber
department_id cp_id language_id payment_id delivery_customer_id delivery_vendor_id taxzone_id shipto_id
- globalproject_id transaction_description currency_id)),
+ globalproject_id transaction_description currency_id delivery_term_id)),
transdate => DateTime->today_local,
gldate => DateTime->today_local,
duedate => DateTime->today_local->add(days => $terms * 1),
--- /dev/null
+package SL::DB::Manager::DeliveryTerm;
+
+use strict;
+
+use SL::DB::Helper::Manager;
+use base qw(SL::DB::Helper::Manager);
+
+use SL::DB::Helper::Sorted;
+
+sub object_class { 'SL::DB::DeliveryTerm' }
+
+__PACKAGE__->make_manager_methods;
+
+sub _sort_spec {
+ return ( default => [ 'sortkey', 1 ],
+ columns => { SIMPLE => 'ALL',
+ map { ( $_ => "lower(delivery_terms.${_})" ) } qw(description description_long),
+ });
+}
+
+1;
creditlimit => { type => 'numeric', default => '0', precision => 5, scale => 15 },
currency_id => { type => 'integer', not_null => 1 },
customernumber => { type => 'text' },
+ delivery_term_id => { type => 'integer' },
department_1 => { type => 'varchar', length => 75 },
department_2 => { type => 'varchar', length => 75 },
direct_debit => { type => 'boolean', default => 'false' },
key_columns => { currency_id => 'id' },
},
+ delivery_term => {
+ class => 'SL::DB::DeliveryTerm',
+ key_columns => { delivery_term_id => 'id' },
+ },
+
language_obj => {
class => 'SL::DB::Language',
key_columns => { language_id => 'id' },
cusordnumber => { type => 'text' },
customer_id => { type => 'integer' },
delivered => { type => 'boolean', default => 'false' },
+ delivery_term_id => { type => 'integer' },
department_id => { type => 'integer' },
donumber => { type => 'text', not_null => 1 },
employee_id => { type => 'integer' },
key_columns => { customer_id => 'id' },
},
+ delivery_term => {
+ class => 'SL::DB::DeliveryTerm',
+ key_columns => { delivery_term_id => 'id' },
+ },
+
department => {
class => 'SL::DB::Department',
key_columns => { department_id => 'id' },
--- /dev/null
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::DeliveryTerm;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+ table => 'delivery_terms',
+
+ columns => [
+ id => { type => 'integer', not_null => 1, sequence => 'id' },
+ description => { type => 'text' },
+ description_long => { type => 'text' },
+ sortkey => { type => 'integer', not_null => 1 },
+ itime => { type => 'timestamp', default => 'now()' },
+ mtime => { type => 'timestamp' },
+ ],
+
+ primary_key_columns => [ 'id' ],
+
+ allow_inline_column_values => 1,
+);
+
+1;
+;
customer_id => { type => 'integer' },
datepaid => { type => 'date' },
delivery_customer_id => { type => 'integer' },
+ delivery_term_id => { type => 'integer' },
delivery_vendor_id => { type => 'integer' },
deliverydate => { type => 'date' },
department_id => { type => 'integer' },
key_columns => { customer_id => 'id' },
},
+ delivery_term => {
+ class => 'SL::DB::DeliveryTerm',
+ key_columns => { delivery_term_id => 'id' },
+ },
+
department => {
class => 'SL::DB::Department',
key_columns => { department_id => 'id' },
customer_id => { type => 'integer' },
delivered => { type => 'boolean', default => 'false' },
delivery_customer_id => { type => 'integer' },
+ delivery_term_id => { type => 'integer' },
delivery_vendor_id => { type => 'integer' },
department_id => { type => 'integer' },
employee_id => { type => 'integer' },
key_columns => { delivery_customer_id => 'id' },
},
+ delivery_term => {
+ class => 'SL::DB::DeliveryTerm',
+ key_columns => { delivery_term_id => 'id' },
+ },
+
delivery_vendor => {
class => 'SL::DB::Vendor',
key_columns => { delivery_vendor_id => 'id' },
cp_id => { type => 'integer' },
currency_id => { type => 'integer', not_null => 1 },
datepaid => { type => 'date' },
+ delivery_term_id => { type => 'integer' },
deliverydate => { type => 'date' },
department_id => { type => 'integer' },
direct_debit => { type => 'boolean', default => 'false' },
key_columns => { currency_id => 'id' },
},
+ delivery_term => {
+ class => 'SL::DB::DeliveryTerm',
+ key_columns => { delivery_term_id => 'id' },
+ },
+
department => {
class => 'SL::DB::Department',
key_columns => { department_id => 'id' },
__PACKAGE__->meta->table('vendor');
__PACKAGE__->meta->columns(
- account_number => { type => 'varchar', length => 15 },
- bank => { type => 'text' },
- bank_code => { type => 'varchar', length => 10 },
- bcc => { type => 'text' },
- bic => { type => 'varchar', length => 100 },
- business_id => { type => 'integer' },
- cc => { type => 'text' },
- city => { type => 'varchar', length => 75 },
- contact => { type => 'varchar', length => 75 },
- country => { type => 'varchar', length => 75 },
- creditlimit => { type => 'numeric', precision => 5, scale => 15 },
- currency_id => { type => 'integer', not_null => 1 },
- department_1 => { type => 'varchar', length => 75 },
- department_2 => { type => 'varchar', length => 75 },
- direct_debit => { type => 'boolean', default => 'false' },
- discount => { type => 'float', precision => 4 },
- email => { type => 'text' },
- fax => { type => 'varchar', length => 30 },
- greeting => { type => 'text' },
- homepage => { type => 'text' },
- iban => { type => 'varchar', length => 100 },
- id => { type => 'integer', not_null => 1, sequence => 'id' },
- itime => { type => 'timestamp', default => 'now()' },
- language => { type => 'varchar', length => 5 },
- language_id => { type => 'integer' },
- mtime => { type => 'timestamp' },
- name => { type => 'varchar', length => 75, not_null => 1 },
- notes => { type => 'text' },
- obsolete => { type => 'boolean', default => 'false' },
- payment_id => { type => 'integer' },
- phone => { type => 'text' },
- salesman_id => { type => 'integer' },
- street => { type => 'varchar', length => 75 },
- taxincluded => { type => 'boolean' },
- taxnumber => { type => 'text' },
- taxzone_id => { type => 'integer', default => '0', not_null => 1 },
- terms => { type => 'integer', default => '0' },
- user_password => { type => 'varchar', length => 12 },
- username => { type => 'varchar', length => 50 },
- ustid => { type => 'varchar', length => 14 },
- v_customer_id => { type => 'text' },
- vendornumber => { type => 'text' },
- zipcode => { type => 'varchar', length => 10 },
+ account_number => { type => 'varchar', length => 15 },
+ bank => { type => 'text' },
+ bank_code => { type => 'varchar', length => 10 },
+ bcc => { type => 'text' },
+ bic => { type => 'varchar', length => 100 },
+ business_id => { type => 'integer' },
+ cc => { type => 'text' },
+ city => { type => 'varchar', length => 75 },
+ contact => { type => 'varchar', length => 75 },
+ country => { type => 'varchar', length => 75 },
+ creditlimit => { type => 'numeric', precision => 5, scale => 15 },
+ currency_id => { type => 'integer', not_null => 1 },
+ delivery_term_id => { type => 'integer' },
+ department_1 => { type => 'varchar', length => 75 },
+ department_2 => { type => 'varchar', length => 75 },
+ direct_debit => { type => 'boolean', default => 'false' },
+ discount => { type => 'float', precision => 4 },
+ email => { type => 'text' },
+ fax => { type => 'varchar', length => 30 },
+ greeting => { type => 'text' },
+ homepage => { type => 'text' },
+ iban => { type => 'varchar', length => 100 },
+ id => { type => 'integer', not_null => 1, sequence => 'id' },
+ itime => { type => 'timestamp', default => 'now()' },
+ language => { type => 'varchar', length => 5 },
+ language_id => { type => 'integer' },
+ mtime => { type => 'timestamp' },
+ name => { type => 'varchar', length => 75, not_null => 1 },
+ notes => { type => 'text' },
+ obsolete => { type => 'boolean', default => 'false' },
+ payment_id => { type => 'integer' },
+ phone => { type => 'text' },
+ salesman_id => { type => 'integer' },
+ street => { type => 'varchar', length => 75 },
+ taxincluded => { type => 'boolean' },
+ taxnumber => { type => 'text' },
+ taxzone_id => { type => 'integer', default => '0', not_null => 1 },
+ terms => { type => 'integer', default => '0' },
+ user_password => { type => 'varchar', length => 12 },
+ username => { type => 'varchar', length => 50 },
+ ustid => { type => 'varchar', length => 14 },
+ v_customer_id => { type => 'text' },
+ vendornumber => { type => 'text' },
+ zipcode => { type => 'varchar', length => 10 },
);
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
key_columns => { currency_id => 'id' },
},
+ delivery_term => {
+ class => 'SL::DB::DeliveryTerm',
+ key_columns => { delivery_term_id => 'id' },
+ },
+
language_obj => {
class => 'SL::DB::Language',
key_columns => { language_id => 'id' },
shippingpoint = ?, shipvia = ?, notes = ?, intnotes = ?, closed = ?,
delivered = ?, department_id = ?, language_id = ?, shipto_id = ?,
globalproject_id = ?, employee_id = ?, salesman_id = ?, cp_id = ?, transaction_description = ?,
- is_sales = ?, taxzone_id = ?, taxincluded = ?, terms = ?, currency_id = (SELECT id FROM currencies WHERE name = ?)
+ is_sales = ?, taxzone_id = ?, taxincluded = ?, terms = ?, currency_id = (SELECT id FROM currencies WHERE name = ?),
+ delivery_term_id = ?
WHERE id = ?|;
@values = ($form->{donumber}, $form->{ordnumber},
$form->{transaction_description},
$form->{type} =~ /^sales/ ? 't' : 'f',
conv_i($form->{taxzone_id}), $form->{taxincluded} ? 't' : 'f', conv_i($form->{terms}), $form->{currency},
+ conv_i($form->{delivery_term_id}),
conv_i($form->{id}));
do_query($form, $dbh, $query, @values);
d.description AS department, dord.language_id,
dord.shipto_id,
dord.globalproject_id, dord.delivered, dord.transaction_description,
- dord.taxzone_id, dord.taxincluded, dord.terms, (SELECT cu.name FROM currencies cu WHERE cu.id=dord.currency_id) AS currency
+ dord.taxzone_id, dord.taxincluded, dord.terms, (SELECT cu.name FROM currencies cu WHERE cu.id=dord.currency_id) AS currency,
+ dord.delivery_term_id
FROM delivery_orders dord
JOIN ${vc} cv ON (dord.${vc}_id = cv.id)
LEFT JOIN employee e ON (dord.employee_id = e.id)
$h_pg->finish();
$h_bin_wh->finish();
+ $form->{delivery_term} = SL::DB::Manager::DeliveryTerm->find_by(id => $form->{delivery_term_id} || undef);
+
$form->{username} = $myconfig->{name};
$main::lxdebug->leave_sub();
netamount = ?, paid = ?, duedate = ?,
invoice = ?, taxzone_id = ?, notes = ?, taxincluded = ?,
intnotes = ?, storno_id = ?, storno = ?,
- cp_id = ?, employee_id = ?, department_id = ?,
+ cp_id = ?, employee_id = ?, department_id = ?, delivery_term_id = ?,
globalproject_id = ?, direct_debit = ?
WHERE id = ?|;
@values = (
$netamount, $form->{paid}, conv_date($form->{duedate}),
'1', $taxzone_id, $form->{notes}, $form->{taxincluded} ? 't' : 'f',
$form->{intnotes}, conv_i($form->{storno_id}), $form->{storno} ? 't' : 'f',
- conv_i($form->{cp_id}), conv_i($form->{employee_id}), conv_i($form->{department_id}),
+ conv_i($form->{cp_id}), conv_i($form->{employee_id}), conv_i($form->{department_id}), conv_i($form->{delivery_term_id}),
conv_i($form->{globalproject_id}),
$form->{direct_debit} ? 't' : 'f',
conv_i($form->{id})
$query = qq|SELECT cp_id, invnumber, transdate AS invdate, duedate,
orddate, quodate, globalproject_id,
ordnumber, quonumber, paid, taxincluded, notes, taxzone_id, storno, gldate,
- intnotes, (SELECT cu.name FROM currencies cu WHERE cu.id=ap.currency_id) AS currency, direct_debit
+ intnotes, (SELECT cu.name FROM currencies cu WHERE cu.id=ap.currency_id) AS currency, direct_debit,
+ delivery_term_id
FROM ap
WHERE id = ?|;
$ref = selectfirst_hashref_query($form, $dbh, $query, conv_i($form->{id}));
qq|SELECT
v.id AS vendor_id, v.name AS vendor, v.discount as vendor_discount,
v.creditlimit, v.terms, v.notes AS intnotes,
- v.email, v.cc, v.bcc, v.language_id, v.payment_id,
+ v.email, v.cc, v.bcc, v.language_id, v.payment_id, v.delivery_term_id,
v.street, v.zipcode, v.city, v.country, v.taxzone_id, cu.name AS curr, v.direct_debit,
$duedate + COALESCE(pt.terms_netto, 0) AS duedate,
b.description AS business
$form->set_payment_options($myconfig, $form->{invdate});
+ $form->{delivery_term} = SL::DB::Manager::DeliveryTerm->find_by(id => $form->{delivery_term_id} || undef);
+
$form->{username} = $myconfig->{name};
$main::lxdebug->leave_sub();
cp_id = ?, marge_total = ?, marge_percent = ?,
globalproject_id = ?, delivery_customer_id = ?,
transaction_description = ?, delivery_vendor_id = ?,
- donumber = ?, invnumber_for_credit_note = ?, direct_debit = ?
+ donumber = ?, invnumber_for_credit_note = ?, direct_debit = ?,
+ delivery_term_id = ?
WHERE id = ?|;
@values = ( $form->{"invnumber"}, $form->{"ordnumber"}, $form->{"quonumber"}, $form->{"cusordnumber"},
conv_date($form->{"invdate"}), conv_date($form->{"orddate"}), conv_date($form->{"quodate"}), conv_i($form->{"customer_id"}),
conv_i($form->{"globalproject_id"}), conv_i($form->{"delivery_customer_id"}),
$form->{transaction_description}, conv_i($form->{"delivery_vendor_id"}),
$form->{"donumber"}, $form->{"invnumber_for_credit_note"}, $form->{direct_debit} ? 't' : 'f',
+ conv_i($form->{delivery_term_id}),
conv_i($form->{"id"}));
do_query($form, $dbh, $query, @values);
a.employee_id, a.salesman_id, a.payment_id,
a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type,
a.transaction_description, a.donumber, a.invnumber_for_credit_note,
- a.marge_total, a.marge_percent, a.direct_debit,
+ a.marge_total, a.marge_percent, a.direct_debit, a.delivery_term_id,
e.name AS employee
FROM ar a
LEFT JOIN employee e ON (e.id = a.employee_id)
$query =
qq|SELECT
c.id AS customer_id, c.name AS customer, c.discount as customer_discount, c.creditlimit, c.terms,
- c.email, c.cc, c.bcc, c.language_id, c.payment_id,
+ c.email, c.cc, c.bcc, c.language_id, c.payment_id, c.delivery_term_id,
c.street, c.zipcode, c.city, c.country,
c.notes AS intnotes, c.klass as customer_klass, c.taxzone_id, c.salesman_id, cu.name AS curr,
c.taxincluded_checked, c.direct_debit,
customer_id = ?, amount = ?, netamount = ?, reqdate = ?, 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 = ?,
+ taxzone_id = ?, shipto_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 = ?
WHERE id = ?|;
conv_i($form->{shipto_id}), conv_i($form->{payment_id}),
conv_i($form->{delivery_vendor_id}),
conv_i($form->{delivery_customer_id}),
+ conv_i($form->{delivery_term_id}),
conv_i($form->{globalproject_id}), conv_i($form->{employee_id}),
conv_i($form->{salesman_id}), conv_i($form->{cp_id}),
$form->{transaction_description},
o.closed, o.reqdate, o.quonumber, o.department_id, o.cusordnumber,
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.globalproject_id, o.delivered, o.transaction_description
+ o.globalproject_id, o.delivered, o.transaction_description, o.delivery_term_id
FROM oe o
JOIN ${vc} cv ON (o.${vc}_id = cv.id)
LEFT JOIN employee e ON (o.employee_id = e.id)
$dbh->disconnect;
+ $form->{delivery_term} = SL::DB::Manager::DeliveryTerm->find_by(id => $form->{delivery_term_id} || undef);
+
$main::lxdebug->leave_sub();
}
use SL::Request qw(flatten);
use SL::DB::Business;
use SL::DB::Default;
+use SL::DB::DeliveryTerm;
use SL::Helper::Flash;
use SL::ReportGenerator;
use SL::MoreCommon qw(uri_encode);
$form->{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{salesman_id}, deleted => 0 ] ]);
$form->{USER} = SL::DB::Manager::Employee->current;
+ $form->{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
+
$form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
$form->{is_customer} = $form->{db} eq 'customer';
$form->{shipto_label} = \&_shipto_label;
DO->retrieve('vc' => $form->{vc},
'ids' => $form->{id});
- $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes currency));
+ $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes delivery_term_id currency));
$form->{shipto} = 1 if $form->{id} || $form->{convert_from_oe_ids};
# get customer / vendor
$form->{discount} = $form->{customer_discount};
}
- $form->restore_vars(qw(payment_id language_id taxzone_id intnotes cp_id));
+ $form->restore_vars(qw(payment_id language_id taxzone_id intnotes cp_id delivery_term_id));
$form->restore_vars(qw(currency)) if ($form->{id} || $form->{convert_from_oe_ids});
$form->restore_vars(qw(taxincluded)) if $form->{id};
$form->restore_vars(qw(salesman_id)) if $editing;
my $form = $main::form;
$form->{PRINT_OPTIONS} = print_options('inline' => 1);
+ $form->{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
print $form->parse_html_template('do/form_footer',
{transfer_default => ($::instance_conf->get_transfer_default)});
my $language_saved = $form->{language_id};
my $payment_id_saved = $form->{payment_id};
+ my $delivery_term_id_saved = $form->{delivery_term_id};
my $salesman_id_saved = $form->{salesman_id};
my $cp_id_saved = $form->{cp_id};
my $taxzone_id_saved = $form->{taxzone_id};
$form->{language_id} = $language_saved;
$form->{payment_id} = $payment_id_saved;
+ $form->{delivery_term_id} = $delivery_term_id_saved;
$form->{taxzone_id} = $taxzone_id_saved;
$form->{currency} = $currency_saved;
}
}
- my ($payment_id, $language_id, $taxzone_id, $currency);
+ my ($payment_id, $language_id, $taxzone_id, $currency, $delivery_term_id);
if ($form->{payment_id}) {
$payment_id = $form->{payment_id};
}
if ($form->{currency}) {
$currency = $form->{currency};
}
+ if ($form->{delivery_term_id}) {
+ $delivery_term_id = $form->{delivery_term_id};
+ }
my $cp_id = $form->{cp_id};
IR->get_vendor(\%myconfig, \%$form);
if ($currency) {
$form->{currency} = $currency;
}
+ if ($delivery_term_id) {
+ $form->{delivery_term_id} = $delivery_term_id;
+ }
my @curr = $form->get_all_currencies();
map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
$totalpaid += $form->{"paid_$i"};
}
+ $form->{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
+
print $form->parse_html_template('ir/form_footer', {
is_type_credit_note => ($form->{type} eq "credit_note"),
totalpaid => $totalpaid,
my $editing = $form->{id};
- $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded currency cp_id intnotes id shipto_id));
+ $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id
+ taxincluded currency cp_id intnotes id shipto_id
+ delivery_term_id));
IS->get_customer(\%myconfig, \%$form);
$form->restore_vars(qw(id));
IS->retrieve_invoice(\%myconfig, \%$form);
- $form->restore_vars(qw(payment_id language_id taxzone_id currency intnotes cp_id shipto_id));
+ $form->restore_vars(qw(payment_id language_id taxzone_id currency intnotes
+ cp_id shipto_id delivery_term_id));
$form->restore_vars(qw(taxincluded)) if $form->{id};
$form->restore_vars(qw(salesman_id)) if $editing;
$form->{oldinvtotal} = $form->{invtotal};
+ $form->{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
+
print $form->parse_html_template('is/form_footer', {
is_type_credit_note => ($form->{type} eq "credit_note"),
totalpaid => $totalpaid,
$form->{"$form->{vc}_id"} ||= $form->{"all_$form->{vc}"}->[0]->{id} if $form->{"all_$form->{vc}"};
- $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes shipto_id currency));
+ $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes shipto_id delivery_term_id currency));
$form->{shipto} = 1 if $form->{id} || $form->{convert_from_oe_ids};
# 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)/;
- $form->restore_vars(qw(payment_id language_id taxzone_id intnotes cp_id shipto_id));
+ $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};
$form->restore_vars(qw(taxincluded)) if $form->{id};
$form->restore_vars(qw(salesman_id)) if $editing;
$form->{oldinvtotal} = $form->{invtotal};
+ $TMPL_VAR{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
+
print $form->parse_html_template("oe/form_footer", {
%TMPL_VAR,
webdav => $::instance_conf->get_webdav,
'Are you sure you want to delete Transaction' => 'Buchung wirklich löschen?',
'Are you sure you want to delete this background job?' => 'Sind Sie sicher, dass Sie diesen Hintergrund-Job löschen möchten?',
'Are you sure you want to delete this business?' => 'Sind Sie sicher, dass Sie diesen Kunden-/Lieferantentyp löschen wollen?',
+ 'Are you sure you want to delete this delivery term?' => 'Wollen Sie diese Lieferbedingungen wirklich löschen?',
'Are you sure you want to delete this department?' => 'Sind Sie sicher, dass Sie diese Abteilung löschen wollen?',
'Are you sure you want to delete this payment term?' => 'Wollen Sie diese Zahlungsbedingungen wirklich löschen?',
'Are you sure you want to remove the marked entries from the queue?' => 'Sind Sie sicher, dass die markierten Einträge von der Warteschlange gelöscht werden sollen?',
'Create a new background job' => 'Einen neuen Hintergrund-Job anlegen',
'Create a new business' => 'Einen neuen Kunden-/Lieferantentyp erfassen',
'Create a new client' => 'Einen neuen Mandanten anlegen',
+ 'Create a new delivery term' => 'Neue Lieferbedingungen anlegen',
'Create a new department' => 'Eine neue Abteilung erfassen',
'Create a new group' => 'Neue Benutzergruppe erfassen',
'Create a new payment term' => 'Neue Zahlungsbedingungen anlegen',
'Create new background job' => 'Neuen Hintergrund-Job anlegen',
'Create new business' => 'Kunden-/Lieferantentyp erfassen',
'Create new client #1' => 'Neuen Mandanten #1 anlegen',
+ 'Create new delivery term' => 'Neue Lieferbedingungen anlegen',
'Create new department' => 'Neue Abteilung erfassen',
'Create new payment term' => 'Neue Zahlungsbedingung anlegen',
'Create new templates from master templates' => 'Neue Druckvorlagen aus Vorlagensatz erstellen',
'Delivery Orders' => 'Lieferscheine',
'Delivery Plan' => 'Lieferplan',
'Delivery Plan for currently outstanding sales orders' => 'Lieferplan für offene Verkaufsaufträge',
+ 'Delivery Terms' => 'Lieferbedingungen',
+ 'Delivery terms' => 'Lieferbedingungen',
+ 'Delivery terms (database ID)' => 'Lieferbedingungen (Datenbank-ID)',
+ 'Delivery terms (name)' => 'Lieferbedingungen (Name)',
'Department' => 'Abteilung',
'Department (database ID)' => 'Abeilung (Datenbank-ID)',
'Department (description)' => 'Abteilung (Beschreibung)',
'Edit bank account' => 'Bankkonto bearbeiten',
'Edit business' => 'Kunden-/Lieferantentyp bearbeiten',
'Edit custom variable' => 'Benutzerdefinierte Variable bearbeiten',
+ 'Edit delivery term' => 'Lieferbedingungen bearbeiten',
'Edit department' => 'Abteilung bearbeiten',
'Edit file' => 'Datei bearbeiten',
'Edit greetings' => 'Anreden bearbeiten',
'Error: Invalid business' => 'Fehler: Kunden-/Lieferantentyp ungültig',
'Error: Invalid contact' => 'Fehler: Ansprechperson ungültig',
'Error: Invalid currency' => 'Fehler: ungültige Währung',
+ 'Error: Invalid delivery terms' => 'Fehler: Lieferbedingungen ungültig',
'Error: Invalid department' => 'Fehler: Abteilung ungültig',
'Error: Invalid language' => 'Fehler: Sprache ungültig',
'Error: Invalid order for this order item' => 'Fehler: Auftrag für diese Position ungültig',
'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
'No data was found.' => 'Es wurden keine Daten gefunden.',
'No default currency' => 'Keine Standardwährung',
+ 'No delivery term has been created yet.' => 'Es wurden noch keine Lieferbedingungen angelegt',
'No department has been created yet.' => 'Es wurde noch keine Abteilung erfasst.',
'No dunnings have been selected for printing.' => 'Es wurden keine Mahnungen zum Drucken ausgewählt.',
'No file has been uploaded yet.' => 'Es wurde noch keine Datei hochgeladen.',
'Password' => 'Passwort',
'Payables' => 'Verbindlichkeiten',
'Payment' => 'Zahlungsausgang',
- 'Payment Options' => 'Zahlungsoptionen',
+ 'Payment / Delivery Options' => 'Zahlungs- und Lieferoptionen',
'Payment Reminder' => 'Zahlungserinnerung',
'Payment Terms' => 'Zahlungsbedingungen',
'Payment Terms missing in row ' => 'Zahlungsfrist fehlt in Zeile ',
'The deductible amount' => 'Der abziehbare Skontobetrag',
'The default value depends on the variable type:' => 'Die Bedeutung des Standardwertes hängt vom Variablentypen ab:',
'The delivery order has not been marked as delivered. The warehouse contents have not changed.' => 'Der Lieferschein wurde nicht als geliefert markiert. Der Lagerinhalt wurde nicht verändert.',
+ 'The delivery term has been created.' => 'Die Lieferbedingungen wurden angelegt.',
+ 'The delivery term has been deleted.' => 'Die Lieferbedingungen wurden gelöscht.',
+ 'The delivery term has been saved.' => 'Die Lieferbedingungen wurden gespeichert.',
+ 'The delivery term is in use and cannot be deleted.' => 'Die Lieferbedingungen werden bereits verwendet und können nicht gelöscht werden.',
'The department has been created.' => 'Die Abteilung wurde angelegt.',
'The department has been deleted.' => 'Die Abteiltung wurde gelöscht.',
'The department has been saved.' => 'Die abteilung wurde gespeichert.',
'Are you sure you want to delete Transaction' => '',
'Are you sure you want to delete this background job?' => '',
'Are you sure you want to delete this business?' => '',
+ 'Are you sure you want to delete this delivery term?' => '',
'Are you sure you want to delete this department?' => '',
'Are you sure you want to delete this payment term?' => '',
'Are you sure you want to remove the marked entries from the queue?' => '',
'Create a new background job' => '',
'Create a new business' => '',
'Create a new client' => '',
+ 'Create a new delivery term' => '',
'Create a new department' => '',
'Create a new group' => '',
'Create a new payment term' => '',
'Delivery Orders' => '',
'Delivery Plan' => '',
'Delivery Plan for currently outstanding sales orders' => '',
+ 'Delivery Terms' => '',
+ 'Delivery terms' => '',
+ 'Delivery terms (database ID)' => '',
+ 'Delivery terms (name)' => '',
'Department' => '',
'Department (database ID)' => '',
'Department (description)' => '',
'Edit bank account' => '',
'Edit business' => '',
'Edit custom variable' => '',
+ 'Edit delivery term' => '',
'Edit department' => '',
'Edit file' => '',
'Edit greetings' => '',
'Error: Invalid business' => '',
'Error: Invalid contact' => '',
'Error: Invalid currency' => '',
+ 'Error: Invalid delivery terms' => '',
'Error: Invalid department' => '',
'Error: Invalid language' => '',
'Error: Invalid order for this order item' => '',
'No customer has been selected yet.' => '',
'No data was found.' => '',
'No default currency' => '',
+ 'No delivery term has been created yet.' => '',
'No department has been created yet.' => '',
'No dunnings have been selected for printing.' => '',
'No file has been uploaded yet.' => '',
'Password' => '',
'Payables' => '',
'Payment' => '',
- 'Payment Options' => '',
+ 'Payment / Delivery Options' => '',
'Payment Reminder' => '',
'Payment Terms' => '',
'Payment Terms missing in row ' => '',
'The deductible amount' => '',
'The default value depends on the variable type:' => '',
'The delivery order has not been marked as delivered. The warehouse contents have not changed.' => '',
+ 'The delivery term has been created.' => '',
+ 'The delivery term has been deleted.' => '',
+ 'The delivery term has been saved.' => '',
+ 'The delivery term is in use and cannot be deleted.' => '',
'The department has been created.' => '',
'The department has been deleted.' => '',
'The department has been saved.' => '',
module=controller.pl
action=PaymentTerm/list
+[System--Delivery Terms]
+module=controller.pl
+action=DeliveryTerm/list
+
[System--Manage Custom Variables]
module=controller.pl
action=CustomVariableConfig/list
--- /dev/null
+-- @tag: delivery_terms
+-- @description: Neue Tabelle und Spalten für Lieferbedingungen
+-- @depends: release_3_0_0
+-- @encoding: utf-8
+
+CREATE TABLE delivery_terms (
+ id integer NOT NULL DEFAULT nextval('id'),
+ description text,
+ description_long text,
+ sortkey integer NOT NULL,
+ itime timestamp DEFAULT now(),
+ mtime timestamp,
+
+ PRIMARY KEY (id)
+);
+
+CREATE TRIGGER mtime_delivery_terms
+ BEFORE UPDATE ON delivery_terms
+ FOR EACH ROW
+ EXECUTE PROCEDURE set_mtime();
+
+
+ALTER TABLE oe ADD COLUMN delivery_term_id integer;
+ALTER TABLE oe ADD FOREIGN KEY (delivery_term_id) REFERENCES delivery_terms(id);
+
+ALTER TABLE delivery_orders ADD COLUMN delivery_term_id integer;
+ALTER TABLE delivery_orders ADD FOREIGN KEY (delivery_term_id) REFERENCES delivery_terms(id);
+
+ALTER TABLE ar ADD COLUMN delivery_term_id integer;
+ALTER TABLE ar ADD FOREIGN KEY (delivery_term_id) REFERENCES delivery_terms(id);
+
+ALTER TABLE ap ADD COLUMN delivery_term_id integer;
+ALTER TABLE ap ADD FOREIGN KEY (delivery_term_id) REFERENCES delivery_terms(id);
+
+ALTER TABLE customer ADD COLUMN delivery_term_id integer;
+ALTER TABLE customer ADD FOREIGN KEY (delivery_term_id) REFERENCES delivery_terms(id);
+
+ALTER TABLE vendor ADD COLUMN delivery_term_id integer;
+ALTER TABLE vendor ADD FOREIGN KEY (delivery_term_id) REFERENCES delivery_terms(id);
<td>[% HTML.escape(payment_terms) %]</td>
</tr>
+ <tr>
+ <td align="right">[% 'Delivery Terms' | $T8 %]</td>
+ <td>[% HTML.escape(delivery_terms) %]</td>
+ </tr>
+
<tr>
<td align="right">[% 'Tax Number' | $T8 %]</td>
<td>[% HTML.escape(taxnumber) %]</td>
label_key = 'description',
-%]
</td>
+ <th align="right">[% 'Delivery Terms' | $T8 %]</th>
+ <td>[% L.select_tag('delivery_term_id', ALL_DELIVERY_TERMS, default = delivery_term_id, with_empty = 1, title_key = 'description') %]</td>
+ </tr>
+
+ <tr>
+ <td align="right"><label for="obsolete">[% 'Obsolete' | $T8 %]</label></td>
+ <td><input name="obsolete" id="obsolete" class="checkbox" type="checkbox" value="1" [% IF obsolete %]checked[% END %]></td>
+ <td align="right"><label for="direct_debit">[% 'direct debit' | $T8 %]</label></td>
+ <td><input name="direct_debit" id="direct_debit" class="checkbox" type="checkbox" value="1" [% IF direct_debit %]checked[% END %]></td>
[%- IF is_customer %]
<th align="right">[% 'Preisklasse' | $T8 %]</th>
[%- END %]
</tr>
- <tr>
- <td align="right"><label for="obsolete">[% 'Obsolete' | $T8 %]</label></td>
- <td><input name="obsolete" id="obsolete" class="checkbox" type="checkbox" value="1" [% IF obsolete %]checked[% END %]></td>
- <td align="right"><label for="direct_debit">[% 'direct debit' | $T8 %]</label></td>
- <td><input name="direct_debit" id="direct_debit" class="checkbox" type="checkbox" value="1" [% IF direct_debit %]checked[% END %]></td>
- </tr>
-
<tr>
<th align="right">[% 'Steuersatz' | $T8 %]</th>
<td>
[% L.select_tag('cv.language_id', SELF.all_languages, default = SELF.cv.language_id, value_key = 'id', title_key = 'description', with_empty = 1) %]
</td>
- [% IF ( SELF.is_customer() ) %]
- <th align="right">[% 'Preisklasse' | $T8 %]</th>
+ <th align="right">[% 'Delivery Terms' | $T8 %]</th>
+
+ <td>
+ [% L.select_tag('cv.delivery_term_id', SELF.all_delivery_terms, default = SELF.cv.delivery_term_id, value_key = 'id', title_key = 'description', with_empty = 1) %]
+ </td>
- <td>
- [% L.select_tag('cv.klass', SELF.all_pricegroups, default = SELF.cv.klass, value_key = 'id', title_key = 'pricegroup', with_empty = 1) %]
- </td>
- [% END %]
</tr>
<tr>
<td>
[% L.checkbox_tag('cv.direct_debit', checked = SELF.cv.direct_debit, for_submit=1) %]
</td>
+
+ [% IF ( SELF.is_customer() ) %]
+ <th align="right">[% 'Preisklasse' | $T8 %]</th>
+
+ <td>
+ [% L.select_tag('cv.klass', SELF.all_pricegroups, default = SELF.cv.klass, value_key = 'id', title_key = 'pricegroup', with_empty = 1) %]
+ </td>
+ [% END %]
+
</tr>
<tr>
--- /dev/null
+[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %]
+
+ <form method="post" action="controller.pl">
+ <div class="listtop">[% FORM.title %]</div>
+
+[%- INCLUDE 'common/flash.html' %]
+
+ <table>
+ <tr>
+ <td>[%- 'Description' | $T8 %]</td>
+ <td>
+ <input name="delivery_term.description" value="[%- HTML.escape(SELF.delivery_term.description) %]">
+ </td>
+ </tr>
+
+ <tr>
+ <td>[%- 'Long Description' | $T8 %]</td>
+ <td>
+ <input name="delivery_term.description_long" value="[%- HTML.escape(SELF.delivery_term.description_long) %]" size="60">
+ </td>
+ </tr>
+
+ <p>
+ <input type="hidden" name="id" value="[% SELF.delivery_term.id %]">
+ <input type="hidden" name="action" value="DeliveryTerm/dispatch">
+ <input type="submit" class="submit" name="action_[% IF SELF.delivery_term.id %]update[% ELSE %]create[% END %]" value="[% 'Save' | $T8 %]">
+ [%- IF SELF.delivery_term.id %]
+ <input type="submit" class="submit" name="action_destroy" value="[% 'Delete' | $T8 %]"
+ onclick="if (confirm('[% 'Are you sure you want to delete this delivery term?' | $T8 %]')) return true; else return false;">
+ [%- END %]
+ <a href="[% SELF.url_for(action => 'list') %]">[%- 'Abort' | $T8 %]</a>
+ </p>
+
+ </form>
+
--- /dev/null
+[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %]
+
+ <div class="listtop">[% FORM.title %]</div>
+
+[%- INCLUDE 'common/flash.html' %]
+
+ <form method="post" action="controller.pl">
+ [% IF !DELIVERY_TERMS.size %]
+ <p>
+ [%- 'No delivery term has been created yet.' | $T8 %]
+ </p>
+
+ [%- ELSE %]
+ <table id="delivery_term_list">
+ <thead>
+ <tr class="listheading">
+ <th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
+ <th>[%- 'Description' | $T8 %]</th>
+ <th>[%- 'Long Description' | $T8 %]</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ [%- FOREACH delivery_term = DELIVERY_TERMS %]
+ <tr class="listrow[% loop.count % 2 %]" id="delivery_term_id_[% delivery_term.id %]">
+ <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
+ <td>
+ <a href="[% SELF.url_for(action => 'edit', id => delivery_term.id) %]">
+ [%- HTML.escape(delivery_term.description) %]
+ </a>
+ </td>
+ <td>[%- HTML.escape(delivery_term.description_long) %]</td>
+ </tr>
+ [%- END %]
+ </tbody>
+ </table>
+ [%- END %]
+
+ <p>
+ <a href="[% SELF.url_for(action => 'new') %]">[%- 'Create new delivery term' | $T8 %]</a>
+ </p>
+ </form>
+
+ [% L.sortable_element('#delivery_term_list tbody', url => 'controller.pl?action=DeliveryTerm/reorder', with => 'delivery_term_id') %]
+
<td><textarea name="notes" rows="[% LxERP.numtextrows(notes, 25, 8, 2) %]" cols="25" wrap="soft"[% RO %]>[% HTML.escape(notes) %]</textarea></td>
<td><textarea name="intnotes" rows="[% LxERP.numtextrows(intnotes, 35, 8, 2) %]" cols="35" wrap="soft"[% RO %]>[% HTML.escape(intnotes) %]</textarea></td>
</tr>
+
+ <tr>
+ <th align="right">[% 'Delivery Terms' | $T8 %]</th>
+ <td>[% L.select_tag('delivery_term_id', ALL_DELIVERY_TERMS, default = delivery_term_id, with_empty = 1, title_key = 'description') %]</td>
+ </tr>
</table>
</td>
<tr>
<th align="left">[% 'Notes' | $T8 %]</th>
<th align="left">[% 'Internal Notes' | $T8 %]</th>
- <th align="left">[% 'Payment Options' | $T8 %]</th>
+ <th align="right">[% 'Payment / Delivery Options' | $T8 %]</th>
</tr>
<tr valign="top">
<td>
<textarea name="intnotes" rows="[% rows %]" cols="35" wrap="soft">[% intnotes %]</textarea>
</td>
<td>
- [%- L.checkbox_tag('direct_debit', 'checked', direct_debit, 'label', LxERP.t8('direct debit')) %]
+ <table>
+ <tr>
+ <th align="right">[% 'Delivery Terms' | $T8 %] </th>
+ <td>
+ [% L.select_tag('delivery_term_id', ALL_DELIVERY_TERMS, default = delivery_term_id, with_empty = 1, title_key = 'description', style = 'width: 250px') %]
+ </td>
+ </tr>
+ <tr>
+ <th align="right">[% 'direct debit' | $T8 %]</th>
+ <td>
+ [%- L.checkbox_tag('direct_debit', 'checked', direct_debit) %]
+ </td>
+ </tr>
+ </table>
</td>
</tr>
[%- IF id && follow_ups.size %]
<tr>
<th align="left">[% 'Notes (will appear on hard copy)' | $T8 %]</th>
<th align="left">[% 'Internal Notes' | $T8 %]</th>
- <th align="right">[% 'Payment Terms' | $T8 %]</th>
+ <th align="right">[% 'Payment / Delivery Options' | $T8 %]</th>
</tr>
<tr valign="top">
<td>
<textarea name="intnotes" rows="[% rows %]" cols="35">[% intnotes %]</textarea>
</td>
<td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'payment_id',
- style = 'width: 250px',
- DATA = payment_terms,
- id_key = 'id',
- label_key = 'description',
- show_empty = 1
- allow_textbox = 0 -%]
- <script type='text/javascript'>$('#payment_id').change(function(){ if (this.value) set_duedate()})</script>
- <br>
- [%- L.checkbox_tag('direct_debit', 'checked', direct_debit, 'label', LxERP.t8('direct debit')) %]
+ <table>
+ <tr>
+ <th align="right">[% 'Payment Terms' | $T8 %]</th>
+ <td>
+ [%- INCLUDE 'generic/multibox.html'
+ name = 'payment_id',
+ style = 'width: 250px',
+ DATA = payment_terms,
+ id_key = 'id',
+ label_key = 'description',
+ show_empty = 1
+ allow_textbox = 0 -%]
+ <script type='text/javascript'>$('#payment_id').change(function(){ if (this.value) set_duedate()})</script>
+ </td>
+ </tr>
+ <tr>
+ <th align="right">[% 'Delivery Terms' | $T8 %] </th>
+ <td>
+ [% L.select_tag('delivery_term_id', ALL_DELIVERY_TERMS, default = delivery_term_id, with_empty = 1, title_key = 'description', style = 'width: 250px') %]
+ </td>
+ </tr>
+ <tr>
+ <th align="right">[% 'direct debit' | $T8 %]</th>
+ <td>
+ [%- L.checkbox_tag('direct_debit', 'checked', direct_debit) %]
+ </td>
+ </tr>
+ </table>
</td>
</tr>
[%- IF id && follow_ups.size %]
label_key = 'description',
show_empty = 1 -%]
</td>
- </tr>
+ </tr>
+ <tr>
+ <th align="right">[% 'Delivery Terms' | $T8 %]</th>
+ <td>[% L.select_tag('delivery_term_id', ALL_DELIVERY_TERMS, default = delivery_term_id, with_empty = 1, title_key = 'description', style = 'width: 250px') %]</td>
+ </tr>
[%- IF is_sales_ord %]
<tr>