Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bbd8da97

Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt

  • ID bbd8da97d8ab15a358c1c905a9b4f164ed4db04d
  • Vorgänger aea509f8
  • Nachfolger 4c5ca4c0

Kosmetik; Code vereinfacht

Unterschiede anzeigen:

SL/DATEV.pm
275 275

  
276 276
  my $sth     = prepare_execute_query($form, $dbh, $query);
277 277

  
278
  my $g       = 0;
279
  my $counter = 0;
280 278
  my @splits;
279
  my $counter = 0;
281 280
  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
282 281
    $counter++;
283 282
    if (($counter % 500) == 0) {
......
315 314
        $taxid_taxkeys{$trans->[$j]->{'taxtaxkey'}}     = $trans->[$j]->{'taxid'};
316 315
      }
317 316
    }
318
    $ml = ($trans->[0]->{'umsatz'} > 0) ? 1 : -1;
317

  
318
    my $ml = ($trans->[0]->{'umsatz'} > 0) ? 1 : -1;
319 319
    for my $j (0 .. (scalar(@{$trans}) - 1)) {
320 320
      if (   ($j != $notsplitindex)
321 321
          && ($trans->[$j]->{'chart_id'}  eq "")
......
324 324
              || $trans->[$j]->{'taxkey'} eq "1"
325 325
              || $trans->[$j]->{'taxkey'} eq "10"
326 326
              || $trans->[$j]->{'taxkey'} eq "11")) {
327
        my %blubb = {};
328
        map({ $blubb{$_} = $trans->[$notsplitindex]->{$_}; } keys(%{ $trans->[$notsplitindex] }));
327
        my %new_trans = {};
328
        map({ $new_trans{$_} = $trans->[$notsplitindex]->{$_}; } keys(%{ $trans->[$notsplitindex] }));
329 329

  
330 330
        $absumsatz               += $trans->[$j]->{'amount'};
331
        $blubb{'amount'}          = $trans->[$j]->{'amount'} * (-1);
332
        $blubb{'umsatz'}          = abs($trans->[$j]->{'amount'}) * $ml;
331
        $new_trans{'amount'}      = $trans->[$j]->{'amount'} * (-1);
332
        $new_trans{'umsatz'}      = abs($trans->[$j]->{'amount'}) * $ml;
333 333
        $trans->[$j]->{'umsatz'}  = abs($trans->[$j]->{'amount'}) * $ml;
334 334

  
335
        push @{ $splits[$g] }, \%blubb;    #$trans->[$notsplitindex];
336
        push @{ $splits[$g] }, $trans->[$j];
337
        push @{ $form->{DATEV} }, \@{ $splits[$g] };
338

  
339
        $g++;
335
        push @splits, [ \%new_trans, $trans->[$j] ];
336
        push @{ $form->{DATEV} }, $splits[-1];
340 337

  
341 338
      } elsif (($j != $notsplitindex) && ($trans->[$j]->{'chart_id'} eq "")) {
342 339
        $absumsatz += ($trans->[$j]->{'amount'} * (1 + $taxes{ $taxid_taxkeys{$trans->[$j]->{'taxkey'}} }));
343 340

  
344
        my %blubb   = {};
345
        map({ $blubb{$_} = $trans->[$notsplitindex]->{$_}; } keys(%{ $trans->[$notsplitindex] }));
341
        my %new_trans = {};
342
        map({ $new_trans{$_} = $trans->[$notsplitindex]->{$_}; } keys(%{ $trans->[$notsplitindex] }));
346 343

  
347 344
        $test                    = 1 + $taxes{  $taxid_taxkeys{$trans->[$j]->{'taxkey'}} };
348
        $blubb{'amount'}         = $form->round_amount(($trans->[$j]->{'amount'} * $test * -1), 2);
349
        $blubb{'umsatz'}         = abs($form->round_amount(($trans->[$j]->{'amount'} * $test), 2)) * $ml;
345
        $new_trans{'amount'}     = $form->round_amount(($trans->[$j]->{'amount'} * $test * -1), 2);
346
        $new_trans{'umsatz'}     = abs($form->round_amount(($trans->[$j]->{'amount'} * $test), 2)) * $ml;
350 347
        $trans->[$j]->{'umsatz'} = abs($form->round_amount(($trans->[$j]->{'amount'} * $test), 2)) * $ml;
351 348

  
352
        push @{ $splits[$g] }, \%blubb;
353
        push @{ $splits[$g] }, $trans->[$j];
354
        push @{ $form->{DATEV} }, \@{ $splits[$g] };
355
        $g++;
349
        push @splits, [ \%new_trans, $trans->[$j] ];
350
        push @{ $form->{DATEV} }, $splits[-1];
356 351
      }
357 352
    }
358 353

  

Auch abrufbar als: Unified diff