Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 138255b0

Von Stephan Köhler vor etwa 19 Jahren hinzugefügt

  • ID 138255b0f5442d2f414bd702d88a4e600562a6b3
  • Vorgänger 0bb0eb67
  • Nachfolger 42fc1e70

Merge von 607-609 aus unstable: Bugfix zu UBL
-Unbalanced Ledger Workaround... Betr. Bugzilla ID 124
-Neuer Patch gegen den Unbalanced Ledger!
Betr. Bugzilla ID 124
-Neuer Patch gegen den Unbalanced Ledger!
Test ob Demodatenbank den Unbalanced ist...
Betr. Bugzilla ID 124

Unterschiede anzeigen:

SL/GL.pm
424 424
        $ref->{credit_taxkey}{$l} = $ref->{taxkey};
425 425
      }
426 426
    }
427

  
428
    while (abs($balance) >= 0.015) {
429
      my $ref2 = $sth->fetchrow_hashref(NAME_lc)
430
        || $form->error("Unbalanced ledger!");
431

  
432
      $balance =
433
        (int($balance * 100000) + int(100000 * $ref2->{amount})) / 100000;
434
      print(STDERR $balance, " BAlance\n");
435
      if ($ref2->{amount} < 0) {
436
        if ($ref2->{chart_id} > 0) {
437
          if ($ref->{debit_tax_accno}{$i} ne "") {
438
            $i++;
439
          }
440
          $ref->{debit_tax}{$i}       = $ref2->{amount} * -1;
441
          $ref->{debit_tax_accno}{$i} = $ref2->{accno};
442
        } else {
443
          if ($ref->{debit_accno}{$k} ne "") {
444
            $k++;
445
          }
446
          $ref->{debit}{$k}        = $ref2->{amount} * -1;
447
          $ref->{debit_accno}{$k}  = $ref2->{accno};
448
          $ref->{debit_taxkey}{$k} = $ref2->{taxkey};
449
        }
450
      } else {
451
        if ($ref2->{chart_id} > 0) {
452
          if ($ref->{credit_tax_accno}{$j} ne "") {
453
            $j++;
454
          }
455
          $ref->{credit_tax}{$j}       = $ref2->{amount};
456
          $ref->{credit_tax_accno}{$j} = $ref2->{accno};
457
        } else {
458
          if ($ref->{credit_accno}{$l} ne "") {
459
            $l++;
460
          }
461
          $ref->{credit}{$l}        = $ref2->{amount};
462
          $ref->{credit_accno}{$l}  = $ref2->{accno};
463
          $ref->{credit_taxkey}{$l} = $ref2->{taxkey};
464
        }
465
      }
466
    }
467

  
427
#    if ($form->{accno} eq ''){ # flo & udo: if general report,
428
#                               # then check balance
429
#      while (abs($balance) >= 0.015) {
430
#        my $ref2 = $sth->fetchrow_hashref(NAME_lc)
431
#          || $form->error("Unbalanced ledger!");
432
#
433
#        $balance =
434
#          (int($balance * 100000) + int(100000 * $ref2->{amount})) / 100000;
435
#        print(STDERR $balance, " BAlance\n");
436
#        print(STDERR $ref2->{amount}, " Ref2->amount\n");
437
#        if ($ref2->{amount} < 0) {
438
#          if ($ref2->{chart_id} > 0) {
439
#            if ($ref->{debit_tax_accno}{$i} ne "") {
440
#              $i++;
441
#            }
442
#            $ref->{debit_tax}{$i}       = $ref2->{amount} * -1;
443
#            $ref->{debit_tax_accno}{$i} = $ref2->{accno};
444
#          } else {
445
#            if ($ref->{debit_accno}{$k} ne "") {
446
#              $k++;
447
#            }
448
#            $ref->{debit}{$k}        = $ref2->{amount} * -1;
449
#            $ref->{debit_accno}{$k}  = $ref2->{accno};
450
#            $ref->{debit_taxkey}{$k} = $ref2->{taxkey};
451
#          }
452
#        } else {
453
#          if ($ref2->{chart_id} > 0) {
454
#            if ($ref->{credit_tax_accno}{$j} ne "") {
455
#              $j++;
456
#            }
457
#            $ref->{credit_tax}{$j}       = $ref2->{amount};
458
#            $ref->{credit_tax_accno}{$j} = $ref2->{accno};
459
#          } else {
460
#            if ($ref->{credit_accno}{$l} ne "") {
461
#              $l++;
462
#            }
463
#            $ref->{credit}{$l}        = $ref2->{amount};
464
#            $ref->{credit_accno}{$l}  = $ref2->{accno};
465
#            $ref->{credit_taxkey}{$l} = $ref2->{taxkey};
466
#          }
467
#        }
468
#      }
469
#    } else {
470
#      # if account-report, then calculate the Balance?!
471
#      # ToDo: Calculate the Balance
472
#      1;
473
#    }
474
       
