Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c510d88b

Von Sven Schöling vor etwa 15 Jahren hinzugefügt

und die restlichen .pm Module.

Unterschiede anzeigen:

SL/DATEV.pm
36 36
use File::Path;
37 37
use Time::HiRes qw(gettimeofday);
38 38

  
39
use strict;
40

  
39 41
sub _get_export_path {
40 42
  $main::lxdebug->enter_sub();
41 43

  
......
125 127
  # connect to database
126 128
  my $dbh = $form->dbconnect($myconfig);
127 129

  
128
  $query = qq|SELECT * FROM datev|;
129
  $sth   = $dbh->prepare($query);
130
  my $query = qq|SELECT * FROM datev|;
131
  my $sth   = $dbh->prepare($query);
130 132
  $sth->execute || $form->dberror($query);
131 133

  
132
  my $ref = $sth->fetchrow_hashref(NAME_lc);
134
  my $ref = $sth->fetchrow_hashref("NAME_lc");
133 135

  
134 136
  map { $form->{$_} = $ref->{$_} } keys %$ref;
135 137

  
......
146 148
  # connect to database
147 149
  my $dbh = $form->dbconnect_noauto($myconfig);
148 150

  
149
  $query = qq|DELETE FROM datev|;
151
  my $query = qq|DELETE FROM datev|;
150 152
  $dbh->do($query) || $form->dberror($query);
151 153

  
152 154
  $query = qq|INSERT INTO datev
......
159 161
    . $dbh->quote($form->{mandantennr}) . qq|,|
160 162
    . $dbh->quote($form->{datentraegernr}) . qq|,|
161 163
    . $dbh->quote($form->{abrechnungsnr}) . qq|)|;
162
  $sth = $dbh->prepare($query);
164
  my $sth = $dbh->prepare($query);
163 165
  $sth->execute || $form->dberror($query);
164 166
  $sth->finish;
165 167

  
......
201 203
  $main::lxdebug->enter_sub();
202 204

  
203 205
  my ($zeitraum, $monat, $quartal, $transdatefrom, $transdateto) = @_;
206
  my ($fromto, $jahr, $leap);
207

  
208
  my $form = $main::form;
204 209

  
205 210
  $fromto = "transdate >= ";
206 211

  
......
322 327

  
323 328
  my $dbh      =  $form->get_standard_dbh($myconfig);
324 329

  
330
  my ($notsplitindex);
325 331
  my @errors   = ();
326 332

  
327 333
  $fromto      =~ s/transdate/ac\.transdate/g;
......
379 385
  my $sth = prepare_execute_query($form, $dbh, $query);
380 386

  
381 387
  my $counter = 0;
382
  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
388
  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
383 389
    $counter++;
