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:

bin/mozilla/wh.pl
625 625
  my $sort_col     = $form->{sort};
626 626

  
627 627
  my %filter;
628
  my @columns = qw(warehousedescription bindescription partnumber partdescription chargenumber qty);
628
  my @columns = qw(warehousedescription bindescription partnumber partdescription chargenumber qty stock_value);
629 629

  
630 630
  # filter stuff
631 631
  map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id partnumber description chargenumber);
......
655 655
    'partdescription'      => { 'text' => $locale->text('Description'), },
656 656
    'chargenumber'         => { 'text' => $locale->text('Charge Number'), },
657 657
    'qty'                  => { 'text' => $locale->text('Qty'), },
658
    'stock_value'          => { 'text' => $locale->text('Stock value'), },
658 659
  );
659 660

  
660 661
  my $href = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables);
661 662
  map { $column_defs{$_}->{link} = $href . "&sort=${_}&order=" . Q($_ eq $sort_col ? 1 - $form->{order} : $form->{order}) } @columns;
662 663

  
663
  my %column_alignment = map { $_ => 'right' } qw(qty);
664
  my %column_alignment = map { $_ => 'right' } qw(qty stock_value);
664 665

  
665 666
  map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns;
666 667

  
......
679 680
  my $all_units = AM->retrieve_units(\%myconfig, $form);
680 681
  my @contents  = WH->get_warehouse_report(%filter);
681 682

  
682
  my $subtotal  = 0;
683 683
  my $idx       = 0;
684 684

  
685
  my @subtotals_columns = qw(qty stock_value);
686
  my %subtotals         = map { $_ => 0 } @subtotals_columns;
687

  
688
  my $total_stock_value = 0;
689

  
685 690
  foreach $entry (@contents) {
686
    $subtotal     += $entry->{qty};
687
    $entry->{qty}  = $form->format_amount_units('amount'     => $entry->{qty},
688
                                                'part_unit'  => $entry->{partunit},
689
                                                'conv_units' => 'convertible');
691
    map { $subtotals{$_} += $entry->{$_} } @subtotals_columns;
692
    $total_stock_value   += $entry->{stock_value} * 1;
693

  
694
    $entry->{qty}         = $form->format_amount_units('amount'     => $entry->{qty},
695
                                                       'part_unit'  => $entry->{partunit},
696
                                                       'conv_units' => 'convertible');
697
    $entry->{stock_value} = $form->format_amount(\%myconfig, $entry->{stock_value} * 1, 2);
690 698

  
691 699
    $row_set = [ { map { $_ => { 'data' => $entry->{$_}, 'align' => $column_alignment{$_} } } @columns } ];
692 700

  
......
695 703
            || ($entry->{$sort_col} ne $contents[$idx + 1]->{$sort_col}))) {
696 704

  
697 705
      my $row = { map { $_ => { 'data' => '', 'class' => 'listsubtotal', 'align' => $column_alignment{$_}, } } @columns };
698
      $row->{qty}->{data} = $form->format_amount_units('amount'     => $subtotal,
699
                                                       'part_unit'  => $entry->{partunit},
700
                                                       'conv_units' => 'convertible');
701
      $subtotal = 0;
706
      $row->{qty}->{data}         = $form->format_amount_units('amount'     => $subtotals{qty} * 1,
707
                                                               'part_unit'  => $entry->{partunit},
708
                                                               'conv_units' => 'convertible');
709
      $row->{stock_value}->{data} = $form->format_amount(\%myconfig, $subtotals{stock_value} * 1, 2);
710

  
711
      %subtotals                  = map { $_ => 0 } @subtotals_columns;
702 712

  
703 713
      push @{ $row_set }, $row;
704 714
    }
......
708 718
    $idx++;
709 719
  }
710 720

  
721
  if ($column_defs{stock_value}->{visible}) {
722
    $report->add_separator();
723

  
724
    my $row                      = { map { $_ => { 'data' => '', 'class' => 'listsubtotal', } } @columns };
725

  
726
    my $left_col                 = first { $column_defs{$_}->{visible} } @columns;
727

  
728
    $row->{$left_col}->{data}    = $locale->text('Total stock value');
729
    $row->{stock_value}->{data}  = $form->format_amount(\%myconfig, $total_stock_value, 2);
730
    $row->{stock_value}->{align} = 'right';
731

  
732
    $report->add_data($row);
733
  }
734

  
711 735
  $report->generate_with_headers();
712 736

  
713 737
  $lxdebug->leave_sub();

Auch abrufbar als: Unified diff