X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fustva.pl;h=0f26de3f6ab5fe4ebf9a5529bfb0d6858ca206ca;hb=15aab04c1710b3c8a2bf8785aef31f13a958a43e;hp=6c80d4665c163c11ccf8ec75d93815cf139ac1b0;hpb=a68089fb83a276f3ce78e5bd145c1cf05cc9a762;p=kivitendo-erp.git diff --git a/bin/mozilla/ustva.pl b/bin/mozilla/ustva.pl index 6c80d4665..0f26de3f6 100644 --- a/bin/mozilla/ustva.pl +++ b/bin/mozilla/ustva.pl @@ -18,7 +18,8 @@ # 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. #====================================================================== # German Tax authority Module and later ELSTER Interface # 08.01.14 ELSTER Interface software (taxbird/winston) removed @@ -29,21 +30,13 @@ use utf8; require "bin/mozilla/common.pl"; -#use strict; -#no strict 'refs'; -#use diagnostics; -#use warnings; # FATAL=> 'all'; -#use vars qw($locale $form %myconfig); -#our ($myconfig); -#use CGI::Carp "fatalsToBrowser"; - use List::Util qw(first); use SL::DB::Default; -use SL::PE; use SL::RP; use SL::USTVA; use SL::User; +use SL::Locale::String qw(t8); 1; # this is for our long dates @@ -94,6 +87,8 @@ sub report { my $department = ''; my $hide = ''; + + setup_ustva_report_action_bar(); $form->header; # Einlesen der Finanzamtdaten @@ -101,12 +96,6 @@ sub report { $ustva->get_config(); $ustva->get_finanzamt(); - my $geierlein_enabled = 0; - my $geierlein_path = $::lx_office_conf{paths}{geierlein_path}; - - if ( $geierlein_path && length($geierlein_path) > 0 ) {$geierlein_enabled=1;} - -# $::lxdebug->message(LXDebug->DEBUG2,"geierlein_enabled=".$geierlein_enabled." path=".$geierlein_path); # Hier Einlesen der user-config # steuernummer entfernt für prerelease my @a = qw( @@ -238,46 +227,16 @@ sub report { checkbox_kz_29 => $checkbox_kz_29, checkbox_kz_26 => $checkbox_kz_26, tax_office_banks => \@tax_office_banks_ref, - geierlein_enabled => $geierlein_enabled, - geierlein_path => $geierlein_path, select_options => &show_options, }; print($form->parse_html_template('ustva/report', $template_ref)); - - $::lxdebug->leave_sub(); } - -sub help { - $::lxdebug->enter_sub(); - - $::auth->assert('advance_turnover_tax_return'); - - # parse help documents under doc - $::form->{templates} = 'doc'; - $::form->{help} = 'ustva'; - $::form->{type} = 'help'; - $::form->{format} = 'html'; - generate_ustva(); - - $::lxdebug->leave_sub(); -} - -sub show { - $::lxdebug->enter_sub(); - - $::auth->assert('advance_turnover_tax_return'); - - #generate_ustva(); - $::lxdebug->leave_sub(); - call_sub($::form->{"nextsub"}); -} - sub ustva_vorauswahl { $::lxdebug->enter_sub(); @@ -508,18 +467,6 @@ sub ustva_vorauswahl { return $select_vorauswahl; } -#sub config { -# $::lxdebug->enter_sub(); -# config_step1(); -# $::lxdebug->leave_sub(); -#} - -sub debug { - $::lxdebug->enter_sub(); - $::form->debug(); - $::lxdebug->leave_sub(); -} - sub show_options { $::lxdebug->enter_sub(); @@ -567,9 +514,6 @@ 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; - my $ustva = USTVA->new(); $ustva->get_config(); @@ -649,42 +593,10 @@ sub generate_ustva { $form->{co_city} =~ s/\\n//g; } - ################################ - # - # Nation specific customisations - # - ################################ - - # Germany - - if ( $form->{coa} eq 'Germany-DATEV-SKR03EU' or $form->{coa} eq 'Germany-DATEV-SKR04EU') { - $form->{id} = []; $form->{amount} = []; - if ( $form->{format} eq 'pdf' or $form->{format} eq 'postscript') { - - $form->{IN} = "$form->{type}-$form->{year}.tex"; - $form->{padding} = "~~"; - $form->{bold} = "\textbf{"; - $form->{endbold} = "}"; - $form->{br} = '\\\\'; - - # Zahlenformatierung für Latex USTVA Formulare - - foreach my $number (@{$::form->{category_euro}}) { - $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', ''); - } - - my ${decimal_comma} = ( $myconfig{numberformat} eq '1.000,00' - or $myconfig{numberformat} eq '1000,00' ) ? ',':'.'; - - foreach my $number (@{$::form->{category_cent}}) { - $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', ''); - $form->{$number} =~ s/${decimal_comma}/~~/g; - } - - } elsif ( $form->{format} eq 'html') { # Formatierungen für HTML Ausgabe + if ( $form->{format} eq 'html') { # Formatierungen für HTML Ausgabe $form->{IN} = $form->{type} . '.html'; $form->{padding} = "  "; @@ -700,41 +612,11 @@ sub generate_ustva { foreach my $number (@{$::form->{category_euro}}) { $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '0'); } - } elsif ( $form->{format} eq '' ){ # No format error. - - $form->header; - USTVA::error( $locale->text('Application Error. No Format given' ) . "!"); - $::dispatcher->end_request; - - } else { # All other Formats are wrong + } else { # we have only html $form->header; USTVA::error( $locale->text('Application Error. Wrong Format') . ": " . $form->{format} ); $::dispatcher->end_request; - } - - - } else # Outputformat for generic output - { - - $form->{USTVA} = []; - - if ( $form->{format} eq 'generic') { # Formatierungen für HTML Ausgabe - - my $rec_ref = {}; - for my $kennziffer (@{$::form->{category_cent}}, @{$::form->{category_euro}}) { - $rec_ref = {}; - $rec_ref->{id} = $kennziffer; - $rec_ref->{amount} = $form->format_amount(\%myconfig, $form->{$kennziffer}, 2, '0'); - - $::lxdebug->message($LXDebug::DEBUG, "Kennziffer $kennziffer: '$form->{$kennziffer}'" ); - $::lxdebug->dump($LXDebug::DEBUG, $rec_ref ); - push @ { $form->{USTVA} }, $rec_ref; - } - - } - - } - + } if ( $form->{period} eq '13' and $form->{format} ne 'html') { $form->header; USTVA::info( @@ -743,31 +625,12 @@ sub generate_ustva { . '!'); } - $form->{templates} = "doc" if ( $form->{type} eq 'help' ); + # add a prefix for ustva pos numbers, i.e.: 81 -> post_ustva_81 + $form->{"pos_ustva_$_"} = $form->{$_} for grep { m{^\d+} } keys %{ $form }; + $form->{title} = $locale->text('Advance turnover tax return'); - if ($form->{format} eq 'generic'){ - - $form->header(); - - my $template_ref = { - taxnumber => $defaults->taxnumber, - }; - - print($form->parse_html_template('ustva/generic_taxreport', $template_ref)); - - } elsif ( $form->{format} eq 'elstertaxbird' ) { - $form->parse_template(\%myconfig); - } else - { - # add a prefix for ustva pos numbers, i.e.: 81 -> post_ustva_81 - $form->{"pos_ustva_$_"} = $form->{$_} for grep { m{^\d+} } keys %{ $form }; - $form->{title} = $locale->text('Advance turnover tax return'); - - $form->header; - print $form->parse_html_template('ustva/ustva'); - - - } + $form->header; + print $form->parse_html_template('ustva/ustva'); $::lxdebug->leave_sub(); } @@ -781,6 +644,8 @@ $::form->{title} = $::locale->text('Tax Office Preferences'); # edit all taxauthority prefs + setup_ustva_config_step1_action_bar(); + $::form->header; my $ustva = USTVA->new(); @@ -807,8 +672,6 @@ $::form->{title} = $::locale->text('Tax Office Preferences'); my %_hidden_local_variables = ( 'saved' => $::locale->text('Check Details'), - 'nextsub' => 'config_step2', - 'warnung' => '0', ); foreach my $variable (keys %_hidden_local_variables) { @@ -852,6 +715,8 @@ sub config_step2 { $::auth->assert('advance_turnover_tax_return'); + setup_ustva_config_step2_action_bar(); + $form->header(); my $fa_land_nr = ''; @@ -930,7 +795,6 @@ sub config_step2 { my %_hidden_local_variables = ( 'fa_land_nr' => $fa_land_nr, 'fa_bufa_nr' => $fa_bufa_nr, - 'warnung' => 0, 'taxnumber' => $stnr, 'lastsub' => 'config_step1', 'nextsub' => 'save', @@ -944,11 +808,11 @@ sub config_step2 { my @_hidden_form_variables = qw( fa_dauerfrist fa_steuerberater_city fa_steuerberater_name - fa_steuerberater_street fa_steuerberater_tel + fa_steuerberater_street fa_steuerberater_tel fa_voranmeld fa_dauerfrist accounting_method type - saved callback + saved ); foreach my $variable (@_hidden_form_variables) { @@ -959,7 +823,6 @@ sub config_step2 { my $template_ref = { input_steuernummer => $input_steuernummer, readonly => '', #q|disabled="disabled"|, - callback => $form->{callback}, COA_Germany => $form->{COA_Germany}, hidden_variables => $_hidden_variables_ref, }; @@ -1054,3 +917,49 @@ sub back { call_sub($::form->{"lastsub"}); $::lxdebug->leave_sub(); } + +sub setup_ustva_report_action_bar { + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Show'), + submit => [ '#form_do', { action => 'generate_ustva' } ], + accesskey => 'enter', + ], + action => [ + t8('Geierlein'), + call => [ 'sendGeierlein' ], + disabled => !length($::lx_office_conf{paths}{geierlein_path} // '') ? t8('The Geierlein path has not been set in the configuration.') : undef, + tooltip => t8('Transfer data to Geierlein ELSTER application'), + ], + ); + } +} + +sub setup_ustva_config_step1_action_bar { + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Continue'), + submit => [ '#form', { action => 'config_step2' } ], + accesskey => 'enter', + ], + ); + } +} + +sub setup_ustva_config_step2_action_bar { + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Save'), + submit => [ '#form', { action => 'save' } ], + accesskey => 'enter', + ], + action => [ + t8('Back'), + call => [ 'kivi.history_back' ], + ], + ); + } +}