+
+}
+
+sub set_FromTo {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $form) = @_;
+
+ # init some form vars
+ my @anmeldungszeitraum =
+ qw('0401' '0402' '0403'
+ '0404' '0405' '0406'
+ '0407' '0408' '0409'
+ '0410' '0411' '0412'
+ '0441' '0442' '0443' '0444');
+
+ foreach my $item (@anmeldungszeitraum) {
+ $form->{$item} = "";
+ }
+
+ #forgotten the year --> thisyear
+ if ($form->{year} !~ m/^\d\d\d\d$/) {
+ $form->{year} = substr(
+ $form->datetonum(
+ $form->current_date(\%::myconfig), \%::myconfig
+ ),
+ 0, 4);
+ $::lxdebug->message(LXDebug->DEBUG1,
+ qq|Actual year from Database: $form->{year}\n|);
+ }
+
+ #
+ # using dates in ISO-8601 format: yyyymmmdd for Postgres...
+ #
+
+ #yearly report
+ if ($form->{period} eq "13") {
+ $form->{fromdate} = "$form->{year}0101";
+ $form->{todate} = "$form->{year}1231";
+ }
+
+ #quarter reports
+ if ($form->{period} eq "41") {
+ $form->{fromdate} = "$form->{year}0101";
+ $form->{todate} = "$form->{year}0331";
+ $form->{'0441'} = "X";
+ }
+ if ($form->{period} eq "42") {
+ $form->{fromdate} = "$form->{year}0401";
+ $form->{todate} = "$form->{year}0630";
+ $form->{'0442'} = "X";
+ }
+ if ($form->{period} eq "43") {
+ $form->{fromdate} = "$form->{year}0701";
+ $form->{todate} = "$form->{year}0930";
+ $form->{'0443'} = "X";
+ }
+ if ($form->{period} eq "44") {
+ $form->{fromdate} = "$form->{year}1001";
+ $form->{todate} = "$form->{year}1231";
+ $form->{'0444'} = "X";
+ }
+
+ #Monthly reports
+ SWITCH: {
+ $form->{period} eq "01" && do {
+ $form->{fromdate} = "$form->{year}0101";
+ $form->{todate} = "$form->{year}0131";
+ $form->{'0401'} = "X";
+ last SWITCH;
+ };
+ $form->{period} eq "02" && do {
+ $form->{fromdate} = "$form->{year}0201";
+
+ #this works from 1901 to 2099, 1900 and 2100 fail.
+ my $leap = ($form->{year} % 4 == 0) ? "29" : "28";
+ $form->{todate} = "$form->{year}02$leap";
+ $form->{"0402"} = "X";
+ last SWITCH;
+ };
+ $form->{period} eq "03" && do {
+ $form->{fromdate} = "$form->{year}0301";
+ $form->{todate} = "$form->{year}0331";
+ $form->{"0403"} = "X";
+ last SWITCH;
+ };
+ $form->{period} eq "04" && do {
+ $form->{fromdate} = "$form->{year}0401";
+ $form->{todate} = "$form->{year}0430";
+ $form->{"0404"} = "X";
+ last SWITCH;
+ };
+ $form->{period} eq "05" && do {
+ $form->{fromdate} = "$form->{year}0501";
+ $form->{todate} = "$form->{year}0531";
+ $form->{"0405"} = "X";
+ last SWITCH;
+ };
+ $form->{period} eq "06" && do {
+ $form->{fromdate} = "$form->{year}0601";
+ $form->{todate} = "$form->{year}0630";
+ $form->{"0406"} = "X";
+ last SWITCH;
+ };
+ $form->{period} eq "07" && do {
+ $form->{fromdate} = "$form->{year}0701";
+ $form->{todate} = "$form->{year}0731";
+ $form->{"0407"} = "X";
+ last SWITCH;
+ };
+ $form->{period} eq "08" && do {
+ $form->{fromdate} = "$form->{year}0801";
+ $form->{todate} = "$form->{year}0831";
+ $form->{"0408"} = "X";
+ last SWITCH;
+ };
+ $form->{period} eq "09" && do {
+ $form->{fromdate} = "$form->{year}0901";
+ $form->{todate} = "$form->{year}0930";
+ $form->{"0409"} = "X";
+ last SWITCH;
+ };
+ $form->{period} eq "10" && do {
+ $form->{fromdate} = "$form->{year}1001";
+ $form->{todate} = "$form->{year}1031";
+ $form->{"0410"} = "X";
+ last SWITCH;
+ };
+ $form->{period} eq "11" && do {
+ $form->{fromdate} = "$form->{year}1101";
+ $form->{todate} = "$form->{year}1130";
+ $form->{"0411"} = "X";
+ last SWITCH;
+ };
+ $form->{period} eq "12" && do {
+ $form->{fromdate} = "$form->{year}1201";
+ $form->{todate} = "$form->{year}1231";
+ $form->{"0412"} = "X";
+ last SWITCH;
+ };
+ }
+
+ # Kontrollvariablen für die Templates
+ $form->{"year$_"} = ($form->{year} >= $_ ) ? "1":"0" for 2007..2107;
+
+ $main::lxdebug->leave_sub();
+}
+
+sub get_fiamt_vars {
+ return @fiamt_finanzamt;
+}
+
+sub get_oldconfig {
+ $main::lxdebug->enter_sub();
+
+ my $ret = 0;
+ my %oldkeys = (
+ 'steuernummer' => 'taxnumber',
+ 'elsterFFFF' => 'fa_bufa_nr',
+ 'FA_dauerfrist' => 'fa_dauerfrist',
+ 'FA_steuerberater_city' => 'fa_steuerberater_city',
+ 'FA_steuerberater_name' => 'fa_steuerberater_name',
+ 'FA_steuerberater_street' => 'fa_steuerberater_street',
+ 'FA_steuerberater_tel' => 'fa_steuerberater_tel',
+ 'FA_voranmeld' => 'fa_voranmeld',
+ );
+
+ my $filename = $::lx_office_conf{paths}{userspath}."/finanzamt.ini";
+ my $FACONF;
+ return unless (open( $FACONF, "<", $filename));
+
+ while (<$FACONF>) {
+ last if (/^\[/);
+ next if (/^(\#|\s)/);
+
+ # remove comments
+ s/\s#.*//g;
+
+ # remove any trailing whitespace
+ s/^\s*(.*?)\s*$/$1/;
+ my ($key, $value) = split(/=/, $_, 2);
+
+ $main::lxdebug->message(LXDebug->DEBUG2(), "oldkey: ".$key." val=".$value." newkey=".
+ $oldkeys{$key}." oval=".$::form->{$oldkeys{$key}});
+ if ( $oldkeys{$key} && $::form->{$oldkeys{$key}} eq '' ) {
+ $::form->{$oldkeys{$key}} = $::locale->{iconv_utf8}->convert($value);
+ $main::lxdebug->message(LXDebug->DEBUG2(), "set ".$oldkeys{$key}."=".$::form->{$oldkeys{$key}});
+ $ret = 1;
+ }
+ }
+ $main::lxdebug->leave_sub();
+ return $ret;