Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 82498fb7

Von Moritz Bunkus vor fast 16 Jahren hinzugefügt

  • ID 82498fb730310873bc3011070b6249034255354e
  • Vorgänger 09685616
  • Nachfolger 15dbafbb

Lagerbestandswert zum Lagerbericht ergänzt.

Unterschiede anzeigen:

SL/WH.pm
433 433
     "chargeid"             => "c.id",
434 434
     "warehousedescription" => "w.description",
435 435
     "partunit"             => "p.unit",
436
     "stock_value"          => "p.lastcost / COALESCE(pfac.factor, 1)",
436 437
  );
437 438
  my $select_clause = join ', ', map { +/^l_/; "$select_tokens{$'} AS $'" }
438 439
        ( grep( { !/qty/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form),
......
442 443
        ( grep( { !/qty/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form),
443 444
          qw(l_parts_id l_partunit) );
444 445

  
446
  my %join_tokens = (
447
    "stock_value" => "LEFT JOIN price_factors pfac ON (p.price_factor_id = pfac.id)",
448
    );
449

  
450
  my $joins = join ' ', grep { $_ } map { +/^l_/; $join_tokens{"$'"} }
451
        ( grep( { !/qty/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form),
452
          qw(l_parts_id l_qty l_partunit) );
453

  
445 454
  my $query =
446 455
    qq|SELECT $select_clause
447 456
      $columns
......
449 458
      LEFT JOIN parts     p ON i.parts_id     = p.id
450 459
      LEFT JOIN bin       b ON i.bin_id       = b.id
451 460
      LEFT JOIN warehouse w ON i.warehouse_id = w.id
461
      $joins
452 462
      WHERE $where_clause
453 463
      GROUP BY $group_clause $group_by
454 464
      ORDER BY $form->{sort}|;
......
477 487
      @all_fields                    = keys %{ $ref } unless (@all_fields);
478 488
    }
479 489

  
490
    $ref->{stock_value} *= $ref->{qty};
491

  
480 492
    push @contents, $ref;
481 493
  }
482 494

  

Auch abrufbar als: Unified diff