return $error;
}
-sub save_defaults {
- $main::lxdebug->enter_sub();
-
- my $self = shift;
- my %params = @_;
-
- my $myconfig = \%main::myconfig;
- my $form = $main::form;
-
- my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
-
- my %accnos;
- map { ($accnos{$_}) = split(m/--/, $form->{$_}) } qw(inventory_accno income_accno expense_accno fxgain_accno fxloss_accno ar_paid_accno);
-
- # these defaults are database wide
-
- my $query =
- qq|UPDATE defaults SET
- inventory_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?),
- income_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?),
- expense_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?),
- fxgain_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?),
- fxloss_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?),
- ar_paid_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?),
- invnumber = ?,
- cnnumber = ?,
- sonumber = ?,
- ponumber = ?,
- sqnumber = ?,
- rfqnumber = ?,
- customernumber = ?,
- vendornumber = ?,
- articlenumber = ?,
- servicenumber = ?,
- assemblynumber = ?,
- sdonumber = ?,
- pdonumber = ?,
- businessnumber = ?,
- weightunit = ?,
- language_id = ?|;
- my @values = ($accnos{inventory_accno}, $accnos{income_accno}, $accnos{expense_accno},
- $accnos{fxgain_accno}, $accnos{fxloss_accno}, $accnos{ar_paid_accno},
- $form->{invnumber}, $form->{cnnumber},
- $form->{sonumber}, $form->{ponumber},
- $form->{sqnumber}, $form->{rfqnumber},
- $form->{customernumber}, $form->{vendornumber},
- $form->{articlenumber}, $form->{servicenumber},
- $form->{assemblynumber},
- $form->{sdonumber}, $form->{pdonumber},
- $form->{businessnumber}, $form->{weightunit},
- conv_i($form->{language_id}));
- do_query($form, $dbh, $query, @values);
-
- $main::lxdebug->message(0, "es gibt rowcount: " . $form->{rowcount});
-
- for my $i (1..$form->{rowcount}) {
- if ($form->{"curr_$i"} ne $form->{"old_curr_$i"}) {
- $query = qq|UPDATE currencies SET name = ? WHERE name = ?|;
- do_query($form, $dbh, $query, $form->{"curr_$i"}, $form->{"old_curr_$i"});
- }
- }
-
- if (length($form->{new_curr}) > 0) {
- $query = qq|INSERT INTO currencies (name) VALUES (?)|;
- do_query($form, $dbh, $query, $form->{new_curr});
- }
-
- $dbh->commit();
-
- $main::lxdebug->leave_sub();
-}
-
sub save_preferences {
$main::lxdebug->enter_sub();
return $defaults;
}
-sub defaultaccounts {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
-
- # get defaults from defaults table
- my $query = qq|SELECT * FROM defaults|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $form->{defaults} = $sth->fetchrow_hashref("NAME_lc");
- $form->{defaults}{IC} = $form->{defaults}{inventory_accno_id};
- $form->{defaults}{IC_income} = $form->{defaults}{income_accno_id};
- $form->{defaults}{IC_expense} = $form->{defaults}{expense_accno_id};
- $form->{defaults}{FX_gain} = $form->{defaults}{fxgain_accno_id};
- $form->{defaults}{FX_loss} = $form->{defaults}{fxloss_accno_id};
- $form->{defaults}{AR_paid} = $form->{defaults}{ar_paid_accno_id};
-
- $form->{defaults}{weightunit} ||= 'kg';
-
- $sth->finish;
-
- $query = qq|SELECT c.id, c.accno, c.description, c.link
- FROM chart c
- WHERE c.link LIKE '%IC%'
- ORDER BY c.accno|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
- foreach my $key (split(/:/, $ref->{link})) {
- if ($key =~ /IC/) {
- my $nkey = $key;
- if ($key =~ /cogs/) {
- $nkey = "IC_expense";
- }
- if ($key =~ /sale/) {
- $nkey = "IC_income";
- }
- %{ $form->{IC}{$nkey}{ $ref->{accno} } } = (
- id => $ref->{id},
- description => $ref->{description}
- );
- }
- }
- }
- $sth->finish;
-
- $query = qq|SELECT c.id, c.accno, c.description
- FROM chart c
- WHERE c.category = 'I'
- AND c.charttype = 'A'
- ORDER BY c.accno|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
- %{ $form->{IC}{FX_gain}{ $ref->{accno} } } = (
- id => $ref->{id},
- description => $ref->{description}
- );
- }
- $sth->finish;
-
- $query = qq|SELECT c.id, c.accno, c.description
- FROM chart c
- WHERE c.category = 'E'
- AND c.charttype = 'A'
- ORDER BY c.accno|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
- %{ $form->{IC}{FX_loss}{ $ref->{accno} } } = (
- id => $ref->{id},
- description => $ref->{description}
- );
- }
- $sth->finish;
-
- # now get the tax rates and numbers
- $query = qq|SELECT c.id, c.accno, c.description,
- t.rate * 100 AS rate, t.taxnumber
- FROM chart c, tax t
- WHERE c.id = t.chart_id|;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
- $form->{taxrates}{ $ref->{accno} }{id} = $ref->{id};
- $form->{taxrates}{ $ref->{accno} }{description} = $ref->{description};
- $form->{taxrates}{ $ref->{accno} }{taxnumber} = $ref->{taxnumber}
- if $ref->{taxnumber};
- $form->{taxrates}{ $ref->{accno} }{rate} = $ref->{rate} if $ref->{rate};
- }
- # Abfrage für Standard Umlaufvermögenskonto
- $query =
- qq|SELECT id, accno, description, link | .
- qq|FROM chart | .
- qq|WHERE link LIKE ? |.
- qq|ORDER BY accno|;
- $sth = prepare_execute_query($form, $dbh, $query, '%AR%');
- $sth->execute || $form->dberror($query);#
- while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
- foreach my $item (split(/:/, $ref->{link})) {
- if ($item eq "AR_paid") {
- %{ $form->{IC}{AR_paid}{ $ref->{accno} } } = (
- id => $ref->{id},
- description => $ref->{description}
- );
- }
- }
- }
-
- $sth->finish;
-
- #Get currencies:
- $query = qq|SELECT name AS curr FROM currencies ORDER BY id|;
- $form->{CURRENCIES} = selectall_hashref_query($form, $dbh, $query);
-
- #Which of them is the default currency?
- $query = qq|SELECT name AS defaultcurrency FROM currencies WHERE id = (SELECT currency_id FROM defaults LIMIT 1);|;
- ($form->{defaultcurrency}) = selectrow_query($form, $dbh, $query);
-
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
-
sub closedto {
$main::lxdebug->enter_sub();
use strict;
use parent qw(SL::Controller::Base);
+use List::Util qw(first);
+
+use SL::DB::Chart;
+use SL::DB::Currency;
use SL::DB::Default;
+use SL::DB::Language;
+use SL::DB::Unit;
use SL::Helper::Flash;
use SL::Locale::String qw(t8);
__PACKAGE__->run_before('check_auth');
use Rose::Object::MakeMethods::Generic (
- 'scalar --get_set_init' => [ qw(defaults all_warehouses posting_options payment_options accounting_options inventory_options profit_options) ],
+ 'scalar --get_set_init' => [ qw(defaults all_warehouses all_weightunits all_languages all_currencies posting_options payment_options accounting_options inventory_options profit_options accounts) ],
);
sub action_edit {
}
sub action_save {
- my ($self, %params) = @_;
+ my ($self, %params) = @_;
- my $defaults = delete($::form->{defaults}) || {};
+ my $defaults = delete($::form->{defaults}) || {};
+ my $entered_currencies = delete($::form->{currencies}) || [];
+ my $original_currency_id = $self->defaults->currency_id;
# undef several fields if an empty value has been selected.
foreach (qw(warehouse_id bin_id warehouse_id_ignore_onhand bin_id_ignore_onhand)) {
undef $defaults->{$_} if !$defaults->{$_};
}
- $self->defaults->update_attributes(%{ $defaults });
+ $self->defaults->assign_attributes(%{ $defaults });
+
+ my %errors_idx;
+
+ # Handle currencies
+ my (%new_currency_names);
+ foreach my $existing_currency (@{ $self->all_currencies }) {
+ my $new_name = $existing_currency->name;
+ my $new_currency = first { $_->{id} == $existing_currency->id } @{ $entered_currencies };
+ $new_name = $new_currency->{name} if $new_currency;
+
+ if (!$new_name) {
+ $errors_idx{0} = t8('Currency names must not be empty.');
+ } elsif ($new_currency_names{$new_name}) {
+ $errors_idx{1} = t8('Currency names must be unique.');
+ }
+
+ if ($new_name) {
+ $new_currency_names{$new_name} = 1;
+ $existing_currency->name($new_name);
+ }
+ }
+
+ if ($::form->{new_currency} && $new_currency_names{ $::form->{new_currency} }) {
+ $errors_idx{1} = t8('Currency names must be unique.');
+ }
+
+ my @errors = map { $errors_idx{$_} } sort keys %errors_idx;
+
+ if (@errors) {
+ flash('error', @errors);
+ return $self->edit_form;
+ }
+
+ # Save currencies. As the names must be unique we cannot simply save
+ # them as they are -- the user might want to swap to names. So make
+ # them unique first and assign the actual names in a second step.
+ my %currency_names_by_id = map { ($_->id => $_->name) } @{ $self->all_currencies };
+ $_->update_attributes(name => '__039519735__' . $_->{id}) for @{ $self->all_currencies };
+ $_->update_attributes(name => $currency_names_by_id{ $_->{id} }) for @{ $self->all_currencies };
+
+ # Create new currency if required
+ my $new_currency;
+ if ($::form->{new_currency}) {
+ $new_currency = SL::DB::Currency->new(name => $::form->{new_currency});
+ $new_currency->save;
+ }
+
+ # If the user wants the new currency to be the default then replace
+ # the ID placeholder with the proper value. However, if no new
+ # currency has been created then don't change the value at all.
+ if (-1 == $self->defaults->currency_id) {
+ $self->defaults->currency_id($new_currency ? $new_currency->id : $original_currency_id);
+ }
+
+ $self->defaults->save;
flash_later('info', t8('Client Configuration saved!'));
# initializers
#
-sub init_defaults { SL::DB::Default->get }
-sub init_all_warehouses { SL::DB::Manager::Warehouse->get_all_sorted }
+sub init_defaults { SL::DB::Default->get }
+sub init_all_warehouses { SL::DB::Manager::Warehouse->get_all_sorted }
+sub init_all_languages { SL::DB::Manager::Language->get_all_sorted }
+sub init_all_currencies { SL::DB::Manager::Currency->get_all_sorted }
+sub init_all_weightunits { SL::DB::Manager::Unit->find_by(name => 'g')->convertible_units }
sub init_posting_options {
[ { title => t8("never"), value => 0 },
{ title => t8("income"), value => "income" }, ]
}
+sub init_accounts {
+ my %accounts;
+
+ foreach my $chart (@{ SL::DB::Manager::Chart->get_all(where => [ link => { like => '%IC%' } ], sort_by => 'accno ASC') }) {
+ my %added;
+
+ foreach my $link (split m/:/, $chart->link) {
+ my $key = lc($link =~ /cogs/ ? 'IC_expense' : $link =~ /sale/ ? 'IC_income' : $link);
+ next if $added{$key};
+
+ $added{$key} = 1;
+ $accounts{$key} ||= [];
+ push @{ $accounts{$key} }, $chart;
+ }
+ }
+
+ $accounts{fx_gain} = SL::DB::Manager::Chart->get_all(where => [ category => 'I', charttype => 'A' ], sort_by => 'accno ASC');
+ $accounts{fx_loss} = SL::DB::Manager::Chart->get_all(where => [ category => 'E', charttype => 'A' ], sort_by => 'accno ASC');
+ $accounts{ar_paid} = SL::DB::Manager::Chart->get_all(where => [ link => { like => '%AR_paid%' } ], sort_by => 'accno ASC');
+
+ return \%accounts;
+}
+
#
# filters
#
sub edit_form {
my ($self) = @_;
- $self->render('client_config/form', title => t8('Client Configuration'));
+ $self->render('client_config/form', title => t8('Client Configuration'),
+ make_chart_title => sub { $_[0]->accno . '--' . $_[0]->description });
}
1;
$main::lxdebug->leave_sub();
}
-sub edit_defaults {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- # get defaults for account numbers and last numbers
- AM->defaultaccounts(\%myconfig, \%$form);
- $form->{ALL_UNITS} = AM->convertible_units(AM->retrieve_all_units(), 'g');
-
- map { $form->{"defaults_${_}"} = $form->{defaults}->{$_} } keys %{ $form->{defaults} };
-
- # default language
- my $all_languages = SL::DB::Manager::Language->get_all;
-
-# cash = IST-Versteuerung, accrual = SOLL-Versteuerung
-
- foreach my $key (keys %{ $form->{IC} }) {
- foreach my $accno (sort keys %{ $form->{IC}->{$key} }) {
- my $array = "ACCNOS_" . uc($key);
- $form->{$array} ||= [];
-
- my $value = "${accno}--" . $form->{IC}->{$key}->{$accno}->{description};
- push @{ $form->{$array} }, {
- 'name' => $value,
- 'value' => $value,
- 'selected' => $form->{IC}->{$key}->{$accno}->{id} == $form->{defaults}->{$key},
- };
- }
- }
-
- $form->{title} = $locale->text('Ranges of numbers and default accounts');
-
- $form->header();
- print $form->parse_html_template('am/edit_defaults',
- { ALL_LANGUAGES => $all_languages, });
-
- $main::lxdebug->leave_sub();
-}
-
-sub save_defaults {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my $locale = $main::locale;
-
- AM->save_defaults();
-
- $form->redirect($locale->text('Defaults saved.'));
-
- $main::lxdebug->leave_sub();
-}
-
sub _build_cfg_options {
my $form = $main::form;
my %myconfig = %main::myconfig;
'Add custom variable' => 'Benutzerdefinierte Variable erfassen',
'Add link: select records to link with' => 'Verknüpfungen hinzufügen: zu verknüpfende Belege auswählen',
'Add links' => 'Verknüpfungen hinzufügen',
+ 'Add new currency' => 'Neue Währung hinzufügen',
'Add note' => 'Notiz erfassen',
'Add printer' => 'Drucker hinzufügen',
'Add unit' => 'Einheit hinzufügen',
'Company Name' => 'Firmenname',
'Company name' => 'Firmenname',
'Compare to' => 'Gegenüberstellen zu',
- 'Configuration' => 'Einstellungen',
'Configuration of individual TODO items' => 'Konfiguration für die einzelnen Aufgabenlistenpunkte',
'Configure' => 'Konfigurieren',
'Confirm' => 'Bestätigen',
'Currencies' => 'Währungen',
'Currency' => 'Währung',
'Currency (database ID)' => 'Währung (Datenbank-ID)',
+ 'Currency name' => 'Währungsname',
+ 'Currency names must be unique.' => 'Währungsnamen müssen eindeutig sein.',
+ 'Currency names must not be empty.' => 'Währungsnamen dürfen nicht leer sein.',
'Current / Next Level' => 'Aktuelles / Nächstes Mahnlevel',
'Current Earnings' => 'Gewinn',
'Current assets account' => 'Konto für Umlaufvermögen',
'Default template format' => 'Standardvorlagenformat',
'Default unit' => 'Standardeinheit',
'Default value' => 'Standardwert',
- 'Defaults saved.' => 'Die Standardeinstellungen wurden gespeichert.',
'Delete' => 'Löschen',
'Delete Account' => 'Konto löschen',
'Delete Contact' => 'Ansprechperson löschen',
'Edit templates' => 'Vorlagen bearbeiten',
'Edit the Delivery Order' => 'Lieferschein bearbeiten',
'Edit the configuration for periodic invoices' => 'Konfiguration für wiederkehrende Rechnungen bearbeiten',
+ 'Edit the currency names in order to rename them.' => 'Bearbeiten Sie den Namen, um eine Währung umzubennen.',
'Edit the purchase_order' => 'Bearbeiten des Lieferantenauftrags',
'Edit the request_quotation' => 'Bearbeiten der Preisanfrage',
'Edit the sales_order' => 'Bearbeiten des Auftrags',
'Hide by default' => 'Standardmäßig verstecken',
'Hide help text' => 'Hilfetext verbergen',
'Hide settings' => 'Einstellungen verbergen',
+ 'Hints' => 'Hinweise',
'History' => 'Historie',
'History Search' => 'Historien Suche',
'History Search Engine' => 'Historien Suchmaschine',
'RFQs' => 'Preisanfragen',
'ROP' => 'Mindestlagerbestand',
'Ranges of numbers' => 'Nummernkreise',
- 'Ranges of numbers and default accounts' => 'Nummernkreise und Standardkonten',
'Re-run analysis' => 'Analyse wiederholen',
'Receipt' => 'Zahlungseingang',
'Receipt posted!' => 'Beleg gebucht!',
module=controller.pl
action=ClientConfig/edit
-[System--Ranges of numbers and default accounts]
-module=am.pl
-action=edit_defaults
-
[System--UStVa Einstellungen]
module=ustva.pl
action=config_step1
+++ /dev/null
-[%- USE T8 %]
-[%- USE HTML %]
-
- <div class="listtop">[% title %]</div>
-
- <form method="post" action="am.pl"name="Form">
-
- <input type="hidden" name="type" value="defaults">
-
- <p>
- <table>
- <tr class="listheading">
- <th colspan="4">[% 'Ranges of numbers' | $T8 %]</th>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Last Invoice Number' | $T8 %]</th>
- <td><input name="invnumber" size="10" value="[% HTML.escape(defaults_invnumber) %]"></td>
- <th align="right" nowrap>[% 'Last Customer Number' | $T8 %]</th>
- <td><input name="customernumber" size="10" value="[% HTML.escape(defaults_customernumber) %]"></td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Last Credit Note Number' | $T8 %]</th>
- <td><input name="cnnumber" size="10" value="[% HTML.escape(defaults_cnnumber) %]"></td>
- <th align="right" nowrap>[% 'Last Vendor Number' | $T8 %]</th>
- <td><input name="vendornumber" size="10" value="[% HTML.escape(defaults_vendornumber) %]"></td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Last Sales Order Number' | $T8 %]</th>
- <td><input name="sonumber" size="10" value="[% HTML.escape(defaults_sonumber) %]"></td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Last Purchase Order Number' | $T8 %]</th>
- <td><input name="ponumber" size="10" value="[% HTML.escape(defaults_ponumber) %]"></td>
- <th align="right" nowrap>[% 'Last Article Number' | $T8 %]</th>
- <td><input name="articlenumber" size="10" value="[% HTML.escape(defaults_articlenumber) %]"></td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Last Sales Quotation Number' | $T8 %]</th>
- <td><input name="sqnumber" size="10" value="[% HTML.escape(defaults_sqnumber) %]"></td>
- <th align="right" nowrap>[% 'Last Service Number' | $T8 %]</th>
- <td><input name="servicenumber" size="10" value="[% HTML.escape(defaults_servicenumber) %]"></td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Last RFQ Number' | $T8 %]</th>
- <td><input name="rfqnumber" size="10" value="[% HTML.escape(defaults_rfqnumber) %]"></td>
- <th align="right" nowrap>[% 'Last Assembly Number' | $T8 %]</th>
- <td><input name="assemblynumber" size="10" value="[% HTML.escape(defaults_assemblynumber) %]"></td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Last Sales Delivery Order Number' | $T8 %]</th>
- <td><input name="sdonumber" size="10" value="[% HTML.escape(defaults_sdonumber) %]"></td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Last Purchase Delivery Order Number' | $T8 %]</th>
- <td><input name="pdonumber" size="10" value="[% HTML.escape(defaults_pdonumber) %]"></td>
- </tr>
-
- <tr class="listheading">
- <th colspan="4">[% 'Default Accounts' | $T8 %]</th>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Inventory Account' | $T8 %]</th>
- <td colspan="3">
- <select name="inventory_accno">
- [%- FOREACH row = ACCNOS_IC %]
- <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
- [%- END %]
- </select>
- </td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Revenue Account' | $T8 %]</th>
- <td colspan="3">
- <select name="income_accno">
- [%- FOREACH row = ACCNOS_IC_INCOME %]
- <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
- [%- END %]
- </select>
- </td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Expense Account' | $T8 %]</th>
- <td colspan="3">
- <select name="expense_accno">
- [%- FOREACH row = ACCNOS_IC_EXPENSE %]
- <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
- [%- END %]
- </select>
- </td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Foreign Exchange Gain' | $T8 %]</th>
- <td colspan="3">
- <select name="fxgain_accno">
- [%- FOREACH row = ACCNOS_FX_GAIN %]
- <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
- [%- END %]
- </select>
- </td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Foreign Exchange Loss' | $T8 %]</th>
- <td colspan="3">
- <select name="fxloss_accno">
- [%- FOREACH row = ACCNOS_FX_LOSS %]
- <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
- [%- END %]
- </select>
- </td>
- </tr>
- <tr>
- <th align="right" nowrap>[% 'Current assets account' | $T8 %]</th>
- <td colspan="3">
- <select name="ar_paid_accno">
- [%- FOREACH row = ACCNOS_AR_PAID %]
- <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
- [%- END %]
- </select>
- </td>
- </tr>
-
- <tr class="listheading">
- <th colspan="4">[% 'Miscellaneous' | $T8 %]</th>
- </tr>
-
- <tr>
- <th align="right">[% 'Business Number' | $T8 %]</th>
- <td colspan="3"><input name="businessnumber" size="25" value="[% HTML.escape(defaults_businessnumber) %]"></td>
- </tr>
-
- <tr>
- <th align="right">[% 'Default currency' | $T8 %]</th>
- <td colspan="3">[% HTML.escape(defaultcurrency) %]</td>
- </tr>
-
- <tr>
- <input type="hidden" name="rowcount" value="[% CURRENCIES.size %]">
- <th align="right">[% 'Currencies' | $T8 %]</th>
- <td colspan="3">[% FOREACH row = CURRENCIES %]<input name="curr_[% loop.count %]" size="3" value="[% HTML.escape(row.curr) %]">
- <input type=hidden name="old_curr_[% loop.count %]" value="[% HTML.escape(row.curr) %]">
- [% END %]
- <input name="new_curr" size="3" value="">
- </td>
- </tr>
-
- <tr>
- <th align="right">[% 'Weight unit' | $T8 %]</th>
- <!-- <td colspan="3"><input name="weightunit" size="20" maxlength="5" value="[% HTML.escape(defaults_weightunit) %]"></td> -->
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'weightunit',
- default = defaults_weightunit,
- style = 'size:20; maxength:5',
- DATA = ALL_UNITS,
- id_key = 'name',
- label_key = 'name',
- -%]
- </td>
- </tr>
-
- <tr>
- <th align="right">[% 'Default Customer/Vendor Language' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'language_id',
- default = defaults_language_id,
- style = 'size:20; maxength:5',
- DATA = ALL_LANGUAGES,
- id_key = 'id',
- label_key = 'description',
- show_empty = 1
- -%]
- </td>
- </tr>
-
- <tr class="listheading">
- <th colspan="4">[% 'Configuration' | $T8 %]</th>
- </tr>
-
- <tr>
- <th align="right">[% 'Accounting method' | $T8 %] </th>
- <td colspan="3"><input name="accounting_method" size="20" readonly="readonly" value="[% HTML.escape(defaults_accounting_method) | $T8 %]"></td>
- </tr>
-
- <tr>
- <th align="right">[% 'Inventory system' | $T8 %] </th>
- <td colspan="3"><input name="inventory_system" size="20" readonly="readonly" value="[% HTML.escape(defaults_inventory_system) | $T8 %]"></td>
- </tr>
-
- <tr>
- <th align="right">[% 'Profit determination' | $T8 %] </th>
- <td colspan="3"><input name="profit_determination" size="20" readonly="readonly" value="[% HTML.escape(defaults_profit_determination) | $T8 %]"></td>
- </tr>
-
- <tr>
- <th align="right">[% 'Chart of accounts' | $T8 %] </th>
- <td colspan="3"><input name="coa" size="20" readonly="readonly" value="[% HTML.escape(defaults_coa) | $T8 %]"></td>
- </tr>
-
-
- </table>
- </p>
-
- <hr height="3" noshade>
-
- <p><input type="submit" class="submit" name="action" value="[% 'Save' | $T8 %]"></p>
-
- <hr height="3" noshade>
-
- </p>
- </form>
--- /dev/null
+[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]
+[% SET style="width: 600px" %]
+<div id="default_accounts">
+ <div class='listheading'>[% LxERP.t8('Default Accounts') %]</div>
+
+ <table>
+ <tr>
+ <td align="right">[% LxERP.t8("Inventory Account") %]</td>
+ <td>[% L.select_tag('defaults.inventory_accno_id', SELF.accounts.ic, default=SELF.defaults.inventory_accno_id, title_sub=\make_chart_title, style=style) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% LxERP.t8("Revenue Account") %]</td>
+ <td>[% L.select_tag('defaults.income_accno_id', SELF.accounts.ic_income, default=SELF.defaults.income_accno_id, title_sub=\make_chart_title, style=style) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% LxERP.t8("Expense Account") %]</td>
+ <td>[% L.select_tag('defaults.expense_accno_id', SELF.accounts.ic_expense, default=SELF.defaults.expense_accno_id, title_sub=\make_chart_title, style=style) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% LxERP.t8("Foreign Exchange Gain") %]</td>
+ <td>[% L.select_tag('defaults.fxgain_accno_id', SELF.accounts.fx_gain, default=SELF.defaults.fxgain_accno_id, title_sub=\make_chart_title, style=style) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% LxERP.t8("Foreign Exchange Loss") %]</td>
+ <td>[% L.select_tag('defaults.fxloss_accno_id', SELF.accounts.fx_loss, default=SELF.defaults.fxloss_accno_id, title_sub=\make_chart_title, style=style) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% LxERP.t8("Current assets account") %]</td>
+ <td>[% L.select_tag('defaults.ar_paid_accno_id', SELF.accounts.ar_paid, default=SELF.defaults.ar_paid_accno_id, title_sub=\make_chart_title, style=style) %]</td>
+ </tr>
+ </table>
+</div>
-[%- USE LxERP -%][%- USE L -%]
+[%- USE LxERP -%][%- USE L -%][%- USE HTML -%]
+[% SET style="width: 200px" %]
<div id="miscellaneous">
- <div class='listheading'>[% LxERP.t8('Weight') %]</div>
+ <div class="listheading">[% LxERP.t8("Miscellaneous") %]</div>
<table>
<tr>
- <td align="right">[% LxERP.t8('Show weights') %]</td>
- <td>
- [% L.yes_no_tag('defaults.show_weight', SELF.defaults.show_weight) %]
+ <td align="right">[% LxERP.t8("Business Number") %]</td>
+ <td>[% L.input_tag('defaults.businessnumber', SELF.defaults.businessnumber, style=style) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% LxERP.t8('Default Customer/Vendor Language') %]</td>
+ <td>[% L.select_tag('defaults.language_id', SELF.all_languages, title_key='description', default=SELF.defaults.language_id, with_empty=1, style=style) %]</td>
+ </tr>
+ </table>
+
+ <div class="listheading">[% LxERP.t8("Currencies") %]</div>
+
+ <table>
+ <tr>
+ <th></th>
+ <th>[% LxERP.t8("Default currency") %]</th>
+ <th>[% LxERP.t8("Currency name") %]</th>
+ <th>[% LxERP.t8("Hints") %]</th>
+ </tr>
+
+[% FOREACH currency = SELF.all_currencies %]
+ <tr>
+ <td align="right">[% IF loop.count == 1 %][% LxERP.t8("Currencies") %][% END %]</td>
+ <td align="center">
+ [% L.hidden_tag("currencies[+].id", currency.id) %]
+ [% L.radio_button_tag('defaults.currency_id', value=currency.id, id='defaults.currency_id_' _ currency.id, checked=(SELF.defaults.currency_id == currency.id)) %]
</td>
<td>
- [% LxERP.t8('Show the weights of articles and the total weight in orders, invoices and delivery notes?') %]<br>
+ [% L.input_tag("currencies[].name", currency.name, style=style) %]
</td>
+ <td>[% IF loop.count == 1 %][% LxERP.t8("Edit the currency names in order to rename them.") %][%- END %]</td>
+ </tr>
+[% END %]
+
+ <tr>
+ <td align="right">[% LxERP.t8("Add new currency") %]</td>
+ <td align="center">[% L.radio_button_tag('defaults.currency_id', value=-1, id='defaults.currency_id__1', checked=(SELF.defaults.currency_id == -1)) %]</td>
+ <td>[% L.input_tag("new_currency", FORM.new_currency, style=style) %]</td>
+ </tr>
+ </table>
+
+ <div class="listheading">[% LxERP.t8("Weight") %]</div>
+
+ <table>
+ <tr>
+ <td align="right">[% LxERP.t8("Weight unit") %]</td>
+ <td>[% L.select_tag('defaults.weightunit', SELF.all_weightunits, default=SELF.defaults.weightunit, value_key='name', title_key='name', style=style) %]</td>
+ </tr>
+
+ <tr>
+ <td align="right">[% LxERP.t8('Show weights') %]</td>
+ <td>[% L.yes_no_tag('defaults.show_weight', SELF.defaults.show_weight, style=style) %]</td>
+ <td>[% LxERP.t8('Show the weights of articles and the total weight in orders, invoices and delivery notes?') %]</td>
</tr>
</table>
</div>
--- /dev/null
+[%- USE LxERP -%][%- USE L -%][%- USE HTML -%]
+<div id="ranges_of_numbers">
+ <div class='listheading'>[% LxERP.t8('Ranges of numbers') %]</div>
+
+ <table>
+ <tr>
+ <td align="right" nowrap>[% LxERP.t8('Last Invoice Number') %]</td>
+ <td>[% L.input_tag("defaults.invnumber", SELF.defaults.invnumber, size="15") %]</td>
+ <td align="right" nowrap>[% LxERP.t8('Last Customer Number') %]</td>
+ <td>[% L.input_tag("defaults.customernumber", SELF.defaults.customernumber, size="15") %]</td>
+ </tr>
+
+ <tr>
+ <td align="right" nowrap>[% LxERP.t8('Last Credit Note Number') %]</td>
+ <td>[% L.input_tag("defaults.cnnumber", SELF.defaults.cnnumber, size="15") %]</td>
+ <td align="right" nowrap>[% LxERP.t8('Last Vendor Number') %]</td>
+ <td>[% L.input_tag("defaults.vendornumber", SELF.defaults.vendornumber, size="15") %]</td>
+ </tr>
+
+ <tr>
+ <td align="right" nowrap>[% LxERP.t8('Last Sales Order Number') %]</td>
+ <td>[% L.input_tag("defaults.sonumber", SELF.defaults.sonumber, size="15") %]</td>
+ </tr>
+
+ <tr>
+ <td align="right" nowrap>[% LxERP.t8('Last Purchase Order Number') %]</td>
+ <td>[% L.input_tag("defaults.ponumber", SELF.defaults.ponumber, size="15") %]</td>
+ <td align="right" nowrap>[% LxERP.t8('Last Article Number') %]</td>
+ <td>[% L.input_tag("defaults.articlenumber", SELF.defaults.articlenumber, size="15") %]</td>
+ </tr>
+
+ <tr>
+ <td align="right" nowrap>[% LxERP.t8('Last Sales Quotation Number') %]</td>
+ <td>[% L.input_tag("defaults.sqnumber", SELF.defaults.sqnumber, size="15") %]</td>
+ <td align="right" nowrap>[% LxERP.t8('Last Service Number') %]</td>
+ <td>[% L.input_tag("defaults.servicenumber", SELF.defaults.servicenumber, size="15") %]</td>
+ </tr>
+
+ <tr>
+ <td align="right" nowrap>[% LxERP.t8('Last RFQ Number') %]</td>
+ <td>[% L.input_tag("defaults.rfqnumber", SELF.defaults.rfqnumber, size="15") %]</td>
+ <td align="right" nowrap>[% LxERP.t8('Last Assembly Number') %]</td>
+ <td>[% L.input_tag("defaults.assemblynumber", SELF.defaults.assemblynumber, size="15") %]</td>
+ </tr>
+
+ <tr>
+ <td align="right" nowrap>[% LxERP.t8('Last Sales Delivery Order Number') %]</td>
+ <td>[% L.input_tag("defaults.sdonumber", SELF.defaults.sdonumber, size="15") %]</td>
+ </tr>
+
+ <tr>
+ <td align="right" nowrap>[% LxERP.t8('Last Purchase Delivery Order Number') %]</td>
+ <td>[% L.input_tag("defaults.pdonumber", SELF.defaults.pdonumber, size="15") %]</td>
+ </tr>
+ </table>
+</div>
-[%- USE T8 %][%- USE L %][% USE LxERP %][% USE HTML %]
-[%- USE JavaScript -%]
+[%- USE L %][% USE LxERP %][% USE HTML %][%- USE JavaScript -%]
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/parts_language_selection.js"></script>
<script type="text/javascript">
<form action='controller.pl' method='POST'>
<div class="tabwidget">
<ul>
- <li><a href="#posting_configuration">[% 'Posting Configuration' | $T8 %]</a></li>
- <li><a href="#datev_check_configuration">[% 'DATEV check configuration' | $T8 %]</a></li>
- <li><a href="#orders_deleteable">[% 'Orders / Delivery Orders deleteable' | $T8 %]</a></li>
- <li><a href="#warehouse">[% 'Warehouse' | $T8 %]</a></li>
- <li><a href="#miscellaneous">[% 'Miscellaneous' | $T8 %]</a></li>
+ <li><a href="#miscellaneous">[% LxERP.t8('Miscellaneous') %]</a></li>
+ <li><a href="#ranges_of_numbers">[% LxERP.t8('Ranges of numbers') %]</a></li>
+ <li><a href="#default_accounts">[% LxERP.t8('Default Accounts') %]</a></li>
+ <li><a href="#posting_configuration">[% LxERP.t8('Posting Configuration') %]</a></li>
+ <li><a href="#datev_check_configuration">[% LxERP.t8('DATEV check configuration') %]</a></li>
+ <li><a href="#orders_deleteable">[% LxERP.t8('Orders / Delivery Orders deleteable') %]</a></li>
+ <li><a href="#warehouse">[% LxERP.t8('Warehouse') %]</a></li>
</ul>
+[% PROCESS 'client_config/_ranges_of_numbers.html' %]
+[% PROCESS 'client_config/_default_accounts.html' %]
[% PROCESS 'client_config/_posting_configuration.html' %]
[% PROCESS 'client_config/_datev_check_configuration.html' %]
[% PROCESS 'client_config/_orders_deleteable.html' %]