Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 79b75e07

Von Jan Büren vor mehr als 3 Jahren hinzugefügt

  • ID 79b75e0750039323bc8a931c653c6b0964f35c0e
  • Vorgänger 01f65005
  • Nachfolger 639c7f18

Gefertigte Erzeugnisse wieder zerlegen

1 Ebene und Prüfung auf transfer_undo Intervall

Unterschiede anzeigen:

SL/WH.pm
519 519
     "comment"              => "i1.comment",
520 520
     "trans_type"           => "tt.description",
521 521
     "trans_id"             => "i1.trans_id",
522
     "id"                   => "i1.id",
522 523
     "oe_id"                => "COALESCE(i1.oe_id, i2.oe_id)",
523 524
     "invoice_id"           => "COALESCE(i1.invoice_id, i2.invoice_id)",
524 525
     "date"                 => "i1.shippingdate",
......
539 540
     };
540 541

  
541 542
  $form->{l_classification_id}  = 'Y';
543
  $form->{l_id}                 = 'Y';
542 544
  $form->{l_part_type}          = 'Y';
543 545
  $form->{l_itime}              = 'Y';
544 546
  $form->{l_invoice_id} = $form->{l_oe_id} if $form->{l_oe_id};
bin/mozilla/wh.pl
41 41
use SL::AM;
42 42
use SL::CVar;
43 43
use SL::CT;
44
use SL::Helper::Flash qw(flash_later);
44 45
use SL::IC;
45 46
use SL::WH;
46 47
use SL::OE;
48
# use SL::Helper::Inventory qw(produce_assembly);
47 49
use SL::Locale::String qw(t8);
48 50
use SL::ReportGenerator;
51
use SL::Presenter::Tag qw(checkbox_tag);
49 52
use SL::Presenter::Part;
50 53

  
54
use SL::DB::AssemblyInventoryPart;
51 55
use SL::DB::Part;
52 56

  
53 57
use Data::Dumper;
......
547 551
  $main::lxdebug->leave_sub();
548 552
}
549 553

  
554
sub disassemble_assembly {
555
  $main::lxdebug->enter_sub();
556

  
557
  $main::auth->assert('warehouse_management');
558

  
559
  my $form = $main::form;
560

  
561
  croak("No assembly ids") unless scalar @{ $form->{ids}} > 0;
562

  
563
  # fail safe, only allow disassemble in certain intervals
564
  my $undo_date  = DateTime->today->subtract(days => $::instance_conf->get_undo_transfer_interval);
565

  
566
  foreach my $assembly_id (@{ $::form->{ids}} )  {
567
    my $assembly_parts;
568
    $assembly_parts  = SL::DB::Manager::AssemblyInventoryPart->get_all(where => [ inventory_assembly_id => $assembly_id ]);
569
    $form->show_generic_error(t8('No relations found for #1', $assembly_id)) unless $assembly_parts;
570
    # check first entry for insertdate
571
    # everything in one transaction
572
    my $db = SL::DB::Inventory->new->db;
573
    $db->with_transaction(sub {
574
      my ($assembly_entry, $part_entry);
575
      foreach my $assembly_part (@{ $assembly_parts }) {
576
        die("No valid entry found") unless (ref($assembly_part)  eq 'SL::DB::AssemblyInventoryPart');
577
        # fail safe undo date
578
        die("Invalid time interval") unless DateTime->compare($assembly_part->itime, $undo_date);
579

  
580
        $assembly_entry //= $assembly_part->assembly;
581
        $part_entry       = $assembly_part->part;
582
        $assembly_part->delete;
583
        $part_entry->delete;
584
      }
585
      flash_later('info', t8("Disassembly successful for #1",  $assembly_entry->part->partnumber));
586

  
587
      $assembly_entry->delete;
588

  
589
      1;
590

  
591
    }) || die t8('error while disassembling assembly #1 : #2', $assembly_id)  . $db->error . "\n";
592

  
593
  }
594
  $main::lxdebug->leave_sub();
595
  $form->redirect;
596
}
597

  
550 598
# --------------------------------------------------------------------
551 599
# Journal
552 600
# --------------------------------------------------------------------
......
583 631
  my %myconfig = %main::myconfig;
