X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fam.pl;h=5a3b742230f7ee65a2a1191ef0a97f66d04bef18;hb=ee56f1b20ab915671ded297f593c0e2e245bad70;hp=c28656795682d5ac501c385dbf4e8fd8b46d66ca;hpb=44e1ec6fcc2422cb75d36578245e16a33acef2d8;p=kivitendo-erp.git
diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl
index c28656795..5a3b74223 100644
--- a/bin/mozilla/am.pl
+++ b/bin/mozilla/am.pl
@@ -24,57 +24,83 @@
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1335, USA.
#======================================================================
#
# administration
#
#======================================================================
+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 CGI::Ajax;
+use SL::TODO;
+use SL::DB::Printer;
+use SL::DB::Tax;
+use SL::DB::Language;
+use SL::DB::Default;
+use SL::DBUtils qw(selectall_array_query conv_dateq);
use CGI;
-use Data::Dumper;
+require "bin/mozilla/common.pl";
-1;
+use strict;
-require "bin/mozilla/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&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;
+ my $defaults = SL::DB::Default->get;
+
+ $main::auth->assert('config');
$form->{title} = "Edit";
+ $form->{feature_balance} = $defaults->feature_balance;
+ $form->{feature_datev} = $defaults->feature_datev;
+ $form->{feature_erfolgsrechnung} = $defaults->feature_erfolgsrechnung;
+ $form->{feature_eurechnung} = $defaults->feature_eurechnung;
+ $form->{feature_ustva} = $defaults->feature_ustva;
+
AM->get_account(\%myconfig, \%$form);
foreach my $item (split(/:/, $form->{link})) {
@@ -84,16 +110,22 @@ 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");
$form->{"$form->{charttype}_checked"} = "checked";
@@ -102,9 +134,9 @@ sub account_header {
$form->{select_tax} = "";
my @tax_report_pos = USTVA->report_variables({
- myconfig => \%myconfig,
- form => $form,
- type => '',
+ myconfig => \%myconfig,
+ form => $form,
+ type => '',
attribute => 'position',
calc => '',
});
@@ -115,7 +147,7 @@ sub account_header {
}
# Fill in empty row for new Taxkey
- $newtaxkey_ref = {
+ my $newtaxkey_ref = {
id => '',
chart_id => '',
accno => '',
@@ -124,7 +156,7 @@ sub account_header {
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;
@@ -140,27 +172,27 @@ sub account_header {
if ($item->{id} == $taxkey_used->{tax_id}) {
$form->{ACCOUNT_TAXKEYS}[$i]{selecttaxkey} .=
qq||;
}
- foreach $item (@{ $form->{NEWACCOUNT} }) {
+ foreach my $item (@{ $form->{NEWACCOUNT} }) {
if ($item->{id} == $form->{new_chart_id}) {
$form->{selectnewaccount} .=
qq||;
@@ -191,30 +223,31 @@ sub account_header {
}
}
- $select_eur = q|\n|;
- %eur = (1 => "Umsatzerlöse",
- 2 => "sonstige Erlöse",
+ my $select_eur = q|\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",
@@ -223,8 +256,8 @@ sub account_header {
29 => "Zinsaufwand",
30 => "Ausserordentlicher Aufwand",
31 => "Betriebliche Steuern");
- foreach $item (sort({ $a <=> $b } keys(%eur))) {
- my $text = H(SL::Iconv::convert("ISO-8859-15", $dbcharset, $eur{$item}));
+ foreach my $item (sort({ $a <=> $b } keys(%eur))) {
+ my $text = H($::locale->{iconv_utf8}->convert($eur{$item}));
if ($item == $form->{pos_eur}) {
$select_eur .= qq|\n|;
} else {
@@ -233,32 +266,47 @@ sub account_header {
}
- $select_bwa = q|\n|;
+ my $select_er = q|\n|;
+ my %er = (
+ 1 => "Ertrag",
+ 6 => "Aufwand");
+ foreach my $item (sort({ $a <=> $b } keys(%er))) {
+ my $text = H($::locale->{iconv_utf8}->convert($er{$item}));
+ if ($item == $form->{pos_er}) {
+ $select_er .= qq|\n|;
+ } else {
+ $select_er .= qq|\n|;
+ }
+
+ }
+
+ my $select_bwa = q|\n|;
- %bwapos = (1 => 'Umsatzerlöse',
+ my %bwapos = (
+ 1 => 'Umsatzerlöse',
2 => 'Best.Verdg.FE/UE',
3 => 'Aktiv.Eigenleistung',
4 => 'Mat./Wareneinkauf',
- 5 => 'So.betr.Erlöse',
+ 5 => 'So.betr.Erlöse',
10 => 'Personalkosten',
11 => 'Raumkosten',
12 => 'Betriebl.Steuern',
- 13 => 'Vers./Beiträge',
+ 13 => 'Vers./Beiträge',
14 => 'Kfz.Kosten o.St.',
15 => 'Werbe-Reisek.',
16 => 'Kosten Warenabgabe',
17 => 'Abschreibungen',
18 => 'Rep./instandhlt.',
- 19 => 'Übrige Steuern',
+ 19 => 'Ãbrige Steuern',
20 => 'Sonst.Kosten',
30 => 'Zinsauwand',
31 => 'Sonst.neutr.Aufw.',
- 32 => 'Zinserträge',
+ 32 => 'Zinserträge',
33 => 'Sonst.neutr.Ertrag',
34 => 'Verr.kalk.Kosten',
35 => 'Steuern Eink.u.Ertr.');
- foreach $item (sort({ $a <=> $b } keys %bwapos)) {
- my $text = H(SL::Iconv::convert("ISO-8859-15", $dbcharset, $bwapos{$item}));
+ foreach my $item (sort({ $a <=> $b } keys %bwapos)) {
+ my $text = H($::locale->{iconv_utf8}->convert($bwapos{$item}));
if ($item == $form->{pos_bwa}) {
$select_bwa .= qq|\n|;
- foreach $item ((1, 2, 3, 4)) {
+# Wieder hinzugefügt zu evaluationszwecken (us) 09.03.2007
+ my $select_bilanz = q|\n|;
+ foreach my $item ((1, 2, 3, 4)) {
if ($item == $form->{pos_bilanz}) {
$select_bilanz .= qq|\n|;
- %category = (
+ my $select_category = q|\n|;
+
+ my %category = (
'A' => $locale->text('Asset'),
'L' => $locale->text('Liability'),
'Q' => $locale->text('Equity'),
- 'I' => $locale->text('Revenue'),
+ 'I' => $locale->text('Revenue'),
'E' => $locale->text('Expense'),
'C' => $locale->text('Costs'),
);
- foreach $item ( sort({ $a <=> $b } keys %category) ) {
+ foreach my $item ( sort({ $a <=> $b } keys %category) ) {
if ($item eq $form->{category}) {
$select_category .= qq|