X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fustva.pl;h=3c12f42a7a76ad9f064e27dc190740b9d6bae4df;hb=6f6f2fd87e08cbe2d1b599b064823f499a7f910f;hp=9df5a663c668b9a5b5561414f106fd149c1c35b4;hpb=7f34b3c1f69619eaf3c41945ab22cf21883bb945;p=kivitendo-erp.git diff --git a/bin/mozilla/ustva.pl b/bin/mozilla/ustva.pl index 9df5a663c..3c12f42a7 100644 --- a/bin/mozilla/ustva.pl +++ b/bin/mozilla/ustva.pl @@ -1,5 +1,5 @@ #===================================================================== -# Lx-Office ERP +# kivitendo ERP # Copyright (c) 2004 by Udo Spallek, Aachen # # Author: Udo Spallek @@ -23,6 +23,7 @@ # German Tax authority Module and later ELSTER Interface #====================================================================== +use strict; use utf8; require "bin/mozilla/common.pl"; @@ -37,6 +38,7 @@ require "bin/mozilla/common.pl"; use List::Util qw(first); +use SL::DB::Default; use SL::PE; use SL::RP; use SL::USTVA; @@ -82,6 +84,7 @@ sub report { $::auth->assert('advance_turnover_tax_return'); + my $defaults = SL::DB::Default->get; $form->{title} = $locale->text('UStVA'); $form->{kz10} = ''; #Berichtigte Anmeldung? Ja =1 Nein=0 @@ -99,19 +102,20 @@ sub report { # Hier Einlesen der user-config # steuernummer entfernt für prerelease my @a = qw( - signature name company address businessnumber + signature name tel fax email co_chief co_department co_custom1 co_custom2 co_custom3 co_custom4 co_custom5 co_name1 co_name2 co_street co_street1 co_zip co_city co_city1 co_country co_tel co_tel1 co_tel2 co_fax co_fax1 co_email co_email1 - co_url co_url1 ustid duns co_bankname + co_url co_url1 co_bankname co_bankname1 co_bankname2 co_bankname3 co_blz co_blz1 co_blz2 co_blz3 co_accountnr co_accountnr1 co_accountnr2 co_accountnr3 ); - map { $form->{$_} = $myconfig{$_} } @a; + $form->{$_} = $myconfig{$_} for @a; + $form->{$_} = $defaults->$_ for qw(company address co_ustid duns); my $openings = $form->{FA_Oeffnungszeiten}; $openings =~ s/\\\\n/
/g; @@ -198,7 +202,7 @@ sub report { company_given => $company_given, address_given => $address_given, taxnumber_given => $taxnumber_given, - taxnumber => $myconfig{taxnumber}, + taxnumber => $defaults->taxnumber, select_year => $select_year, period_local => $period_local, method_local => $method_local, @@ -224,14 +228,12 @@ sub help { $::auth->assert('advance_turnover_tax_return'); # parse help documents under doc - my $tmp = $::form->{templates}; $::form->{templates} = 'doc'; $::form->{help} = 'ustva'; $::form->{type} = 'help'; $::form->{format} = 'html'; generate_ustva(); - #$form->{templates} = $tmp; $::lxdebug->leave_sub(); } @@ -542,6 +544,10 @@ sub generate_ustva { $::auth->assert('advance_turnover_tax_return'); + my $defaults = SL::DB::Default->get; + $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; + $form->{templates} = $defaults->templates; + # Aufruf von get_config zum Einlesen der Finanzamtdaten aus finanzamt.ini my $ustva = USTVA->new(); @@ -737,14 +743,15 @@ sub generate_ustva { $locale->date(\%myconfig, $form->current_date(\%myconfig), 0, 0, 0); # setup variables for the form - my @a = qw(company businessnumber tel fax email + my @a = qw(tel fax email co_chief co_department co_custom1 co_custom2 co_custom3 co_custom4 co_custom5 co_name1 co_name2 co_street co_street1 co_zip co_city co_city1 co_country co_tel co_tel1 co_tel2 - co_fax co_fax1 co_email co_email1 co_url co_url1 ustid duns + co_fax co_fax1 co_email co_email1 co_url co_url1 co_bankname co_bankname1 co_bankname2 co_bankname3 co_blz co_blz1 co_blz2 co_blz3 co_accountnr co_accountnr1 co_accountnr2 co_accountnr3); - map { $form->{$_} = $myconfig{$_} } @a; + $form->{$_} = $myconfig{$_} for @a; + $form->{$_} = $defaults->$_ for qw(company address co_ustid duns); if ($form->{address} ne '') { my $temp = $form->{address}; @@ -775,7 +782,7 @@ sub generate_ustva { dec_places => '2', }); - push @category_cent, qw(83 Z43 Z45 Z53 Z62 Z65 Z67); + push @category_cent, qw(Z43 Z45 Z53 Z62 Z65 Z67); my @category_euro = $ustva->report_variables({ myconfig => \%myconfig, @@ -847,7 +854,6 @@ sub generate_ustva { #file suffix $file .= '.xml'; $file =~ s|.*/||; - $form->{tmpfile} = "$::lx_office_conf{paths}{userspath}/$file"; $form->{attachment_filename} = $file; @@ -855,9 +861,9 @@ sub generate_ustva { my $temp_numberformat = $myconfig{numberformat}; - # Numberformat must be '1000.00' for Winston + # Numberformat must be '1000,00' for Winston - $myconfig{numberformat} = '1000.00'; + $myconfig{numberformat} = '1000,00'; foreach my $number (@category_cent) { $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : ''; @@ -893,16 +899,10 @@ sub generate_ustva { # Define serveral filenames $form->{IN} = 'taxbird.txb'; - $form->{attachment_filename} = "USTVA-" . $form->{period} - . sprintf("%02d", $form->{year} % 100) . ".txb"; + $form->{attachment_filename} = "USTVA-" . ($form->{period} * 1) . sprintf("%02d", $form->{year} % 100) . ".txb"; $form->{attachment_filename} =~ s|.*/||; - $form->{tmpfile} = "$::lx_office_conf{paths}{userspath}/" . $form->{attachment_filename}; - # TODO: set Output to UTF-8 or system Preference - #$form->{"iconv"} = Text::Iconv->new($myconfig{dbcharset}, "UTF-8"); - #my $iconv = $self->{"iconv"}; - #$iconv->convert($variable); if ($form->{period} =~ /^[4]\d$/ ){ my %periods = ( # Lx => taxbird '41' => '12', @@ -1062,7 +1062,6 @@ sub generate_ustva { . '!'); } - $form->{templates} = $myconfig{templates}; $form->{templates} = "doc" if ( $form->{type} eq 'help' ); if ($form->{format} eq 'generic'){ @@ -1070,15 +1069,19 @@ sub generate_ustva { $form->header(); my $template_ref = { - taxnumber => $myconfig{taxnumber}, + taxnumber => $defaults->taxnumber, }; print($form->parse_html_template('ustva/generic_taxreport', $template_ref)); } else { + #$form->parse_template(\%myconfig, $::lx_office_conf{paths}{userspath}); + $form->{title} = $locale->text('Advance turnover tax return'); + + $form->header; + print $form->parse_html_template('ustva/ustva'); - $form->parse_template(\%myconfig, $::lx_office_conf{paths}{userspath}); } @@ -1106,13 +1109,13 @@ $::form->{title} = $::locale->text('Tax Office Preferences'); $::form->{title} = $::locale->text('Tax Office Preferences'); - 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'); - my $checked_quarterly = "checked" if ($::form->{FA_voranmeld} eq 'quarter'); - my $checked_dauerfristverlaengerung = "checked" if ($::form->{FA_dauerfrist} eq '1'); - my $checked_kz_71 = "checked" if ($::form->{FA_71} eq 'X'); + my $select_tax_office = $ustva->fa_auswahl($land, $amt, $ustva->query_finanzamt(\%::myconfig, $::form)); + my $checked_accrual = $::form->{method} eq 'accrual' ? q|checked="checked"| : ''; + my $checked_cash = $::form->{method} eq 'cash' ? q|checked="checked"| : ''; + my $checked_monthly = $::form->{FA_voranmeld} eq 'month' ? "checked" : ''; + my $checked_quarterly = $::form->{FA_voranmeld} eq 'quarter' ? "checked" : ''; + my $checked_dauerfristverlaengerung = $::form->{FA_dauerfrist} eq '1' ? "checked" : ''; + my $checked_kz_71 = $::form->{FA_71} eq 'X' ? "checked" : ''; my $_hidden_variables_ref; @@ -1179,10 +1182,6 @@ sub config_step2 { $form->header(); -# print qq| -# -# |; - my $elsterland = ''; my $elster_amt = ''; my $elsterFFFF = ''; @@ -1224,11 +1223,7 @@ sub config_step2 { create_steuernummer(); # rebuild elster_amt - my $amt = ''; - foreach $amt (keys %{ $elster_init{ $form->{elsterland} } }) { - $elster_amt = $amt - if ($elster_init{ $form->{elsterland}{$amt} eq $form->{elsterFFFF} }); - } + my $amt = $elster_init{$elsterFFFF}; # load the predefined hash data into the FA_* Vars my @variables = qw(FA_Name FA_Strasse FA_PLZ FA_Ort @@ -1254,7 +1249,7 @@ sub config_step2 { my $patterncount = $form->{patterncount}; my $elster_pattern = $form->{elster_pattern}; my $delimiter = $form->{delimiter}; - my $steuernummer = $form->{steuernummer} if ($stnr eq ''); + my $steuernummer = $stnr eq '' ? $form->{steuernummer} : ''; $form->{FA_Oeffnungszeiten} =~ s/\\\\n/\n/g; @@ -1436,4 +1431,3 @@ sub back { call_sub($::form->{"lastsub"}); $::lxdebug->leave_sub(); } -