584 632
  my $locale   = $main::locale;
585 633

  
634
  setup_wh_journal_list_all_action_bar();
586 635
  $form->{title}   = $locale->text("WHJournal");
587 636
  $form->{sort}  ||= 'date';
588 637

  
589 638
  $form->{report_generator_output_format} = 'HTML' if !$form->{report_generator_output_format};
590 639

  
591 640
  my %filter;
592
  my @columns = qw(trans_id date warehouse_from bin_from warehouse_to bin_to partnumber type_and_classific partdescription chargenumber bestbefore trans_type comment qty unit partunit employee oe_id projectnumber);
641
  my @columns = qw(ids trans_id date warehouse_from bin_from warehouse_to bin_to partnumber type_and_classific partdescription chargenumber bestbefore trans_type comment qty unit partunit employee oe_id projectnumber);
593 642

  
594 643
  # filter stuff
595 644
  map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id classification_id partnumber description chargenumber bestbefore transtype_id transtype_ids comment projectnumber);
......
634 683
  push @hidden_variables, qw(classification_id);
635 684

  
636 685
  my %column_defs = (
686
    'ids'             => { raw_header_data => checkbox_tag("", id => "check_all", checkall  => "[data-checkall=1]") },
637 687
    'date'            => { 'text' => $locale->text('Date'), },
638 688
    'trans_id'        => { 'text' => $locale->text('Trans Id'), },
639 689
    'trans_type'      => { 'text' => $locale->text('Trans Type'), },
......
674 724
  $column_defs{partunit}->{visible} = 1;
675 725
  $column_defs{type_and_classific}->{visible} = 1;
676 726
  $column_defs{type_and_classific}->{link} ='';
727
  $column_defs{ids}->{visible} = 1;
677 728

  
678 729
  $report->set_columns(%column_defs);
679 730
  $report->set_column_order(@columns);
......
706 757
    $entry->{type_and_classific} = SL::Presenter::Part::type_abbreviation($entry->{part_type}) .
707 758
                                   SL::Presenter::Part::classification_abbreviation($entry->{classification_id});
708 759
    $entry->{qty}        = $form->format_amount(\%myconfig, $entry->{qty});
760
    $entry->{assembled} = $entry->{trans_type} eq 'assembled' ? 1 : '';
709 761
    $entry->{trans_type} = $locale->text($entry->{trans_type});
710

  
711 762
    my $row = { };
712 763

  
713 764
    foreach my $column (@columns) {
......
717 768
      };
718 769
    }
719 770

  
720
    $row->{trans_type}->{raw_data} = $entry->{trans_type};
771
    $row->{ids}->{raw_data} = checkbox_tag("ids[]", value => $entry->{id}, "data-checkall" => 1) if $entry->{assembled};
721 772

  
773
    $row->{trans_type}->{raw_data} = $entry->{trans_type};
722 774
    if ($form->{l_oe_id}) {
723 775
      $row->{oe_id}->{data} = '';
724 776
      my $info              = $entry->{oe_id_info};
......
735 787
    $idx++;
736 788
  }
737 789

  
790

  
791
    $report->set_options(
792
      raw_top_info_text     => $form->parse_html_template('wh/report_top'),
793
      raw_bottom_info_text  => $form->parse_html_template('wh/report_bottom', { callback => $href }),
794
    );