468 475
    #    print(STDERR Dumper($ref));
469 476
    push @{ $form->{GL} }, $ref;
470 477
    $balance = 0;
bin/mozilla/gl.pl
399 399

  
400 400
  $form->{title} = $locale->text('General Ledger');
401 401

  
402
  $ml = ($form->{ml} =~ /(A|E)/) ? -1 : 1;
402
  $ml = ($form->{ml} =~ /(A|E|Q)/) ? -1 : 1;
403 403

  
404 404
  unless ($form->{category} eq 'X') {
405 405
    $form->{title} .= " : " . $locale->text($acctype{ $form->{category} });
......
624 624
        </tr>
625 625
|;
626 626
  }
627

  
627
   $form->{balance} *= $ml;
628 628
  foreach $ref (@{ $form->{GL} }) {
629

  
629
    $form->{balance} *= $ml;
630 630
    # if item ne sort print subtotal
631 631
    if ($form->{l_subtotal} eq 'Y') {
632 632
      if ($sameitem ne $ref->{ $form->{sort} }) {
633 633
        &gl_subtotal;
634 634
      }
635 635
    }
636
    foreach $key (sort keys(%{ $ref->{amount} })) {
637
      $form->{balance} += $ref->{amount}{$key};
638
    }
636
    #foreach $key (sort keys(%{ $ref->{amount} })) {
637
    #  $form->{balance} += $ref->{amount}{$key};
638
    #}
639 639

  
640 640
    $debit = "";
641 641
    foreach $key (sort keys(%{ $ref->{debit} })) {
......
647 647
        $debit .=
648 648
          "<br>" . $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0);
649 649
      }
650
      $form->{balance} = abs($form->{balance}) - abs($ref->{debit}{$key});
650 651
    }
651 652

  
652 653
    $credit = "";
......
659 660
        $credit .= "<br>"
660 661
          . $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
661 662
      }
663
      $form->{balance} = abs($form->{balance}) - abs( $ref->{credit}{$key});
662 664
    }
663 665

  
664 666
    $debittax = "";
......
672 674
        $debittax .= "<br>"
673 675
          . $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0);
674 676
      }
677
      $form->{balance} = abs($form->{balance}) - abs($ref->{debit_tax}{$key});
675 678
    }
676 679

  
677 680
    $credittax = "";
......
685 688
        $credittax .= "<br>"
686 689
          . $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0);
687 690
      }
691
      $form->{balance} = abs($form->{balance}) - abs($ref->{credit_tax}{$key});
688 692
    }
689 693

  
690 694
    $debitaccno  = "";
......
777 781
      "<td><a href=$href&gifi_accno=$ref->{gifi_accno}&callback=$callback>$ref->{gifi_accno}</a>&nbsp;</td>";
778 782
    $column_data{balance} =
779 783
        "<td align=right>"
780
      . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)
784
      . $form->format_amount(\%myconfig, $form->{balance}, 2, 0)
781 785
      . "</td>";
782 786

  
783 787
    $i++;

Auch abrufbar als: Unified diff