-sub make_kne_data_header {
- $main::lxdebug->enter_sub();
-
- my ($self, $form) = @_;
- my ($primanota);
-
- my $stamm = $self->get_datev_stamm;
-
- my $jahr = $self->from ? $self->from->year : DateTime->today->year;
-
- #Header
- my $header = "\x1D\x181";
- $header .= _fill($stamm->{datentraegernr}, 3, ' ', 'left');
- $header .= ($self->fromto) ? "11" : "13"; # Anwendungsnummer
- $header .= _fill($stamm->{dfvkz}, 2, '0');
- $header .= _fill($stamm->{beraternr}, 7, '0');
- $header .= _fill($stamm->{mandantennr}, 5, '0');
- $header .= _fill($stamm->{abrechnungsnr} . $jahr, 6, '0');
-
- $header .= $self->from ? $self->from->strftime('%d%m%y') : '';
- $header .= $self->to ? $self->to->strftime('%d%m%y') : '';
-
- if ($self->fromto) {
- $primanota = "001";
- $header .= $primanota;
- }
-
- $header .= _fill($stamm->{passwort}, 4, '0');
- $header .= " " x 16; # Anwendungsinfo
- $header .= " " x 16; # Inputinfo
- $header .= "\x79";
-
- #Versionssatz
- my $versionssatz = $self->exporttype == DATEV_ET_BUCHUNGEN ? "\xB5" . "1," : "\xB6" . "1,";
-
- my $query = qq|SELECT accno FROM chart LIMIT 1|;
- my $ref = selectfirst_hashref_query($form, $self->dbh, $query);
-
- $versionssatz .= length $ref->{accno};
- $versionssatz .= ",";
- $versionssatz .= length $ref->{accno};
- $versionssatz .= ",SELF" . "\x1C\x79";
-
- $header .= $versionssatz;
-
- $main::lxdebug->leave_sub();
-
- return $header;
-}
-
-sub datetofour {
- $main::lxdebug->enter_sub();
-
- my ($date, $six) = @_;
-
- my ($day, $month, $year) = split(/\./, $date);
-
- if ($day =~ /^0/) {
- $day = substr($day, 1, 1);
- }
- if (length($month) < 2) {
- $month = "0" . $month;
- }
- if (length($year) > 2) {
- $year = substr($year, -2, 2);
- }
-
- if ($six) {
- $date = $day . $month . $year;
- } else {
- $date = $day . $month;
- }
-
- $main::lxdebug->leave_sub();
-
- return $date;
-}
-
-sub trim_leading_zeroes {
- my $str = shift;
-
- $str =~ s/^0+//g;
-
- return $str;
-}
-
-sub make_ed_versionset {
- $main::lxdebug->enter_sub();
-
- my ($self, $header, $filename, $blockcount) = @_;
-
- my $versionset = "V" . substr($filename, 2, 5);
- $versionset .= substr($header, 6, 22);
-
- if ($self->fromto) {
- $versionset .= "0000" . substr($header, 28, 19);
- } else {
- my $datum = " " x 16;
- $versionset .= $datum . "001" . substr($header, 28, 4);
- }
-
- $versionset .= _fill($blockcount, 5, '0');
- $versionset .= "001";
- $versionset .= " 1";
- $versionset .= substr($header, -12, 10) . " ";
- $versionset .= " " x 53;
-
- $main::lxdebug->leave_sub();
-
- return $versionset;
-}
-
-sub make_ev_header {
- $main::lxdebug->enter_sub();
-
- my ($self, $form, $fileno) = @_;
-
- my $stamm = $self->get_datev_stamm;
-
- my $ev_header = _fill($stamm->{datentraegernr}, 3, ' ', 'left');
- $ev_header .= " ";
- $ev_header .= _fill($stamm->{beraternr}, 7, ' ', 'left');
- $ev_header .= _fill($stamm->{beratername}, 9, ' ', 'left');
- $ev_header .= " ";
- $ev_header .= (_fill($fileno, 5, '0')) x 2;
- $ev_header .= " " x 95;
-
- $main::lxdebug->leave_sub();
-
- return $ev_header;
-}
-
-sub kne_buchungsexport {
- $main::lxdebug->enter_sub();
-