738 795
  if ( ! $allrows ) {
739 796
      $pages->{max}  = SL::DB::Helper::Paginated::ceil($form->{maxrows}, $pages->{per_page}) || 1;
740 797
      $pages->{page} = $page < 1 ? 1: $page > $pages->{max} ? $pages->{max}: $page;
741 798
      $pages->{common} = [ grep { $_->{visible} } @{ SL::DB::Helper::Paginated::make_common_pages($pages->{page}, $pages->{max}) } ];
742 799

  
743
      $report->set_options('raw_bottom_info_text' => $form->parse_html_template('common/paginate',
800
      $report->set_options('raw_bottom_info_text' =>  $form->parse_html_template('wh/report_bottom', { callback => $href }) . $form->parse_html_template('common/paginate',
744 801
                                                            { 'pages' => $pages , 'base_url' => $href.'&sort='.$form->{sort}.'&order='.$form->{order}}) );
745 802
  }
746 803
  $report->generate_with_headers();
......
1190 1247
    );
1191 1248
  }
1192 1249
}
1250
sub setup_wh_journal_list_all_action_bar {
1251
  my ($action) = @_;
1252
  for my $bar ($::request->layout->get('actionbar')) {
1253
    $bar->add(
1254
      combobox => [
1255
        action => [ t8('Actions') ],
1256
        action => [
1257
          t8('Disassemble Assembly'),
1258
            submit => [ '#form', { action => 'disassemble_assembly' } ],
1259
            checks => [ [ 'kivi.check_if_entries_selected', '[name="ids[]"]' ] ],
1260
          ],
1261
        ],
1262
    );
1263
  }
1264
}
1265

  
1193 1266

  
1194 1267
1;
1195 1268

  
doc/changelog
36 36
     Mahnung
37 37

  
38 38
Kleinere neue Features und Detailverbesserungen:
39
  - Gefertigte Erzeugnisse können innerhalb des Zurücklagerungszeitraums
40
    wieder zerlegt werden. Die Aktion befindet sich im Lagerbuchungsbericht
39 41
  - E-Mail-Versand: Neben dem Freitext CC-Feld kann jetzt auch ein
40 42
    kivitendo Benutzer mittels einer Auswahlliste in CC gesetzt werden
41 43
  - Falls der Mandant zu jeder Buchung einen Beleg hinzufügen möchte,
locale/de/all
519 519
  'CANCELED'                    => 'Storniert',
520 520
  'CB Transaction'              => 'SB-Buchung',
521 521
  'CB Transactions'             => 'SB-Buchungen',
522
  'CC to Employee'              => 'CC an Mitarbeiter',
522 523
  'CN'                          => 'Kd-Nr.',
523 524
  'CR'                          => 'H',
524 525
  'CSS style for pictures'      => 'CSS Style für Bilder',
......
1063 1064
  'Direct debit revoked'        => 'Die Einzugsermächtigung wird widerrufen',
1064 1065
  'Directory'                   => 'Verzeichnis',
1065 1066
  'Disabled Price Sources'      => 'Deaktivierte Preisquellen',
1067
  'Disassemble Assembly'        => 'Erzeugnis zerlegen',
1068
  'Disassembly successful for #1' => 'Erzeugnis #1 erfolgreich zerlegt',
1066 1069
  'Discard duplicate entries in CSV file' => 'Doppelte Einträge in CSV-Datei verwerfen',
1067 1070
  'Discard entries with duplicates in database or CSV file' => 'Einträge aus CSV-Datei verwerfen, die es bereits in der Datenbank oder der CSV-Datei gibt',
1068 1071
  'Discount'                    => 'Rabatt',
......
1764 1767
  'Introduction of clients'     => 'Einführung von Mandanten',
1765 1768
  'Inv. Duedate'                => 'Rg. Fälligkeit',
1766 1769
  'Invalid'                     => 'Ungültig',
1770
  'Invalid assembly'            => 'Ungültiges Erzeugnis',
1771
  'Invalid bin'                 => '',
1767 1772
  'Invalid charge number: #1'   => 'Ungültige Chargennummer: #1',
1768 1773
  'Invalid combination of ledger account number length. Mismatch length of #1 with length of #2. Please check your account settings. ' => 'Ungültige Kombination der Nummernkreislänge der Sachkonten. Kann nicht eine Länge von #1 und eine Länge von #2 verarbeiten. Bitte entsprechend die Konteneinstellungen überprüfen.',
