X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fustva.pl;h=cfd78bf7c208154636186eb3675fbc7087fb69e5;hb=19db5b9099df8a70daac82388e45c0aee17c9266;hp=1f69c0ab51932f8e6f7bb26ac64f0ed26bd532b8;hpb=9fb8eec834ac3be77f5995053694b32ec140c877;p=kivitendo-erp.git
diff --git a/bin/mozilla/ustva.pl b/bin/mozilla/ustva.pl
index 1f69c0ab5..cfd78bf7c 100644
--- a/bin/mozilla/ustva.pl
+++ b/bin/mozilla/ustva.pl
@@ -1,4 +1,3 @@
-#!/bin/perl
#=====================================================================
# Lx-Office ERP
# Copyright (c) 2004 by Udo Spallek, Aachen
@@ -34,6 +33,8 @@ require "bin/mozilla/common.pl";
#our ($myconfig);
#use CGI::Carp "fatalsToBrowser";
+use List::Util qw(first);
+
use SL::PE;
use SL::RP;
use SL::USTVA;
@@ -88,7 +89,8 @@ sub report {
$form->header;
# Einlesen der Finanzamtdaten
- USTVA->get_config($userspath, 'finanzamt.ini');
+ my $ustva = USTVA->new();
+ $ustva->get_config($userspath, 'finanzamt.ini');
# Hier Einlesen der user-config
# steuernummer entfernt für prerelease
@@ -142,11 +144,7 @@ sub report {
$form->{co_fax} = $form->{fax} unless $form->{co_fax};
$form->{co_url} = $form->{urlx} unless $form->{co_url};
- my $taxnumber_given = ($form->{steuernummer} ne '')
- ? qq|$form->{steuernummer}|
- : qq|Keine Steuernummer hinterlegt!|
- . qq|
|;
+ my $taxnumber_given = ($form->{steuernummer} ne '') ? $form->{steuernummer} : qq|Keine Steuernummer hinterlegt!
|;
my $ustva_vorauswahl = &ustva_vorauswahl();
@@ -190,7 +188,7 @@ sub report {
# Which COA is in use?
- USTVA->get_coa($form, $myconfig);
+ $ustva->get_coa($form, $myconfig);
my $template_ref = {
openings => $openings,
@@ -537,7 +535,8 @@ sub generate_ustva {
# Aufruf von get_config zum Einlesen der Finanzamtdaten aus finanzamt.ini
- USTVA->get_config($userspath, 'finanzamt.ini');
+ my $ustva = USTVA->new();
+ $ustva->get_config($userspath, 'finanzamt.ini');
# init some form vars
my @anmeldungszeitraum =
@@ -678,7 +677,7 @@ sub generate_ustva {
# Get the USTVA
- USTVA->ustva(\%myconfig, \%$form);
+ $ustva->ustva(\%myconfig, \%$form);
# reformat Dates to dateformat
$form->{fromdate} = $locale->date(\%myconfig, $form->{fromdate}, 0, 0, 0);
@@ -760,7 +759,7 @@ sub generate_ustva {
# Outputformat specific customisation's
#
- my @category_cent = USTVA->report_variables({
+ my @category_cent = $ustva->report_variables({
myconfig => \%myconfig,
form => $form,
type => '',
@@ -770,7 +769,7 @@ sub generate_ustva {
push @category_cent, qw(83 Z43 Z45 Z53 Z62 Z65 Z67);
- my @category_euro = USTVA->report_variables({
+ my @category_euro = $ustva->report_variables({
myconfig => \%myconfig,
form => $form,
type => '',
@@ -919,27 +918,8 @@ sub generate_ustva {
exit(0);
}
- my %lands = ( # Lx => taxbird # TODO: besser als array...
- 'Baden Würtemberg' => '0',
- 'Bayern' => '1',
- 'Berlin' => '2',
- 'Brandenburg' => '3',
- 'Bremen' => '4',
- 'Hamburg' => '5',
- 'Hessen' => '6',
- 'Mecklenburg Vorpommern' => '7',
- 'Niedersachsen' => '8',
- 'Nordrhein Westfalen' => '9',
- 'Rheinland Pfalz' => '10',
- 'Saarland' => '11',
- 'Sachsen' => '12',
- 'Sachsen Anhalt' => '13',
- 'Schleswig Holstein' => '14',
- 'Thüringen' => '15',
- );
- foreach my $land ( keys %lands ){
- $form->{taxbird_land_nr} = $lands{$land} if ($form->{elsterland} eq $land );
- }
+ my $tax_office = first { $_->{name} eq $form->{elsterland} } @{ $ustva->{tax_office_information} };
+ $form->{taxbird_land_nr} = $tax_office->{taxbird_nr} if $tax_office;
$form->{co_zip} = $form->{co_city};
$form->{co_zip} =~ s/\D//g;
@@ -1015,7 +995,7 @@ sub generate_ustva {
} else # Outputformat for generic output
{
- my @category_cent = USTVA->report_variables({
+ my @category_cent = $ustva->report_variables({
myconfig => \%myconfig,
form => $form,
type => '',
@@ -1023,7 +1003,7 @@ sub generate_ustva {
dec_places => '2',
});
- my @category_euro = USTVA->report_variables({
+ my @category_euro = $ustva->report_variables({
myconfig => \%myconfig,
form => $form,
type => '',
@@ -1089,7 +1069,9 @@ sub config_step1 {
# edit all taxauthority prefs
$form->header;
- USTVA->get_config($userspath, 'finanzamt.ini');
+
+ my $ustva = USTVA->new();
+ $ustva->get_config($userspath, 'finanzamt.ini');
my $land = $form->{elsterland};
my $amt = $form->{elsterFFFF};
@@ -1098,7 +1080,7 @@ sub config_step1 {
$form->{title} = $locale->text('Tax Office Preferences');
- my $select_tax_office = USTVA->fa_auswahl($land, $amt, &elster_hash());
+ my $select_tax_office = $ustva->fa_auswahl($land, $amt, $ustva->query_finanzamt(\%myconfig, $form));
my $checked_accrual = q|checked="checked"| if ($form->{method} eq 'accrual');
my $checked_cash = q|checked="checked"| if ($form->{method} eq 'cash');
my $checked_monthly = "checked" if ($form->{FA_voranmeld} eq 'month');
@@ -1137,7 +1119,7 @@ sub config_step1 {
# Which COA is in use?
- USTVA->get_coa($form, \%myconfig);
+ $ustva->get_coa($form, \%myconfig);
# hä? kann die weg?
my $steuernummer_new = '';
@@ -1175,7 +1157,9 @@ sub config_step2 {
my $elster_amt = '';
my $elsterFFFF = '';
my $elstersteuernummer = '';
- USTVA->get_config($userspath, 'finanzamt.ini')
+
+ my $ustva = USTVA->new();
+ $ustva->get_config($userspath, 'finanzamt.ini')
if ($form->{saved} eq $locale->text('saved'));
# Auf Übergabefehler checken
@@ -1194,7 +1178,7 @@ sub config_step2 {
my $change = $form->{elsterland} eq $form->{elsterland_new}
&& $form->{elsterFFFF} eq $form->{elsterFFFF_new} ? '0' : '1';
$change = '0' if ($form->{saved} eq $locale->text('saved'));
- my $elster_init = &elster_hash();
+ my $elster_init = $ustva->query_finanzamt(\%myconfig, $form);
my %elster_init = %$elster_init;
@@ -1245,8 +1229,9 @@ sub config_step2 {
$form->{FA_Oeffnungszeiten} =~ s/\\\\n/\n/g;
+ $ustva->get_coa($form, \%myconfig);
- my $input_steuernummer = USTVA->steuernummer_input(
+ my $input_steuernummer = $ustva->steuernummer_input(
$form->{elsterland},
$form->{elsterFFFF},
$form->{steuernummer}
@@ -1425,12 +1410,3 @@ sub back {
$lxdebug->leave_sub();
}
-sub elster_hash {
- $lxdebug->enter_sub();
-
- $auth->assert('advance_turnover_tax_return');
-
- my $finanzamt = USTVA->query_finanzamt(\%myconfig, \%$form);
- $lxdebug->leave_sub();
- return $finanzamt;
-}