if ($mode eq "monat") {
$fromdate = DateTime->new(day => 1, month => $month, year => DateTime->today->year);
+ # december export is usually in january/february
+ $fromdate = $fromdate->subtract(years => 1) if ($month == 12);
+
$todate = $fromdate->clone->add(months => 1)->add(days => -1);
} elsif ($mode eq "quartal") {
die 'quarter out of of bounds' if $quarter < 1 || $quarter > 4;