X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FUSTVA.pm;h=13f9a62869dd108d20c714c8dafad1289f2c75df;hb=996ddb70dc0d35be7a72e981ab38011a13d09484;hp=28fc5718e59b8be1dccfcf99544e15a34a5d1911;hpb=c1dafb8482847bb39edd6340bbbcbb77a7abb7b3;p=kivitendo-erp.git
diff --git a/SL/USTVA.pm b/SL/USTVA.pm
index 28fc5718e..13f9a6286 100644
--- a/SL/USTVA.pm
+++ b/SL/USTVA.pm
@@ -25,6 +25,78 @@
package USTVA;
+use SL::DBUtils;
+
+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;
+
+ $form->{coa} = $coa;
+ $form->{"COA_$coa"} = '1';
+ $form->{COA_Germany} = '1' if ( $coa eq 'Germany-DATEV-SKR03EU' or $coa eq 'Germany-DATEV-SKR04EU');
+
+ return;
+}
+
+
+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) = @_;
+
+ my $myconfig = $arg_ref->{myconfig};
+ my $form = $arg_ref->{form};
+ my $type = $arg_ref->{type}; # 'paied' || 'received' || ''
+ 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 $query = qq|
+ SELECT $attribute
+ FROM tax.report_variables
+ LEFT JOIN tax.report_headings
+ ON (tax.report_variables.heading_id = tax.report_headings.id)
+ WHERE 1=1
+ $where_type
+ $where_dcp
+ |;
+
+ my $dbh = $form->dbconnect($myconfig);
+ my $sth = $dbh->prepare($query);
+
+ $sth->execute() || $form->dberror($query);
+
+ my @positions;
+
+ while ( my $row_ref = $sth->fetchrow_arrayref() ) {
+ push @positions, @$row_ref; # Copy the array contents
+ }
+
+ $sth->finish;
+
+ $dbh->disconnect;
+
+ return @positions;
+
+}
+
sub create_steuernummer {
$main::lxdebug->enter_sub();
@@ -40,8 +112,8 @@ sub create_steuernummer {
my $h = 0;
my $i = 0;
- $steuernummer_new = $part;
- $elstersteuernummer_new = $elster_FFFF;
+ $steuernummer_new = $part;
+ $elstersteuernummer_new = $elster_FFFF;
$elstersteuernummer_new .= '0';
for ($h = 1; $h < $patterncount; $h++) {
@@ -63,38 +135,40 @@ sub create_steuernummer {
sub steuernummer_input {
$main::lxdebug->enter_sub();
- ($elsterland, $elsterFFFF, $steuernummer) = @_;
+ my ($self, $elsterland, $elsterFFFF, $steuernummer) = @_;
+ my $steuernummer_input = '';
+
$elster_land = $elsterland;
$elster_FFFF = $elsterFFFF;
$steuernummer = '0000000000' if ($steuernummer eq '');
# $steuernummer formatieren (nur Zahlen) -> $stnr
- $stnr = $steuernummer;
+ my $stnr = $steuernummer;
$stnr =~ s/\D+//g;
#Pattern description Elstersteuernummer
my %elster_STNRformat = (
- 'Mecklenburg Vorpommern' => 'FFF/BBB/UUUUP', # '/' 3
- 'Hessen' => '0FF BBB UUUUP', # ' ' 3
- 'Nordrhein Westfalen' => 'FFF/BBBB/UUUP', # '/' 3
- 'Schleswig Holstein' => 'FF BBB UUUUP', # ' ' 2
- 'Berlin' => 'FF/BBB/UUUUP', # '/' 3
- 'Thüringen' => 'FFF/BBB/UUUUP', # '/' 3
- 'Sachsen' => 'FFF/BBB/UUUUP', # '/' 3
- 'Hamburg' => 'FF/BBB/UUUUP', # '/' 3
- 'Baden Würtemberg' => 'FF/BBB/UUUUP', # '/' 2
- 'Sachsen Anhalt' => 'FFF/BBB/UUUUP', # '/' 3
- 'Saarland' => 'FFF/BBB/UUUUP', # '/' 3
- 'Bremen' => 'FF BBB UUUUP', # ' ' 3
- 'Bayern' => 'FFF/BBB/UUUUP', # '/' 3
- 'Rheinland Pfalz' => 'FF/BBB/UUUU/P', # '/' 4
- 'Niedersachsen' => 'FF/BBB/UUUUP', # '/' 3
- 'Brandenburg' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Mecklenburg Vorpommern' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Hessen' => '0FF BBB UUUUP', # ' ' 3
+ 'Nordrhein Westfalen' => 'FFF/BBBB/UUUP', # '/' 3
+ 'Schleswig Holstein' => 'FF BBB UUUUP', # ' ' 2
+ 'Berlin' => 'FF/BBB/UUUUP', # '/' 3
+ 'Thüringen' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Sachsen' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Hamburg' => 'FF/BBB/UUUUP', # '/' 3
+ 'Baden Württemberg' => 'FF/BBB/UUUUP', # '/' 2
+ 'Sachsen Anhalt' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Saarland' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Bremen' => 'FF BBB UUUUP', # ' ' 3
+ 'Bayern' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Rheinland Pfalz' => 'FF/BBB/UUUU/P', # '/' 4
+ 'Niedersachsen' => 'FF/BBB/UUUUP', # '/' 3
+ 'Brandenburg' => 'FFF/BBB/UUUUP', # '/' 3
);
#split the pattern
- $elster_pattern = $elster_STNRformat{$elster_land};
+ my $elster_pattern = $elster_STNRformat{$elster_land};
my @elster_pattern = split(' ', $elster_pattern);
my $delimiter = ' ';
my $patterncount = @elster_pattern;
@@ -108,76 +182,77 @@ sub steuernummer_input {
# no we have an array of patternparts and a delimiter
# create the first automated and fixed part and delimiter
- print qq||;
- $part = '';
+ $steuernummer_input .= qq||;
+ my $part = '';
SWITCH: {
$elster_pattern[0] eq 'FFF' && do {
$part = substr($elster_FFFF, 1, 4);
- print qq|$part|;
+ $steuernummer_input .= qq|$part|;
last SWITCH;
};
$elster_pattern[0] eq '0FF' && do {
$part = '0' . substr($elster_FFFF, 2, 4);
- print qq|$part|;
+ $steuernummer_input .= qq|$part|;
last SWITCH;
};
$elster_pattern[0] eq 'FF' && do {
$part = substr($elster_FFFF, 2, 4);
- print qq|$part|;
+ $steuernummer_input .= qq|$part|;
last SWITCH;
};
1 == 1 && do {
- print qq|Fehler!|;
+ $steuernummer_input .= qq|Fehler!|;
last SWITCH;
};
}
#now the rest of the Steuernummer ...
- print qq||;
- print qq|\n
+ $steuernummer_input .= qq||;
+ $steuernummer_input .= qq|\n
|;
- my $h = 0;
- my $i = 0;
- my $j = 0;
- $k = 0;
- for ($h = 1; $h < $patterncount; $h++) {
- print qq| $delimiter \n|;
- for ($i = 1; $i <= length($elster_pattern[$h]); $i++) {
- print qq|\n|;
+ $steuernummer_input .= qq|\n|;
}
}
+
$main::lxdebug->leave_sub();
+
+ return $steuernummer_input;
}
sub fa_auswahl {
$main::lxdebug->enter_sub();
- use SL::Form;
+# 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
- my ($land, $elsterFFFF, $elster_init) =
- @_; #Referenz auf Hash von Hash übergeben
+ my ($self, $land, $elsterFFFF, $elster_init) = @_;
+
my $terminal = '';
my $FFFF = $elsterFFFF;
my $ffff = '';
@@ -191,8 +266,7 @@ sub fa_auswahl {
#}
#if ( $terminal eq 'mozilla' or $terminal eq 'js' ) {
- print qq|
-
+ my $fa_auswahl = qq|
@@ -235,18 +310,18 @@ sub fa_auswahl {