384 390
    if (($counter % 500) == 0) {
385 391
      print("$counter ");
......
391 397
    my $firstrun = 1;
392 398

  
393 399
    while (abs($count) > 0.01 || $firstrun) {
394
      my $ref2 = $sth->fetchrow_hashref(NAME_lc);
400
      my $ref2 = $sth->fetchrow_hashref("NAME_lc");
395 401
      last unless ($ref2);
396 402

  
397 403
      if ($ref2->{trans_id} != $trans->[0]->{trans_id}) {
......
490 496

  
491 497
    my $idx        = 0;
492 498
    my $correction = 0;
499
    our @taxed;          # most likely defunct
493 500
    while (abs($absumsatz) >= 0.01) {
494 501
      if ($idx >= scalar @taxed) {
495 502
        last if (!$correction);
......
542 549
  $main::lxdebug->enter_sub();
543 550

  
544 551
  my ($myconfig, $form, $fromto, $start_jahr) = @_;
552
  my ($primanota);
545 553

  
546 554
  my $jahr = $start_jahr;
547 555
  if (!$jahr) {
......
626 634

  
627 635
  my ($date, $six) = @_;
628 636

  
629
  ($day, $month, $year) = split(/\./, $date);
637
  my ($day, $month, $year) = split(/\./, $date);
630 638

  
631 639
  if ($day =~ /^0/) {
632 640
    $day = substr($day, 1, 1);
......
668 676
  if ($fromto ne "") {
669 677
    $versionset .= "0000" . substr($header, 28, 19);
670 678
  } else {
671
    $datum = " " x 16;
679
    my $datum = " " x 16;
672 680
    $versionset .= $datum . "001" . substr($header, 28, 4);
673 681
  }
674 682

  
......
711 719
  my $export_path = _get_export_path() . "/";
712 720
  my $filename    = "ED00000";
713 721
  my $evfile      = "EV01";
714
  my @ed_versionsets;
722
  my @ed_versionset;
715 723
  my $fileno = 0;
716 724

  
717 725
  $form->header;
......
721 729
  Buchungssätze verarbeitet:
722 730
|;
723 731

  
724
  ($fromto, $start_jahr) =
732
  my ($fromto, $start_jahr) =
725 733
    &get_dates($form->{zeitraum}, $form->{monat},
726 734
               $form->{quartal},  $form->{transdatefrom},
727 735
               $form->{transdateto});
......
733 741
    $filename++;
734 742
    my $ed_filename = $export_path . $filename;
735 743
    push(@filenames, $filename);
736
    $header = &make_kne_data_header($myconfig, $form, $fromto, $start_jahr);
744
    my $header = &make_kne_data_header($myconfig, $form, $fromto, $start_jahr);
737 745

  
738 746
    my $kne_file = SL::DATEV::KNEFile->new();
739 747
    $kne_file->add_block($header);
740 748

  
741 749
    while (scalar(@{ $form->{DATEV} }) > 0) {
742
      $transaction = shift @{ $form->{DATEV} };
743
      $trans_lines = scalar(@{$transaction});
750
      my $transaction = shift @{ $form->{DATEV} };
751
      my $trans_lines = scalar(@{$transaction});
744 752
      $counter++;
745 753
      if (($counter % 500) == 0) {
746 754
        print("$counter ");
......
757 765
      my $datevautomatik = 0;
758 766
      my $taxkey         = 0;
759 767
      my $charttax       = 0;
768
      my ($haben, $soll);
760 769
      my $iconv          = $main::locale->{iconv_iso8859};
761 770
      my %umlaute = ($iconv->convert('?') => 'ae',
762 771
                     $iconv->convert('?') => 'oe',
......
792 801
      }
793 802

  
794 803
      # Umwandlung von Umlauten und Sonderzeichen in erlaubte Zeichen bei Textfeldern
795
      foreach $umlaut (keys(%umlaute)) {
804
      foreach my $umlaut (keys(%umlaute)) {
796 805
        $transaction->[$haben]->{'invnumber'} =~ s/${umlaut}/${umlaute{$umlaut}}/g;
797 806
        $transaction->[$haben]->{'name'}      =~ s/${umlaut}/${umlaute{$umlaut}}/g;
798 807
      }
......
856 865
  }
857 866

  
858 867
  #Make EV Verwaltungsdatei
859
  $ev_header = &make_ev_header($form, $fileno);
860
  $ev_filename = $export_path . $evfile;
868
  my $ev_header = &make_ev_header($form, $fileno);
869
  my $ev_filename = $export_path . $evfile;
861 870
  push(@filenames, $evfile);
862 871
  open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n";
863 872
  print(EV $ev_header);
864 873

  
865
  foreach $file (@ed_versionset) {
874
  foreach my $file (@ed_versionset) {
866 875
    print(EV $ed_versionset[$file]);
867 876
  }
868 877
  close(EV);
......
891 900
  my $export_path = _get_export_path() . "/";
892 901
  my $filename    = "ED00000";
893 902
  my $evfile      = "EV01";
894
  my @ed_versionsets;
903
  my @ed_versionset;
895 904
  my $fileno          = 1;
896 905
  my $i               = 0;
897 906
  my $blockcount      = 1;
......
902 911
  my $ed_filename = $export_path . $filename;
903 912
  push(@filenames, $filename);
904 913
  open(ED, "> $ed_filename") or die "can't open outputfile: $!\n";
905
  $header = &make_kne_data_header($myconfig, $form, "");
914
  my $header = &make_kne_data_header($myconfig, $form, "");
906 915
  $remaining_bytes -= length($header);
907 916

  
917
  my $fuellzeichen;
918
  our $fromto;
919

  
908 920
  # connect to database
909 921
  my $dbh = $form->dbconnect($myconfig);
910 922

  
......
928 940
  my $sth = $dbh->prepare($query);
929 941
  $sth->execute(@values) || $form->dberror($query);
930 942

  
931
  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
943
  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
932 944
    if (($remaining_bytes - length("t" . $ref->{'accno'})) <= 6) {
933 945
      $fuellzeichen = ($blockcount * 256 - length($buchungssatz . $header));
934 946
      $buchungssatz .= "\x00" x $fuellzeichen;
......
958 970
  print(ED $header);
959 971
  print(ED $buchungssatz);
960 972
  $fuellzeichen = 256 - (length($header . $buchungssatz . "z") % 256);
961
  $dateiende = "\x00" x $fuellzeichen;
973
  my $dateiende = "\x00" x $fuellzeichen;
962 974
  print(ED "z");
963 975
  print(ED $dateiende);
964 976
  close(ED);
......
967 979
  $ed_versionset[0] =
968 980
    &make_ed_versionset($header, $filename, $blockcount, $fromto);
969 981

  
970
  $ev_header = &make_ev_header($form, $fileno);
971
  $ev_filename = $export_path . $evfile;
982
  my $ev_header = &make_ev_header($form, $fileno);
983
  my $ev_filename = $export_path . $evfile;
972 984
  push(@filenames, $evfile);
973 985
  open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n";
974 986
  print(EV $ev_header);
975 987

  
976
  foreach $file (@ed_versionset) {
988
  foreach my $file (@ed_versionset) {
977 989
    print(EV $ed_versionset[$file]);
978 990
  }
979 991
  close(EV);

Auch abrufbar als: Unified diff