Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6c20bff1

Von Bernd Bleßmann vor etwa 6 Jahren hinzugefügt

  • ID 6c20bff1fde66612b803b2716589f97b1441612a
  • Vorgänger 1b46f321
  • Nachfolger 7fa33ab3

Inventur: Schwellwert in Mandantenkonfig. für Warnung bei Mengenabweichung

In der Mandantenkonfiguration kann ein Mengenschwellwert eingegeben werden.
Wenn die bei der Inventur gezählte/eingegebene Zielmenge mehr als dieser
Schwellwert von der Menge in der Datenbank abweicht, dann wird eine Warnung
angezeigt.

Hintergrund: Mitarbeiter lesen den Artikel mit einem Barcode-Scanner ein und
vergessen manchmal, die vorher eingegebene Menge zu speichern. Dann wird die
Artikelnummer oder EAN in das Mengenfeld geschrieben und ein "Enter" ausgelöst.
Dann ist die Zielmenge sehr groß und falsch. Das kann damit verhindert bzw.
abgeschwächt werden.

Unterschiede anzeigen:

SL/Controller/Inventory.pm
30 30

  
31 31
__PACKAGE__->run_before('_check_auth');
32 32
__PACKAGE__->run_before('_check_warehouses');
33
__PACKAGE__->run_before('load_part_from_form',   only => [ qw(stock_in part_changed mini_stock stock stocktaking_part_changed save_stocktaking) ]);
34
__PACKAGE__->run_before('load_unit_from_form',   only => [ qw(stock_in part_changed mini_stock stock stocktaking_part_changed save_stocktaking) ]);
35
__PACKAGE__->run_before('load_wh_from_form',     only => [ qw(stock_in warehouse_changed stock stocktaking save_stocktaking) ]);
36
__PACKAGE__->run_before('load_bin_from_form',    only => [ qw(stock_in stock stocktaking save_stocktaking) ]);
33
__PACKAGE__->run_before('load_part_from_form',   only => [ qw(stock_in part_changed mini_stock stock stocktaking_part_changed stocktaking_get_warn_qty_threshold save_stocktaking) ]);
34
__PACKAGE__->run_before('load_unit_from_form',   only => [ qw(stock_in part_changed mini_stock stock stocktaking_part_changed stocktaking_get_warn_qty_threshold save_stocktaking) ]);
35
__PACKAGE__->run_before('load_wh_from_form',     only => [ qw(stock_in warehouse_changed stock stocktaking stocktaking_get_warn_qty_threshold save_stocktaking) ]);
36
__PACKAGE__->run_before('load_bin_from_form',    only => [ qw(stock_in stock stocktaking stocktaking_get_warn_qty_threshold save_stocktaking) ]);
37 37
__PACKAGE__->run_before('set_target_from_part',  only => [ qw(part_changed) ]);
38 38
__PACKAGE__->run_before('mini_stock',            only => [ qw(stock_in mini_stock) ]);
39
__PACKAGE__->run_before('sanitize_target',       only => [ qw(stock_usage stock_in warehouse_changed part_changed stocktaking stocktaking_part_changed save_stocktaking) ]);
39
__PACKAGE__->run_before('sanitize_target',       only => [ qw(stock_usage stock_in warehouse_changed part_changed stocktaking stocktaking_part_changed stocktaking_get_warn_qty_threshold save_stocktaking) ]);
40 40
__PACKAGE__->run_before('set_layout');
41 41

  
42 42
sub action_stock_in {
......
603 603
  $self->prepare_stocktaking_report(full => 1);
604 604
  $self->report_generator_list_objects(report => $self->{report}, objects => $self->stocktaking_models->get);
605 605
}
606

  
607
sub action_stocktaking_get_warn_qty_threshold {
608
  my ($self) = @_;
609

  
610
  return $_[0]->render(\ !!0, { type => 'text' }) if $::form->{target_qty} eq '';
611
  return $_[0]->render(\ !!0, { type => 'text' }) if 0 == $::instance_conf->get_stocktaking_qty_threshold;
612

  
613
  my $target_qty  = $::form->parse_amount(\%::myconfig, $::form->{target_qty});
614
  my $stocked_qty = _get_stocked_qty($self->part,
615
                                     warehouse_id => $self->warehouse->id,
616
                                     bin_id       => $self->bin->id,
617
                                     chargenumber => $::form->{chargenumber},
618
                                     bestbefore   => $::form->{bestbefore},);
619
  my $stocked_qty_in_form_units = $self->part->unit_obj->convert_to($stocked_qty, $self->unit);
620
  my $qty        = $target_qty - $stocked_qty_in_form_units;
621
  $qty           = abs($qty);
622

  
623
  my $warn;
624
  if ($qty > $::instance_conf->get_stocktaking_qty_threshold) {
625
    $warn  = t8('The target quantity of #1 differs more than the threshold quantity of #2.',
626
                $::form->{target_qty} . " " . $self->unit->name,
627
                $::form->format_amount(\%::myconfig, $::instance_conf->get_stocktaking_qty_threshold, 2));
628
    $warn .= "\n";
629
    $warn .= t8('Choose "continue" if you want to use this value. Choose "cancel" otherwise.');
630
  }
631
  return $_[0]->render(\ $warn, { type => 'text' });
632
}
633

  
606 634
#================================================================
607 635

  
608 636
sub _check_auth {
......
930 958
    $bar->add(
931 959
      action => [
932 960
        t8('Save'),
961
        checks    => [ 'kivi.Inventory.check_stocktaking_qty_threshold' ],
933 962
        call      => [ 'kivi.Inventory.save_stocktaking' ],
934 963
        accesskey => 'enter',
935 964
      ],
......
1016 1045

  
1017 1046
This action is called after the user selected or changed the part.
1018 1047

  
1048
=item C<action_stocktaking_get_warn_qty_threshold>
1049

  
1050
This action checks if a warning should be shown and returns the warning text via
1051
ajax. The warning will be shown if the given target value is greater than the
1052
threshold given in the client configuration.
1053

  
1019 1054
=item C<is_stocktaking>
1020 1055

  
1021 1056
This is a method to check if actions are called from stocktaking form.
1057
This actions should contain "stocktaking" in their name.
1022 1058

  
1023 1059
=back
1024 1060

  
SL/DB/MetaSetup/Default.pm
142 142
  sqnumber                                  => { type => 'text' },
143 143
  stocktaking_bin_id                        => { type => 'integer' },
144 144
  stocktaking_cutoff_date                   => { type => 'date' },
145
  stocktaking_qty_threshold                 => { type => 'numeric', default => '0', precision => 25, scale => 5 },
145 146
  stocktaking_warehouse_id                  => { type => 'integer' },
146 147
  taxnumber                                 => { type => 'text' },
147 148
  templates                                 => { type => 'text' },
js/kivi.Inventory.js
52 52
    $('#already_counted_dialog').dialog("close");
53 53
  };
54 54

  
55
  ns.check_stocktaking_qty_threshold = function() {
56
    var data = $('#stocktaking_form').serializeArray();
57
    data.push({ name: 'action', value: 'Inventory/stocktaking_get_warn_qty_threshold' });
58

  
59
    var warn = false;
60
    $.ajax({
61
      url:      'controller.pl',
62
      data:     data,
63
      method:   "GET",
64
      async:    false,
65
      dataType: 'text',
66
      success:  function(val) {
67
        warn = val;
68
      }
69
    });
70

  
71
    if (warn) {
72
      return confirm(warn);
73
    } else {
74
      return true;
75
    }
76
  };
55 77
});
56 78

  
57 79
$(function(){
locale/de/all
600 600
  'Check on purchase invoice'   => 'Prüfen bei Einkaufsrechnung',
601 601
  'Check on sales invoice'      => 'Prüfen bei Verkaufsrechnung',
602 602
  'Checks'                      => 'Schecks',
603
  'Choose "continue" if you want to use this value. Choose "cancel" otherwise.' => 'Wählen Sie "Ok" um diesen Wert zu übernehmen. Andernfalls wählen Sie "Abbrechen".',
603 604
  'Choose Customer'             => 'Endkunde wählen:',
604 605
  'Choose Outputformat'         => 'Ausgabeformat auswählen...',
605 606
  'Choose Vendor'               => 'Händler wählen',
......
1566 1567
  'If searching a part from a document and no part is found then offer to create a new part.' => 'Wenn bei der Artikelsuche aus einem Dokument heraus kein Artikel gefunden wird, dann wird ermöglicht, von dort aus einen neuen Artikel anzulegen.',
1567 1568
  'If the article type is set to \'mixed\' then a column called \'part_type\' or called \'pclass\' must be present.' => 'Falls der Artikeltyp auf \'mixed\' gesetzt ist muss entweder eine Spalte \'part_type\' oder \'pclass\' im Import vorhanden sein',
1568 1569
  'If the automatic creation of invoices for fees and interest is switched on for a dunning level then the following accounts will be used for the invoice.' => 'Wenn das automatische Erstellen einer Rechnung über Mahngebühren und Zinsen für ein Mahnlevel aktiviert ist, so werden die folgenden Konten für die Rechnung benutzt.',
1570
  'If the counted quantity differs more than this threshold from the quantity in the database, a warning will be shown. Set to 0 to switch of this feature.' => 'Wenn die gezählte Menge mehr als dieser Schwellwert von der Menge in der Datenbank abweicht, wird eine Warnmeldung angezeigt. Setzen Sie den Schwellwert auf 0, um dieses Feature abzuschalten.',
1569 1571
  'If the database user listed above does not have the right to create a database then enter the name and password of the superuser below:' => 'Falls der oben genannte Datenbankbenutzer nicht die Berechtigung zum Anlegen neuer Datenbanken hat, so können Sie hier den Namen und das Passwort des Datenbankadministratoraccounts angeben:',
1570 1572
  'If the default transfer out always succeed use this bin for negative stock quantity.' => 'Standardlagerplatz für Auslagern ohne Prüfung auf Bestand',
1571 1573
  'If yes, delivery order positions are considered "delivered" only if they have been stocked out of the inventory. Otherwise saving the delivery order is considered delivered.' => 'Wenn diese Option aktiviert ist, gelten Lieferscheinpositionen nur dann als geliefert wenn sie im Lieferschein ausgelagert wurden, und die Ware aus dem Lager ausgebucht wurde. Andernfalls gilt das Speichern des Lieferscheins als Lieferung.',
......
3365 3367
  'The subject is missing.'     => 'Der Betreff fehlt.',
3366 3368
  'The tables for user management and authentication do not exist. They will be created in the next step in the following database:' => 'Die Tabellen zum Speichern der Benutzerdaten und zur Benutzerauthentifizierung wurden nicht gefunden. Sie werden in der folgenden Datenbank angelegt:',
3367 3369
  'The tabulator character'     => 'Das Tabulator-Symbol',
3370
  'The target quantity of #1 differs more than the threshold quantity of #2.' => 'Die Abweichung der Zielmenge #1 ist größer als der Mengenschwellwert #2.',
3368 3371
  'The task server does not appear to be running.' => 'Der Task-Server scheint nicht zu laufen.',
3369 3372
  'The task server is already running.' => 'Der Task-Server läuft bereits.',
3370 3373
  'The task server is not running at the moment but needed for this module' => 'Der Taskserver wird für dieses Modul benötigt, läuft aber im Moment nicht.',
......
3531 3534
  'This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?' => 'Dies wird die Rechnung nicht mehr als offen anzeigen, auch wenn der unbezahlte Betrag nicht dem Rechnungsbetrag entspricht. Fortfahren?',
3532 3535
  'This will set an exact price.' => 'Diese Option setzt einen festen Preis.',
3533 3536
  'Three Options:'              => 'Drei Optionen:',
3537
  'Threshold for warning on quantity difference' => 'Schwellwert für Warnung bei Mengenabweichung',
3534 3538
  'Time'                        => 'Zeit',
3535 3539
  'Time Format'                 => 'Uhrzeitformat',
3536 3540
  'Time and price estimate'     => 'Zeit- und Preisschätzung',
locale/en/all
600 600
  'Check on purchase invoice'   => '',
601 601
  'Check on sales invoice'      => '',
602 602
  'Checks'                      => '',
603
  'Choose "continue" if you want to use this value. Choose "cancel" otherwise.' => '',
603 604
  'Choose Customer'             => '',
604 605
  'Choose Outputformat'         => '',
605 606
  'Choose Vendor'               => '',
......
1566 1567
  'If searching a part from a document and no part is found then offer to create a new part.' => '',
1567 1568
  'If the article type is set to \'mixed\' then a column called \'part_type\' or called \'pclass\' must be present.' => '',
1568 1569
  'If the automatic creation of invoices for fees and interest is switched on for a dunning level then the following accounts will be used for the invoice.' => '',
1570
  'If the counted quantity differs more than this threshold from the quantity in the database, a warning will be shown. Set to 0 to switch of this feature.' => '',
1569 1571
  'If the database user listed above does not have the right to create a database then enter the name and password of the superuser below:' => '',
1570 1572
  'If the default transfer out always succeed use this bin for negative stock quantity.' => '',
1571 1573
  'If yes, delivery order positions are considered "delivered" only if they have been stocked out of the inventory. Otherwise saving the delivery order is considered delivered.' => '',
......
3364 3366
  'The subject is missing.'     => '',
3365 3367
  'The tables for user management and authentication do not exist. They will be created in the next step in the following database:' => '',
3366 3368
  'The tabulator character'     => '',
3369
  'The target quantity of #1 differs more than the threshold quantity of #2.' => '',
3367 3370
  'The task server does not appear to be running.' => '',
3368 3371
  'The task server is already running.' => '',
3369 3372
  'The task server is not running at the moment but needed for this module' => '',
......
3530 3533
  'This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?' => '',
3531 3534
  'This will set an exact price.' => '',
3532 3535
  'Three Options:'              => '',
3536
  'Threshold for warning on quantity difference' => '',
3533 3537
  'Time'                        => '',
3534 3538
  'Time Format'                 => '',
3535 3539
  'Time and price estimate'     => '',
sql/Pg-upgrade2/add_stocktaking_qty_threshold_client_config_default.sql
1
-- @tag: add_stocktaking_qty_threshold_client_config_default
2
-- @description: Konfigurations-Option für Mengen-Schwellwert zur Inventur
3
-- @depends: add_stocktaking_preselects_client_config_default
4

  
5
ALTER TABLE defaults ADD COLUMN stocktaking_qty_threshold NUMERIC(25,5) DEFAULT 0;
templates/webpages/client_config/_stocktaking.html
35 35
  </tr>
36 36
  <tr>
37 37

  
38
  <tr>
39
   <td align="right" nowrap="true">[% LxERP.t8('Threshold for warning on quantity difference') %]</td>
40
   <td>[% L.input_tag('defaults.stocktaking_qty_threshold_as_number', SELF.defaults.stocktaking_qty_threshold_as_number, size=15, class="numeric") %]</td>
41
   <td>
42
    [% LxERP.t8('If the counted quantity differs more than this threshold from the quantity in the database, a warning will be shown. Set to 0 to switch of this feature.') %]<br>
43
   </td>
44
  </tr>
45
  <tr>
46

  
38 47
 </table>
39 48
</div>

Auch abrufbar als: Unified diff