# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1335, USA.
#======================================================================
#
# Datev export module
use SL::Common;
use SL::DATEV qw(:CONSTANTS);
+use SL::Locale::String qw(t8);
+use SL::DB::Department;
use strict;
my $stamm = SL::DATEV->new->get_datev_stamm;
+ setup_datev_export_action_bar();
+
$::form->header;
print $::form->parse_html_template('datev/export', $stamm);
$::lxdebug->enter_sub;
$::auth->assert('datev_export');
+ setup_datev_export2_action_bar();
+
$::form->header;
+ $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
+ $::form->{show_pk_option} = SL::DATEV->new->check_vcnumbers_are_valid_pk_numbers;
print $::form->parse_html_template('datev/export_bewegungsdaten');
$::lxdebug->leave_sub;
$::lxdebug->enter_sub;
$::auth->assert('datev_export');
+ setup_datev_export2_action_bar();
+
$::form->header;
print $::form->parse_html_template('datev/export_stammdaten');
my %data = (
exporttype => $::form->{exporttype} ? DATEV_ET_STAMM : DATEV_ET_BUCHUNGEN,
- format => $::form->{kne} ? DATEV_FORMAT_KNE : DATEV_FORMAT_OBE,
+ format => $::form->{kne} ? DATEV_FORMAT_KNE : $::form->{csv} ? DATEV_FORMAT_CSV : die "unknown format",
);
if ($::form->{exporttype} == DATEV_ET_STAMM) {
$::form->{zeitraum}, $::form->{monat}, $::form->{quartal},
$::form->{transdatefrom}, $::form->{transdateto},
);
+ $data{use_pk} = $::form->{use_pk};
} else {
die 'invalid exporttype';
}
$datev->export;
if (!$datev->errors) {
+ setup_datev_export3_action_bar(download_token => $datev->download_token);
+
$::form->header;
- print $::form->parse_html_template('datev/export3', { datev => $datev });
+ print $::form->parse_html_template('datev/export3', { WARNINGS => $datev->warnings });
} else {
$::form->error("Export schlug fehl.\n" . join "\n", $datev->errors);
}
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' ],
+ ],
+ );
+ }
+}