Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2f6636f6

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

  • ID 2f6636f68edda5b8a47afd16fda868033a7076ec
  • Vorgänger fe901661
  • Nachfolger 5c25bb6b

Listenpreis in Belegen u. Ausdruck richtig formatieren und nicht mehr parsen.

listprice wird in den Belegen nur angezeigt. Man kann ihn nicht eingeben und
auch nicht speichern. Deshalb wird er jetzt nur zur Ausgabe formatiert
(io.pl:display_row, OE.pm:order_details, IS.pm:invoice_details), aber nicht
formatiert gespeichert.
io.pl:display_row schreibt ihn auch unformatiert als hidden in die Form.

Das war wohl so gedacht, aber nicht konsequent eingehalten und auch von mir an
einigen Stellen "verschlimmbessert" worden.

Evtl. sollte der listprice gar nicht als hidden mitgeschliffen werden, sondern
immer aus der DB gelesen werden.

behebt #46 (redmine)

Unterschiede anzeigen:

SL/DB/Helper/FlattenToForm.pm
62 62

  
63 63
    $form->{"partsgroup_${idx}"} = $item->part->partsgroup->partsgroup if _has($item->part, 'partsgroup_id');
64 64
    _copy($item->part,    $form, '',        "_${idx}", 0,               qw(id partnumber weight));
65
    _copy($item->part,    $form, '',        "_${idx}", $format_amounts, qw(listprice));
65
    _copy($item->part,    $form, '',        "_${idx}", 0,               qw(listprice));
66 66
    _copy($item,          $form, '',        "_${idx}", 0,               qw(description project_id ship serialnumber pricegroup_id ordnumber donumber cusordnumber unit
67 67
                                                                           subtotal longdescription price_factor_id marge_price_factor approved_sellprice reqdate transdate));
68 68
    _copy($item,          $form, '',        "_${idx}", $format_amounts, qw(qty sellprice marge_total marge_percent lastcost));
SL/IS.pm
220 220
      push @{ $form->{TEMPLATE_ARRAYS}->{price_factor_name} }, $price_factor->{description};
221 221
      push @{ $form->{TEMPLATE_ARRAYS}->{partsgroup} },        $form->{"partsgroup_$i"};
222 222
      push @{ $form->{TEMPLATE_ARRAYS}->{reqdate} },           $form->{"reqdate_$i"};
223
      push(@{ $form->{TEMPLATE_ARRAYS}->{listprice} },         $form->{"listprice_$i"});
223
      push @{ $form->{TEMPLATE_ARRAYS}->{listprice} },         $form->format_amount($myconfig, $form->{"listprice_$i"}, 2);
224
      push(@{ $form->{TEMPLATE_ARRAYS}->{listprice_nofmt} },   $form->{"listprice_$i"});
224 225

  
225 226
      my $sellprice     = $form->parse_amount($myconfig, $form->{"sellprice_$i"});
226 227
      my ($dec)         = ($sellprice =~ /\.(\d+)/);
SL/OE.pm
1295 1295
      push @{ $form->{TEMPLATE_ARRAYS}->{reqdate} },           $form->{"reqdate_$i"};
1296 1296
      push @{ $form->{TEMPLATE_ARRAYS}->{sellprice} },         $form->{"sellprice_$i"};
1297 1297
      push @{ $form->{TEMPLATE_ARRAYS}->{sellprice_nofmt} },   $form->parse_amount($myconfig, $form->{"sellprice_$i"});
1298
      push @{ $form->{TEMPLATE_ARRAYS}->{listprice} },         $form->{"listprice_$i"};
1298
      push @{ $form->{TEMPLATE_ARRAYS}->{listprice} },         $form->format_amount($myconfig, $form->{"listprice_$i"}, 2);
1299
      push @{ $form->{TEMPLATE_ARRAYS}->{listprice_nofmt} },   $form->{"listprice_$i"};
1299 1300
      push @{ $form->{TEMPLATE_ARRAYS}->{price_factor} },      $price_factor->{formatted_factor};
1300 1301
      push @{ $form->{TEMPLATE_ARRAYS}->{price_factor_name} }, $price_factor->{description};
1301 1302
      push @{ $form->{TEMPLATE_ARRAYS}->{partsgroup} },        $form->{"partsgroup_$i"};
bin/mozilla/do.pl
820 820
        }
821 821
      }
822 822
    }
823
    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice listprice lastcost basefactor);
823
    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice lastcost basefactor);
824 824
    $form->{"donumber_$i"} = $form->{donumber};
