Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 97908d77

Von Bernd Bleßmann vor mehr als 9 Jahren hinzugefügt

  • ID 97908d779dfe277a4482c1be2c7e919dfd28026b
  • Vorgänger dc83feb1
  • Nachfolger 33298084

parse/format-Fehler bei Rabatten behoben

Schon in der Maske eingegebene Rabatte wurden nicht geparsed,
Kunden-/Lieferanten und -Typ-Rabatte wurden teilweise ohne Berücksichtigung
schon eingegebener Rabatte gesetzt. Und beim Auswahl eines Artikels über die
Auswahlmaske, wurden Rabatte falsch formatiert.

behebt #50 (redmine) (unter anderem)

Unterschiede anzeigen:

bin/mozilla/do.pl
453 453
        $form->{"sellprice_$i"}          = $form->format_amount(\%myconfig, $form->{"sellprice_$i"});
454 454
        $form->{"lastcost_$i"}           = $form->format_amount(\%myconfig, $form->{"lastcost_$i"});
455 455
        $form->{"qty_$i"}                = $form->format_amount(\%myconfig, $form->{"qty_$i"});
456
        $form->{"discount_$i"}           = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100.0);
456 457
      }
457 458

  
458 459
      display_form();
bin/mozilla/io.pl
655 655
  }
656 656

  
657 657
  my $amount =
658
    $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) *
658
    $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"}) *
659 659
    $form->{"qty_$i"};
660 660
  map { $form->{"${_}_base"} += $amount }
661 661
    (split / /, $form->{"taxaccounts_$i"});
......
672 672
    $form->{"${_}_$i"} =
673 673
      $form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces)
674 674
  } qw(sellprice listprice lastcost qty) if $form->{item} ne 'assembly';
675
  $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100.0) if $form->{item} ne 'assembly';
675 676

  
676 677
  delete $form->{nextsub};
677 678

  
bin/mozilla/ir.pl
484 484

  
485 485
    my $rows = scalar @{ $form->{item_list} };
486 486

  
487
    $form->{"discount_$i"}   = $form->parse_amount(\%myconfig, $form->{"discount_$i"}) / 100.0;
488
    $form->{"discount_$i"} ||= $form->{vendor_discount};
489

  
487 490
    if ($rows) {
488 491
      $form->{"qty_$i"} = $form->parse_amount(\%myconfig, $form->{"qty_$i"});
489 492
      if( !$form->{"qty_$i"} ) {
......
500 503
        # override sellprice if there is one entered
501 504
        my $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
502 505

  
503
        # ergaenzung fuer bug 736 Lieferanten-Rabatt auch in Einkaufsrechnungen vorbelegen jb
504
        $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{vendor_discount} * 100 );
505 506
        map { $form->{item_list}[$i]{$_} =~ s/\"/"/g } qw(partnumber description unit);
506 507
        map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} } keys %{ $form->{item_list}[0] };
507 508

  
......
532 533
          $form->{"sellprice_$i"} /= $exchangerate;
533 534
        }
534 535

  
535
        my $amount                   = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"} / 100);
536
        my $amount                = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"});
536 537
        $form->{creditremaining} -= $amount;
537 538
        $form->{"sellprice_$i"}   = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
538 539
        $form->{"qty_$i"}         = $form->format_amount(\%myconfig, $form->{"qty_$i"},       $dec_qty);
540
        $form->{"discount_$i"}    = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100.0);
539 541
      }
540 542

  
541 543
      &display_form;
bin/mozilla/is.pl
554 554

  
555 555
    my $rows = scalar @{ $form->{item_list} };
556 556

  
557
    # Falls kein Kundenrabatt vorhanden ist, den aktuellen Rabatt nicht mit 0% überschreiben,
558
    # da hier der Anwender schon manual einen Wert eingetragen haben könnte (analog zu qty) Bugfix: 1412
559
    if ($form->{customer_discount}){
560
      $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{customer_discount} * 100);
561
    }
557
    $form->{"discount_$i"}   = $form->parse_amount(\%myconfig, $form->{"discount_$i"}) / 100.0;
558
    $form->{"discount_$i"} ||= $form->{customer_discount};
562 559

  
563 560
    if ($rows) {
564 561
      $form->{"qty_$i"} = $form->parse_amount(\%myconfig, $form->{"qty_$i"});
......
609 606

  
610 607
        $form->{"listprice_$i"} /= $exchangerate;
611 608

  
612
        my $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"} / 100);
609
        my $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"});
613 610
        map { $form->{"${_}_base"} = 0 }                                 split / /, $form->{taxaccounts};
614 611
        map { $form->{"${_}_base"} += $amount }                          split / /, $form->{"taxaccounts_$i"};
615 612
        map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } split / /, $form->{"taxaccounts_$i"} if !$form->{taxincluded};
......
618 615

  
619 616
        map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces) } qw(sellprice lastcost);
620 617

  
621
        $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
618
        $form->{"qty_$i"}      = $form->format_amount(\%myconfig, $form->{"qty_$i"});
619
        $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100.0);
622 620
      }
623 621

  
624 622
      &display_form;
bin/mozilla/oe.pl
631 631

  
632 632
    my $rows = scalar @{ $form->{item_list} };
633 633

  
634
    # hier ist das problem fuer bug 817 $form->{discount} wird nicht durchgeschliffen
635
    # ferner fallunterscheidung fuer verkauf oder einkauf s.a. bug 736 jb 04.05.2009
636
    # select discount as vendor_discount from vendor ||
637
    # select discount as customer_discount from customer
638
    $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"$form->{vc}_discount"} * 100);
634
    $form->{"discount_$i"}   = $form->parse_amount(\%myconfig, $form->{"discount_$i"}) / 100.0;
635
    $form->{"discount_$i"} ||= $form->{"$form->{vc}_discount"};
639 636

  
640 637
    $form->{"lastcost_$i"} = $form->parse_amount(\%myconfig, $form->{"lastcost_$i"});
641 638

  
......
693 690
          $form->{"sellprice_$i"} /= $exchangerate;   # if there is an exchange rate adjust sellprice
694 691
        }
695 692

  
696
        my $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"} / 100);
693
        my $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"});
697 694
        map { $form->{"${_}_base"} = 0 }                                 split / /, $form->{taxaccounts};
698 695
        map { $form->{"${_}_base"} += $amount }                          split / /, $form->{"taxaccounts_$i"};
699 696
        map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } split / /, $form->{taxaccounts} if !$form->{taxincluded};
......
703 700
        $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
704 701
        $form->{"lastcost_$i"}  = $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, $decimalplaces);
705 702
        $form->{"qty_$i"}       = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
703
        $form->{"discount_$i"}  = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100.0);
706 704
      }
707 705

  
708 706
      display_form();

Auch abrufbar als: Unified diff