X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FUSTVA.pm;h=a80372b282e179c36a511d809df1f90dd4720b05;hb=a3335295fe8ac1acdb4b55324812c70af1e43b47;hp=84a8a96e0b0a12c0e7743b33282242f4e1e5996f;hpb=fb1e65086b66bac948150bbc1e8fd6e300c21823;p=kivitendo-erp.git diff --git a/SL/USTVA.pm b/SL/USTVA.pm index 84a8a96e0..a80372b28 100644 --- a/SL/USTVA.pm +++ b/SL/USTVA.pm @@ -1,5 +1,5 @@ #===================================================================== -# Lx-Office ERP +# kivitendo ERP # Copyright (c) 2004 by Udo Spallek, Aachen # # Author: Udo Spallek @@ -29,25 +29,26 @@ use List::Util qw(first); use SL::DBUtils; +use utf8; use strict; my @tax_office_information = ( - { 'id' => 8, 'name' => 'Baden Württemberg', 'taxbird_nr' => '0', 'elster_format' => 'FF/BBB/UUUUP', }, + { 'id' => 8, 'name' => 'Baden-Württemberg', 'taxbird_nr' => '0', 'elster_format' => 'FF/BBB/UUUUP', }, { 'id' => 9, 'name' => 'Bayern', 'taxbird_nr' => '1', 'elster_format' => 'FFF/BBB/UUUUP', }, { 'id' => 11, 'name' => 'Berlin', 'taxbird_nr' => '2', 'elster_format' => 'FF/BBB/UUUUP', }, { 'id' => 12, 'name' => 'Brandenburg', 'taxbird_nr' => '3', 'elster_format' => 'FFF/BBB/UUUUP', }, { 'id' => 4, 'name' => 'Bremen', 'taxbird_nr' => '4', 'elster_format' => 'FF BBB UUUUP', }, { 'id' => 2, 'name' => 'Hamburg', 'taxbird_nr' => '5', 'elster_format' => 'FF/BBB/UUUUP', }, { 'id' => 6, 'name' => 'Hessen', 'taxbird_nr' => '6', 'elster_format' => '0FF BBB UUUUP', }, - { 'id' => 13, 'name' => 'Mecklenburg Vorpommern', 'taxbird_nr' => '7', 'elster_format' => 'FFF/BBB/UUUUP', }, + { 'id' => 13, 'name' => 'Mecklenburg-Vorpommern', 'taxbird_nr' => '7', 'elster_format' => 'FFF/BBB/UUUUP', }, { 'id' => 3, 'name' => 'Niedersachsen', 'taxbird_nr' => '8', 'elster_format' => 'FF/BBB/UUUUP', }, - { 'id' => 5, 'name' => 'Nordrhein Westfalen', 'taxbird_nr' => '9', 'elster_format' => 'FFF/BBBB/UUUP', }, - { 'id' => 7, 'name' => 'Rheinland Pfalz', 'taxbird_nr' => '10', 'elster_format' => 'FF/BBB/UUUU/P', }, + { 'id' => 5, 'name' => 'Nordrhein-Westfalen', 'taxbird_nr' => '9', 'elster_format' => 'FFF/BBBB/UUUP', }, + { 'id' => 7, 'name' => 'Rheinland-Pfalz', 'taxbird_nr' => '10', 'elster_format' => 'FF/BBB/UUUU/P', }, { 'id' => 10, 'name' => 'Saarland', 'taxbird_nr' => '11', 'elster_format' => 'FFF/BBB/UUUUP', }, { 'id' => 14, 'name' => 'Sachsen', 'taxbird_nr' => '12', 'elster_format' => 'FFF/BBB/UUUUP', }, - { 'id' => 15, 'name' => 'Sachsen Anhalt', 'taxbird_nr' => '13', 'elster_format' => 'FFF/BBB/UUUUP', }, - { 'id' => 1, 'name' => 'Schleswig Holstein', 'taxbird_nr' => '14', 'elster_format' => 'FF BBB UUUUP', }, - { 'id' => 16, 'name' => 'Thüringen', 'taxbird_nr' => '15', 'elster_format' => 'FFF/BBB/UUUUP', }, + { 'id' => 15, 'name' => 'Sachsen-Anhalt', 'taxbird_nr' => '13', 'elster_format' => 'FFF/BBB/UUUUP', }, + { 'id' => 1, 'name' => 'Schleswig-Holstein', 'taxbird_nr' => '14', 'elster_format' => 'FF BBB UUUUP', }, + { 'id' => 16, 'name' => 'Thüringen', 'taxbird_nr' => '15', 'elster_format' => 'FFF/BBB/UUUUP', }, ); sub new { @@ -69,26 +70,16 @@ sub _init { foreach (@tax_office_information) { my $entry = \%{ $_ }; - $entry->{name} = $main::locale->{iconv_iso8859}->convert($entry->{name}); + $entry->{name} = $::locale->{iconv_utf8}->convert($entry->{name}); push @{ $self->{tax_office_information} }, $entry; } } sub get_coa { - my ( $self, $form, $myconfig) = @_; - - my $query = q{ SELECT coa FROM defaults }; - - my $dbh = $form->dbconnect($myconfig); - my $sth = $dbh->prepare($query); - $sth->execute() || $form->dberror($query); - - my ($coa) = selectrow_query($form, $dbh, $query); - - $sth->finish; - $dbh->disconnect; + my ( $self, $form ) = @_; + my $coa = $::instance_conf->get_coa; $form->{coa} = $coa; $form->{"COA_$coa"} = '1'; $form->{COA_Germany} = '1' if ($coa =~ m/^germany/i); @@ -101,8 +92,6 @@ sub report_variables { # Get all positions for taxreport out of the database # Needs Databaseupdate Pg-upgrade2/USTVA_abstraction.pl - return unless defined wantarray; - my ( $self, $arg_ref) = @_; @@ -112,8 +101,8 @@ sub report_variables { my $attribute = $arg_ref->{attribute}; # my $dec_places = (defined $arg_ref->{dec_places}) ? $arg_ref->{dec_places}:undef; - my $where_type = "AND tax.report_headings.type = '$type'" if ( $type ); - my $where_dcp = "AND tax.report_variables.dec_places = '$dec_places'" if ( defined $dec_places ); + my $where_type = $type ? "AND tax.report_headings.type = '$type'" : ''; + my $where_dcp = defined $dec_places ? "AND tax.report_variables.dec_places = '$dec_places'" : ''; my $query = qq| SELECT $attribute @@ -282,9 +271,9 @@ sub fa_auswahl { # use SL::Form; - # Referenz wird übergeben, hash of hash wird nicht - # in neues Hash kopiert, sondern direkt über die Referenz verändert - # Prototyp für diese Konstruktion + # Referenz wird übergeben, hash of hash wird nicht + # in neues Hash kopiert, sondern direkt über die Referenz verändert + # Prototyp für diese Konstruktion my ($self, $land, $elsterFFFF, $elster_init) = @_; @@ -302,7 +291,7 @@ sub fa_auswahl { var elsterBLAuswahl = document.verzeichnis.elsterland_new; var elsterFAAuswahl = document.verzeichnis.elsterFFFF_new; - elsterFAAuswahl.options.length = 0; // dropdown aufräumen + elsterFAAuswahl.options.length = 0; // dropdown aufräumen |; foreach my $elster_land (sort keys %$elster_init) { @@ -427,8 +416,8 @@ sub stichtag { $main::lxdebug->enter_sub(); # noch nicht fertig - # soll mal eine Erinnerungsfunktion für USTVA Abgaben werden, die automatisch - # den Termin der nächsten USTVA anzeigt. + # soll mal eine Erinnerungsfunktion für USTVA Abgaben werden, die automatisch + # den Termin der nächsten USTVA anzeigt. # # my ($today, $FA_dauerfrist, $FA_voranmeld) = @_; @@ -517,18 +506,16 @@ sub query_finanzamt { my $filename = "sql/$table.sql"; my $tst = $dbh->prepare("SELECT * FROM $table"); - $tst->execute; - if ($DBI::err) { - + $tst->execute || do { #There is no table, read the table from sql/finanzamt.sql print qq|

