my @values;
- if ($form->{vendor_id}) {
- $where .= " AND a.vendor_id = ?";
- push(@values, $form->{vendor_id});
- } elsif ($form->{vendor}) {
+ if ($form->{vendor}) {
$where .= " AND v.name ILIKE ?";
push(@values, like($form->{vendor}));
}
}
$form->{paid} = $form->round_amount($form->{paid} * ($form->{exchangerate} || 1), 2);
- ($null, $form->{employee_id}) = split /--/, $form->{employee};
-
$form->get_employee($dbh) unless $form->{employee_id};
# if we have an id delete old records else make one
$where .= " AND NOT invoice = 'f' "; # remove ar transactions from Sales -> Reports -> Invoices
};
- if ($form->{customernumber}) {
- $where .= " AND c.customernumber = ?";
- push(@values, trim($form->{customernumber}));
- }
- if ($form->{customer_id}) {
- $where .= " AND a.customer_id = ?";
- push(@values, $form->{customer_id});
- } elsif ($form->{customer}) {
+ if ($form->{customer}) {
$where .= " AND c.name ILIKE ?";
push(@values, like($form->{customer}));
}
use strict;
-sub get_vc {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
-
- my %arap = (invoice => 'ar',
- sales_order => 'oe',
- purchase_order => 'oe',
- sales_quotation => 'oe',
- request_quotation => 'oe',
- check => 'ap',
- receipt => 'ar');
-
- my $vc = $form->{vc} eq "customer" ? "customer" : "vendor";
- my $arap_type = defined($arap{$form->{type}}) ? $arap{$form->{type}} : 'ar';
-
- my $query =
- qq|SELECT count(*) | .
- qq|FROM (SELECT DISTINCT ON (vc.id) vc.id FROM $vc vc, $arap_type a, status s | .
- qq| WHERE a.${vc}_id = vc.id AND s.trans_id = a.id AND s.formname = ? | .
- qq| AND s.spoolfile IS NOT NULL) AS total|;
-
- my ($count) = selectrow_query($form, $dbh, $query, $form->{type});
-
- # build selection list
- if ($count < $myconfig->{vclimit}) {
- $query =
- qq|SELECT DISTINCT ON (vc.id) vc.id, vc.name | .
- qq|FROM $vc vc, $arap_type a, status s | .
- qq|WHERE a.${vc}_id = vc.id AND s.trans_id = a.id AND s.formname = ? | .
- qq| AND s.spoolfile IS NOT NULL|;
-
- my $sth = $dbh->prepare($query);
- $sth->execute($form->{type}) || $form->dberror($query . " ($form->{type})");
-
- $form->{"all_${vc}"} = [];
- while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
- push @{ $form->{"all_${vc}"} }, $ref;
- }
- $sth->finish;
- }
-
- $main::lxdebug->leave_sub();
-}
-
sub payment_accounts {
$main::lxdebug->enter_sub();
}
1;
-
$main::lxdebug->leave_sub();
}
-sub get_openvc {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- my $dbh = SL::DB->client->dbh;
-
- my $arap = ($form->{vc} eq 'customer') ? 'ar' : 'ap';
- my $vc = $form->{vc} eq "customer" ? "customer" : "vendor";
- my $query =
- qq|SELECT count(*) | .
- qq|FROM $vc ct, $arap a | .
- qq|WHERE (a.${vc}_id = ct.id) AND (a.amount != a.paid)|;
- my ($count) = selectrow_query($form, $dbh, $query);
-
- # build selection list
- if ($count < $myconfig->{vclimit}) {
- $query =
- qq|SELECT DISTINCT ct.id, ct.name | .
- qq|FROM $vc ct, $arap a | .
- qq|WHERE (a.${vc}_id = ct.id) AND (a.amount != a.paid) | .
- qq|ORDER BY ct.name|;
- $form->{"all_$form->{vc}"} = selectall_hashref_query($form, $dbh, $query);
- }
-
- $main::lxdebug->leave_sub();
-}
-
sub get_openinvoices {
$main::lxdebug->enter_sub();
}
1;
-
my $defaults = SL::DefaultManager->new($::lx_office_conf{system}->{default_manager});
$self->user(SL::DB::AuthUser->new(
config_values => {
- vclimit => 200,
countrycode => $defaults->language('de'),
numberformat => $defaults->numberformat('1.000,00'),
dateformat => $defaults->dateformat('dd.mm.yy'),
vendor_id => $use_vendor_filter ? $vendor_of_transaction->id : undef,
vendor_name => $use_vendor_filter ? $vendor_of_transaction->name : undef,
ALL_VENDORS => $all_vendors,
- limit => $myconfig{vclimit},
callback => $callback,
);
}
use constant CONFIG_VARS => qw(copies countrycode dateformat timeformat default_media default_printer_id
email favorites fax hide_cvar_search_options mandatory_departments menustyle name
numberformat show_form_details signature stylesheet taxincluded_checked tel
- template_format vclimit focus_position form_cvars_nr_cols item_multiselect);
+ template_format focus_position form_cvars_nr_cols item_multiselect);
__PACKAGE__->meta->add_relationship(
groups => {
return scalar(@{ $self->{name_list} });
}
-# the selection sub is used in the AR, AP, IS, IR, DO and OE module
-#
-sub all_vc {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $table, $module) = @_;
-
- my $ref;
- my $dbh = $self->get_standard_dbh;
-
- $table = $table eq "customer" ? "customer" : "vendor";
-
- # build selection list
- # Hotfix für Bug 1837 - Besser wäre es alte Buchungsbelege
- # OHNE Auswahlliste (reines Textfeld) zu laden. Hilft aber auch
- # nicht für veränderbare Belege (oe, do, ...)
- my $obsolete = $self->{id} ? '' : "WHERE NOT obsolete";
- my $query = qq|SELECT count(*) FROM $table $obsolete|;
- my ($count) = selectrow_query($self, $dbh, $query);
-
- if ($count <= $myconfig->{vclimit}) {
- $query = qq|SELECT id, name, salesman_id
- FROM $table $obsolete
- ORDER BY name|;
- $self->{"all_$table"} = selectall_hashref_query($self, $dbh, $query);
- }
-
- # get self
- $self->get_employee($dbh);
-
- # setup sales contacts
- $query = qq|SELECT e.id, e.name
- FROM employee e
- WHERE (e.sales = '1') AND (NOT e.id = ?)
- ORDER BY name|;
- $self->{all_employees} = selectall_hashref_query($self, $dbh, $query, $self->{employee_id});
-
- # this is for self
- push(@{ $self->{all_employees} },
- { id => $self->{employee_id},
- name => $self->{employee} });
-
- # prepare query for departments
- $query = qq|SELECT id, description
- FROM department
- ORDER BY description|;
-
- $self->{all_departments} = selectall_hashref_query($self, $dbh, $query);
-
- # get languages
- $query = qq|SELECT id, description
- FROM language
- ORDER BY id|;
-
- $self->{languages} = selectall_hashref_query($self, $dbh, $query);
-
- # get printer
- $query = qq|SELECT printer_description, id
- FROM printers
- ORDER BY printer_description|;
-
- $self->{printers} = selectall_hashref_query($self, $dbh, $query);
-
- # get payment terms
- $query = qq|SELECT id, description
- FROM payment_terms
- WHERE ( obsolete IS FALSE OR id = ? )
- ORDER BY sortkey |;
- $self->{payment_terms} = selectall_hashref_query($self, $dbh, $query, $self->{payment_id} || undef);
-
- $main::lxdebug->leave_sub();
-}
-
sub new_lastmtime {
$main::lxdebug->enter_sub();
# need the current dbh to get the not yet committed mtime
$form->new_lastmtime('ar', $provided_dbh);
- $form->{name} = $form->{customer};
- $form->{name} =~ s/--\Q$form->{customer_id}\E//;
-
# add shipto
if (!$form->{shipto_id}) {
$form->add_shipto($dbh, $form->{id}, "AR");
use parent qw(Exporter);
use Exporter qw(import);
-our @EXPORT = qw(html_tag input_tag hidden_tag javascript man_days_tag name_to_id select_tag checkbox_tag stringify_attributes restricted_html);
+our @EXPORT = qw(html_tag input_tag hidden_tag javascript man_days_tag name_to_id select_tag checkbox_tag button_tag submit_tag ajax_submit_tag stringify_attributes restricted_html);
use Carp;
}
}
+sub _J {
+ my $string = shift;
+ $string =~ s/(\"|\'|\\)/\\$1/g;
+ return $string;
+}
sub stringify_attributes {
my ($self, %params) = @_;
return $code;
}
+sub button_tag {
+ my ($self, $onclick, $value, %attributes) = @_;
+
+ _set_id_attribute(\%attributes, $attributes{name}) if $attributes{name};
+ $attributes{type} ||= 'button';
+
+ $onclick = 'if (!confirm("'. _J(delete($attributes{confirm})) .'")) return false; ' . $onclick if $attributes{confirm};
+
+ return $self->html_tag('input', undef, %attributes, value => $value, onclick => $onclick);
+}
+
+sub submit_tag {
+ my ($self, $name, $value, %attributes) = @_;
+
+ _set_id_attribute(\%attributes, $attributes{name}) if $attributes{name};
+
+ if ( $attributes{confirm} ) {
+ $attributes{onclick} = 'return confirm("'. _J(delete($attributes{confirm})) .'");';
+ }
+
+ return $self->input_tag($name, $value, %attributes, type => 'submit', class => 'submit');
+}
+
+sub ajax_submit_tag {
+ my ($self, $url, $form_selector, $text, %attributes) = @_;
+
+ $url = _J($url);
+ $form_selector = _J($form_selector);
+ my $onclick = qq|kivi.submit_ajax_form('${url}', '${form_selector}')|;
+
+ return $self->button_tag($onclick, $text, %attributes);
+}
+
sub javascript {
my ($self, $data) = @_;
return $self->html_tag('script', $data, type => 'text/javascript');
C<$value> and with arbitrary HTML attributes from C<%attributes>. The
tag's C<id> defaults to C<name_to_id($name)>.
+=item C<submit_tag $name, $value, %attributes>
+
+Creates a HTML 'input type=submit class=submit' tag named C<$name> with the
+value C<$value> and with arbitrary HTML attributes from C<%attributes>. The
+tag's C<id> defaults to C<name_to_id($name)>.
+
+If C<$attributes{confirm}> is set then a JavaScript popup dialog will
+be added via the C<onclick> handler asking the question given with
+C<$attributes{confirm}>. The request is only submitted if the user
+clicks the dialog's ok/yes button.
+
+=item C<ajax_submit_tag $url, $form_selector, $text, %attributes>
+
+Creates a HTML 'input type="button"' tag with a very specific onclick
+handler that submits the form given by the jQuery selector
+C<$form_selector> to the URL C<$url> (the actual JavaScript function
+called for that is C<kivi.submit_ajax_form()> in
+C<js/client_js.js>). The button's label will be C<$text>.
+
+=item C<button_tag $onclick, $text, %attributes>
+
+Creates a HTML 'input type="button"' tag with an onclick handler
+C<$onclick> and a value of C<$text>. The button does not have a name
+nor an ID by default.
+
+If C<$attributes{confirm}> is set then a JavaScript popup dialog will
+be prepended to the C<$onclick> handler asking the question given with
+C<$attributes{confirm}>. The request is only submitted if the user
+clicks the dialog's "ok/yes" button.
+
=item C<man_days_tag $name, $object, %attributes>
Creates two HTML inputs: a text input for entering a number and a drop
sub chart_picker { return _call_presenter('chart_picker', @_); }
sub customer_vendor_picker { return _call_presenter('customer_vendor_picker', @_); }
sub project_picker { return _call_presenter('project_picker', @_); }
+sub button_tag { return _call_presenter('button_tag', @_); }
+sub submit_tag { return _call_presenter('submit_tag', @_); }
+sub ajax_submit_tag { return _call_presenter('ajax_submit_tag', @_); }
sub _set_id_attribute {
my ($attributes, $name, $unique) = @_;
return $self->html_tag('a', $content, %params, href => $href);
}
-sub submit_tag {
- my ($self, $name, $value, %attributes) = _hashify(3, @_);
-
- if ( $attributes{confirm} ) {
- $attributes{onclick} = 'return confirm("'. _J(delete($attributes{confirm})) .'");';
- }
-
- return $self->input_tag($name, $value, %attributes, type => 'submit', class => 'submit');
-}
-
-sub button_tag {
- my ($self, $onclick, $value, %attributes) = _hashify(3, @_);
-
- _set_id_attribute(\%attributes, $attributes{name}) if $attributes{name};
- $attributes{type} ||= 'button';
-
- $onclick = 'if (!confirm("'. _J(delete($attributes{confirm})) .'")) return false; ' . $onclick if $attributes{confirm};
-
- return $self->html_tag('input', undef, %attributes, value => $value, onclick => $onclick);
-}
-
-sub ajax_submit_tag {
- my ($self, $url, $form_selector, $text, @slurp) = @_;
-
- $url = _J($url);
- $form_selector = _J($form_selector);
- my $onclick = qq|kivi.submit_ajax_form('${url}', '${form_selector}')|;
-
- return $self->button_tag($onclick, $text, @slurp);
-}
-
sub yes_no_tag {
my ($self, $name, $value, %attributes) = _hashify(3, @_);
C<$value> and with arbitrary HTML attributes from C<%attributes>. The
tag's C<id> defaults to C<name_to_id($name)>.
-=item C<submit_tag $name, $value, %attributes>
-
-Creates a HTML 'input type=submit class=submit' tag named C<$name> with the
-value C<$value> and with arbitrary HTML attributes from C<%attributes>. The
-tag's C<id> defaults to C<name_to_id($name)>.
-
-If C<$attributes{confirm}> is set then a JavaScript popup dialog will
-be added via the C<onclick> handler asking the question given with
-C<$attributes{confirm}>. The request is only submitted if the user
-clicks the dialog's ok/yes button.
-
-=item C<ajax_submit_tag $url, $form_selector, $text, %attributes>
-
-Creates a HTML 'input type="button"' tag with a very specific onclick
-handler that submits the form given by the jQuery selector
-C<$form_selector> to the URL C<$url> (the actual JavaScript function
-called for that is C<kivi.submit_ajax_form()> in
-C<js/client_js.js>). The button's label will be C<$text>.
-
-=item C<button_tag $onclick, $text, %attributes>
-
-Creates a HTML 'input type="button"' tag with an onclick handler
-C<$onclick> and a value of C<$text>. The button does not have a name
-nor an ID by default.
-
-If C<$attributes{confirm}> is set then a JavaScript popup dialog will
-be prepended to the C<$onclick> handler asking the question given with
-C<$attributes{confirm}>. The request is only submitted if the user
-clicks the dialog's "ok/yes" button.
-
=item C<textarea_tag $name, $value, %attributes>
Creates a HTML 'textarea' tag named C<$name> with the content
use SL::IR;
use SL::IS;
use SL::ReportGenerator;
+use SL::DB::Currency;
use SL::DB::Default;
use SL::DB::PurchaseInvoice;
use SL::Webdav;
use SL::Locale::String qw(t8);
-require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
require "bin/mozilla/reportgenerator.pl";
IR->get_vendor(\%myconfig, \%$form);
$form->{$_} = $saved{$_} for keys %saved;
- $form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}";
$form->{rowcount} = 1;
$form->{AP_chart_id} = $form->{acc_trans} && $form->{acc_trans}->{AP} ? $form->{acc_trans}->{AP}->[0]->{chart_id} : $form->{AP_links}->{AP}->[0]->{chart_id};
# currencies
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
- $form->{selectcurrency} = "";
- map { my $quoted = H($_); $form->{selectcurrency} .= "<option value=\"${quoted}\">${quoted}\n" } $form->get_all_currencies(\%myconfig);
-
- # vendors
- if (@{ $form->{all_vendor} || [] }) {
- $form->{vendor} = qq|$form->{vendor}--$form->{vendor_id}|;
- map { my $quoted = H($_->{name} . "--" . $_->{id}); $form->{selectvendor} .= "<option value=\"${quoted}\">${quoted}\n" }
- (@{ $form->{all_vendor} });
- }
-
- $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
+ $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
$form->{employee} = "$form->{employee}--$form->{employee_id}";
$::form->{invoice_obj} = SL::DB::PurchaseInvoice->new(id => $::form->{id})->load if $::form->{id};
- $form->{initial_focus} = !($form->{amount_1} * 1) ? 'vendor' : 'row_' . $form->{rowcount};
+ $form->{initial_focus} = !($form->{amount_1} * 1) ? 'vendor_id' : 'row_' . $form->{rowcount};
$form->{title_} = $form->{title};
$form->{title} = $form->{title} eq 'Add' ? $locale->text('Add Accounts Payables Transaction') : $locale->text('Edit Accounts Payables Transaction');
# type=submit $locale->text('Add Accounts Payables Transaction')
# type=submit $locale->text('Edit Accounts Payables Transaction')
- # set option selected
- foreach my $item (qw(vendor currency)) {
- my $to_replace = H($form->{$item});
- $form->{"select$item"} =~ s/ selected//;
- $form->{"select$item"} =~ s/>\Q${to_replace}\E/ selected>${to_replace}/;
- }
my $readonly = $form->{id} ? "readonly" : "";
$form->{radier} = ($::instance_conf->get_ap_changeable == 2)
$charts{$item->{accno}} = $item;
}
- my $follow_up_vc = $form->{vendor};
- $follow_up_vc =~ s/--.*?//;
+ my $follow_up_vc = $form->{vendor_id} ? SL::DB::Vendor->load_cached($form->{vendor_id})->name : '';
my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)";
- $::request->layout->add_javascripts("autocomplete_chart.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js");
+ $::request->layout->add_javascripts("autocomplete_chart.js", "autocomplete_customer.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js");
my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local;
my $first_taxchart;
print $form->parse_html_template('ap/form_header', {
today => DateTime->today,
+ currencies => SL::DB::Manager::Currency->get_all_sorted,
});
$main::lxdebug->leave_sub();
$form->{invdate} = $form->{transdate};
- my $vendor_changed = &check_name("vendor");
+ if (($form->{previous_vendor_id} || $form->{vendor_id}) != $form->{vendor_id}) {
+ IR->get_vendor(\%::myconfig, $form);
+ }
$form->{rowcount} = $count + 1;
# check if there is a vendor, invoice, due date and invnumber
$form->isblank("transdate", $locale->text("Invoice Date missing!"));
$form->isblank("duedate", $locale->text("Due Date missing!"));
- $form->isblank("vendor", $locale->text('Vendor missing!'));
+ $form->isblank("vendor_id", $locale->text('Vendor missing!'));
$form->isblank("invnumber", $locale->text('Invoice Number missing!'));
if ($myconfig{mandatory_departments} && !$form->{department_id}) {
}
# if old vendor ne vendor redo form
- my ($vendor) = split /--/, $form->{vendor};
- if ($form->{oldvendor} ne "$vendor--$form->{vendor_id}") {
+ if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
&update;
$::dispatcher->end_request;
}
my %myconfig = %main::myconfig;
my $locale = $main::locale;
- # setup customer selection
- $form->all_vc(\%myconfig, "vendor", "AP");
-
$form->{title} = $locale->text('AP Transactions');
- $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 },
- "vendors" => "ALL_VC");
+ $form->get_lists(projects => { "key" => "ALL_PROJECTS", "all" => 1 });
- $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
+ $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
# constants and subs for template
$form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
+ $::request->layout->add_javascripts("autocomplete_project.js");
+
$form->header;
print $form->parse_html_template('ap/search', { %myconfig });
$main::auth->assert('vendor_invoice_edit');
- ($form->{vendor}, $form->{vendor_id}) = split(/--/, $form->{vendor});
-
report_generator_set_default_sort('transdate', 1);
AP->ap_transactions(\%myconfig, \%$form);
use SL::FU;
use SL::GL;
use SL::IS;
+use SL::DB::Business;
+use SL::DB::Currency;
use SL::DB::Default;
+use SL::DB::Employee;
use SL::DB::Invoice;
use SL::ReportGenerator;
IS->get_customer(\%myconfig, \%$form);
$form->{$_} = $saved{$_} for keys %saved;
- $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
$form->{rowcount} = 1;
$form->{AR_chart_id} = $form->{acc_trans} && $form->{acc_trans}->{AR} ? $form->{acc_trans}->{AR}->[0]->{chart_id} : $form->{AR_links}->{AR}->[0]->{chart_id};
# currencies
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
- $form->{selectcurrency} = "";
- map { $form->{selectcurrency} .= "<option>$_\n" } $form->get_all_currencies(\%myconfig);
-
- # customers
- if (@{ $form->{all_customer} || [] }) {
- $form->{customer} = "$form->{customer}--$form->{customer_id}";
- map { $form->{selectcustomer} .= "<option>$_->{name}--$_->{id}\n" }
- (@{ $form->{all_customer} });
- }
-
$form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
- $form->{employee} = "$form->{employee}--$form->{employee_id}";
-
- # sales staff
- if (@{ $form->{all_employees} || [] }) {
- $form->{selectemployee} = "";
- map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}\n" }
- (@{ $form->{all_employees} || [] });
- }
-
# build the popup menus
$form->{taxincluded} = ($form->{id}) ? $form->{taxincluded} : "checked";
$form->{invoice_obj} = _retrieve_invoice_object();
my ($title, $readonly, $exchangerate, $rows);
- my ($notes, $customer, $employee, $amount, $project);
+ my ($notes, $amount, $project);
- $form->{initial_focus} = !($form->{amount_1} * 1) ? 'customer' : 'row_' . $form->{rowcount};
+ $form->{initial_focus} = !($form->{amount_1} * 1) ? 'customer_id' : 'row_' . $form->{rowcount};
$title = $form->{title};
# $locale->text('Add Accounts Receivables Transaction')
: ($::instance_conf->get_ar_changeable == 1);
$readonly = ($form->{radier}) ? "" : $readonly;
- # set option selected
- foreach my $item (qw(customer currency employee)) {
- $form->{"select$item"} =~ s/ selected//;
- $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
- }
-
$form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'buy');
$form->{exchangerate} = $form->{forex} if $form->{forex};
}
}
- my $follow_up_vc = $form->{customer};
- $follow_up_vc =~ s/--.*?//;
+ my $follow_up_vc = $form->{customer_id} ? SL::DB::Customer->load_cached($form->{customer_id})->name : '';
my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)";
- $::request->layout->add_javascripts("autocomplete_chart.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js");
+ $::request->layout->add_javascripts("autocomplete_chart.js", "autocomplete_customer.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js");
my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local;
my $first_taxchart;
$form->{totalpaid} = sum map { $_->{paid} } @payments;
+ my $employees = SL::DB::Manager::Employee->get_all_sorted(
+ where => [
+ or => [
+ (id => $::form->{employee_id}) x !!$::form->{employee_id},
+ deleted => undef,
+ deleted => 0,
+ ],
+ ],
+ );
+
$form->header;
print $::form->parse_html_template('ar/form_header', {
paid_missing => $::form->{invtotal} - $::form->{totalpaid},
title_str => $title,
follow_up_trans_info => $follow_up_trans_info,
today => DateTime->today,
+ currencies => scalar(SL::DB::Manager::Currency->get_all_sorted),
+ employees => $employees,
});
$main::lxdebug->leave_sub();
$form->{invdate} = $form->{transdate};
- &check_name("customer");
+ if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
+ IS->get_customer(\%myconfig, $form);
+ }
$form->{invtotal} =
($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
# check if there is an invoice number, invoice and due date
$form->isblank("transdate", $locale->text('Invoice Date missing!'));
$form->isblank("duedate", $locale->text('Due Date missing!'));
- $form->isblank("customer", $locale->text('Customer missing!'));
+ $form->isblank("customer_id", $locale->text('Customer missing!'));
if ($myconfig{mandatory_departments} && !$form->{department_id}) {
$form->{saved_message} = $::locale->text('You have to specify a department.');
}
# if oldcustomer ne customer redo form
- my ($customer) = split /--/, $form->{customer};
- if ($form->{oldcustomer} ne "$customer--$form->{customer_id}") {
+ if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
update();
$::dispatcher->end_request;
}
my $locale = $main::locale;
my $cgi = $::request->{cgi};
- # setup customer selection
- $form->all_vc(\%myconfig, "customer", "AR");
-
$form->{title} = $locale->text('AR Transactions');
- # Auch in Rechnungsübersicht nach Kundentyp filtern - jan
- $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 },
- "customers" => "ALL_VC",
- "business_types" => "ALL_BUSINESS_TYPES");
$form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]);
- $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
- $form->{SHOW_BUSINESS_TYPES} = scalar @{ $form->{ALL_BUSINESS_TYPES} } > 0;
+ $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
+ $form->{ALL_BUSINESS_TYPES} = SL::DB::Manager::Business->get_all_sorted;
$form->{CT_CUSTOM_VARIABLES} = CVar->get_configs('module' => 'CT');
($form->{CT_CUSTOM_VARIABLES_FILTER_CODE},
# constants and subs for template
$form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
+ $::request->layout->add_javascripts("autocomplete_project.js");
+
$form->header;
print $form->parse_html_template('ar/search', { %myconfig });
my ($callback, $href, @columns);
- ($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer});
-
report_generator_set_default_sort('transdate', 1);
AR->ar_transactions(\%myconfig, \%$form);
+++ /dev/null
-#=====================================================================
-# LX-Office ERP
-# Copyright (C) 2004
-# Based on SQL-Ledger Version 2.1.9
-# Web http://www.lx-office.org
-#
-#=====================================================================
-# SQL-Ledger Accounting
-# Copyright (c) 2002
-#
-# Author: Dieter Simader
-# Email: dsimader@sql-ledger.org
-# Web: http://www.sql-ledger.org
-#
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1335, USA.
-#======================================================================
-#
-# common routines for gl, ar, ap, is, ir, oe
-#
-
-use strict;
-
-# any custom scripts for this one
-if (-f "bin/mozilla/custom_arap.pl") {
- eval { require "bin/mozilla/custom_arap.pl"; };
-}
-if (-f "bin/mozilla/$::myconfig{login}_arap.pl") {
- eval { require "bin/mozilla/$::myconfig{login}_arap.pl"; };
-}
-
-1;
-
-require "bin/mozilla/common.pl";
-
-# end of main
-
-sub check_name {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- $main::auth->assert('ar_transactions | ap_transactions | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
- 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash |' .
- 'purchase_delivery_order_edit | sales_delivery_order_edit');
-
- my ($name, %params) = @_;
-
- $name = $name eq "customer" ? "customer" : "vendor";
-
- my ($new_name,$new_id) = $form->{$name} =~ /^(.*?)--(\d+)$/;
- my $i = 0;
- # if we use a selection
- if ($form->{"select$name"}) {
- if ($form->{"old$name"} ne $form->{$name}) {
-
- # this is needed for is, ir and oe
- $form->{update} = 0;
- # for credit calculations
- $form->{oldinvtotal} = 0;
- $form->{oldtotalpaid} = 0;
- $form->{calctax} = 1;
-
- $form->{"${name}_id"} = $new_id;
-
- _reset_salesman_id();
- delete @{ $form }{qw(payment_id)};
-
- IS->get_customer(\%myconfig, \%$form) if ($name eq 'customer');
- IR->get_vendor(\%myconfig, \%$form) if ($name eq 'vendor');
-
- $form->{$name} = $form->{"old$name"} = "$new_name--$new_id";
-
- $i = 1;
- }
- } else {
-
- # check name, combine name and id
- if ($form->{"old$name"} ne qq|$form->{$name}--$form->{"${name}_id"}|) {
-
- # this is needed for is, ir and oe
- $form->{update} = 0;
-
- # for credit calculations
- $form->{oldinvtotal} = 0;
- $form->{oldtotalpaid} = 0;
- $form->{calctax} = 1;
-
- # return one name or a list of names in $form->{name_list}
- $i = $form->get_name(\%myconfig, $name);
-
- if ($i > 1) {
- if ($params{no_select}) {
- # $locale->text('Customer')
- # $locale->text('Vendor')
- $form->error($locale->text("More than one #1 found matching, please be more specific.", $locale->text(ucfirst $name)));
- } else {
- &select_name($name);
- $::dispatcher->end_request;
- }
- }
-
- if ($i == 1) {
-
- # we got one name
- $form->{"${name}_id"} = $form->{name_list}[0]->{id};
- $form->{$name} = $form->{name_list}[0]->{name};
- $form->{"old$name"} = qq|$form->{$name}--$form->{"${name}_id"}|;
-
- _reset_salesman_id();
- delete @{ $form }{qw(payment_id)};
-
- IS->get_customer(\%myconfig, \%$form) if ($name eq 'customer');
- IR->get_vendor(\%myconfig, \%$form) if ($name eq 'vendor');
-
- } else {
-
- # name is not on file
- # $locale->text('Customer not on file or locked!')
- # $locale->text('Vendor not on file or locked!')
- my $msg = ucfirst $name . " not on file or locked!";
- $form->error($locale->text($msg));
- }
- }
- }
- $form->language_payment(\%myconfig);
-
- $main::lxdebug->leave_sub();
-
- return $i;
-}
-
-# $locale->text('Customer not on file!')
-# $locale->text('Vendor not on file!')
-
-sub select_name {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my $locale = $main::locale;
-
- $main::auth->assert('ar_transactions| ap_transactions | vendor_invoice_edit | sales_order_edit | invoice_edit | sales_delivery_order_edit |' .
- 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash');
-
- my ($table) = @_;
-
- my @column_index = qw(ndx name address);
-
- my $label = ucfirst $table;
- my %column_data;
- $column_data{ndx} = qq|<th> </th>|;
- $column_data{name} =
- qq|<th class=listheading>| . $locale->text($label) . qq|</th>|;
- $column_data{address} =
- qq|<th class=listheading>| . $locale->text('Address') . qq|</th>|;
-
- # list items with radio button on a form
- $form->header;
-
- my $title = $locale->text('Select from one of the names below');
-
- print qq|
- <h1>$title</h1>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-
- my $i = 0;
- my $j;
- foreach my $ref (@{ $form->{name_list} }) {
- my $checked = ($i++) ? "" : "checked";
-
- $ref->{name} =~ s/\"/"/g;
-
- $column_data{ndx} =
- qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
- $column_data{name} =
- qq|<td><input name="new_name_$i" type=hidden value="$ref->{name}">$ref->{name}</td>|;
- $column_data{address} = qq|<td>$ref->{address} </td>|;
-
- $j++;
- $j %= 2;
- print qq|
- <tr class=listrow$j>|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
-
-<input name="new_id_$i" type=hidden value=$ref->{id}>
-
-|;
-
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<input name=lastndx type=hidden value=$i>
-
-|;
-
- # delete variables
- map { delete $form->{$_} } qw(action name_list header);
-
- # save all other form variables
- foreach my $key (keys %${form}) {
- next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
- $form->{$key} =~ s/\"/"/g;
- print qq|<input name=$key type=hidden value="$form->{$key}">\n|;
- }
-
- print qq|
-<input type=hidden name=nextsub value=name_selected>
-
-<input type=hidden name=vc value=$table>
-<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Continue') . qq|">
-</form>
-|;
-
- $main::lxdebug->leave_sub();
-}
-
-sub name_selected {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- $main::auth->assert('ar_transactions | ap_transactions | vendor_invoice_edit | sales_order_edit | invoice_edit | sales_delivery_order_edit | ' .
- 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash');
-
- # replace the variable with the one checked
-
- # index for new item
- my $i = $form->{ndx};
-
- _reset_salesman_id();
- delete @{ $form }{qw(payment_id)};
-
- $form->{ $form->{vc} } = $form->{"new_name_$i"};
- $form->{"$form->{vc}_id"} = $form->{"new_id_$i"};
- $form->{"old$form->{vc}"} =
- qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
-
- # delete all the new_ variables
- for $i (1 .. $form->{lastndx}) {
- map { delete $form->{"new_${_}_$i"} } qw(id name);
- }
-
- map { delete $form->{$_} } qw(ndx lastndx nextsub);
-
- IS->get_customer(\%myconfig, \%$form) if ($form->{vc} eq 'customer');
- IR->get_vendor(\%myconfig, \%$form) if ($form->{vc} eq 'vendor');
-
- &update(1);
-
- $main::lxdebug->leave_sub();
-}
-
-# Reset the $::form field 'salesman_id' to the ID of the currently
-# logged in user. Useful when changing to a customer/vendor that has
-# no salesman listed in their master data.
-sub _reset_salesman_id {
- my $current_employee = SL::DB::Manager::Employee->current;
- $::form->{salesman_id} = $current_employee->id if $current_employee && exists $::form->{salesman_id};
-}
-
-sub select_project {
- $::lxdebug->enter_sub;
-
- $::auth->assert('ar_transactions | ap_transactions | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
- 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report');
-
- my ($is_global, $nextsub) = @_;
- my $project_list = delete $::form->{project_list};
-
- map { delete $::form->{$_} } qw(action header update);
-
- my @hiddens;
- for my $key (keys %$::form) {
- next if $key eq 'login' || $key eq 'password' || '' ne ref $::form->{$key};
- push @hiddens, { key => $key, value => $::form->{$key} };
- }
- push @hiddens, { key => 'is_global', value => $is_global },
- { key => 'project_selected_nextsub', value => $nextsub };
-
- $::form->header;
- print $::form->parse_html_template('arap/select_project', { hiddens => \@hiddens, project_list => $project_list });
-
- $::lxdebug->leave_sub;
-}
-
-sub project_selected {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
-
- $main::auth->assert('ar_transactions | ap_transactions | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
- 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report');
-
- # replace the variable with the one checked
-
- # index for new item
- my $i = $form->{ndx};
-
- my $prefix = $form->{"is_global"} ? "global" : "";
- my $suffix = $form->{"is_global"} ? "" : "_$form->{rownumber}";
-
- $form->{"${prefix}projectnumber${suffix}"} =
- $form->{"new_projectnumber_$i"};
- $form->{"old${prefix}projectnumber${suffix}"} =
- $form->{"new_projectnumber_$i"};
- $form->{"${prefix}project_id${suffix}"} = $form->{"new_id_$i"};
-
- # delete all the new_ variables
- for $i (1 .. $form->{lastndx}) {
- map { delete $form->{"new_${_}_$i"} } qw(id projectnumber description);
- }
-
- my $nextsub = $form->{project_selected_nextsub} || 'update';
-
- map { delete $form->{$_} } qw(ndx lastndx nextsub is_global project_selected_nextsub);
-
- call_sub($nextsub);
-
- $main::lxdebug->leave_sub();
-}
-
-sub continue { call_sub($main::form->{"nextsub"}); }
-
-1;
-
-__END__
-
-=head1 NAME
-
-arap.pl - helper functions or customer/vendor retrieval
-
-=head1 SYNOPSIS
-
- check_name('vendor')
-
-=head1 DESCRIPTION
-
-Don't use anyting in this file without extreme care, and even then be prepared for massive headaches.
-
-It's a collection of helper routines that wrap the customer/vendor dropdown/textfield duality into something even complexer.
-
-=head1 FUNCTIONS
-
-=head2 check_name customer|vendor
-
-check_name was originally meant to update the selected customer or vendor. The
-way it does that has generted more hate than almost any other part of this
-software.
-
-What it does is:
-
-=over 4
-
-=item *
-
-It checks if a vendor or customer is given. No failsafe, vendor fallback if
-$_[0] is something fancy.
-
-=item *
-
-It assumes, that there is a field named customer or vendor in $form.
-
-=item *
-
-It assumes, that this field is filled with name--id, and tries to split that.
-sql ledger uses that combination to get ids into the select keys.
-
-=item *
-
-It looks for a field selectcustomer or selectvendor in $form. sql ledger used
-to store a copy of the html select in there. (again, don't ask)
-
-=item *
-
-If this field exists, it looks for a field called oldcustomer or oldvendor, in
-which the old name--id string was stored in sql ledger, and compares those.
-
-=item *
-
-if they don't match, it will set customer_id or vendor_id in $form, load the
-entry (which will clobber everything in $form named like a column in customer
-oder vendor) and return.
-
-=item *
-
-If there was no select* entry, it assumes that vclimit was lower than the
-number of entries, and that an input field was generated. In that case the
-splitting is omitted (since users don't generally include ids in entered names)
-
-=item *
-
-It looks for a *_id field, and combines it with the given input into a name--id
-entry and compares it to the old* entry. (Missing any of these will instantly
-break check_namea.
-
-=item *
-
-If those do not match, $form->get_name is called to get matching results.
-get_name only matches by *number and name, not by id, don't try to get it to do
-so.
-
-=item *
-
-The results are stored in $form>{name_list} but a count is returned, and
-checked.
-
-=item *
-
-If only one result was found, *_id, * and old* are copied into $form, the entry
-is loaded (like above, clobbering)
-
-=item *
-
-If there is more than one, a selection dialog is rendered
-
-=item *
-
-If none is found, an error is generated.
-
-=back
-
-=head3 I built a customer/vendor box somewhere and it doesn't work, what's wrong?
-
-Make sure a select* field is given if and only if you render a select box. The
-actual contents are ignored, but recognition fails if not present.
-
-Make sure old* and *_id fields are set correctly (name--id form for old*). They
-are necessary in all steps and branches.
-
-Since get_customer and get_vendor clobber a lot of fields, make sure what
-changes exactly.
-
-=head3 select- version works fine, but things go awry when I use a textbox, any idea?
-
-If there is more than one match, check_name will display a select form, that
-will redirect to the original C<nextsub>. Unfortunately any hidden vars or
-input fields will be lost in the process unless saved before in a callback.
-
-If you still want to use it, you can disable this feature, like this:
-
- check_name('customer', no_select => 1)
-
-In that case multiple matches will trigger an error.
-
-Otherwise you'll have to care to include a complete state in callback.
-
-=cut
assert_bp_access();
- # setup customer/vendor selection
- BP->get_vc(\%::myconfig, $::form);
-
my %label = (
invoice => { title => $::locale->text('Sales Invoices'), invnumber => 1, ordnumber => 1 },
sales_order => { title => $::locale->text('Sales Orders'), ordnumber => 1, },
goto &SL::DB::Helper::Mappings::db;
}
+sub continue { call_sub($::form->{nextsub}); }
+
1;
use strict;
#use warnings;
-require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
our ($form, %myconfig, $lxdebug, $locale, $auth);
$form->{ARAP} = ($form->{type} eq 'receipt') ? "AR" : "AP";
$form->{arap} = lc $form->{ARAP};
- # setup customer/vendor selection for open invoices
- if ($form->{all_vc}) {
- # Dieser Zweig funktioniert derzeit NIE. Ggf. ganz raus oder
- # alle offenen Zahlungen wieder korrekt anzeigen. jb 12.10.2010
- $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP});
- } else {
- CP->get_openvc(\%myconfig, \%$form);
- }
- # Auswahlliste für vc zusammenbauen
- # Erweiterung für schliessende option und erweiterung um value
- # für bugfix 1771 (doppelte Leerzeichen werden nicht 'gepostet')
- $form->{"select$form->{vc}"} = "";
-
- if ($form->{"all_$form->{vc}"}) {
- $form->{"select$form->{vc}"} .= "<option value=\"\"></option>\n";
- # s.o. jb 12.10.2010
- $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
- # hotfix for 2450. TODO remove legacy code and use L
- map { $form->{"select$form->{vc}"} .= "<option value=\"" . H($_->{name}) . "--$_->{id}\">" . H($_->{name}) . "--$_->{id}</option>\n" }
- @{ $form->{"all_$form->{vc}"} };
- }
CP->paymentaccounts(\%myconfig, \%$form);
# Standard Konto für Umlaufvermögen
map { $form->{selectaccount} .= "<option value=\"$_->{accno}--$_->{description}\">$_->{accno}--$_->{description}</option>\n";
$form->{account} = "$_->{accno}--$_->{description}" if ($_->{accno} eq $accno_arap) } @{ $form->{PR}{"$form->{ARAP}_paid"} };
- # Braucht man das hier überhaupt? Erstmal auskommentieren .. jan 18.12.2010
- # map {
- # $form->{"select$form->{ARAP}"} .=
- # "<option>$_->{accno}--$_->{description}\n"
- # } @{ $form->{PR}{ $form->{ARAP} } };
- # ENDE LOESCHMICH in 2012
-
# currencies
# oldcurrency ist zwar noch hier als fragment enthalten, wird aber bei
# der aktualisierung der form auch nicht mitübernommen. das konzept
$auth->assert('cash');
- my ($vc, $arap, $exchangerate);
+ $::request->layout->add_javascripts("autocomplete_customer.js");
- if ($form->{ $form->{vc} } eq "") {
+ my ($arap, $exchangerate);
+
+ if (!$form->{ $form->{vc} . '_id' }) {
map { $form->{"addr$_"} = "" } (1 .. 4);
}
- # sometimes it happens that values in customer arrive without the signs '--'
- # but in order to select the right option field we need values with '--'
- if ($form->{vc} eq "customer" && $form->{"all_$form->{vc}"}){
- my ($customername) = split /--/, $form->{ $form->{vc} };
- $form->{ $form->{vc} } = $customername . "--" . $form->{customer_id};
- }
# bugfix 1771
# geändert von <option>asdf--2929
# nach:
# <option value="asdf--2929">asdf--2929</option>
# offen: $form->{ARAP} kann raus?
- for my $item ($form->{vc}, "account", "currency", $form->{ARAP}) {
+ for my $item ("account", "currency", $form->{ARAP}) {
$form->{$item} = H($form->{$item});
$form->{"select$item"} =~ s/ selected//;
$form->{"select$item"} =~ s/option value="\Q$form->{$item}\E">\Q$form->{$item}\E/option selected value="$form->{$item}">$form->{$item}/;
}
- $vc =
- ($form->{"select$form->{vc}"})
- ? qq|<select name=$form->{vc}>$form->{"select$form->{vc}"}\n</select>|
- : qq|<input name=$form->{vc} size=35 value="$form->{$form->{vc}}">|;
-
- $form->{openinvoices} = $form->{all_vc} ? "" : 1;
+ $form->{openinvoices} = 1;
# $locale->text('AR')
# $locale->text('AP')
is_customer => $form->{vc} eq 'customer',
is_receipt => $form->{type} eq 'receipt',
arap => $arap,
- vccontent => $vc,
});
$lxdebug->leave_sub;
$auth->assert('cash');
- my ($new_name_selected) = @_;
-
- my ($buysell, $newvc, $updated, $exchangerate, $amount);
+ my ($buysell, $updated, $exchangerate, $amount);
if ($form->{vc} eq 'customer') {
$buysell = "buy";
$buysell = "sell";
}
- # if we switched to all_vc
- # funktioniert derzeit nicht 12.10.2010 jb
- if ($form->{all_vc} ne $form->{oldall_vc}) {
-
- $form->{openinvoices} = ($form->{all_vc}) ? 0 : 1;
-
- $form->{"select$form->{vc}"} = "";
-
- if ($form->{all_vc}) {
- $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP});
-
- if ($form->{"all_$form->{vc}"}) {
- map {
- $form->{"select$form->{vc}"} .=
- "<option>$_->{name}--$_->{id}\n"
- } @{ $form->{"all_$form->{vc}"} };
- }
- } else { # ab hier wieder ausgeführter code (s.o.):
- CP->get_openvc(\%myconfig, \%$form);
-
- if ($form->{"all_$form->{vc}"}) {
- $newvc =
- qq|$form->{"all_$form->{vc}"}[0]->{name}--$form->{"all_$form->{vc}"}[0]->{id}|;
- map {
- $form->{"select$form->{vc}"} .=
- "<option>$_->{name}--$_->{id}\n"
- } @{ $form->{"all_$form->{vc}"} };
- }
-
- # if the name is not the same
- if ($form->{"select$form->{vc}"} !~ /$form->{$form->{vc}}/) {
- $form->{ $form->{vc} } = $newvc;
- }
- }
- }
-
- # search by customernumber
- # the customernumber has to be correct otherwise nothing is found
- if ($form->{vc} eq 'customer' and $form->{customernumber} and $form->{ARAP} eq 'AR') {
- $form->{open} ='Y'; # only open invoices
- # ar_transactions automatically searches by $form->{customer_id} or else
- # $form->{customer} if available, and these variables will always be set
- # so we have to empty these values first
- $form->{customer_id} = '';
- $form->{customer} = '';
- AR->ar_transactions(\%myconfig, \%$form);
-
- # Here we just take the first returned value even if the custumernumber
- # may not be unique
- $form->{customer} = $form->{AR}[0]{name};
- $form->{customer_id} = $form->{AR}[0]{customer_id};
- }
-
# search by invoicenumber,
if ($form->{invnumber}) {
$form->{open} ='Y'; # only open invoices
foreach my $i ( @{ $form->{AR} } ) {
next unless $i->{invnumber} eq $form->{invnumber};
# found exactly matching invnumber
- $form->{$form->{vc}} = $i->{name};
$form->{customer_id} = $i->{customer_id};
- #$form->{"old${form->{vc}"} = $i->{customer_id};
$found_exact_invnumber_match = 1;
};
unless ( $found_exact_invnumber_match ) {
# use first returned entry, may not be the correct one if invnumber doesn't
# match uniquely
- $form->{$form->{vc}} = $form->{AR}[0]{name};
$form->{customer_id} = $form->{AR}[0]{customer_id};
};
} else {
# s.o. nur für zahlungsausgang
AP->ap_transactions(\%myconfig, \%$form);
- $form->{$form->{vc}} = $form->{AP}[0]{name};
+ $form->{vendor_id} = $form->{AP}[0]{vendor_id};
}
}
# determine customer/vendor
- if ( $form->{customer_id} and ($form->{invnumber} or $form->{customernumber}) ) {
- # we already know the exact customer_id, so fill $form with customer data
+ my $vc = $form->{vc};
+ if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
IS->get_customer(\%myconfig, \%$form);
- $updated = 1;
- } else {
- # check_name is called with "customer" or "vendor" and otherwise uses contents of $form
- # check_name also runs get_customer/get_vendor
- $updated = &check_name($form->{vc});
- };
-
- if ($new_name_selected || $updated) {
- # get open invoices from ar/ap using $form->{vc} and a.${vc}_id, i.e. customer_id
- CP->get_openinvoices(\%myconfig, \%$form);
- ($newvc) = split /--/, $form->{ $form->{vc} };
- $form->{"old$form->{vc}"} = qq|$newvc--$form->{"$form->{vc}_id"}|;
- $updated = 1;
}
- if ($form->{currency} ne $form->{oldcurrency}) {
- $form->{oldcurrency} = $form->{currency};
- if (!$updated) {
- CP->get_openinvoices(\%myconfig, \%$form);
- $updated = 1;
- }
- }
+ $form->{oldcurrency} = $form->{currency};
+
+ # get open invoices from ar/ap using a.${vc}_id, i.e. customer_id
+ CP->get_openinvoices(\%myconfig, \%$form) if $form->{"${vc}_id"};
if (!$form->{forex}) { # read exchangerate from input field (not hidden)
$form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate});
$amount = $form->{amount} = $form->parse_amount(\%myconfig, $form->{amount});
- if ($updated) {
+ if ($form->{"${vc}_id"}) {
$form->{rowcount} = 0;
$form->{queued} = "";
$form->{amount}=$amount;
&form_header;
- &list_invoices;
+ list_invoices() if $form->{"${vc}_id"};
&form_footer;
$lxdebug->leave_sub();
my ($closedto, $datepaid, $amount);
- &check_name($form->{vc});
+ my $vc = $form->{vc};
+ if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
+ IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
+ IR->get_vendor(\%myconfig, $form) if $vc eq 'vendor';
+ }
if ($form->{currency} ne $form->{oldcurrency}) {
&update;
use SL::IS;
use SL::DN;
+use SL::DB::Department;
use SL::DB::Dunning;
use SL::Helper::Flash qw(flash);
use SL::Locale::String qw(t8);
$main::auth->assert('dunning_edit');
- # setup customer selection
- $form->all_vc(\%myconfig, "customer", "AR");
-
DN->get_config(\%myconfig, \%$form);
- $form->{SHOW_CUSTOMER_SELECTION} = $form->{all_customer} && scalar @{ $form->{all_customer} };
$form->{SHOW_DUNNING_LEVEL_SELECTION} = $form->{DUNNING} && scalar @{ $form->{DUNNING} };
$form->{SHOW_DEPARTMENT_SELECTION} = $form->{all_departments} && scalar @{ $form->{all_departments} || [] };
DN->get_config(\%myconfig, \%$form);
- $form->{SHOW_CUSTOMER_DDBOX} = scalar @{ $form->{ALL_CUSTOMERS} } <= $myconfig{vclimit};
- $form->{SHOW_DEPARTMENT_DDBOX} = scalar @{ $form->{ALL_CUSTOMERS} };
$form->{SHOW_DUNNING_LEVELS} = scalar @{ $form->{DUNNING} };
$form->{title} = $locale->text('Dunnings');
use SL::ReportGenerator;
use SL::WH;
use Sort::Naturally ();
-require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
require "bin/mozilla/io.pl";
require "bin/mozilla/reportgenerator.pl";
my $form = $main::form;
my %myconfig = %main::myconfig;
- # get customer/vendor
- $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
-
# retrieve order/quotation
my $editing = $form->{id};
$form->restore_vars(qw(taxincluded)) if $form->{id};
$form->restore_vars(qw(salesman_id)) if $editing;
- if ($form->{"all_$form->{vc}"}) {
- unless ($form->{"$form->{vc}_id"}) {
- $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
- }
- }
-
- ($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} };
- $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
-
- $form->{employee} = "$form->{employee}--$form->{employee_id}";
-
$main::lxdebug->leave_sub();
}
my $form = $main::form;
my %myconfig = %main::myconfig;
+ my $class = "SL::DB::" . ($form->{vc} eq 'customer' ? 'Customer' : 'Vendor');
+ $form->{VC_OBJ} = $class->load_cached($form->{ $form->{vc} . '_id' });
+
$form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
$form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
- $form->get_lists($vc => "ALL_VC",
- "price_factors" => "ALL_PRICE_FACTORS",
+ $form->get_lists("price_factors" => "ALL_PRICE_FACTORS",
"business_types" => "ALL_BUSINESS_TYPES",
);
$form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
]
]);
- map { $_->{value} = "$_->{name}--$_->{id}" } @{ $form->{ALL_VC} };
-
- $form->{SHOW_VC_DROP_DOWN} = $myconfig{vclimit} > scalar @{ $form->{ALL_VC} };
-
- $form->{oldvcname} = $form->{"old$form->{vc}"};
- $form->{oldvcname} =~ s/--.*//;
-
my $dispatch_to_popup = '';
if ($form->{resubmit} && ($form->{format} eq "html")) {
$dispatch_to_popup = "window.open('about:blank','Beleg'); document.do.target = 'Beleg';";
$::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup});");
- my $follow_up_vc = $form->{ $form->{vc} eq 'customer' ? 'customer' : 'vendor' };
- $follow_up_vc =~ s/--\d*\s*$//;
-
- $form->{follow_up_trans_info} = $form->{donumber} .'('. $follow_up_vc .')';
+ $form->{follow_up_trans_info} = $form->{donumber} .'('. $form->{VC_OBJ}->name .')';
$::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part));
my $payment_id;
$payment_id = $form->{payment_id} if $form->{payment_id};
- check_name($form->{vc});
+ my $vc = $form->{vc};
+ 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';
+ }
+
$form->{discount} = $form->{"$form->{vc}_discount"} if defined $form->{"$form->{vc}_discount"};
# Problem: Wenn man ohne Erneuern einen Kunden/Lieferanten
# wechselt, wird der entsprechende Kunden/ Lieferantenrabatt
$form->get_lists("projects" => { "key" => "ALL_PROJECTS",
"all" => 1 },
- "$form->{vc}s" => "ALL_VC",
"business_types" => "ALL_BUSINESS_TYPES");
$form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]);
$form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
- $form->{SHOW_VC_DROP_DOWN} = $myconfig{vclimit} > scalar @{ $form->{ALL_VC} };
$form->{title} = $locale->text('Delivery Orders');
$form->header();
$form->{donumber} =~ s/\s*$//g;
my $msg = ucfirst $form->{vc};
- $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
+ $form->isblank($form->{vc} . "_id", $locale->text($msg . " missing!"));
# $locale->text('Customer missing!');
# $locale->text('Vendor missing!');
validate_items();
# if the name changed get new values
- if (check_name($form->{vc})) {
+ my $vc = $form->{vc};
+ 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';
+
update();
$::dispatcher->end_request;
}
do.pl - Script for all calls to delivery order
-
=head1 FUNCTIONS
=over 2
$form->{lastsort} = ""; # memory for which table was sort at last time
$form->{ndxs_counter} = 0; # counter for added entries to top100
- # for seach all possibibilities, is_service only used as UNLESS so == 0
- my %is_xyz = ("is_part" => 1, "is_service" => 0, "is_assembly" =>1 );
-
$form->{title} = (ucfirst $form->{searchitems}) . "s";
$form->{title} =~ s/ys$/ies/;
$form->{title} = $locale->text($form->{title});
$form->header;
$form->get_lists('partsgroup' => 'ALL_PARTSGROUPS');
- print $form->parse_html_template('ic/search', { %is_xyz, });
+ print $form->parse_html_template('ic/search');
$lxdebug->leave_sub();
} #end search()
use SL::IR;
use SL::IS;
use SL::DB::Default;
+use SL::DB::Department;
use SL::DB::PurchaseInvoice;
+use SL::DB::Vendor;
use List::Util qw(max sum);
use List::UtilsBy qw(sort_by);
require "bin/mozilla/io.pl";
-require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
use strict;
# create links
$form->create_links("AP", \%myconfig, "vendor");
- #quote all_vendor Bug 133
- foreach my $ref (@{ $form->{all_vendor} }) {
- $ref->{name} = $form->quote($ref->{name});
- }
-
- if ($form->{all_vendor}) {
- unless ($form->{vendor_id}) {
- $form->{vendor_id} = $form->{all_vendor}->[0]->{id};
- }
- }
-
$form->backup_vars(qw(payment_id language_id taxzone_id
currency delivery_term_id intnotes cp_id));
my @curr = $form->get_all_currencies();
map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
- $form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}";
-
- # build vendor/customer drop down comatibility... don't ask
- if (@{ $form->{"all_vendor"} || [] }) {
- $form->{"selectvendor"} = 1;
- $form->{vendor} = qq|$form->{vendor}--$form->{vendor_id}|;
- }
-
- # departments
- if ($form->{all_departments}) {
- $form->{selectdepartment} = "<option>\n";
- $form->{department} = "$form->{department}--$form->{department_id}";
-
- map {
- $form->{selectdepartment} .=
- "<option>$_->{description}--$_->{id}\n"
- } (@{ $form->{all_departments} || [] });
- }
-
# forex
$form->{forex} = $form->{exchangerate};
my $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
my %TMPL_VAR = ();
my @custom_hiddens;
- $TMPL_VAR{invoice_obj} = SL::DB::PurchaseInvoice->new(id => $form->{id})->load if $form->{id};
+ $TMPL_VAR{invoice_obj} = SL::DB::PurchaseInvoice->load_cached($form->{id}) if $form->{id};
+ $TMPL_VAR{vendor_obj} = SL::DB::Vendor->load_cached($form->{vendor_id}) if $form->{vendor_id};
$form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
$form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
my @old_project_ids = ($form->{"globalproject_id"});
map { push @old_project_ids, $form->{"project_id_$_"} if $form->{"project_id_$_"}; } 1..$form->{"rowcount"};
- $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
- "all" => 0,
- "old_id" => \@old_project_ids },
- "taxzones" => "ALL_TAXZONES",
+ $form->get_lists("taxzones" => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"),
"currencies" => "ALL_CURRENCIES",
- "vendors" => "ALL_VENDORS",
- "departments" => "all_departments",
"price_factors" => "ALL_PRICE_FACTORS");
+ $TMPL_VAR{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
$TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]);
$TMPL_VAR{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all_sorted(query => [
or => [
]
]
]);
- $TMPL_VAR{department_labels} = sub { "$_[0]->{description}--$_[0]->{id}" };
-
- # customer
- $TMPL_VAR{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
- $TMPL_VAR{vclimit} = $myconfig{vclimit};
- $TMPL_VAR{vc_select} = "customer_or_vendor_selection_window('vendor', '', 1, 0)";
- push @custom_hiddens, "vendor_id";
- push @custom_hiddens, "oldvendor";
- push @custom_hiddens, "selectvendor";
# currencies and exchangerate
my @values = map { $_ } @{ $form->{ALL_CURRENCIES} };
$TMPL_VAR{creditwarning} = ($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update};
$TMPL_VAR{is_credit_remaining_negativ} = $form->{creditremaining} =~ /-/;
- my $follow_up_vc = $form->{vendor};
- $follow_up_vc =~ s/--\d*\s*$//;
- $TMPL_VAR{vendor_name} = $follow_up_vc;
-
# set option selected
foreach my $item (qw(AP)) {
$form->{"select$item"} =~ s/ selected//;
$TMPL_VAR{payment_terms_obj} = get_payment_terms_for_invoice();
$form->{duedate} = $TMPL_VAR{payment_terms_obj}->calc_date(reference_date => $form->{invdate}, due_date => $form->{due_due})->to_kivitendo if $TMPL_VAR{payment_terms_obj};
- $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.Draft kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part client_js));
+ $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.Draft kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part autocomplete_project client_js));
$form->header();
$main::auth->assert('vendor_invoice_edit');
- &check_name('vendor');
+ if (($form->{previous_vendor_id} || $form->{vendor_id}) != $form->{vendor_id}) {
+ IR->get_vendor(\%myconfig, $form);
+ }
if (!$form->{forex}) { # read exchangerate from input field (not hidden)
$form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate});
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
$form->isblank("invdate", $locale->text('Invoice Date missing!'));
- $form->isblank("vendor", $locale->text('Vendor missing!'));
+ $form->isblank("vendor_id", $locale->text('Vendor missing!'));
$form->isblank("invnumber", $locale->text('Invnumber missing!'));
$form->{invnumber} =~ s/^\s*//g;
$form->{invnumber} =~ s/\s*$//g;
# if the vendor changed get new values
- if (&check_name('vendor')) {
+ if (($form->{previous_vendor_id} || $form->{vendor_id}) != $form->{vendor_id}) {
&update;
$::dispatcher->end_request;
}
use SL::DB::Default;
use SL::DB::Customer;
+use SL::DB::Department;
use SL::DB::Invoice;
use SL::DB::PaymentTerm;
+require "bin/mozilla/common.pl";
require "bin/mozilla/io.pl";
-require "bin/mozilla/arap.pl";
use strict;
# create links
$form->create_links("AR", \%myconfig, "customer");
- if ($form->{all_customer}) {
- unless ($form->{customer_id}) {
- $form->{customer_id} = $form->{all_customer}->[0]->{id};
- $form->{salesman_id} = $form->{all_customer}->[0]->{salesman_id};
- }
- }
-
my $editing = $form->{id};
$form->backup_vars(qw(payment_id language_id taxzone_id salesman_id
IS->get_customer(\%myconfig, \%$form);
- #quote all_customer Bug 133
- foreach my $ref (@{ $form->{all_customer} }) {
- $ref->{name} = $form->quote($ref->{name});
- }
-
$form->restore_vars(qw(id));
IS->retrieve_invoice(\%myconfig, \%$form);
$form->restore_vars(qw(taxincluded)) if $form->{id};
$form->restore_vars(qw(salesman_id)) if $editing;
-
- # build vendor/customer drop down compatibility... don't ask
- if (@{ $form->{"all_customer"} }) {
- $form->{"selectcustomer"} = 1;
- $form->{customer} = qq|$form->{customer}--$form->{"customer_id"}|;
- }
-
- $form->{"oldcustomer"} = $form->{customer};
-
- if ($form->{"oldcustomer"} !~ m/--\d+$/ && $form->{"customer_id"}) {
- $form->{"oldcustomer"} .= qq|--$form->{"customer_id"}|
- }
-
-
-# $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
-# $form->{selectcustomer} = 1;
-
$form->{employee} = "$form->{employee}--$form->{employee_id}";
# forex
my %TMPL_VAR = ();
my @custom_hiddens;
- if ($form->{id}) {
- require SL::DB::Invoice;
- $TMPL_VAR{invoice_obj} = SL::DB::Invoice->new(id => $form->{id})->load;
- }
+ $TMPL_VAR{customer_obj} = SL::DB::Customer->load_cached($form->{customer_id}) if $form->{customer_id};
+ $TMPL_VAR{invoice_obj} = SL::DB::Invoice->load_cached($form->{id}) if $form->{id};
+
$form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
$form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
$form->get_lists("taxzones" => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"),
"currencies" => "ALL_CURRENCIES",
- "customers" => "ALL_CUSTOMERS",
"price_factors" => "ALL_PRICE_FACTORS");
- $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
+ $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
# Projects
my @old_project_ids = uniq grep { $_ } map { $_ * 1 } ($form->{"globalproject_id"}, map { $form->{"project_id_$_"} } 1..$form->{"rowcount"});
]
]
]);
- $TMPL_VAR{department_labels} = sub { "$_[0]->{description}--$_[0]->{id}" };
-
- # customer
- $TMPL_VAR{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
- $TMPL_VAR{vclimit} = $myconfig{vclimit};
- $TMPL_VAR{vc_select} = "customer_or_vendor_selection_window('customer', '', 0, 0)";
- push @custom_hiddens, "customer_id";
- push @custom_hiddens, "oldcustomer";
- push @custom_hiddens, "selectcustomer";
# currencies and exchangerate
my @values = map { $_ } @{ $form->{ALL_CURRENCIES} };
$TMPL_VAR{creditwarning} = ($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update};
$TMPL_VAR{is_credit_remaining_negativ} = $form->{creditremaining} =~ /-/;
- my $follow_up_vc = $form->{customer};
- $follow_up_vc =~ s/--\d*\s*$//;
- $TMPL_VAR{customer_name} = $follow_up_vc;
-
# set option selected
foreach my $item (qw(AR)) {
$form->{"select$item"} =~ s/ selected//;
$form->{taxaccounts_array} = [ split(/ /, $form->{taxaccounts}) ];
if( $form->{customer_id} && !$form->{taxincluded_changed_by_user} ) {
- my $customer = SL::DB::Customer->new(id => $form->{customer_id})->load();
+ my $customer = SL::DB::Customer->load_cached($form->{customer_id});
$form->{taxincluded} = defined($customer->taxincluded_checked) ? $customer->taxincluded_checked : $myconfig{taxincluded_checked};
}
my $taxincluded = $form->{taxincluded} ? "checked" : '';
$form->{update} = 1;
- &check_name("customer");
+ if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
+ $::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
+
+ IS->get_customer(\%myconfig, $form);
+ }
$form->{taxincluded} ||= $taxincluded;
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
$form->isblank("invdate", $locale->text('Invoice Date missing!'));
- $form->isblank("customer", $locale->text('Customer missing!'));
+ $form->isblank("customer_id", $locale->text('Customer missing!'));
$form->error($locale->text('Cannot post invoice for a closed period!'))
if ($form->date_closed($form->{"invdate"}, \%myconfig));
$form->{invnumber} =~ s/\s*$//g;
# if oldcustomer ne customer redo form
- if (&check_name('customer')) {
+ if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
&update;
$::dispatcher->end_request;
}
use SL::DB::TaxZone;
use SL::DB::PaymentTerm;
+require "bin/mozilla/common.pl";
require "bin/mozilla/io.pl";
-require "bin/mozilla/arap.pl";
require "bin/mozilla/reportgenerator.pl";
use strict;
check_oe_access();
- # get customer/vendor
- $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
-
# retrieve order/quotation
my $editing = $form->{id};
if $form->{rowcount} && $form->{type} eq 'sales_order'
&& defined $form->{customer} && $form->{customer} eq '';
- $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 delivery_term_id currency));
# get customer / vendor
$form->{forex} = $form->{exchangerate};
$form->{employee} = "$form->{employee}--$form->{employee_id}";
- # build vendor/customer drop down comatibility... don't ask
- if (@{ $form->{"all_$form->{vc}"} || [] }) {
- $form->{"select$form->{vc}"} = 1;
- $form->{$form->{vc}} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
- }
-
- $form->{"old$form->{vc}"} = $form->{$form->{vc}};
-
- if ($form->{"old$form->{vc}"} !~ m/--\d+$/ && $form->{"$form->{vc}_id"}) {
- $form->{"old$form->{vc}"} .= qq|--$form->{"$form->{vc}_id"}|
- }
-
$main::lxdebug->leave_sub();
}
$form->get_lists("taxzones" => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"),
"currencies" => "ALL_CURRENCIES",
- $vc => { key => "ALL_" . uc($vc),
- limit => $myconfig{vclimit} + 1 },
"price_factors" => "ALL_PRICE_FACTORS");
$form->{ALL_PAYMENTS} = SL::DB::Manager::PaymentTerm->get_all( where => [ or => [ obsolete => 0, id => $form->{payment_id} || undef ] ]);
]);
$TMPL_VAR{sales_employee_labels} = sub { $_[0]->{name} || $_[0]->{login} };
- # vendor/customer
- $TMPL_VAR{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
- $TMPL_VAR{vclimit} = $myconfig{vclimit};
- $TMPL_VAR{vc_select} = "customer_or_vendor_selection_window('$form->{vc}', '', @{[ $form->{vc} eq 'vendor' ? 1 : 0 ]}, 0)";
- push @custom_hiddens, "$form->{vc}_id";
- push @custom_hiddens, "old$form->{vc}";
- push @custom_hiddens, "select$form->{vc}";
-
# currencies and exchangerate
- my @values = map { $_ } @{ $form->{ALL_CURRENCIES} };
- my %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} };
$form->{currency} = $form->{defaultcurrency} unless $form->{currency};
$TMPL_VAR{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency};
- $TMPL_VAR{currencies} = NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
- '-values' => \@values, '-labels' => \%labels,
- '-onchange' => "document.getElementById('update_button').click();"
- )) if scalar @values;
push @custom_hiddens, "forex";
push @custom_hiddens, "exchangerate" if $form->{forex};
$form->{update} = 1;
- &check_name($form->{vc});
+ my $vc = $form->{vc};
+ 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 (!$form->{forex}) { # read exchangerate from input field (not hidden)
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate) unless $recursive_call;
}
# setup vendor / customer data
- $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
$form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 },
- "$form->{vc}s" => "ALL_VC",
"taxzones" => "ALL_TAXZONES",
"business_types" => "ALL_BUSINESS_TYPES",);
$form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]);
$form->{ORDER_PROBABILITIES} = [ map { { title => ($_ * 10) . '%', id => $_ * 10 } } (0..10) ];
+ $::request->{layout}->use_javascript(map { "${_}.js" } qw(autocomplete_project));
+
$form->header();
print $form->parse_html_template('oe/search', {
$form->{$idx} =~ s/\s*$//g;
my $msg = ucfirst $form->{vc};
- $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
+ $form->isblank($form->{vc} . '_id', $locale->text($msg . " missing!"));
# $locale->text('Customer missing!');
# $locale->text('Vendor missing!');
&validate_items;
- my $payment_id;
- if($form->{payment_id}) {
- $payment_id = $form->{payment_id};
- }
+ my $vc = $form->{vc};
+ 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};
- # if the name changed get new values
- if (&check_name($form->{vc})) {
- if($form->{payment_id} eq "") {
- $form->{payment_id} = $payment_id;
- }
- &update;
+ IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
+ IR->get_vendor(\%myconfig, $form) if $vc eq 'vendor';
+
+ update();
$::dispatcher->end_request;
}
$form->{$idx} =~ s/\s*$//g;
my $msg = ucfirst $form->{vc};
- $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
+ $form->isblank($form->{vc} . '_id', $locale->text($msg . " missing!"));
# $locale->text('Customer missing!');
# $locale->text('Vendor missing!');
remove_emptied_rows();
&validate_items;
- my $payment_id;
- if($form->{payment_id}) {
- $payment_id = $form->{payment_id};
- }
+ my $vc = $form->{vc};
+ 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};
- # if the name changed get new values
- if (&check_name($form->{vc})) {
- if($form->{payment_id} eq "") {
- $form->{payment_id} = $payment_id;
- }
- &update;
+ IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
+ IR->get_vendor(\%myconfig, $form) if $vc eq 'vendor';
+
+ update();
$::dispatcher->end_request;
}
$form->{quodate} = $form->{transdate};
}
- my $payment_id;
- if ($form->{payment_id}) {
- $payment_id = $form->{payment_id};
- }
+ my $vc = $form->{vc};
+ 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};
- # if the name changed get new values
- if (&check_name($form->{vc})) {
- $form->{payment_id} = $payment_id if $form->{payment_id} eq "";
- &update;
+ IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
+ IR->get_vendor(\%myconfig, $form) if $vc eq 'vendor';
+
+ update();
$::dispatcher->end_request;
}
require "bin/mozilla/$form->{script}";
- map { $form->{"select$_"} = "" } ($form->{vc}, "currency");
-
my $currency = $form->{currency};
&invoice_links;
use Data::Dumper;
use List::MoreUtils qw(any);
-require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
require "bin/mozilla/reportgenerator.pl";
$nextsub = "generate_$::form->{report}";
- # setup vc selection
- $::form->all_vc(\%::myconfig, $::form->{vc}, $is_sales ? "AR" : "AP");
- $vc .= "<option>$_->{name}--$_->{id}\n" for @{ $::form->{"all_$::form->{vc}"} };
- $vc = ($vc)
- ? qq|<select name=$::form->{vc} class="initial_focus"><option>\n$vc</select>|
- : qq|<input name=$::form->{vc} size=35 class="initial_focus">|;
+ $vc = qq|<input name=$::form->{vc} size=35 class="initial_focus">|;
}
my ($selection, $paymentaccounts);
use List::Util qw(sum first);
use SL::AM;
+use SL::DB::Employee;
use SL::VK;
use SL::IS;
use SL::ReportGenerator;
use Data::Dumper;
-require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
require "bin/mozilla/reportgenerator.pl";
my ($customer);
- # setup customer selection
- $form->all_vc(\%myconfig, "customer", "AR");
+ $::request->layout->add_javascripts("autocomplete_project.js");
$form->{title} = $locale->text('Sales Report');
- $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 },
- "departments" => "ALL_DEPARTMENTS",
+ $form->get_lists("departments" => "ALL_DEPARTMENTS",
"business_types" => "ALL_BUSINESS_TYPES",
"salesmen" => "ALL_SALESMEN",
- 'employees' => 'ALL_EMPLOYEES',
- 'partsgroup' => 'ALL_PARTSGROUPS',
- "customers" => "ALL_VC");
+ 'partsgroup' => 'ALL_PARTSGROUPS');
+
+ $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted;
+
$form->{CUSTOM_VARIABLES_IC} = CVar->get_configs('module' => 'IC');
($form->{CUSTOM_VARIABLES_FILTER_CODE_IC},
$form->{CUSTOM_VARIABLES_INCLUSION_CODE_IC}) = CVar->render_search_options('variables' => $form->{CUSTOM_VARIABLES_IC},
$form->{CUSTOM_VARIABLES_INCLUSION_CODE_CT}) = CVar->render_search_options('variables' => $form->{CUSTOM_VARIABLES_CT},
'include_prefix' => 'l_',
'include_value' => 'Y');
- $form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
- $form->{employee_labels} = sub { $_[0]->{"name"} || $_[0]->{"login"} };
- $form->{salesman_labels} = $form->{employee_labels};
-
$form->header;
print $form->parse_html_template('vk/search_invoice', { %myconfig });
</listitem>
<listitem>
- <para>Enthält unter anderem Listenbegrenzung vclimit,
- Datumsformat dateformat und Nummernformat numberformat</para>
+ <para>Enthält unter anderem Datumsformat dateformat und Nummernformat numberformat</para>
</listitem>
<listitem>
}</pre></div><div class="sect3" title="4.1.3.2. %::myconfig"><div class="titlepage"><div><div><h4 class="title"><a name="d0e6540"></a>4.1.3.2. %::myconfig</h4></div></div></div><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Das einzige Hash unter den globalen Variablen</p></li><li class="listitem"><p>Wird spätestens benötigt wenn auf die Datenbank
zugegriffen wird</p></li><li class="listitem"><p>Wird bei jedem Request neu erstellt.</p></li><li class="listitem"><p>Enthält die Userdaten des aktuellen Logins</p></li><li class="listitem"><p>Sollte nicht ohne Filterung irgendwo gedumpt werden oder
extern serialisiert werden, weil da auch der Datenbankzugriff
- für diesen user drinsteht.</p></li><li class="listitem"><p>Enthält unter anderem Listenbegrenzung vclimit,
- Datumsformat dateformat und Nummernformat numberformat</p></li><li class="listitem"><p>Enthält Datenbankzugriffinformationen</p></li></ul></div><p>
+ für diesen user drinsteht.</p></li><li class="listitem"><p>Enthält unter anderem Datumsformat dateformat und Nummernformat numberformat</p></li><li class="listitem"><p>Enthält Datenbankzugriffinformationen</p></li></ul></div><p>
<code class="varname">%::myconfig</code> ist im Moment der Ersatz für
ein Userobjekt. Die meisten Funktionen, die etwas anhand des
aktuellen Users entscheiden müssen, befragen
'Customer deleted!' => 'Kunde gelöscht!',
'Customer details' => 'Kundendetails',
'Customer missing!' => 'Kundenname fehlt!',
- 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
- 'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
'Customer saved' => 'Kunde gespeichert',
'Customer saved!' => 'Kunde gespeichert!',
'Customer type' => 'Kundentyp',
'Draft suggestions' => 'Entwurfsvorschläge',
'Drafts' => 'Entwürfe',
'Drawing' => 'Zeichnung',
- 'Dropdown Limit' => 'Auswahllistenbegrenzung',
'Due' => 'Fällig',
'Due Date' => 'Fälligkeitsdatum',
'Due Date missing!' => 'Fälligkeitsdatum fehlt!',
'Monat' => 'Monat',
'Month' => 'Monat',
'Monthly' => 'monatlich',
- 'More than one #1 found matching, please be more specific.' => 'Mehr als ein #1 wurde gefunden, bitte geben Sie den Namen genauer an.',
'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'Multi mode not supported.' => 'Multimodus wird nicht unterstützt.',
'Multiple addresses can be entered separated by commas.' => 'Mehrere Adressen können durch Kommata getrennt angegeben werden.',
'Select federal state...' => 'Bundesland auswählen...',
'Select file to upload' => 'Datei zum Hochladen auswählen',
'Select from one of the items below' => 'Wählen Sie einen der untenstehenden Einträge',
- 'Select from one of the names below' => 'Wählen Sie einen der untenstehenden Namen',
- 'Select from one of the projects below' => 'Wählen Sie eines der untenstehenden Projekte',
'Select postscript or PDF!' => 'Postscript oder PDF auswählen!',
'Select tax office...' => 'Finanzamt auswählen...',
'Select template to paste' => 'Einzufügende Vorlage auswählen',
'Vendor details' => 'Lieferantendetails',
'Vendor filter for AP transaction drafts' => 'Filter für Entwürfe',
'Vendor missing!' => 'Lieferant fehlt!',
- 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
- 'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
'Vendor saved' => 'Lieferant gespeichert',
'Vendor saved!' => 'Lieferant gespeichert!',
'Vendor type' => 'Lieferantentyp',
signature => '',
hide_cvar_search_options => '',
numberformat => '1.000,00',
- vclimit => 0,
favorites => '',
copies => '',
menustyle => 'v3',
signature => '',
hide_cvar_search_options => '',
numberformat => '1.000,00',
- vclimit => 0,
favorites => '',
copies => '',
menustyle => 'v3',
<td>[% L.select_tag("user.config_values.numberformat", SELF.all_numberformats, default=props.numberformat) %]</td>
</tr>
- <tr>
- <th align="right">[% LxERP.t8("Dropdown Limit") %]</th>
- <td>[% L.input_tag("user.config_values.vclimit", props.vclimit) %]</td>
- </tr>
-
<tr>
<th align="right">[% LxERP.t8("Language") %]</th>
<td>[% L.select_tag("user.config_values.countrycode", SELF.all_countrycodes, title_key="title", default=props.countrycode) %]</td>
</td>
</tr>
- <tr>
- <th align="right">[% 'Dropdown Limit' | $T8 %]</th>
- <td><input name="vclimit" size="10" value="[% HTML.escape(MYCONFIG.vclimit) %]"></td>
- </tr>
-
<tr>
<th align="right">[% 'Language' | $T8 %]</th>
<td>
</select>
[%- ELSIF var.type == 'date' %]
- [% 'from (time)' | $T8 %]
[% L.date_tag(filter_prefix _'cvar_'_ HTML.escape(var.name) _'_from') %]
[% 'to (time)' | $T8 %]
<form method="post" action="[% script | html %]">
-<input type="hidden" name="selectvendor" value="[% selectvendor | html %]">
-<input type="hidden" name="selectcurrency" value="[% selectcurrency | html %]">
-
-<input type="hidden" name="oldvendor" value="[% oldvendor | html %]">
-<input type="hidden" name="vendor_id" value="[% vendor_id | html %]">
<input type="hidden" name="terms" value="[% terms | html %]">
<input type="hidden" name="creditlimit" value="[% creditlimit | html %]">
<tr>
<th align="right" nowrap>[% 'Vendor' | $T8 %]</th>
<td colspan="3">
- [% IF ( selectvendor ) %]
- <select name="vendor" onchange="document.getElementById('update_button').click();"[% IF initial_focus == 'vendor' %] class="initial_focus"[% END %]>[% selectvendor %]</select>
- [% ELSE %]
- <input name=vendor value="[% vendor | html %]" size="35"[% IF initial_focus == 'vendor' %] class="initial_focus"[% END %]>
- [% END %]
- <input type="button" value="D" onclick="show_vc_details('vendor')">
+ [% P.customer_vendor_picker("vendor_id", vendor_id, type="vendor", style="width: 300px") %]
+ [% L.button_tag("show_vc_details('vendor')", LxERP.t8('Details (one letter abbreviation)')) %]
+ [% L.hidden_tag("previous_vendor_id", vendor_id) %]
</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Currency' | $T8 %]</th>
- <td><select name="currency">[% selectcurrency %]</select></td>
+ <td>[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]</td>
[% IF ( defaultcurrency && (currency != defaultcurrency) ) %]
<th align=right>[% 'Exchangerate' | $T8 %]</th>
[%- USE T8 %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
+[% SET style="width: 250px" %]
<h1>[% title %]</h1>
<form method=post name="search" action=[% script %]>
<table>
<tr>
<th align=right>[% 'Vendor' | $T8 %]</th>
- <td colspan=3>
- [%- INCLUDE 'generic/multibox.html'
- id = 'vendor',
- name = 'vendor',
- default = oldvendor,
- style = 'width: 250px',
- class = 'initial_focus',
- DATA = ALL_VC,
- id_sub = 'vc_keys',
- label_key = 'name',
- select = vc_select,
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 1,
- -%]
- </td>
+ <td>[% L.input_tag("vendor", vendor, style=style, class="initial_focus") %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Contact Person' | $T8 %]</th>
- <td colspan="3">[% L.input_tag("cp_name", '', size=20) %]</td>
+ <td>[% L.input_tag("cp_name", '', style=style) %]</td>
</tr>
<tr>
<th align=right nowrap>[% 'Department' | $T8 %]</th>
- <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, title_key = 'description', with_empty = 1, style="width: 200px") %]</td>
+ <td>[% L.select_tag('department_id', ALL_DEPARTMENTS, title_key = 'description', with_empty = 1, style=style) %]</td>
</tr>
<tr>
<th align=right nowrap>[% 'Invoice Number' | $T8 %]</th>
- <td colspan=3><input name=invnumber size=20></td>
+ <td>[% L.input_tag("invnumber", "", style=style) %]</td>
</tr>
<tr>
<th align=right nowrap>[% 'Order Number' | $T8 %]</th>
- <td colspan=3><input name=ordnumber size=20></td>
+ <td>[% L.input_tag("ordnumber", "", style=style) %]</td>
</tr>
<tr>
<th align=right nowrap>[% 'Notes' | $T8 %]</th>
- <td><input name=notes size=20></td>
+ <td>[% L.input_tag("notes", "", style=style) %]</td>
<th align="right">[% 'Part Description' | $T8 %]</th>
- <td><input name="parts_description" size="20"></td>
+ <td>[% L.input_tag("parts_description", "", style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Project Number' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'project_id',
- style = "width: 250px",
- DATA = ALL_PROJECTS,
- id_key = 'id',
- label_key = 'projectnumber',
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 0,
- -%]
- </td>
+ <td>[% P.project_picker("project_id", project_id, style=style) %]</td>
<th align="right">[% 'Part Number' | $T8 %]</th>
- <td><input name="parts_partnumber" size="20"></td>
+ <td>[% L.input_tag("parts_partnumber", "", style=style) %]</td>
</tr>
<tr>
- <th align=right nowrap>[% 'From' | $T8 %]</th>
+ <th align=right nowrap>[% 'Invoice Date' | $T8 %]</th>
<td>
[% L.date_tag('transdatefrom') %]
- </td>
- <th align=right>[% 'Bis' | $T8 %]</th>
- <td>
- [% L.date_tag('transdateto') %]
+ [% 'Bis' | $T8 %]
+ [% L.date_tag('transdateto') %]
</td>
</tr>
<input type=hidden name=sort value=transdate>
<tr>
<th align="right" nowrap>[% 'Customer' | $T8 %]</th>
<td colspan=3>
-[%- IF selectcustomer %]
- <select id='customer' name="customer" onchange="document.getElementById('update_button').click();"[% IF initial_focus == 'customer'%] class="initial_focus"[% END %]>[% selectcustomer %]</select>
-[%- ELSE %]
- <input id='customer' name=customer value="[% customer | html %]" size=35[% IF initial_focus == 'customer'%] class="initial_focus"[% END %]>
-[%- END %]
- <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('customer')"></td>
- [% L.hidden_tag('selectcustomer', selectcustomer) %]
- [% L.hidden_tag('oldcustomer', oldcustomer) %]
- [% L.hidden_tag('customer_id', customer_id) %]
- [% L.hidden_tag('terms', terms) %]
+ [% P.customer_vendor_picker("customer_id", customer_id, type="customer", style="width: 300px", class=(initial_focus == 'customer_id' ? "initial_focus" : "")) %]
+ [% L.button_tag("show_vc_details('customer')", LxERP.t8('Details (one letter abbreviation)')) %]
+ [% L.hidden_tag("previous_customer_id", customer_id) %]
+ [% L.hidden_tag('terms', terms) %]
+ </td>
</tr>
[%- IF max_dunning_level || invoice_obj.dunning_config_id %]
<tr>
[%- END %]
<tr>
<th align=right>[% 'Currency' | $T8 %]</th>
- <td><select name=currency>[% selectcurrency %]</select></td>
- [% L.hidden_tag('selectcurrency', selectcurrency) %]
+ <td>[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]</td>
[% L.hidden_tag('defaultcurrency', defaultcurrency) %]
[% L.hidden_tag('fxgain_accno', fxgain_accno) %]
[% L.hidden_tag('fxloss_accno', fxloss_accno) %]
</td>
<td align=right>
<table>
-[%- IF selectemployee %]
<tr>
<th align=right nowrap>[% 'Salesperson' | $T8 %]</th>
- <td colspan=2><select name=employee>[% selectemployee %]</select>[% L.hidden_tag('selectemployee', selectemployee) %]</td>
+ <td colspan=2>[% P.select_tag("employee_id", employees, default=employee_id, title_key='safe_name') %]</td>
</tr>
-[%- ELSE %]
- [% L.hidden_tag('employee', employee) %]
-[%- END %]
<tr>
<th align=right nowrap>[% 'Invoice Number' | $T8 %]</th>
<td><input name=invnumber size=11 value="[% invnumber | html %]"></td>
[%- USE T8 %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
+[%- SET style="width: 250px" %]
<h1>[% title %]</h1>
<form method=post name="search" action=[% script %]>
<table>
<tr>
<th align=right>[% 'Customer' | $T8 %]</th>
- <td colspan=3>
- [%- INCLUDE 'generic/multibox.html'
- name = 'customer',
- default = oldcustomer,
- style = 'width: 250px',
- DATA = ALL_VC,
- id_sub = 'vc_keys',
- label_key = 'name',
- select = vc_select,
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 1,
- class = 'initial_focus',
- -%]
- </td>
+ <td>[% L.input_tag("customer", customer, style=style, class="initial_focus") %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Contact Person' | $T8 %]</th>
- <td colspan="3">[% L.input_tag("cp_name", '', size=20) %]</td>
+ <td>[% L.input_tag("cp_name", '', style=style) %]</td>
</tr>
<tr>
<th align=right nowrap>[% 'Department' | $T8 %]</th>
- <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, title_key = 'description', with_empty = 1, style="width: 200px") %]</td>
+ <td>[% L.select_tag('department_id', ALL_DEPARTMENTS, title_key = 'description', with_empty = 1, style=style) %]</td>
</tr>
<tr>
<th align=right nowrap>[% 'Invoice Number' | $T8 %]</th>
- <td colspan=3><input name=invnumber id=invnumber size=20></td>
+ <td>[% L.input_tag("invnumber", "", style=style) %]</td>
</tr>
<tr>
<th align=right nowrap>[% 'Order Number' | $T8 %]</th>
- <td colspan=3><input name=ordnumber id=ordnumber size=20></td>
+ <td>[% L.input_tag("ordnumber", "", style=style) %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Customer Order Number' | $T8 %]</th>
- <td colspan=3><input name="cusordnumber" id="cusordnumber" size="20"></td>
+ <td>[% L.input_tag("cusordnumber", "", style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Employee' | $T8 %]</th>
- <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style = 'width:250px') %]</td>
+ <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Salesman' | $T8 %]</th>
- <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style = 'width:250px') %]</td>
+ <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style=style) %]</td>
</tr>
<tr>
<th align=right nowrap>[% 'Transaction description' | $T8 %]</th>
- <td><input name=transaction_description id=transaction_description size=20></td>
+ <td>[% L.input_tag("transaction_description", "", style=style) %]</td>
<th align="right">[% 'Part Description' | $T8 %]</th>
- <td><input name="parts_description" size="20"></td>
+ <td>[% L.input_tag("parts_description", "", style=style) %]</td>
</tr>
<tr>
<th align=right nowrap>[% 'Notes' | $T8 %]</th>
- <td><input name=notes id=notes size=20></td>
+ <td>[% L.input_tag("notes", "", style=style) %]</td>
<th align="right">[% 'Part Number' | $T8 %]</th>
- <td><input name="parts_partnumber" size="20"></td>
+ <td>[% L.input_tag("parts_partnumber", "", style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Project Number' | $T8 %]</th>
- <td colspan="3">
- [%- INCLUDE 'generic/multibox.html'
- name = 'project_id',
- style = "width: 250px",
- DATA = ALL_PROJECTS,
- id_key = 'id',
- label_key = 'projectnumber',
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 0,
- -%]
- </td>
+ <td>[% P.project_picker("project_id", project_id, style=style) %]</td>
</tr>
- [% IF SHOW_BUSINESS_TYPES %]
+ [% IF ALL_BUSINESS_TYPES.as_list.size > 0 %]
<tr>
<th align="right" nowrap>[% 'Customer type' | $T8 %]</th>
- <td colspan="3">
- [%- INCLUDE 'generic/multibox.html'
- name = 'business_id',
- style = "width: 250px",
- DATA = ALL_BUSINESS_TYPES,
- id_key = 'id',
- label_key = 'description',
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 0,
- -%]
- </td>
+ <td>[% L.select_tag("business_id", ALL_BUSINESS_TYPES, with_empty=1, title_key="description", style=style) %]</td>
</tr>
[% END %]
<tr>
<th align=right nowrap>[% 'Invoice Date' | $T8 %]</th>
<td>
- [% 'From' | $T8 %]
[% L.date_tag('transdatefrom') %]
- </td>
- <th align=right>[% 'Bis' | $T8 %]</th>
- <td>
- [% L.date_tag('transdateto') %]
+ [% 'Bis' | $T8 %]
+ [% L.date_tag('transdateto') %]
</td>
</tr>
<tr>
<th align=right nowrap>[% 'Due Date' | $T8 %]</th>
<td>
- [% 'From' | $T8 %]
[% L.date_tag('duedatefrom') %]
- </td>
- <th align=right>[% 'Bis' | $T8 %]</th>
- <td>
- [% L.date_tag('duedateto') %]
+ [% 'Bis' | $T8 %]
+ [% L.date_tag('duedateto') %]
</td>
</tr>
<br>
<input class=submit type=submit name=action id="continue" value="[% 'Continue' | $T8 %]">
</form>
- <script type="text/javascript">
- <!--
- $(document).ready(function(){
- $('customer').focus();
- })
- //-->
- </script>
+++ /dev/null
-[%- USE HTML %]
-[%- USE T8 %]
-[%- USE L %]
-[%- USE LxERP %]
-
-<h1>[% 'Select from one of the projects below' | $T8 %]</h1>
-
-<form method=post action="[% script %]">
-
-<table width=100%>
- <tr class=listheading>
- <th> </th>
- <th>[% 'Number' | $T8 %]</th>
- <th>[% 'Description' | $T8 %]</th>
- </tr>
-[%- FOREACH row IN project_list %]
- <tr class=listrow[% loop.count % 2 %]>
- <td>[% L.radio_button_tag('ndx', value=loop.count, checked=loop.first) %]</td>
- <td>[% row.projectnumber | html %]</td>
- <td>[% row.description | html %]</td>
- [% L.hidden_tag('new_id_' _ loop.count, row.id) %]
- [% L.hidden_tag('new_projectnumber_' _ loop.count, row.projectnumber) %]
- </tr>
-[%- END %]
-</table>
-
-<hr size=3 noshade>
-
-[% L.hidden_tag(row.key, row.value) FOREACH row = hiddens %]
-[% L.hidden_tag('lastndx', project_list.size) %]
-[% L.hidden_tag('nextsub', 'project_selected') %]
-[% L.hidden_tag('rownumber', rownumber) %]
-[% L.submit_tag('action', LxERP.t8('Continue')) %]
-
-</form>
-
-[%- USE HTML %][%- USE L %][%- USE LxERP %][%- USE T8 %]
+[%- USE HTML %][%- USE L %][%- USE LxERP %][%- USE T8 %][%- USE P -%]
<b>Transaction</b>
<table>
<table>
<tr>
<th align="right">[%- LxERP.t8("Vendor") %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'vendor',
- select_name = 'vendor_id',
- default = ALL_VENDORS.size < limit ? vendor_id : vendor_name,
- style = 'width: 250px',
- DATA = ALL_VENDORS,
- id_key = 'id',
- label_key = 'name',
- limit = limit,
- show_empty = 1,
- allow_textbox = 1,
- class = 'initial_focus',
- onChange = 'filter_drafts();',
- -%]
- </td>
+ <td>[% P.input_tag("vendor", vendor_name, class="initial_focus", style="width: 250px") %]</td>
</tr>
</table>
</form>
}
//-->
</script>
-
<table>
<tr>
<th align=right>[% 'Customer' | $T8 %]</th>
- <td colspan=3>
- [%- IF vc == 'customer' ? all_customer.size : all_vendor.size %]
- [%- INCLUDE 'generic/multibox.html'
- name = vc,
- DATA = vc == 'customer' ? all_customer : all_vendor,
- id_sub = 'vc_keys',
- label_sub = 'vc_keys',
- select = vc_select,
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 1,
- -%]
- [%- ELSE %]
- [% L.input_tag(vc, '', size=35) %]
- [%- END %]
-</td>
+ <td colspan=3>[% L.input_tag(vc, '', size=35) %]</td>
</tr>
[% IF show_accounts %]
<tr>
[% L.submit_tag('action', LxERP.t8('Continue')) %]
</form>
-
-
[%- USE L %]
[%- USE HTML %]
[%- USE T8 %]
-[%- USE LxERP %]
+[%- USE LxERP %][%- USE P -%]
<form method=post action=cp.pl>
+[% SET vc_id = vc _ '_id'
+ style = "width: 250px" %]
[% L.hidden_tag('defaultcurrency', defaultcurrency) %]
[% L.hidden_tag('closedto', closedto) %]
[% L.hidden_tag('vc', vc) %]
<h1>[% is_receipt ? LxERP.t8('Receipt') : LxERP.t8('Payment') %]</h1>
-<table width=100%>
+<table>
<tr valign=top>
<td>
<table>
<tr>
<th align=right>[% is_customer ? LxERP.t8('Customer') : LxERP.t8('Vendor') %]</th>
- <td>[% vccontent %]</td>
- [% IF vc == 'customer' %]
- [% L.hidden_tag('selectcustomer', selectcustomer) %]
- [% L.hidden_tag('customer_id', customer_id) %]
- [% L.hidden_tag('oldcustomer', oldcustomer) %]
- [% ELSE %]
- [% L.hidden_tag('selectvendor', selectvendor) %]
- [% L.hidden_tag('vendor_id', vendor_id) %]
- [% L.hidden_tag('oldvendor', oldvendor) %]
- [% END %]
- </tr>
- [% IF vc == 'customer' %]
- <tr>
- <th align=right>[% 'Customer Number' | $T8 %]</th>
- <td><input name="customernumber" size="35"></td>
+ <td>
+ [% P.customer_vendor_picker(vc_id, $vc_id, type=vc, class="initial_focus", style=style) %]
+ [% P.hidden_tag("previous_" _ vc_id, $vc_id) %]
+ </td>
</tr>
- [% END %]
<tr>
<th align=right>[% 'Invoice Number' | $T8 %]</th>
<td><input name="invnumber" size="35"></td>
[%- USE T8 %]
[%- USE HTML %]
[%- USE LxERP %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
<h1>[% title %]</h1>
<script type="text/javascript" src="js/show_form_details.js"></script>
<script type="text/javascript" src="js/show_history.js"></script>
<script type="text/javascript" src="js/show_vc_details.js"></script>
- <script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/delivery_customer_selection.js"></script>
- <script type="text/javascript" src="js/vendor_selection.js"></script>
<script type="text/javascript" src="js/calculate_qty.js"></script>
<script type="text/javascript" src="js/stock_in_out.js"></script>
<script type="text/javascript" src="js/follow_up.js"></script>
</style>
[%- IF vc == 'customer' %]
- [%- SET vc = 'customer' %]
- [%- SET the_vc_id = customer_id %]
- [%- SET the_vc = customer %]
- [%- SET the_oldvc = oldcustomer %]
[%- SET is_customer = '1' %]
[%- ELSE %]
[%- SET vc = 'vendor' %]
- [%- SET the_vc_id = vendor_id %]
- [%- SET the_vc = vendor %]
- [%- SET the_oldvc = oldvendor %]
[%- SET is_customer = '0' %]
[%- END %]
+ [%- SET vc_id = vc _ "_id" %]
[%- IF delivered %]
[%- SET DISABLED = ' disabled' %]
[%- END %]
<td>
<table width="100%">
<tr>
- <input type="hidden" name="[% vc %]_id" value="[% HTML.escape(the_vc_id) %]">
- <input type="hidden" name="old[% vc %]" value="[% HTML.escape(the_oldvc) %]">
- <input type="hidden" name="tradediscount" value="[% HTML.escape(tradediscount) %]">
<th align="right">[% IF is_customer %][% 'Customer' | $T8 %][% ELSE %][% 'Vendor' | $T8 %][% END %]</th>
<td>
- [%- UNLESS !delivered && SHOW_VC_DROP_DOWN %]
- <input type="text" value="[% HTML.escape(oldvcname) %]" name="[% HTML.escape(vc) %]"[% RO %]>
- [%- ELSE %]
- <select name="[% vc %]" class="fixed_width" onchange="document.do.update_button.click();"[% RO %]>
- [%- FOREACH row = ALL_VC %]
- <option value="[% HTML.escape(row.value) %]" [% IF the_oldvc == row.value %] selected[% END %]>[% HTML.escape(row.name) %]</option>
- [%- END %]
- </select>
- <input type="hidden" name="select[% vc %]" value="1">
- [%- END %]
- <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('[% vc %]')">
+ [% IF RO %]
+ [% P.hidden_tag(vc_id, $vc_id) %]
+ [% HTML.escape(VC_OBJ.name) %]
+ [% ELSE %]
+ [% P.customer_vendor_picker(vc_id, $vc_id, type=vc, class="fixed_width") %]
+ [% END %]
+ [% P.hidden_tag("previous_" _ vc_id, $vc_id) %]
+ [% P.button_tag("show_vc_details('" _ HTML.escape(vc) _ "')", LxERP.t8("Details (one letter abbreviation)")) %]
</td>
[%- IF ALL_CONTACTS.size %]
[%- USE T8 %]
[%- USE L %]
-[%- USE HTML %][%- USE LxERP %]
+[%- USE HTML %][%- USE LxERP %][%- USE P -%]
<h1>[% title %]</h1>
[%- IF vc == 'customer' %]
<table>
<tr>
<th align="right">[% IF is_customer %][% 'Customer' | $T8 %][% ELSE %][% 'Vendor' | $T8 %][% END %]</th>
- <td colspan="3">
- [%- UNLESS SHOW_VC_DROP_DOWN %]
- <input type="text" name="[% HTML.escape(vc) %]" class="fixed_width initial_focus">
- [%- ELSE %]
- <select name="[% vc %]" class="fixed_width initial_focus">
- <option></option>
- [%- FOREACH row = ALL_VC %]
- <option>[% HTML.escape(row.name) %]--[% HTML.escape(row.id) %]</option>
- [%- END %]
- </select>
- <input type="hidden" name="select[% vc %]" value="1">
- [%- END %]
- </td>
+ <td colspan="3">[% P.input_tag(vc, "", class="fixed_width initial_focus") %]</td>
</tr>
<tr>
<th align="right">[% 'Transaction description' | $T8 %]</th>
<td><input name="transaction_description" class="fixed_width"></td>
<th align="right">[% 'Part Description' | $T8 %]</th>
- <td><input name="parts_description" size="20"></td>
+ <td><input name="parts_description" size="20" class="fixed_width"></td>
</tr>
<tr>
</select>
</td>
<th align="right">[% 'Part Number' | $T8 %]</th>
- <td><input name="parts_partnumber" size="20"></td>
+ <td><input name="parts_partnumber" size="20", class="fixed_width"></td>
</tr>
<tr>
<th align="right">[% 'Delivery Order Date' | $T8 %] [% 'From' | $T8 %]</th>
<td>
[% L.date_tag('transdatefrom') %]
- </td>
- <th align="right">[% 'Bis' | $T8 %]</th>
- <td>
+ [% 'Bis' | $T8 %]
[% L.date_tag('transdateto') %]
</td>
</tr>
<th align="right">[% 'Reqdate' | $T8 %] [% 'From' | $T8 %]</th>
<td>
[% L.date_tag('reqdatefrom') %]
- </td>
- <th align="right">[% 'Bis' | $T8 %]</th>
- <td>
+ [% 'Bis' | $T8 %]
[% L.date_tag('reqdateto') %]
</td>
</tr>
<th align="right">[% 'Insert Date' | $T8 %] [% 'From' | $T8 %]</th>
<td>
[% L.date_tag('insertdatefrom') %]
- </td>
- <th align="right">[% 'Bis' | $T8 %]</th>
- <td>
+ [% 'Bis' | $T8 %]
[% L.date_tag('insertdateto') %]
</td>
</tr>
<tr>
<th align="right">[% 'Customer' | $T8 %]</th>
<td colspan="3">
- [% IF SHOW_CUSTOMER_SELECTION %]
- <select name="customer" class="initial_focus">
- <option></option>
- [% FOREACH row = all_customer %]<option>[% HTML.escape(row.name) %]--[% HTML.escape(row.id) %]</option>[% END %]
- </select>
- [% ELSE %]
<input name="customer" size="35" class="initial_focus">
- [% END %]
</td>
</tr>
</tr>
[% END %]
- [% IF SHOW_DEPARTMENT_SELECTION %]
- <tr>
- <th align="right">[% 'Department' | $T8 %]</th>
- <td colspan="3">
- <select name="department">
- <option></option>
- [% FOREACH row = all_departments %]<option>[% HTML.escape(row.description) %]--[% HTML.escape(row.id) %]</option>[% END %]
- </select>
- </td>
- </tr>
- [% END %]
-
<tr>
<th align="right" nowrap>[% 'Invoice Number' | $T8 %]</th>
<td colspan="3"><input name="invnumber" size="20"></td>
[%- USE T8 %]
[%- USE HTML %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
<h1>[% title %]</h1>
[% PROCESS 'common/flash.html' %]
<table>
<tr>
<th align="right">[% 'Customer' | $T8 %]</th>
- <td colspan="3">
- [% IF SHOW_CUSTOMER_DDBOX %]
- <select id='customer' name="customer_id" class="initial_focus">
- <option value=""></option>
- [% FOREACH row = ALL_CUSTOMERS %]<option value="[% HTML.escape(row.id) %]">[% HTML.escape(row.name) %]</option>
- [% END %]
- </select>
- [% ELSE %]
- <input id='customer' name="customer" size="35" class="initial_focus">
- [% END %]
- </td>
+ <td colspan="3">[% P.input_tag("customer", "", size="35", class="initial_focus") %]</td>
</tr>
[% IF SHOW_DUNNING_LEVELS %]
</tr>
[% END %]
- [% IF SHOW_DEPARTMENT_DDBOX %]
+ [% IF ALL_DEPARTMENTS.as_list.size %]
<tr>
<th align="right" nowrap>[% 'Department' | $T8 %]</th>
<td colspan="3">
+++ /dev/null
-[%- USE HTML %]
-[%#-
- Multibox
-
- This template makes an input box for you,
- decides whether it should be a text field or a drop down box,
- generates the HTML code, and fixes everything just right.
-
- call: PROCESS generic/multibox.html var = var, var2 = ....
-
- options and variables:
- name : name of the select/textfield
- id : id of the select/textfield, optional, defaults to name
- default : entered/selected value. defaults to a dereference of name, since it is usually set to that for update mechanisms
- id_key : key that holds the id in each row.
- id_sub : name of a perl sub that calculates the id for each row. will be called with a hashref.
- label_key : key that holds the label in each row.
- label_sub : name of a perl sub that calculates the label for each row. will be called with a hashref.
- DATA : the actual data, expected to be arrayref of hashrefs, usually what's returned by the all_vc routines.
- show_empty : show an empty first line in select boxes. defaults to false
- style : additional style information
- onChange : java magic on change
- select : java function call for a selection popup or other magic
- allow_textbox : allow to display a textbox instead of a drop down box if there are more entries than 'limit' entries.
- limit : defines the limit of entries, after which a textbox is generated. defaults to vclimit, or, failing to find that, 200.
- select_name : if a select is displayed, use a different name. ex.: department for textinput, but department_id for selects
- readonly : softly prevents modification
- class : CSS class names (optional)
--%]
-[%-
- Multibox__limit = limit != '' ? limit : vclimit != '' ? vclimit : 200
- Multibox__show_text = allow_textbox and DATA.size and Multibox__limit < DATA.size ? 1 : 0
- Multibox__id = id != '' && id * 1 != id ? id : name
- Multibox__default = default != '' ? default : $name
- Multibox__name = (select_name != '' and ! Multibox__show_text) ? select_name : name
--%]
-[%- IF Multibox__show_text %]
-<input type="text"
- [%- IF Multibox__name %] name="[% Multibox__name | html %]"[% END -%]
- [%- IF Multibox__id %] id="[% Multibox__id | html %]"[% END -%]
- [%- IF Multibox__default %] value="[% Multibox__default | html %]"[% END -%]
- [%- IF style %] style="[% style | html %]"[% END -%]
- [%- IF class %] class="[% class | html %]"[% END -%]
- [%- IF readonly %] readonly[% END -%]
-[%- -%]>
-[%- IF select -%]
- <input type="button" onclick="[% select %]" value="?">
-[%- END -%]
-[%- ELSE %]
-<select
- [%- IF Multibox__name %] name="[% Multibox__name | html %]"[% END -%]
- [%- IF Multibox__id %] id="[% Multibox__id | html %]"[% END -%]
- [%- IF style %] style="[% style | html %]"[% END -%]
- [%- IF class %] class="[% class | html %]"[% END -%]
- [%- IF onChange %] onChange="[% onChange | html %]"[% END -%]
- [%- IF readonly %] disabled[% END -%]
-[%- -%]>
- [%- IF show_empty %]
- <option value=""></option>
- [%- END %]
- [%- FOREACH row = DATA %]
- [%-
- Multibox__row_id = row.$id_key != '' ? row.$id_key : $id_sub(row)
- Multibox__row_label = row.$label_key != '' ? row.$label_key
- : $label_sub(row) != '' ? $label_sub(row)
- : Multibox__row_id
- Multibox__row_selected = Multibox__default == Multibox__row_id
- %]
- <option value="[% Multibox__row_id | html %]"[% IF Multibox__row_selected %] selected[% END %]>[% Multibox__row_label | html %]</option>
- [%- END %]
-</select>
-[%- END %]
[%- USE LxERP %]
[%- USE L %]
[%- USE P %]
+[% SET style="width: 250px" %]
<h1>[% title %]</h1>
<form method="post" action="ic.pl">
</tr>
<tr>
<th align="right" nowrap>[% 'Part Number' | $T8 %]</th>
- <td><input name="partnumber" size="20"></td>
+ <td>[% L.input_tag("partnumber", "", style=style) %]</td>
<th align="right" nowrap>[% 'EAN' | $T8 %]</th>
- <td><input name="ean" size="20"></td>
+ <td>[% L.input_tag("ean", "", style=style) %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Part Classification' | $T8 %]:</th>
- <td>[% P.select_classification('classification_id') %]</td>
+ <td>[% P.select_classification('classification_id', style=style) %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Part Description' | $T8 %]</th>
- <td colspan="3"><input name="description" size="40" class="initial_focus"></td>
+ <td colspan="3">[% L.input_tag("description", "", style=style, class="initial_focus") %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Partsgroup' | $T8 %]</th>
- <td>
- [%- INCLUDE generic/multibox.html
- name = 'partsgroup',
- select_name = 'partsgroup_id',
- DATA = ALL_PARTSGROUPS,
- show_empty = 1,
- id_key = 'id',
- label_key = 'partsgroup',
- style = 'width:250px',
- limit = MYCONFIG.vclimit,
- allow_textbox = 1
- -%]
- </td>
- <th align="right" nowrap>[% 'Serial Number' | $T8 %]</th> <td><input name="serialnumber" size="20"></td>
+ <td>[% P.select_tag("partsgroup_id", ALL_PARTSGROUPS, with_empty=1, default=partsgroup, title_key="partsgroup", style=style) %]</td>
+ <th align="right" nowrap>[% 'Serial Number' | $T8 %]</th>
+ <td>[% L.input_tag("serialnumber", "", style=style) %]</td>
</tr>
- [%- UNLESS is_service %]
<tr>
- <th align="right" nowrap>[% 'Make' | $T8 %]</th> <td><input name="make" size="20"></td>
- <th align="right" nowrap>[% 'Model' | $T8 %]</th> <td><input name="model" size="20"></td>
+ <th align="right" nowrap>[% 'Make' | $T8 %]</th>
+ <td>[% L.input_tag("make", "", style=style) %]</td>
+ <th align="right" nowrap>[% 'Model' | $T8 %]</th>
+ <td>[% L.input_tag("model", "", style=style) %]</td>
</tr>
- [%- END %]
<tr>
<th align="right" nowrap>[% 'Drawing' | $T8 %]</th>
- <td><input name="drawing" size="20"></td>
+ <td>[% L.input_tag("drawing", "", style=style) %]</td>
<th align="right" nowrap>[% 'Microfiche' | $T8 %]</th>
- <td><input name="microfiche" size="20"></td>
+ <td>[% L.input_tag("microfiche", "", style=style) %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Shop article' | $T8 %]</th>
- <td>[% L.yes_no_tag('shop', shop, default='', with_empty=1, empty_title='---') %]</td>
+ <td>[% L.yes_no_tag('shop', shop, default='', with_empty=1, empty_title='---', style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Insert Date' | $T8 %]</th>
<td>
- [% 'From' | $T8 %][% L.date_tag('insertdatefrom') %]
- [% 'Bis' | $T8 %] [% L.date_tag('insertdateto') %]
+ [% L.date_tag('insertdatefrom') %]
+ [% 'Bis' | $T8 %]
+ [% L.date_tag('insertdateto') %]
</td>
</tr>
[% CUSTOM_VARIABLES_FILTER_CODE %]
- [%- IF is_assembly %]
<tr>
<td></td>
<td colspan="3">
[% L.radio_button_tag('bom', id='bom_1', value=1, label=LxERP.t8('Individual Items')) %]
</td>
</tr>
- [%- END %]
<tr>
<td></td>
<td colspan="3">
[%- L.radio_button_tag('itemstatus', value='active', id='itemstatus_active', label=LxERP.t8('Active'), checked=1) %]
- [%- UNLESS is_service %]
[%- L.radio_button_tag('itemstatus', value='onhand', id='itemstatus_onhand', label=LxERP.t8('On Hand')) %]
[%- L.radio_button_tag('itemstatus', value='short', id='itemstatus_short', label=LxERP.t8('Short')) %]
[%- L.radio_button_tag('itemstatus', value='obsolete', id='itemstatus_obsolete', label=LxERP.t8('Obsolete')) %]
- [%- END %]
[%- L.radio_button_tag('itemstatus', value='orphaned', id='itemstatus_orphaned', label=LxERP.t8('Orphaned')) %]
[%- L.radio_button_tag('itemstatus', value='', id='itemstatus_all', label=LxERP.t8('All')) %]
</td>
<td>
<table>
<tr>
- [%- UNLESS is_assembly %]
<td>[%- L.checkbox_tag('bought', label=LxERP.t8('Bought')) %]</td>
- [%- END %]
<td>[%- L.checkbox_tag('sold', label=LxERP.t8('Sold')) %]</td>
</tr>
</tr>
<tr>
- [%- UNLESS is_assembly %]
<td>[%- L.checkbox_tag('onorder', label=LxERP.t8('On Order')) %]</td>
- [%- END %]
<td>[%- L.checkbox_tag('ordered', label=LxERP.t8('Ordered')) %]</td>
</tr>
</tr>
<tr>
- [%- UNLESS is_assembly %]
<td>[%- L.checkbox_tag('rfq', label=LxERP.t8('RFQ')) %]</td>
- [%- END %]
<td>[%- L.checkbox_tag('quoted', label=LxERP.t8('Quoted')) %]</td>
</tr>
</table>
<tr>
<td>[%- L.checkbox_tag('l_partnumber', label=LxERP.t8('Part Number'), checked=1, value='Y') %]</td>
<td>[%- L.checkbox_tag('l_description', label=LxERP.t8('Part Description'), checked=1, value='Y') %]</td>
- [%- UNLESS is_service %]
<td>[%- L.checkbox_tag('l_serialnumber', label=LxERP.t8('Serial Number'), value='Y') %]</td>
- [%- END %]
<td>[%- L.checkbox_tag('l_unit', label=LxERP.t8('Unit of measure'), value='Y', checked=1) %]</td>
</tr>
<tr>
<td>[%- L.checkbox_tag('l_priceupdate', label=LxERP.t8('Updated'), value='Y') %]</td>
<td>[%- L.checkbox_tag('l_deliverydate', label=LxERP.t8('Delivery Date'), value='Y') %]</td>
- [%- UNLESS is_service %]
<td>[%- L.checkbox_tag('l_rop', label=LxERP.t8('ROP'), value='Y') %]</td>
<td>[%- L.checkbox_tag('l_weight', label=LxERP.t8('Weight'), value='Y') %]</td>
- [%- END %]
</tr>
<tr>
</tr>
<tr>
- [%- UNLESS is_service %]
<td>[%- L.checkbox_tag('l_onhand', label=LxERP.t8('Stocked Qty'), value='Y') %]</td>
- [%- END %]
<td>[%- L.checkbox_tag('l_projectnumber', label=LxERP.t8('Project Number'), value='Y') %]</td>
<td>[%- L.checkbox_tag('l_projectdescription', label=LxERP.t8('Project Description'), value='Y') %]</td>
<td>[%- L.checkbox_tag('l_pricegroups', label=LxERP.t8('Pricegroups'), value='Y', checked=1) %]</td>
[%- USE T8 %]
[%- USE HTML %]
[%- USE LxERP %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
<h1>[% title %]</h1>
-[%- SET follow_up_trans_info = invnumber _ ' (' _ vendor_name _ ')' %]
+[%- SET follow_up_trans_info = invnumber _ ' (' _ vendor_obj.name _ ')' %]
<script type="text/javascript" src="js/common.js"></script>
-<script type="text/javascript" src="js/vendor_selection.js"></script>
<script type="text/javascript" src="js/calculate_qty.js"></script>
<script type="text/javascript" src="js/follow_up.js"></script>
-<script type="text/javascript" src="js/customer_or_vendor_selection.js"></script>
<form method="post" name="invoice" action="[% script %]">
<tr>
<th align="right">[% 'Vendor' | $T8 %]</th>
<td>
- [%- INCLUDE 'generic/multibox.html'
- id = 'vendor',
- name = 'vendor',
- style = 'width: 250px',
- class = 'initial_focus',
- DATA = ALL_VENDORS,
- id_sub = 'vc_keys',
- label_key = 'name',
- select = vc_select,
- limit = vclimit,
- allow_textbox = 1,
- onChange = "document.getElementById('update_button').click();" -%]
- <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('[% vc | html %]')">
+ [% P.customer_vendor_picker("vendor_id", vendor_id, type="vendor", style="width: 250px", class="initial_focus") %]
+ [% P.button_tag("show_vc_details('vendor')", LxERP.t8('Details (one letter abbreviation)')) %]
+ [% P.hidden_tag("previous_vendor_id", vendor_id) %]
</td>
- <input type="hidden" name="vendor_id" value="[% HTML.escape(vendor_id) %]">
- <input type="hidden" name="oldvendor" value="[% HTML.escape(oldvendor) %]">
- <input type="hidden" name="selectvendor" value="[% HTML.escape(selectvendor) %]">
</tr>
[%- IF ALL_CONTACTS.size %]
<tr>
<tr>
<th align="right">[% 'Steuersatz' | $T8 %]</th>
<td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'taxzone_id'
- style = 'width: 250px'
- DATA = ALL_TAXZONES
- id_key = 'id'
- readonly = (id ? 1 : 0)
- label_key = 'description' -%]
+ [% L.select_tag('taxzone_id', ( id ? ALL_TAXZONES : ALL_ACTIVE_TAXZONES) , default = taxzone_id, title_key = 'description', disabled = (id ? 1 : 0), style='width: 250px', onchange = "document.getElementById('update_button').click();") %]
+ [%- IF id %]
+ <input type='hidden' name='taxzone_id' value='[% taxzone_id %]'>
+ [%- END %]
</td>
[%- IF id %]
<input type='hidden' name='taxzone_id' value='[% taxzone_id %]'>
[%- END %]
</tr>
-[%- IF all_departments %]
+[%- IF ALL_DEPARTMENTS.as_list.size %]
<tr>
<th align="right" nowrap>[% 'Department' | $T8 %]</th>
- <td colspan="3">
- [%- INCLUDE 'generic/multibox.html'
- name = 'department_id',
- style = 'width: 250px',
- DATA = all_departments,
- id_key = 'id',
- label_sub = 'department_labels',
- show_empty = 1 -%]
- </td>
+ <td colspan="3">[% P.select_tag("department_id", ALL_DEPARTMENTS, with_empty=1, default=department_id, title_key="description", style="width: 250px") %]</td>
</tr>
[%- END %]
[%- IF currencies %]
</tr>
<tr>
<th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'globalproject_id',
- DATA = ALL_PROJECTS,
- id_key = 'id',
- label_key = 'projectnumber',
- show_empty = 1,
- onChange = "document.getElementById('update_button').click();" -%]
- </td>
+ <td>[% P.project_picker('globalproject_id', globalproject_id) %]</td>
</tr>
</table>
</td>
[%- USE T8 %]
[%- USE HTML %]
[%- USE LxERP %]
-[%- USE L %]
-[%- SET follow_up_trans_info = invnumber _ ' (' _ customer_name _ ')' %]
+[%- USE L %][%- USE P -%]
+[%- SET follow_up_trans_info = invnumber _ ' (' _ customer_obj.name _ ')' %]
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/delivery_customer_selection.js"></script>
-<script type="text/javascript" src="js/vendor_selection.js"></script>
<script type="text/javascript" src="js/calculate_qty.js"></script>
<script type="text/javascript" src="js/follow_up.js"></script>
-<script type="text/javascript" src="js/customer_or_vendor_selection.js"></script>
<form method="post" name="invoice" action="[% script %]">
<tr>
<th align="right">[% 'Customer' | $T8 %]</th>
<td>
- [%- INCLUDE 'generic/multibox.html'
- id = 'customer',
- name = 'customer',
- style = 'width: 250px',
- class = 'initial_focus',
- DATA = ALL_CUSTOMERS,
- id_sub = 'vc_keys',
- label_key = 'name',
- select = vc_select,
- limit = vclimit,
- allow_textbox = 1,
- onChange = "document.getElementById('update_button').click();" -%]
- <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('[% HTML.escape(vc) %]')">
+ [% P.customer_vendor_picker("customer_id", customer_id, type="customer", style="width: 250px", class="initial_focus") %]
+ [% L.button_tag("show_vc_details('customer')", LxERP.t8('Details (one letter abbreviation)')) %]
+ [% L.hidden_tag("previous_customer_id", customer_id) %]
<input type="hidden" name="customer_pricegroup_id" value="[% HTML.escape(customer_pricegroup_id) %]">
- <input type="hidden" name="customer_id" value="[% HTML.escape(customer_id) %]">
- <input type="hidden" name="oldcustomer" value="[% HTML.escape(oldcustomer) %]">
- <input type="hidden" name="selectcustomer" value="[% HTML.escape(selectcustomer) %]">
</td>
</tr>
[%- IF ALL_CONTACTS.size %]
[%- USE T8 %]
[%- USE HTML %]
[%- USE LxERP %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
<form method="post" name="oe" action="[% script %]">
<script type="text/javascript" src="js/delivery_customer_selection.js"></script>
- <script type="text/javascript" src="js/vendor_selection.js"></script>
<script type="text/javascript" src="js/calculate_qty.js"></script>
- <script type="text/javascript" src="js/customer_or_vendor_selection.js"></script>
<script type="text/javascript" src="js/follow_up.js"></script>
[%- IF is_sales_ord %]
[% L.javascript_tag("js/edit_periodic_invoices_config") %]
<tr>
<th align="right">[% IF vc == 'customer' %][% 'Customer' | $T8 %][% ELSE %][% 'Vendor' | $T8 %][% END %]</th>
<td>
- [%- INCLUDE 'generic/multibox.html'
- name = vc,
- style = 'width: 250px',
- class = 'initial_focus',
- DATA = vc == 'customer' ? ALL_CUSTOMERS : ALL_VENDORS,
- id_sub = 'vc_keys',
- label_key = 'name',
- select = vc_select,
- limit = vclimit,
- allow_textbox = 1,
- onChange = "document.getElementById('update_button').click();" -%]
- <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('[% HTML.escape(vc) %]')">
+ [%- SET vc_id = vc _ "_id" %]
+ [% P.customer_vendor_picker(vc_id, $vc_id, type=vc, style="width: 250px", class="initial_focus") %]
+ [% P.button_tag("show_vc_details('" _ HTML.escape(vc) _ "')", LxERP.t8("Details (one letter abbreviation)")) %]
+ [% P.hidden_tag("previous_" _ vc_id, $vc_id) %]
</td>
</tr>
[%- IF ALL_CONTACTS.size %]
</td>
</tr>
[%- END %]
-[%- IF currencies %]
<tr>
<th align="right">[% 'Currency' | $T8 %]</th>
- <td>[% currencies %]</td>
+ <td>[% L.select_tag("currency", ALL_CURRENCIES, value_key="name", default=currency, onchange="document.getElementById('update_button').click();") %]</td>
</tr>
-[%- END %]
[%- IF show_exchangerate %]
<tr>
<th align="right">[% 'Exchangerate' | $T8 %]</th>
[%- USE HTML %]
[%- USE T8 %]
[%- USE LxERP %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
<h1>[% HTML.escape(title) %]</h1>
[%- SET vclabel = vc == 'customer' ? LxERP.t8('Customer') : LxERP.t8('Vendor') %]
[%- SET vcnumberlabel = vc == 'customer' ? LxERP.t8('Customer Number') : LxERP.t8('Vendor Number') %]
[%- SET vctypelabel = vc == 'customer' ? LxERP.t8('Customer type') : LxERP.t8('Vendor type') %]
+[%- SET vcdefault = 'old' _ vc %]
+[%- SET style="width: 250px" %]
<form method="post" action="oe.pl">
<table>
<tr>
<th align="right">[% HTML.escape(vclabel) %]</th>
- <td colspan="3">
- [%- INCLUDE 'generic/multibox.html'
- name = vc,
- default = vc == 'customer' ? oldcustomer : oldvendor,
- style = 'width: 250px',
- DATA = ALL_VC,
- id_sub = 'vc_keys',
- label_key = 'name',
- select = vc_select,
- limit = MYCONFIG.vclimit,
- show_empty = 1,
- allow_textbox = 1,
- class = 'initial_focus',
- -%]
- </td>
+ <td>[% L.input_tag(vc, $vcdefault, style=style, class="initial_focus") %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Contact Person' | $T8 %]</th>
- <td colspan="3">[% L.input_tag("cp_name", '', style="width: 250px") %]</td>
+ <td>[% L.input_tag("cp_name", '', style=style) %]</td>
</tr>
[%- IF ALL_DEPARTMENTS.size %]
<tr>
<th align="right" nowrap>[% 'Department' | $T8 %]</th>
- <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1, style="width: 250px") %]</td>
+ <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1, style=style) %]</td>
</tr>
[%- END %]
<tr>
<th align="right">[% HTML.escape(ordlabel) %]</th>
- <td colspan="3"><input name="[% HTML.escape(ordnrname) %]" style="width: 250px"></td>
+ <td>[% L.input_tag(ordnrname, "", style=style) %]</td>
</tr>
[% IF is_order %]
<tr>
<th align="right">[% LxERP.t8("Customer Order Number") %]</th>
- <td colspan="3">[% L.input_tag("cusordnumber", '', style="width: 250px") %]</td>
+ <td>[% L.input_tag("cusordnumber", '', style=style) %]</td>
</tr>
[% END %]
<tr>
<th align="right">[% 'Employee' | $T8 %]</th>
- <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style='width:250px') %]</td>
+ <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Salesman' | $T8 %]</th>
- <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style='width:250px') %]</td>
+ <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Steuersatz' | $T8 %]</th>
- <td>[% L.select_tag('taxzone_id', ALL_TAXZONES, with_empty=1, title_key='description', style='width: 250px') %]</td>
+ <td>[% L.select_tag('taxzone_id', ALL_TAXZONES, with_empty=1, title_key='description', style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Shipping Point' | $T8 %]</th>
- <td colspan="3">[% L.input_tag('shippingpoint', '', style='width:250px') %]</td>
+ <td>[% L.input_tag('shippingpoint', '', style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Transaction description' | $T8 %]</th>
- <td><input name="transaction_description" style="width: 250px"></td>
+ <td>[% L.input_tag("transaction_description", "", style=style) %]</td>
<th align="right">[% 'Part Description' | $T8 %]</th>
- <td><input name="parts_description" style="width: 250px"></td>
+ <td>[% L.input_tag("parts_description", "", style=style) %]</td>
</tr>
<tr>
- <th align="right">[% 'Project Number' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = MYCONFIG.vclimit < ALL_PROJECTS.size ? 'projectnumber' : 'project_id',
- style = "width: 250px",
- DATA = ALL_PROJECTS,
- id_key = 'id',
- label_key = 'projectnumber',
- limit = MYCONFIG.vclimit,
- show_empty = 1,
- allow_textbox = 1,
- -%]
- </td>
+ <th align="right">[% 'Project' | $T8 %]</th>
+ <td>[% P.project_picker("project_id", '', style=style) %]</td>
<th align="right">[% 'Part Number' | $T8 %]</th>
- <td><input name="parts_partnumber" style="width: 250px"></td>
+ <td>[% L.input_tag("parts_partnumber", "", style=style) %]</td>
</tr>
[%- UNLESS ALL_BUSINESS_TYPES.size == 0 %]
<tr>
<th align="right" nowrap>[% vctypelabel %]</th>
- <td colspan="3">
- [% L.select_tag('business_id', ALL_BUSINESS_TYPES, title_key = 'description', with_empty = 1, style='width:250px') %]
+ <td>
+ [% L.select_tag('business_id', ALL_BUSINESS_TYPES, title_key = 'description', with_empty = 1, style=style) %]
</td>
</tr>
[%- END %]
<th align="right">[% IF is_order %][% 'Order Date' | $T8 %][% ELSE %][% 'Quotation Date' | $T8 %][% END %] [% 'From' | $T8 %]</th>
<td>
[% L.date_tag('transdatefrom') %]
- </td>
- <th align="right">[% 'Bis' | $T8 %]</th>
- <td>
+ [% 'Bis' | $T8 %]
[% L.date_tag('transdateto') %]
</td>
</tr>
<th align="right">[% IF is_order %][% 'Delivery Date' | $T8 %][% ELSE %][% 'Valid until' | $T8 %][% END %] [% 'From' | $T8 %]</th>
<td>
[% L.date_tag('reqdatefrom') %]
- </td>
- <th align="right">[% 'Bis' | $T8 %]</th>
- <td>
+ [% 'Bis' | $T8 %]
[% L.date_tag('reqdateto') %]
</td>
</tr>
<th align="right">[% 'Insert Date' | $T8 %] [% 'From' | $T8 %]</th>
<td>
[% L.date_tag('insertdatefrom') %]
- </td>
- <th align="right">[% 'Bis' | $T8 %]</th>
- <td>
+ [% 'Bis' | $T8 %]
[% L.date_tag('insertdateto') %]
</td>
</tr>
<th align="right">[% 'Expected billing date' | $T8 %] [% 'From' | $T8 %]</th>
<td>
[% L.date_tag('expected_billing_date_from', '' 'BL') %]
- </td>
- <th align="right">[% 'Expected billing date' | $T8 %] [% 'Bis' | $T8 %]</th>
- <td>
+ [% 'Bis' | $T8 %]
[% L.date_tag('expected_billing_date_to', '' 'BL') %]
</td>
</tr>
<tr>
<th align="right">[% 'Order probability' | $T8 %]</th>
- <td colspan="3">
+ <td>
[% L.select_tag('order_probability_op', [[ 'ge', '>=' ], [ 'le', '<=' ]]) %]
[% L.select_tag('order_probability_value', ORDER_PROBABILITIES, title='title', with_empty=1) %]
</td>
[% CT_CUSTOM_VARIABLES_INCLUSION_CODE %]
-[%- IF type == 'sales_order' %]
- <tr><td colspan="3"><hr></td></tr>
-[%- END %]
</table>
</td>
</tr>
-[%- USE T8 %]
-[%- USE L %]
+[%- USE T8 %][%- USE L %][%- USE P -%]
+[%- SET style="width: 250px" %]
<h1>[% title %]</h1>
<form method=post name="search_invoice" action=[% script %]>
<tr>
<th align=right>[% 'Customer' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'customer',
- default = oldcustomer,
- style = 'width: 250px',
- DATA = ALL_VC,
- id_sub = 'vc_keys',
- label_key = 'name',
- select = vc_select,
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 1,
- class = 'initial_focus',
- -%]
- </td>
+ <td>[% P.input_tag("customer", "", class="initial_focus", style=style) %]</td>
<th align="right" nowrap>[% 'Customer Number' | $T8 %]</th>
- <td>
- <input name="customernumber" size="20">
- </td>
+ <td>[% P.input_tag("customernumber", "", style=style) %]</td>
</tr>
<tr>
ALL_DEPARTMENTS,
title_key = 'description',
with_empty = 1,
- style = 'width: 250px')
+ style = style)
-%]
</td>
<th align="right">[% 'Project Number' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'project_id',
- style = "width: 250px",
- DATA = ALL_PROJECTS,
- id_key = 'id',
- label_key = 'projectnumber',
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 0,
- -%]
- </td>
+ <td>[% P.project_picker("project_id", "", style=style) %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Part Number' | $T8 %]</th>
- <td><input name="partnumber" size="20"></td>
+ <td>[% P.input_tag("partnumber", "", style=style) %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Part Description' | $T8 %]</th>
- <td>
- <input name="description" size="40">
- </td>
+ <td>[% P.input_tag("description", "", style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Partsgroup' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'partsgroup_id',
- style = 'width: 250px',
- DATA = ALL_PARTSGROUPS,
- id_key = 'id',
- label_key = 'partsgroup',
- show_empty = 1,
- allow_textbox = 0,
- -%]
- </td>
-
+ <td>[% P.select_tag("partsgroupd_id", ALL_PARTSGROUPS, title_key="partsgroup", with_empty=1, style=style) %]</td>
<td align="right" nowrap>[% 'Country' | $T8 %]</td>
- <td><input name="country" size="20"></td>
+ <td>[% P.input_tag("country", "", style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Employee' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'employee_id',
- style = 'width: 250px',
- DATA = ALL_EMPLOYEES,
- id_key = 'id',
- label_sub = 'employee_labels',
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 0,
- default = ' ',
- -%]
- </td>
+ <td>[% L.select_tag("employee_id", ALL_EMPLOYEES, title_key="safe_name", with_empty=1, style=style) %]</td>
<th align="right">[% 'Salesman' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'salesman_id',
- style = 'width: 250px',
- DATA = ALL_SALESMEN,
- id_key = 'id',
- label_sub = 'salesman_labels',
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 0,
- -%]
- </td>
+ <td>[% L.select_tag("salesman_id", ALL_EMPLOYEES, title_key="safe_name", with_empty=1, style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Customer type' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'business_id',
- style = "width: 250px",
- DATA = ALL_BUSINESS_TYPES,
- id_key = 'id',
- label_key = 'description',
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 0,
- -%]
- </td>
+ <td>[% L.select_tag("business_id", ALL_BUSINESS_TYPES, title_key="description", with_empty=1, style=style) %]</td>
</tr>
<tr>
<th align=right nowrap>[% 'Invoice Date' | $T8 %] [% 'From' | $T8 %]</th>
<td>
[% L.date_tag('transdatefrom') %]
- </td>
-
- <th align=right>[% 'Bis' | $T8 %]</th>
-
- <td>
+ [% 'Bis' | $T8 %]
[% L.date_tag('transdateto') %]
</td>
</tr>