1769 1774
  'Invalid duration format'     => 'Falsches Format für Zeitdauer',
......
2145 2150
  'No profit and loss carried forward chart configured!' => 'Kein Verlustvortragskonto konfiguriert!',
2146 2151
  'No profit carried forward chart configured!' => 'Kein Gewinnvortragskonto konfiguriert!',
2147 2152
  'No quotations or orders have been created yet.' => 'Es wurden noch keine Angebote oder Aufträge angelegt.',
2153
  'No relations found for #1'   => 'Keine Relation für #1 gefunden',
2148 2154
  'No report with id #1'        => 'Es gibt keinen Report mit der Id #1',
2149 2155
  'No requirement spec templates have been created yet.' => 'Es wurden noch keine Pflichtenheftvorlagen angelegt.',
2150 2156
  'No results.'                 => 'Keine Artikel',
......
4248 4254
  'ea'                          => 'St.',
4249 4255
  'emailed to'                  => 'gemailt an',
4250 4256
  'empty'                       => 'leer',
4257
  'error while disassembling assembly #1 : #2' => 'Fehler beim Zerlegen von Erzeugnis #1: #2',
4251 4258
  'error while paying invoice #1 : ' => 'Fehler beim Bezahlen von Rechnung #1 : ',
4252 4259
  'error while unlinking payment #1 : ' => 'Fehler beim Zurücksetzen von Zahlung #1:',
4253 4260
  'every third month'           => 'vierteljährlich',
locale/en/all
519 519
  'CANCELED'                    => '',
520 520
  'CB Transaction'              => '',
521 521
  'CB Transactions'             => '',
522
  'CC to Employee'              => '',
522 523
  'CN'                          => '',
523 524
  'CR'                          => '',
524 525
  'CSS style for pictures'      => '',
......
1063 1064
  'Direct debit revoked'        => '',
1064 1065
  'Directory'                   => '',
1065 1066
  'Disabled Price Sources'      => '',
1067
  'Disassemble Assembly'        => '',
1068
  'Disassembly successful for #1' => '',
1066 1069
  'Discard duplicate entries in CSV file' => '',
1067 1070
  'Discard entries with duplicates in database or CSV file' => '',
1068 1071
  'Discount'                    => '',
......
1764 1767
  'Introduction of clients'     => '',
1765 1768
  'Inv. Duedate'                => '',
1766 1769
  'Invalid'                     => '',
1770
  'Invalid assembly'            => '',
1771
  'Invalid bin'                 => '',
1767 1772
  'Invalid charge number: #1'   => '',
1768 1773
  'Invalid combination of ledger account number length. Mismatch length of #1 with length of #2. Please check your account settings. ' => '',
1769 1774
  'Invalid duration format'     => '',
......
2145 2150
  'No profit and loss carried forward chart configured!' => '',
2146 2151
  'No profit carried forward chart configured!' => '',
2147 2152
  'No quotations or orders have been created yet.' => '',
2153
  'No relations found for #1'   => '',
2148 2154
  'No report with id #1'        => '',
2149 2155
  'No requirement spec templates have been created yet.' => '',
2150 2156
  'No results.'                 => '',
......
4247 4253
  'ea'                          => '',
4248 4254
  'emailed to'                  => '',
4249 4255
  'empty'                       => '',
4256
  'error while disassembling assembly #1 : #2' => '',
4250 4257
  'error while paying invoice #1 : ' => '',
4251 4258
  'error while unlinking payment #1 : ' => '',
4252 4259
  'every third month'           => '',
templates/webpages/wh/report_bottom.html
1
[%- USE HTML %]
2
 <input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
3
</form>
templates/webpages/wh/report_top.html
1
<form method="post" action="wh.pl" id="form">

Auch abrufbar als: Unified diff