825 825
    $form->{"converted_from_delivery_order_items_id_$i"} = delete $form->{"delivery_order_items_id_$i"};
826 826
  }
bin/mozilla/io.pl
420 420
                   $locale->text('EK'), $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, $decimalplaces) }
421 421
      if $form->{"id_$i"} && ($form->{type} =~ /^sales_/ ||  $form->{type} =~ /invoice/ || $form->{type} =~ /^credit_note$/ ) && !$is_delivery_order;
422 422

  
423
    $form->{"listprice_$i"} = $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2)
424
      if $form->{"id_$i"} && ($form->{type} =~ /^sales_/ ||  $form->{type} =~ /invoice/) ;
425 423
# / marge calculations ending
426 424

  
427 425
# Calculate total weight
......
557 555
  }
558 556

  
559 557
  map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
560
    qw(sellprice listprice weight);
558
    qw(sellprice weight);
561 559

  
562 560
  if ( $mode eq 'IC' ) {
563 561
    # assembly mode:
......
667 665
    map {
668 666
      $form->{"${_}_$i"} =
669 667
          $form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces)
670
    } qw(sellprice listprice lastcost qty) if $form->{item} ne 'assembly';
668
    } qw(sellprice lastcost qty) if $form->{item} ne 'assembly';
671 669
    $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100.0) if $form->{item} ne 'assembly';
672 670

  
673 671
    delete $form->{nextsub};
......
728 726
    #$form->{sellprice} = 0;
729 727
    $form->{weight}    = 0;
730 728
    map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
731
      qw(listprice sellprice rop stock);
729
      qw(sellprice rop stock);
732 730

  
733 731
    my @flds = qw(id qty unit bom partnumber description sellprice weight runningnumber partsgroup lastcost);
734 732

  
......
934 932
  for my $i (1 .. $form->{rowcount}) {
935 933
    map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"})
936 934
            if ($form->{"${_}_${i}"}) }
937
        qw(ship qty sellprice listprice basefactor discount));
935
        qw(ship qty sellprice basefactor discount));
938 936
    $form->{"converted_from_invoice_id_$i"} = delete $form->{"invoice_id_$i"};
939 937
  }
940 938

  
......
1002 1000
    map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig,
1003 1001
                                                     $form->{"${_}_${i}"})
1004 1002
            if ($form->{"${_}_${i}"}) }
1005
        qw(ship qty sellprice listprice basefactor discount lastcost));
1003
        qw(ship qty sellprice basefactor discount lastcost));
1006 1004
  }
1007 1005

  
1008 1006
  &prepare_order;
bin/mozilla/is.pl
1019 1019
#  map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1020 1020
#    qw(creditlimit creditremaining);
1021 1021

  
1022
  for my $i (1 .. $form->{rowcount}) {
1023
    for (qw(listprice)) {
1024
      $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"};
1025
    }
1026
  }
1027 1022
  # set new persistent ids for credit note and link previous invoice id
1028 1023
  $form->{"converted_from_invoice_id_$_"} = delete $form->{"invoice_id_$_"} for 1 .. $form->{"rowcount"};
1029 1024

  
bin/mozilla/oe.pl
1445 1445
  $form->{cp_id} *= 1;
1446 1446

  
1447 1447
  for my $i (1 .. $form->{rowcount}) {
1448
    for (qw(ship qty sellprice listprice basefactor)) {
1448
    for (qw(ship qty sellprice basefactor)) {
1449 1449
      $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"};
1450 1450
    }
1451 1451
    $form->{"converted_from_orderitems_id_$i"} = delete $form->{"orderitems_id_$i"};
......
1847 1847
  };
1848 1848

  
1849 1849
  for my $i (1 .. $form->{rowcount}) {
1850
    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor discount lastcost);
1850
    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice basefactor discount lastcost);
1851 1851
  }
1852 1852

  
1853 1853
  my %saved_vars = map { $_ => $form->{$_} } grep { $form->{$_} } qw(currency);
......
1909 1909
  delete @{$form}{qw(id subject message cc bcc printed emailed queued creditlimit creditremaining discount tradediscount oldinvtotal closed delivered)};
1910 1910

  
1911 1911
  for my $i (1 .. $form->{rowcount}) {
1912
    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice lastcost basefactor discount);
1912
    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice lastcost basefactor discount);
1913 1913
    $form->{"converted_from_orderitems_id_$i"} = delete $form->{"orderitems_id_$i"};
1914 1914
  }
1915 1915

  

Auch abrufbar als: Unified diff