Bitte warten, Tabelle $table wird einmalig in Datenbank: - $myconfig->{dbname} als Benutzer: $myconfig->{dbuser} hinzugefügt...

|; + $myconfig->{dbname} als Benutzer: $myconfig->{dbuser} hinzugefügt...

|; process_query($form, $dbh, $filename) || $self->error(DBI->errstr); #execute second last call my $dbh = $form->dbconnect($myconfig) or $self->error(DBI->errstr); $dbh->disconnect(); - } + }; $tst->finish(); #$dbh->disconnect(); @@ -662,7 +649,7 @@ sub ustva { my ($self, $myconfig, $form) = @_; # connect to database - my $dbh = $form->dbconnect($myconfig); + my $dbh = $form->get_standard_dbh; my $last_period = 0; my $category = "pos_ustva"; @@ -701,7 +688,7 @@ sub ustva { foreach my $item (@category_euro) { $form->{"$item"} = 0; } - my $coa_name = coa_get($dbh); + my $coa_name = $::instance_conf->get_coa; $form->{coa} = $coa_name; # Controlvariable for templates @@ -741,9 +728,9 @@ sub ustva { } - # Fixme: Wird auch noch für Oesterreich gebraucht, + # Fixme: Wird auch noch für Oesterreich gebraucht, # weil kein eigenes Ausgabeformular - # sotte aber aus der allgeméinen Steuerberechnung verschwinden + # sotte aber aus der allgeméinen Steuerberechnung verschwinden # # Berechnung der USTVA Formularfelder laut Bogen 207 # @@ -760,10 +747,10 @@ sub ustva { $form->{"Z45"} = $form->{"Z43"}; - $form->{"Z53"} = $form->{"Z45"} + $form->{"53"} + $form->{"74"} + $form->{"Z53"} = $form->{"Z45"} + $form->{"47"} + $form->{"53"} + $form->{"74"} + $form->{"85"} + $form->{"65"}; - $form->{"Z62"} = $form->{"Z43"} - $form->{"66"} - $form->{"61"} + $form->{"Z62"} = $form->{"Z53"} - $form->{"66"} - $form->{"61"} - $form->{"62"} - $form->{"67"} - $form->{"63"} - $form->{"64"} - $form->{"59"}; @@ -775,23 +762,6 @@ sub ustva { $main::lxdebug->leave_sub(); } -sub coa_get { - - my ($dbh) = @_; - my $form = $main::form; - - my $query= qq|SELECT coa FROM defaults|; - - my $sth = $dbh->prepare($query); - - $sth->execute || $form->dberror($query); - - my ($ref) = $sth->fetchrow_array; - - return $ref; - -}; - sub get_accounts_ustva { $main::lxdebug->enter_sub(); @@ -807,7 +777,7 @@ sub get_accounts_ustva { my $arwhere = ""; my $item; - my $gltaxkey_where = "(tk.pos_ustva>=59 AND tk.pos_ustva<=66)"; + my $gltaxkey_where = "((tk.pos_ustva = 46) OR (tk.pos_ustva>=59 AND tk.pos_ustva<=67) or (tk.pos_ustva>=89 AND tk.pos_ustva<=93))"; if ($fromdate) { if ($form->{method} eq 'cash') { @@ -925,7 +895,7 @@ sub get_accounts_ustva { ######################################### # Ausgaben und Gl Buchungen sind gleich - # für Ist- und Soll-Versteuerung + # für Ist- und Soll-Versteuerung ######################################### $query .= qq| UNION -- alle Ausgaben AP erfassen @@ -1033,7 +1003,7 @@ sub get_config { $form->error("Missing Parameter: @_") if !$userspath || !$filename; - $filename = "$form->{login}_$filename"; + $filename = "$::myconfig{login}_$filename"; $filename =~ s|.*/||; $filename = "$userspath/$filename"; open my $FACONF, "<", $filename or do {# Annon Sub