#our ($myconfig);
#use CGI::Carp "fatalsToBrowser";
+use List::Util qw(first);
+
use SL::PE;
use SL::RP;
use SL::USTVA;
$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
# Which COA is in use?
- USTVA->get_coa($form, $myconfig);
+ $ustva->get_coa($form, $myconfig);
my $template_ref = {
openings => $openings,
# 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 =
# 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);
# Outputformat specific customisation's
#
- my @category_cent = USTVA->report_variables({
+ my @category_cent = $ustva->report_variables({
myconfig => \%myconfig,
form => $form,
type => '',
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 => '',
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;
} else # Outputformat for generic output
{
- my @category_cent = USTVA->report_variables({
+ my @category_cent = $ustva->report_variables({
myconfig => \%myconfig,
form => $form,
type => '',
dec_places => '2',
});
- my @category_euro = USTVA->report_variables({
+ my @category_euro = $ustva->report_variables({
myconfig => \%myconfig,
form => $form,
type => '',
# 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};
$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');
# Which COA is in use?
- USTVA->get_coa($form, \%myconfig);
+ $ustva->get_coa($form, \%myconfig);
# hä? kann die weg?
my $steuernummer_new = '';
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
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;
$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}
$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;
-}