X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fam.pl;h=997fd2c284006041dfa1049e787ee6d553dc0556;hb=e36cc2a647f25b9b8f1b9b8965f9fdef09a5cd8b;hp=b01f5f6bf6621a3fc5b2d0f87fa8117a84c1335c;hpb=a0f6a00c1db8152633841777a95f5420b56b42ee;p=kivitendo-erp.git
diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl
index b01f5f6bf..997fd2c28 100644
--- a/bin/mozilla/am.pl
+++ b/bin/mozilla/am.pl
@@ -31,44 +31,62 @@
#
#======================================================================
+use utf8;
+
+use SL::Auth;
+use SL::Auth::PasswordPolicy;
use SL::AM;
use SL::CA;
use SL::Form;
use SL::User;
+use SL::USTVA;
+use SL::Iconv;
+use SL::TODO;
+use SL::Printer;
+use CGI;
-use Data::Dumper;
+require "bin/mozilla/common.pl";
-1;
+use strict;
-require "$form->{path}/common.pl";
+1;
# end of main
-sub add { call_sub("add_$form->{type}"); }
-sub delete { call_sub("delete_$form->{type}"); }
-sub save { call_sub("save_$form->{type}"); }
-sub edit { call_sub("edit_$form->{type}"); }
-sub continue { call_sub($form->{"nextsub"}); }
+sub add { call_sub("add_$main::form->{type}"); }
+sub delete { call_sub("delete_$main::form->{type}"); }
+sub save { call_sub("save_$main::form->{type}"); }
+sub edit { call_sub("edit_$main::form->{type}"); }
+sub continue { call_sub($main::form->{"nextsub"}); }
+sub save_as_new { call_sub("save_as_new_$main::form->{type}"); }
sub add_account {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('config');
$form->{title} = "Add";
$form->{charttype} = "A";
AM->get_account(\%myconfig, \%$form);
- $form->{callback} =
- "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
- unless $form->{callback};
+ $form->{callback} = "am.pl?action=list_account" unless $form->{callback};
&account_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_account {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('config');
$form->{title} = "Edit";
AM->get_account(\%myconfig, \%$form);
@@ -80,163 +98,144 @@ sub edit_account {
&account_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub account_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
+
+ if ( $form->{action} eq 'edit_account') {
+ $form->{account_exists} = '1';
+ }
$form->{title} = $locale->text("$form->{title} Account");
- $checked{ $form->{charttype} } = "checked";
- $checked{"$form->{category}_"} = "checked";
- $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
+ $form->{"$form->{charttype}_checked"} = "checked";
+ $form->{"$form->{category}_checked"} = "checked";
- $form->{description} =~ s/\"/"/g;
+ $form->{select_tax} = "";
+
+ my @tax_report_pos = USTVA->report_variables({
+ myconfig => \%myconfig,
+ form => $form,
+ type => '',
+ attribute => 'position',
+ calc => '',
+ });
if (@{ $form->{TAXKEY} }) {
foreach my $item (@{ $form->{TAXKEY} }) {
-
$item->{rate} = $item->{rate} * 100 . '%';
+ }
+
+ # Fill in empty row for new Taxkey
+ my $newtaxkey_ref = {
+ id => '',
+ chart_id => '',
+ accno => '',
+ tax_id => '',
+ taxdescription => '',
+ rate => '',
+ taxkey_id => '',
+ pos_ustva => '',
+ startdate => '',
+ };
+
+ push @{ $form->{ACCOUNT_TAXKEYS} }, $newtaxkey_ref;
+
+ my $i = 0;
+ foreach my $taxkey_used (@{ $form->{ACCOUNT_TAXKEYS} } ) {
+
+ # Fill in a runningnumber
+ $form->{ACCOUNT_TAXKEYS}[$i]{runningnumber} = $i;
+
+ # Fill in the Taxkeys as select options
+ foreach my $item (@{ $form->{TAXKEY} }) {
+ if ($item->{id} == $taxkey_used->{tax_id}) {
+ $form->{ACCOUNT_TAXKEYS}[$i]{selecttaxkey} .=
+ qq|";
+ $form->{selectnewaccount} = qq||;
}
- foreach $item (@{ $form->{NEWACCOUNT} }) {
+ foreach my $item (@{ $form->{NEWACCOUNT} }) {
if ($item->{id} == $form->{new_chart_id}) {
$form->{selectnewaccount} .=
- "";
+ qq||;
} elsif (!$form->{new_chart_valid}) {
$form->{selectnewaccount} .=
- "";
+ qq||;
}
}
}
- $newaccount = qq|
-
-
-
- |
-
|;
-
- $form->{selectustva} = "\n|;
+ my %eur = (
+ 1 => "Umsatzerlöse",
+ 2 => "sonstige Erlöse",
3 => "Privatanteile",
- 4 => "Zinserträge",
- 5 => "Ausserordentliche Erträge",
+ 4 => "Zinserträge",
+ 5 => "Ausserordentliche Erträge",
6 => "Vereinnahmte Umsatzst.",
7 => "Umsatzsteuererstattungen",
- 8 => "Wareneingänge",
- 9 => "Löhne und Gehälter",
+ 8 => "Wareneingänge",
+ 9 => "Löhne und Gehälter",
10 => "Gesetzl. sozialer Aufw.",
11 => "Mieten",
12 => "Gas, Strom, Wasser",
13 => "Instandhaltung",
- 14 => "Steuern, Versich., Beiträge",
+ 14 => "Steuern, Versich., Beiträge",
15 => "Kfz-Steuern",
16 => "Kfz-Versicherungen",
- 17 => "Sonst. Fahrtkosten",
+ 17 => "Sonst. Fahrzeugkosten",
18 => "Werbe- und Reisekosten",
19 => "Instandhaltung u. Werkzeuge",
- 20 => "Fachzeitschriften, Bücher",
- 21 => "Miete für Einrichtungen",
+ 20 => "Fachzeitschriften, Bücher",
+ 21 => "Miete für Einrichtungen",
22 => "Rechts- und Beratungskosten",
- 23 => "Bürobedarf, Porto, Telefon",
+ 23 => "Bürobedarf, Porto, Telefon",
24 => "Sonstige Aufwendungen",
25 => "Abschreibungen auf Anlagever.",
26 => "Abschreibungen auf GWG",
@@ -245,249 +244,148 @@ sub account_header {
29 => "Zinsaufwand",
30 => "Ausserordentlicher Aufwand",
31 => "Betriebliche Steuern");
- foreach $item (sort({ $a <=> $b } keys(%eur))) {
+ foreach my $item (sort({ $a <=> $b } keys(%eur))) {
+ my $text = H($::locale->{iconv_utf8}->convert($eur{$item}));
if ($item == $form->{pos_eur}) {
- $form->{selecteur} .= "\n|;
} else {
- $form->{selecteur} .= "\n|;
}
}
- $eur = qq|
-
- | . $locale->text('EUER') . qq| |
- |
-
-
|;
+ my $select_bwa = q|\n|;
- $form->{selectbwa} = "\n|;
+ foreach my $item ((1, 2, 3, 4)) {
+ if ($item == $form->{pos_bilanz}) {
+ $select_bilanz .= qq|\n|;
+
+ my %category = (
+ 'A' => $locale->text('Asset'),
+ 'L' => $locale->text('Liability'),
+ 'Q' => $locale->text('Equity'),
+ 'I' => $locale->text('Revenue'),
+ 'E' => $locale->text('Expense'),
+ 'C' => $locale->text('Costs'),
+ );
+ foreach my $item ( sort({ $a <=> $b } keys %category) ) {
+ if ($item eq $form->{category}) {
+ $select_category .= qq|