Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 83f2cb78

Von Moritz Bunkus vor fast 2 Jahren hinzugefügt

  • ID 83f2cb7891ffb97c0de64b9150f6b8d41b4c9729
  • Vorgänger ced6ec1d
  • Nachfolger df365c93

Sortimentsstammdaten: Exportmöglichkeit für Bestandteilliste als CSV

Unterschiede anzeigen:

SL/Controller/Part.pm
693 693
  }
694 694
}
695 695

  
696
sub action_export_assembly_components {
696
sub action_export_assembly_assortment_components {
697 697
  my ($self) = @_;
698 698

  
699
  my $bom_or_charge = $self->part->is_assembly ? 'bom' : 'charge';
700

  
699 701
  my @rows = ([
700 702
    $::locale->text('Partnumber'),
701 703
    $::locale->text('Description'),
......
703 705
    $::locale->text('Classification'),
704 706
    $::locale->text('Qty'),
705 707
    $::locale->text('Unit'),
706
    $::locale->text('BOM'),
708
    $self->part->is_assembly ? $::locale->text('BOM') : $::locale->text('Charge'),
707 709
    $::locale->text('Line Total'),
708 710
    $::locale->text('Sellprice'),
709 711
    $::locale->text('Lastcost'),
......
720 722
      SL::Presenter::Part::classification_abbreviation($part->classification_id),
721 723
      $item->qty_as_number,
722 724
      $part->unit,
723
      $item->bom ? $::locale->text('yes') : $::locale->text('no'),
725
      $item->$bom_or_charge ? $::locale->text('yes') : $::locale->text('no'),
724 726
      $::form->format_amount(\%::myconfig, $item->linetotal_sellprice, 3, 0),
725 727
      $part->sellprice_as_number,
726 728
      $part->lastcost_as_number,
......
744 746

  
745 747
  $file_handle->close;
746 748

  
747
  my $timestamp       = strftime('_%Y-%m-%d_%H-%M-%S', localtime());
749
  my $type_prefix     = $self->part->is_assembly ? 'assembly' : 'assortment';
748 750
  my $part_number     = $self->part->partnumber;
749 751
  $part_number        =~ s{[^[:word:]]+}{_}g;
750
  my $attachment_name = sprintf('assembly_components_%s_%s.csv', $part_number, $timestamp);
752
  my $timestamp       = strftime('_%Y-%m-%d_%H-%M-%S', localtime());
753
  my $attachment_name = sprintf('%s_components_%s_%s.csv', $type_prefix, $part_number, $timestamp);
751 754

  
752 755
  $self->send_file(
753 756
    $file_name,
......
1466 1469
      combobox => [
1467 1470
        action => [
1468 1471
          t8('Export'),
1469
          only_if => $self->part->is_assembly,
1472
          only_if => $self->part->is_assembly || $self->part->is_assortment,
1470 1473
        ],
1471 1474
        action => [
1472
          t8('Assembly items'),
1473
          submit   => [ '#ic', { action => "Part/export_assembly_components" } ],
1475
          $self->part->is_assembly ? t8('Assembly items') : t8('Assortment items'),
1476
          submit   => [ '#ic', { action => "Part/export_assembly_assortment_components" } ],
1474 1477
          checks   => ['kivi.validate_form'],
1475 1478
          disabled => !$self->part->id                                    ? t8('The object has not been saved yet.')
1476 1479
                    : !$may_edit                                          ? t8('You do not have the permissions to access this function.')
1477 1480
                    : !$::auth->assert('purchase_order_edit', 'may fail') ? t8('You do not have the permissions to access this function.')
1478 1481
                    :                                                       undef,
1479
          only_if  => $self->part->is_assembly,
1482
          only_if  => $self->part->is_assembly || $self->part->is_assortment,
1480 1483
        ],
1481 1484
      ],
1482 1485

  

Auch abrufbar als: Unified diff