+
+sub _get_dates {
+ $::lxdebug->enter_sub;
+
+ my ($mode, $month, $quarter, $transdatefrom, $transdateto) = @_;
+ my ($fromdate, $todate);
+
+ if ($mode eq "monat") {
+ $fromdate = DateTime->new(day => 1, month => $month, year => DateTime->today->year);
+ $todate = $fromdate->clone->add(months => 1)->add(days => -1);
+ } elsif ($mode eq "quartal") {
+ die 'quarter out of of bounds' if $quarter < 1 || $quarter > 4;
+ $fromdate = DateTime->new(day => 1, month => (3 * $quarter - 2), year => DateTime->today->year);
+ $todate = $fromdate->clone->add(months => 3)->add(days => -1);
+ } elsif ($mode eq "zeit") {
+ $fromdate = DateTime->from_lxoffice($transdatefrom);
+ $todate = DateTime->from_lxoffice($transdateto);
+ die 'need from and to time' unless $fromdate && $todate;
+ } else {
+ die 'undefined interval mode';
+ }
+
+ $::lxdebug->leave_sub;
+
+ return ($fromdate, $todate);
+}
+
+sub setup_datev_export_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Continue'),
+ submit => [ '#form', { action => 'export2' } ],
+ accesskey => 'enter',
+ ],
+ );
+ }
+}
+
+sub setup_datev_export2_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Export'),
+ submit => [ '#form', { action => 'export3' } ],
+ accesskey => 'enter',
+ ],
+ action => [
+ t8('Back'),
+ call => [ 'kivi.history_back' ],
+ ],
+ );
+ }
+}
+
+sub setup_datev_export3_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ link => [
+ t8('Download'),
+ link => [ 'datev.pl?action=download&download_token=' . $::form->escape($params{download_token}) ],
+ ],
+ action => [
+ t8('Back'),
+ call => [ 'kivi.history_back' ],
+ ],
+ );
+ }
+}