Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1beca8de

Von Moritz Bunkus vor fast 11 Jahren hinzugefügt

  • ID 1beca8de27492157b3534d1b0fd432ce0286828a
  • Vorgänger b841f0fd
  • Nachfolger 0c298dbf

Umwandlung Angebot/Auftrag -> Lieferschein/Rechnung: Seriennummern bei Mengenberechnung berücksichtigen

Unterschiede anzeigen:

bin/mozilla/io.pl
1920 1920
  my @fields = map { s/_1$//; $_ } grep { m/_1$/ } keys %{ $::form };
1921 1921
  my @new_rows;
1922 1922

  
1923
  my $make_key = sub {
1924
    my ($row) = @_;
1925
    return $::form->{"id_${row}"} unless $::form->{"serialnumber_${row}"};
1926
    my $key = $::form->{"id_${row}"} . ':' . $::form->{"serialnumber_${row}"};
1927
    return exists $params{quantities}->{$key} ? $key : $::form->{"id_${row}"};
1928
  };
1929

  
1923 1930
  my $removed_rows = 0;
1924 1931
  my $row          = 0;
1925 1932
  while ($row < $::form->{rowcount}) {
......
1929 1936
    my $parts_id                      = $::form->{"id_$row"};
1930 1937
    my $base_qty                      = $::form->parse_amount(\%::myconfig, $::form->{"qty_$row"}) * SL::DB::Manager::Unit->find_by(name => $::form->{"unit_$row"})->base_factor;
1931 1938

  
1932
    my $sub_qty                       = min($base_qty, $params{quantities}->{$parts_id});
1933
    $params{quantities}->{$parts_id} -= $sub_qty;
1939
    my $key                           = $make_key->($row);
1940
    my $sub_qty                       = min($base_qty, $params{quantities}->{$key});
1941
    $params{quantities}->{$key}      -= $sub_qty;
1934 1942

  
1935 1943
    if (!$sub_qty || ($sub_qty != $base_qty)) {
1936 1944
      $::form->{"qty_${row}"} = $::form->format_amount(\%::myconfig, ($base_qty - $sub_qty) / SL::DB::Manager::Unit->find_by(name => $::form->{"unit_$row"})->base_factor);
bin/mozilla/oe.pl
2068 2068
    next if $ord_quot->is_sales != $record->is_sales;
2069 2069

  
2070 2070
    foreach my $item (@{ $record->items }) {
2071
      $handled_base_qtys{ $item->parts_id } += $item->qty * $item->unit_obj->base_factor;
2071
      my $key  = $item->parts_id;
2072
      $key    .= ':' . $item->serialnumber if $item->serialnumber;
2073
      $handled_base_qtys{$key} += $item->qty * $item->unit_obj->base_factor;
2072 2074
    }
2073 2075
  }
2074 2076

  

Auch abrufbar als: Unified diff