rate => '',
taxkey_id => '',
pos_ustva => '',
- startdate => '',
+ startdate => $form->{account_exists} ? '' : DateTime->new(year => 1970, month => 1, day => 1)->to_lxoffice,
};
push @{ $form->{ACCOUNT_TAXKEYS} }, $newtaxkey_ref;
# account where AR_tax or AP_tax is set are not orphaned if they are used as
# tax-o-matic account
- if ( $form->{id} && !$form->{orphaned} && ($form->{link} =~ m/(AP_tax|AR_tax)/) ) {
+ if ( $form->{id} && $form->{orphaned} && ($form->{link} =~ m/(AP_tax|AR_tax)/) ) {
if (SL::DB::Manager::Tax->find_by(chart_id => $form->{id})) {
$form->{orphaned} = 0;
}
if ($form->{charttype} eq 'A'){
$form->isblank("category", $locale->text('Account Type missing!'));
+
+ my $found_valid_taxkey = 0;
+ foreach my $i (0 .. 10) { # 10 is maximum count of taxkeys in form
+ if ($form->{"taxkey_startdate_$i"} and !$form->{"taxkey_del_$i"}) {
+ $found_valid_taxkey = 1;
+ last;
+ }
+ }
+ if ($found_valid_taxkey == 0) {
+ $form->error($locale->text('A valid taxkey is missing!'));
+ }
}
$form->redirect($locale->text('Account saved!'))
}
$form->{id} = 0;
- if ($form->{"original_accno"} &&
- ($form->{"accno"} eq $form->{"original_accno"})) {
- $form->error($locale->text('Account Number already used!'));
- }
$form->redirect($locale->text('Account saved!'))
if (AM->save_account(\%myconfig, \%$form));
$form->error($locale->text('Cannot save account!'));
$ca->{link_edit_account} = $link_edit_account . '&id=' . E($ca->{id});
}
- $form->use_stylesheet("list_accounts.css");
+ $::request->{layout}->use_stylesheet("list_accounts.css");
$form->{title} = $locale->text('Chart of Accounts');
$form->header;
print $::form->parse_html_template('am/language_header', {
numberformats => [ '1,000.00', '1000.00', '1.000,00', '1000,00' ],
- dateformats => [ qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd) ],
+ dateformats => [ qw(mm/dd/yy dd/mm/yy dd.mm.yy yyyy-mm-dd) ],
});
$::lxdebug->leave_sub;
# default language
my $all_languages = SL::DB::Manager::Language->get_all;
-# EÜR = cash, Bilanzierung = accrual
+# cash = IST-Versteuerung, accrual = SOLL-Versteuerung
foreach my $key (keys %{ $form->{IC} }) {
foreach my $accno (sort keys %{ $form->{IC}->{$key} }) {
my %myconfig = %main::myconfig;
my $locale = $main::locale;
- _build_cfg_options('dateformat', qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd));
+ _build_cfg_options('dateformat', qw(mm/dd/yy dd/mm/yy dd.mm.yy yyyy-mm-dd));
_build_cfg_options('numberformat', ('1,000.00', '1000.00', '1.000,00', '1000,00'));
my @formats = ();
}
$form->{STYLESHEETS} = [];
- foreach my $item (qw(lx-office-erp.css Win2000.css Mobile.css kivitendo.css)) {
+ foreach my $item (qw(lx-office-erp.css Mobile.css kivitendo.css)) {
push @{ $form->{STYLESHEETS} }, {
'name' => $item,
'value' => $item,
$form->header();
+ #set readonly if the there are entries in acc_trans with the tax
+ my $readonly = $form->{tax_already_used} ? 'readonly' : '';
+
my $parameters_ref = {
+ readonly => $readonly,
};
# Ausgabe des Templates
$main::auth->assert('config');
- $form->isblank("rate", $locale->text('Taxrate missing!'));
- $form->isblank("taxdescription", $locale->text('Taxdescription missing!'));
- $form->isblank("taxkey", $locale->text('Taxkey missing!'));
+ $form->error($locale->text('Taxkey missing!')) unless length($form->{taxkey}) != 0;
+ $form->error($locale->text('Taxdescription missing!')) unless length($form->{taxdescription}) != 0;
+ $form->error($locale->text('Taxrate missing!')) unless length($form->{rate}) != 0;
$form->{rate} = $form->parse_amount(\%myconfig, $form->{rate});
+ if ($form->{taxkey} == 0 and $form->{rate} > 0) {
+ $form->error($locale->text('Taxkey 0 is reserved for rate 0'));
+ }
+
if ( $form->{rate} < 0 || $form->{rate} >= 100 ) {
$form->error($locale->text('Tax Percent is a number between 0 and 100'));
}
$form->{title} = $locale->text('Add Price Factor');
$form->{callback} ||= build_std_url('action=add_price_factor');
- $form->{fokus} = 'description';
+ $::request->{layout}->focus('#description');
$form->header();
print $form->parse_html_template('am/edit_price_factor');
$form->{title} = $locale->text('Edit Price Factor');
$form->{callback} ||= build_std_url('action=add_price_factor');
- $form->{fokus} = 'description';
+ $::request->{layout}->focus('#description');
AM->get_price_factor(\%myconfig, $form);
$form->{title} = $locale->text('Add Warehouse');
$form->{callback} ||= build_std_url('action=add_warehouse');
- $form->{fokus} = 'description';
+ $::request->{layout}->focus('#description');
$form->header();
print $form->parse_html_template('am/edit_warehouse');
$form->{title} = $locale->text('Edit Warehouse');
$form->{callback} ||= build_std_url('action=list_warehouses');
- $form->{fokus} = 'description';
+ $::request->{layout}->focus('#description');
$form->header();
print $form->parse_html_template('am/edit_warehouse');