Funktionalität für Mindesthaltbarkeitsdatum hinzugefügt.
authorBernd Blessmann <bibi@online.de>
Sat, 6 Mar 2010 00:16:11 +0000 (01:16 +0100)
committerBernd Blessmann <bibi@online.de>
Sat, 6 Mar 2010 00:16:11 +0000 (01:16 +0100)
17 files changed:
SL/DO.pm
SL/WH.pm
bin/mozilla/common.pl
bin/mozilla/do.pl
bin/mozilla/wh.pl
doc/dokumentenvorlagen-und-variablen.html
sql/Pg-upgrade2/warehouse_add_bestbefore.sql [new file with mode: 0644]
templates/webpages/do/stock_in_form_master.html
templates/webpages/do/stock_out_form_master.html
templates/webpages/generic/select_part_master.html
templates/webpages/wh/journal_filter_master.html
templates/webpages/wh/removal_parts_selection_master.html
templates/webpages/wh/report_filter_master.html
templates/webpages/wh/transfer_parts_selection_master.html
templates/webpages/wh/warehouse_selection_assembly_master.html
templates/webpages/wh/warehouse_selection_master.html
templates/webpages/wh/warehouse_selection_stock_master.html

index b5faeae..cdb2441 100644 (file)
--- a/SL/DO.pm
+++ b/SL/DO.pm
@@ -258,8 +258,8 @@ sub save {
   my $h_item = prepare_query($form, $dbh, $q_item);
 
   my $q_item_stock =
-    qq|INSERT INTO delivery_order_items_stock (delivery_order_item_id, qty, unit, warehouse_id, bin_id, chargenumber)
-       VALUES (?, ?, ?, ?, ?, ?)|;
+    qq|INSERT INTO delivery_order_items_stock (delivery_order_item_id, qty, unit, warehouse_id, bin_id, chargenumber, bestbefore)
+       VALUES (?, ?, ?, ?, ?, ?, ?)|;
   my $h_item_stock = prepare_query($form, $dbh, $q_item_stock);
 
   my $in_out       = $form->{type} =~ /^sales/ ? 'out' : 'in';
@@ -309,7 +309,7 @@ sub save {
 
     foreach my $sinfo (@{ $stock_info }) {
       @values = ($item_id, $sinfo->{qty}, $sinfo->{unit}, conv_i($sinfo->{warehouse_id}),
-                 conv_i($sinfo->{bin_id}), $sinfo->{chargenumber});
+                 conv_i($sinfo->{bin_id}), $sinfo->{chargenumber}, conv_date($sinfo->{bestbefore}));
       do_statement($form, $h_item_stock, $q_item_stock, @values);
     }
 
@@ -693,7 +693,7 @@ sub retrieve {
     my $in_out = $form->{type} =~ /^sales/ ? 'out' : 'in';
 
     $query =
-      qq|SELECT qty, unit, bin_id, warehouse_id, chargenumber
+      qq|SELECT qty, unit, bin_id, warehouse_id, chargenumber, bestbefore
          FROM delivery_order_items_stock
          WHERE delivery_order_item_id = ?|;
     my $sth = prepare_query($form, $dbh, $query);
@@ -792,7 +792,7 @@ sub order_details {
     qw(runningnumber number description longdescription qty unit
        partnotes serialnumber reqdate projectnumber
        si_runningnumber si_number si_description
-       si_warehouse si_bin si_chargenumber si_qty si_unit);
+       si_warehouse si_bin si_chargenumber si_bestbefore si_qty si_unit);
 
   map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays);
 
@@ -875,6 +875,7 @@ sub order_details {
         push @{ $form->{TEMPLATE_ARRAYS}{si_warehouse}[$position-1] },     $bin_wh->{warehouse};
         push @{ $form->{TEMPLATE_ARRAYS}{si_bin}[$position-1] },           $bin_wh->{bin};
         push @{ $form->{TEMPLATE_ARRAYS}{si_chargenumber}[$position-1] },  $si->{chargenumber};
+        push @{ $form->{TEMPLATE_ARRAYS}{si_bestbefore}[$position-1] },    $si->{bestbefore};
         push @{ $form->{TEMPLATE_ARRAYS}{si_qty}[$position-1] },           $form->format_amount($myconfig, $si->{qty} * 1);
         push @{ $form->{TEMPLATE_ARRAYS}{si_unit}[$position-1] },          $si->{unit};
       }
@@ -944,16 +945,16 @@ sub get_item_availability {
   my $myconfig  = \%main::myconfig;
 
   my $query     =
-    qq|SELECT i.warehouse_id, i.bin_id, i.chargenumber, SUM(qty) AS qty, i.parts_id,
+    qq|SELECT i.warehouse_id, i.bin_id, i.chargenumber, i.bestbefore, SUM(qty) AS qty, i.parts_id,
          w.description AS warehousedescription,
          b.description AS bindescription
        FROM inventory i
        LEFT JOIN warehouse w ON (i.warehouse_id = w.id)
        LEFT JOIN bin b       ON (i.bin_id       = b.id)
        WHERE (i.parts_id IN (| . join(', ', ('?') x scalar(@parts_ids)) . qq|))
-       GROUP BY i.warehouse_id, i.bin_id, i.chargenumber, i.parts_id, w.description, b.description
+       GROUP BY i.warehouse_id, i.bin_id, i.chargenumber, i.bestbefore, i.parts_id, w.description, b.description
        HAVING SUM(qty) > 0
-       ORDER BY LOWER(w.description), LOWER(b.description), LOWER(i.chargenumber)
+       ORDER BY LOWER(w.description), LOWER(b.description), LOWER(i.chargenumber), i.bestbefore
 |;
   my $contents = selectall_hashref_query($form, $form->get_standard_dbh($myconfig), $query, @parts_ids);
 
@@ -991,7 +992,8 @@ sub check_stock_availability {
     foreach my $row (@contents) {
       next if (($row->{bin_id}       != $sinfo->{bin_id}) ||
                ($row->{warehouse_id} != $sinfo->{warehouse_id}) ||
-               ($row->{chargenumber} ne $sinfo->{chargenumber}));
+               ($row->{chargenumber} ne $sinfo->{chargenumber}) ||
+               ($row->{bestbefore}   ne $sinfo->{bestbefore}));
 
       $found       = 1;
 
@@ -1039,6 +1041,7 @@ sub transfer_in_out {
       "${prefix}_warehouse_id" => $request->{warehouse_id},
       "${prefix}_bin_id"       => $request->{bin_id},
       'chargenumber'           => $request->{chargenumber},
+      'bestbefore'             => $request->{bestbefore},
       'qty'                    => $request->{qty},
       'unit'                   => $request->{unit},
       'oe_id'                  => $form->{id},
index 08f7a80..5b0054d 100644 (file)
--- a/SL/WH.pm
+++ b/SL/WH.pm
@@ -73,9 +73,10 @@ sub transfer {
 
   my ($now)     = selectrow_query($form, $dbh, qq|SELECT current_date|);
 
-  $query = qq|INSERT INTO inventory (warehouse_id, bin_id, parts_id, chargenumber, oe_id, orderitems_id, shippingdate,
+  $query = qq|INSERT INTO inventory (warehouse_id, bin_id, parts_id, chargenumber, bestbefore,
+                                     oe_id, orderitems_id, shippingdate,
                                      employee_id, project_id, trans_id, trans_type_id, comment, qty)
-              VALUES (?, ?, ?, ?, ?, ?, ?, (SELECT id FROM employee WHERE login = ?), ?, ?, ?, ?, ?)|;
+              VALUES (?, ?, ?, ?, ?, ?, ?, ?, (SELECT id FROM employee WHERE login = ?), ?, ?, ?, ?, ?)|;
 
   $sth   = prepare_query($form, $dbh, $query);
 
@@ -90,7 +91,7 @@ sub transfer {
     $direction |= 1 if ($transfer->{src_warehouse_id} && $transfer->{src_bin_id});
     $direction |= 2 if ($transfer->{dst_warehouse_id} && $transfer->{dst_bin_id});
 
-    push @values, conv_i($transfer->{parts_id}), "$transfer->{chargenumber}", conv_i($transfer->{oe_id}), conv_i($transfer->{orderitems_id});
+    push @values, conv_i($transfer->{parts_id}), "$transfer->{chargenumber}", conv_date($transfer->{bestbefore}), conv_i($transfer->{oe_id}), conv_i($transfer->{orderitems_id});
     push @values, $transfer->{shippingdate} eq 'current_date' ? $now : conv_date($transfer->{shippingdate}), $form->{login}, conv_i($transfer->{project_id}), $trans_id;
 
     if ($transfer->{transfer_type_id}) {
@@ -131,7 +132,7 @@ sub transfer_assembly {
 
   my $self     = shift;
   my %params   = @_;
-  Common::check_params(\%params, qw(assembly_id dst_warehouse_id login qty unit dst_bin_id chargenumber comment));
+  Common::check_params(\%params, qw(assembly_id dst_warehouse_id login qty unit dst_bin_id chargenumber bestbefore comment));
 
 #  my $maxcreate=WH->check_assembly_max_create(assembly_id =>$params{'assembly_id'}, dbh => $my_dbh);
 
@@ -163,8 +164,8 @@ sub transfer_assembly {
   my $sth_part_qty_assembly = prepare_execute_query($form, $dbh, $query, $params{assembly_id});
 
   # Hier wird das prepared Statement für die Schleife über alle Lagerplätze vorbereitet
-  my $transferPartSQL = qq|INSERT INTO inventory (parts_id, warehouse_id, bin_id, chargenumber, comment, employee_id, qty, trans_id, trans_type_id)
-                           VALUES (?, ?, ?, ?, ?,(SELECT id FROM employee WHERE login = ?), ?, nextval('id'),
+  my $transferPartSQL = qq|INSERT INTO inventory (parts_id, warehouse_id, bin_id, chargenumber, bestbefore, comment, employee_id, qty, trans_id, trans_type_id)
+                           VALUES (?, ?, ?, ?, ?, ?, (SELECT id FROM employee WHERE login = ?), ?, nextval('id'),
                            (SELECT id FROM transfer_type WHERE direction = 'out' AND description = 'used'))|;
   my $sthTransferPartSQL   = prepare_query($form, $dbh, $transferPartSQL);
 
@@ -191,15 +192,15 @@ sub transfer_assembly {
       next; # die weiteren Überprüfungen sind unnötig, daher das nächste elemente prüfen (genaue Ausgabe, was noch fehlt)
     }
 
-    # Eine kurze Vorabfrage, um den Lagerplatz und die Chargennummber zu bestimmen
+    # Eine kurze Vorabfrage, um den Lagerplatz, Chargennummer und die Mindesthaltbarkeit zu bestimmen
     # Offen: Die Summe über alle Lagerplätze wird noch nicht gebildet
     # Gelöst: Wir haben vorher schon die Abfrage durchgeführt, ob wir fertigen können.
     # Noch besser gelöst: Wir laufen durch alle benötigten Waren zum Fertigen und geben eine Rückmeldung an den Benutzer was noch fehlt
     # und lösen den Rest dann so wie bei xplace im Barcode-Programm
     # S.a. Kommentar im bin/mozilla-Code mb übernimmt und macht das in ordentlich
 
-    my $tempquery = qq|SELECT SUM(qty), bin_id, chargenumber   FROM inventory  
-                       WHERE warehouse_id = ? AND parts_id = ?  GROUP BY bin_id, chargenumber having SUM(qty)>0|;
+    my $tempquery = qq|SELECT SUM(qty), bin_id, chargenumber, bestbefore   FROM inventory  
+                       WHERE warehouse_id = ? AND parts_id = ?  GROUP BY bin_id, chargenumber, bestbefore having SUM(qty)>0|;
     my $tempsth   = prepare_execute_query($form, $dbh, $tempquery, $params{dst_warehouse_id}, $currentPart_ID);
 
     # Alle Werte zu dem einzelnen Artikel, die wir später auslagern
@@ -208,6 +209,7 @@ sub transfer_assembly {
     while (my $temphash_ref = $tempsth->fetchrow_hashref()) {
       my $temppart_bin_id       = $temphash_ref->{bin_id}; # kann man hier den quelllagerplatz beim verbauen angeben?
       my $temppart_chargenumber = $temphash_ref->{chargenumber};
+      my $temppart_bestbefore   = $temphash_ref->{bestbefore};
       my $temppart_qty          = $temphash_ref->{sum};
 
       if ($tmpPartsQTY > $temppart_qty) {  # wir haben noch mehr waren zum wegbuchen. 
@@ -218,7 +220,7 @@ sub transfer_assembly {
                                             # Dieser Wert IST und BLEIBT positiv!! Hilfe. 
                                             # Liegt das daran, dass dieser Wert aus einem SQL-Statement stammt?
         do_statement($form, $sthTransferPartSQL, $transferPartSQL, $currentPart_ID, $params{dst_warehouse_id}, 
-                     $temppart_bin_id, $temppart_chargenumber, 'Verbraucht für ' .
+                     $temppart_bin_id, $temppart_chargenumber, $temppart_bestbefore, 'Verbraucht für ' .
                      $self->get_part_description(parts_id => $params{assembly_id}), $params{login}, $temppart_qty);
 
         # hier ist noch ein fehler am besten mit definierten erzeugnissen debuggen 02/2009 jb
@@ -228,24 +230,24 @@ sub transfer_assembly {
       } else { # okay, wir haben weniger oder gleich Waren die wir wegbuchen müssen, wir können also aufhören
         $tmpPartsQTY *=-1;
         do_statement($form, $sthTransferPartSQL, $transferPartSQL, $currentPart_ID, $params{dst_warehouse_id},
-                     $temppart_bin_id, $temppart_chargenumber, 'Verbraucht für ' .
+                     $temppart_bin_id, $temppart_chargenumber, $temppart_bestbefore, 'Verbraucht für ' .
                      $self->get_part_description(parts_id => $params{assembly_id}), $params{login}, $tmpPartsQTY);
         last; # beendet die schleife (springt zum letzten element)
       }
-    }  # ende while SELECT SUM(qty), bin_id, chargenumber   FROM inventory  WHERE warehouse_id
+    }  # ende while SELECT SUM(qty), bin_id, chargenumber, bestbefore   FROM inventory  WHERE warehouse_id
   } #ende while select parts_id,qty from assembly where id = ?
   if ($kannNichtFertigen) {
     return $kannNichtFertigen;
   }
 
   # soweit alles gut. Jetzt noch die wirkliche Lagerbewegung für das Erzeugnis ausführen ...
-  my $transferAssemblySQL = qq|INSERT INTO inventory (parts_id, warehouse_id, bin_id, chargenumber, 
+  my $transferAssemblySQL = qq|INSERT INTO inventory (parts_id, warehouse_id, bin_id, chargenumber, bestbefore,
                                                       comment, employee_id, qty, trans_id, trans_type_id)
-                               VALUES (?, ?, ?, ?, ?, (SELECT id FROM employee WHERE login = ?), ?, nextval('id'),
+                               VALUES (?, ?, ?, ?, ?, ?, (SELECT id FROM employee WHERE login = ?), ?, nextval('id'),
                                (SELECT id FROM transfer_type WHERE direction = 'in' AND description = 'stock'))|;
   my $sthTransferAssemblySQL   = prepare_query($form, $dbh, $transferAssemblySQL);
   do_statement($form, $sthTransferAssemblySQL, $transferAssemblySQL, $params{assembly_id}, $params{dst_warehouse_id}, 
-               $params{dst_bin_id}, $params{chargenumber}, $params{comment}, $params{login}, $params{qty});
+               $params{dst_bin_id}, $params{chargenumber}, $params{bestbefore}, $params{comment}, $params{login}, $params{qty});
   $dbh->commit();
 
   $main::lxdebug->leave_sub();
@@ -294,6 +296,11 @@ sub get_warehouse_journal {
     push @filter_vars, '%' . $filter{chargenumber} . '%';
   }
 
+  if ($form->{bestbefore}) {
+    push @filter_ary, "?::DATE = i1.bestbefore::DATE";
+    push @filter_vars, $form->{bestbefore};
+  }
+
   if ($form->{fromdate}) {
     push @filter_ary, "?::DATE <= i1.itime::DATE";
     push @filter_vars, $form->{fromdate};
@@ -344,6 +351,7 @@ sub get_warehouse_journal {
      "partdescription"      => "p.description",
      "bindescription"       => "b.description",
      "chargenumber"         => "i1.chargenumber",
+     "bestbefore"           => "i1.bestbefore",
      "warehousedescription" => "w.description",
      "partunit"             => "p.unit",
      "bin_from"             => "b1.description",
@@ -512,6 +520,7 @@ SQL
 #  - partsid      - will return matches with this parts_id only
 #  - description  - will return only matches where the given string is a substring of the description
 #  - chargenumber - will return only matches where the given string is a substring of the chargenumber
+#  - bestbefore   - will return only matches with this bestbefore date
 #  - ean          - will return only matches where the given string is a substring of the ean as stored in the table parts (article)
 #  - charge_ids   - must be an arrayref. will return contents with these ids only
 #  - expires_in   - will only return matches that expire within the given number of days
@@ -574,6 +583,12 @@ sub get_warehouse_report {
     push @filter_ary,  "i.chargenumber ILIKE ?";
     push @filter_vars, '%' . $filter{chargenumber} . '%';
   }
+
+  if ($form->{bestbefore}) {
+    push @filter_ary, "?::DATE = i.bestbefore::DATE";
+    push @filter_vars, $form->{bestbefore};
+  }
+
   if ($filter{ean}) {
     push @filter_ary,  "p.ean ILIKE ?";
     push @filter_vars, '%' . $filter{ean} . '%';
@@ -616,6 +631,7 @@ sub get_warehouse_report {
      "bindescription"       => "b.description",
      "binid"                => "b.id",
      "chargenumber"         => "i.chargenumber",
+     "bestbefore"           => "i.bestbefore",
      "ean"                  => "p.ean",
      "chargeid"             => "c.id",
      "warehousedescription" => "w.description",
@@ -810,12 +826,12 @@ $main::lxdebug->enter_sub();
 
   my $dbh      = $params{dbh} || $form->get_standard_dbh();
 
-  my $query = qq| SELECT SUM(qty), bin_id, chargenumber  FROM inventory where parts_id = ? AND warehouse_id = ? GROUP BY bin_id, chargenumber|;
+  my $query = qq| SELECT SUM(qty), bin_id, chargenumber, bestbefore  FROM inventory where parts_id = ? AND warehouse_id = ? GROUP BY bin_id, chargenumber, bestbefore|;
 
   my $sth_QTY      = prepare_execute_query($form, $dbh, $query, ,$params{parts_id}, $params{warehouse_id}); #info: aufruf an DBUtils.pm
 
   my $max_qty_parts = 0; #Initialisierung mit 0
-  while (my $ref = $sth_QTY->fetchrow_hashref()) {  # wir laufen über alle chargen und Lagerorte (s.a. SQL-Query oben)
+  while (my $ref = $sth_QTY->fetchrow_hashref()) {  # wir laufen über alle Haltbarkeiten, chargen und Lagerorte (s.a. SQL-Query oben)
     $max_qty_parts += $ref->{sum};
   }
 
index 17dac99..defa5f1 100644 (file)
@@ -76,6 +76,11 @@ sub select_part {
     $has_charge = 1;
     map { $_->{has_charge} = 1; } @parts;
   }
+  my $has_bestbefore = 0;
+  if (defined($parts[0]->{bestbefore})) {
+    $has_bestbefore = 1;
+    map { $_->{has_bestbefore} = 1; } @parts;
+  }
   my $has_ean = 0;
   if (defined($parts[0]->{ean})) {
     $has_ean = 1;
@@ -92,6 +97,7 @@ sub select_part {
                                      "nextsub"          => "select_part_internal",
                                      "callback_sub"     => $callback_sub,
                                      "has_charge"       => $has_charge,
+                                     "has_bestbefore"   => $has_bestbefore,
                                      "has_ean"          => $has_ean,
                                      "remap_parts_id"   => $remap_parts_id,
                                      "remap_partnumber" => $remap_partnumber });
index a57022b..dd4d2d0 100644 (file)
@@ -1004,7 +1004,7 @@ sub update_stock_in {
 
   foreach my $i (1..$form->{rowcount}) {
     $form->{"qty_$i"} = $form->parse_amount(\%myconfig, $form->{"qty_$i"});
-    push @{ $stock_info }, { map { $_ => $form->{"${_}_${i}"} } qw(warehouse_id bin_id chargenumber qty unit) };
+    push @{ $stock_info }, { map { $_ => $form->{"${_}_${i}"} } qw(warehouse_id bin_id chargenumber bestbefore qty unit) };
   }
 
   display_stock_in_form($stock_info);
@@ -1033,6 +1033,8 @@ sub display_stock_in_form {
   my %myconfig = %main::myconfig;
   my $locale   = $main::locale;
 
+  $form->{jsscript} = 1;
+
   $form->{title} = $locale->text('Stock');
 
   my $part_info  = IC->get_basic_part_info('id' => $form->{parts_id});
@@ -1068,7 +1070,7 @@ sub set_stock_in {
 
     next if ($form->{"qty_$i"} <= 0);
 
-    push @{ $stock_info }, { map { $_ => $form->{"${_}_${i}"} } qw(warehouse_id bin_id chargenumber qty unit) };
+    push @{ $stock_info }, { map { $_ => $form->{"${_}_${i}"} } qw(warehouse_id bin_id chargenumber bestbefore qty unit) };
   }
 
   $form->{stock} = YAML::Dump($stock_info);
@@ -1107,7 +1109,8 @@ sub stock_out_form {
       foreach my $sinfo (@{ $stock_info }) {
         next if (($row->{bin_id}       != $sinfo->{bin_id}) ||
                  ($row->{warehouse_id} != $sinfo->{warehouse_id}) ||
-                 ($row->{chargenumber} ne $sinfo->{chargenumber}));
+                 ($row->{chargenumber} ne $sinfo->{chargenumber}) ||
+                 ($row->{bestbefore}   ne $sinfo->{bestbefore}));
 
         map { $row->{"stock_$_"} = $sinfo->{$_} } qw(qty unit error);
       }
@@ -1147,6 +1150,7 @@ sub set_stock_out {
       'warehouse_id' => $form->{"warehouse_id_$i"},
       'bin_id'       => $form->{"bin_id_$i"},
       'chargenumber' => $form->{"chargenumber_$i"},
+      'bestbefore'   => $form->{"bestbefore_$i"},
       'qty'          => $form->{"qty_$i"},
       'unit'         => $form->{"unit_$i"},
       'row'          => $i,
@@ -1266,7 +1270,7 @@ sub transfer_out {
         $request->{parts_id} = $form->{"id_$i"};
         $request->{base_qty} = $request->{qty} * $units->{$request->{unit}}->{factor} / $base_unit_factor;
 
-        my $map_key          = join '--', ($form->{"id_$i"}, @{$request}{qw(warehouse_id bin_id chargenumber)});
+        my $map_key          = join '--', ($form->{"id_$i"}, @{$request}{qw(warehouse_id bin_id chargenumber bestbefore)});
 
         $request_map{$map_key}                 ||= $request;
         $request_map{$map_key}->{sum_base_qty} ||= 0;
@@ -1292,7 +1296,7 @@ sub transfer_out {
       my @contents     = DO->get_item_availability('parts_id' => \@part_ids);
 
       foreach my $inv (@contents) {
-        my $map_key = join '--', @{$inv}{qw(parts_id warehouse_id bin_id chargenumber)};
+        my $map_key = join '--', @{$inv}{qw(parts_id warehouse_id bin_id chargenumber bestbefore)};
 
         next unless ($request_map{$map_key});
 
@@ -1306,9 +1310,10 @@ sub transfer_out {
         my $pinfo = $part_info_map{$request->{parts_id}};
         my $binfo = $bin_info_map{$request->{bin_id}};
 
-        push @{ $form->{ERRORS} }, $locale->text("There is not enough available of '#1' at warehouse '#2', bin '#3', #4, for the transfer of #5.",
+        push @{ $form->{ERRORS} }, $locale->text("There is not enough available of '#1' at warehouse '#2', bin '#3', #4, #5, for the transfer of #6.",
                                                  $pinfo->{description}, $binfo->{warehouse_description}, $binfo->{bin_description},
                                                  $request->{chargenumber} ? $locale->text('chargenumber #1', $request->{chargenumber}) : $locale->text('no chargenumber'),
+                                                 $request->{bestbefore} ? $locale->text('bestbefore #1', $request->{bestbefore}) : $locale->text('no bestbefore'),
                                                  $form->format_amount_units('amount'      => $request->{sum_base_qty},
                                                                             'part_unit'   => $pinfo->{unit},
                                                                             'conv_units'  => 'convertible_not_smaller'));
index f96d596..6af6980 100644 (file)
@@ -164,12 +164,13 @@ sub transfer_or_removal_prepare_contents {
 
   $form->show_generic_error($locale->text("The source warehouse does not contain any bins.")) if (0 == scalar @{ $warehouse->{BINS} });
 
-  map { $form->{"l_$_"} = 'Y' } qw(parts_id qty warehouseid binid partnumber partdescription bindescription chargenumber partunit ean);
+  map { $form->{"l_$_"} = 'Y' } qw(parts_id qty warehouseid binid partnumber partdescription bindescription chargenumber bestbefore partunit ean);
 
   $form->{sort} = 'bindescription';
   my @contents  = WH->get_warehouse_report("warehouse_id" => $form->{warehouse_id},
                                            "bin_id"       => $form->{bin_id},
                                            "chargenumber" => $form->{chargenumber},
+                                           "bestbefore"   => $form->{bestbefore},
                                            "partnumber"   => $form->{partnumber},
                                            "ean"          => $form->{ean},
                                            "description"  => $form->{description});
@@ -219,7 +220,7 @@ sub transfer_parts {
 
   $form->show_generic_error($locale->text("The source warehouse does not contain any bins.")) if (0 == scalar @{ $warehouse->{BINS} });
 
-  map { $form->{"l_$_"} = 'Y' } qw(parts_id qty warehouseid binid partnumber partdescription bindescription chargenumber partunit);
+  map { $form->{"l_$_"} = 'Y' } qw(parts_id qty warehouseid binid partnumber partdescription bindescription chargenumber bestbefore partunit);
 
   $form->{sort} = 'bindescription';
   my @contents  = WH->get_warehouse_report("warehouse_id" => $form->{warehouse_id});
@@ -243,12 +244,12 @@ sub transfer_parts {
       'transfer_type_id' => $form->{transfer_type_id},
     };
 
-    map { $transfer->{$_} = $form->{"${_}_${row}"} } qw(src_bin_id chargenumber parts_id qty dst_warehouse_id dst_bin_id);
+    map { $transfer->{$_} = $form->{"${_}_${row}"} } qw(src_bin_id chargenumber bestbefore parts_id qty dst_warehouse_id dst_bin_id);
 
     my $entry;
 
     foreach (@contents) {
-      if (($_->{binid} == $transfer->{src_bin_id}) && ($_->{parts_id} == $transfer->{parts_id}) && ($_->{chargenumber} eq $transfer->{chargenumber})) {
+      if (($_->{binid} == $transfer->{src_bin_id}) && ($_->{parts_id} == $transfer->{parts_id}) && ($_->{chargenumber} eq $transfer->{chargenumber}) && $_->{bestbefore} eq $transfer->{bestbefore}) {
         $entry = $_;
         last;
       }
@@ -441,6 +442,7 @@ sub create_assembly {
     'dst_warehouse_id' => $form->{warehouse_id},
     'dst_bin_id'       => $form->{bin_id},
     'chargenumber'     => $form->{chargenumber},
+    'bestbefore'       => $form->{bestbefore},
     'assembly_id'      => $form->{parts_id},
     'qty'              => $form->{qty},
     'unit'             => $form->{unit},
@@ -455,7 +457,7 @@ sub create_assembly {
     $form->show_generic_error($ret, 'back_button' => 1);
   }
 
-  delete @{$form}{qw(parts_id partnumber description qty unit chargenumber comment)};
+  delete @{$form}{qw(parts_id partnumber description qty unit chargenumber bestbefore comment)};
 
   $form->{saved_message} = $locale->text('The assembly has been created.');
   $form->{trans_type}    = 'assembly';
@@ -487,6 +489,7 @@ sub transfer_stock {
     'dst_warehouse_id' => $form->{warehouse_id},
     'dst_bin_id'       => $form->{bin_id},
     'chargenumber'     => $form->{chargenumber},
+    'bestbefore'       => $form->{bestbefore},
     'parts_id'         => $form->{parts_id},
     'qty'              => $form->{qty},
     'unit'             => $form->{unit},
@@ -495,7 +498,7 @@ sub transfer_stock {
 
   WH->transfer($transfer);
 
-  delete @{$form}{qw(parts_id partnumber description qty unit chargenumber comment)};
+  delete @{$form}{qw(parts_id partnumber description qty unit chargenumber bestbefore comment)};
 
   $form->{saved_message} = $locale->text('The parts have been stocked.');
   $form->{trans_type}    = 'stock';
@@ -546,7 +549,7 @@ sub remove_parts {
 
   $form->show_generic_error($locale->text("The warehouse does not contain any bins.")) if (0 == scalar @{ $warehouse->{BINS} });
 
-  map { $form->{"l_$_"} = 'Y' } qw(parts_id qty warehouseid binid partnumber partdescription bindescription chargenumber partunit);
+  map { $form->{"l_$_"} = 'Y' } qw(parts_id qty warehouseid binid partnumber partdescription bindescription chargenumber bestbefore partunit);
 
   $form->{sort} = 'bindescription';
   my @contents  = WH->get_warehouse_report("warehouse_id" => $form->{warehouse_id});
@@ -570,12 +573,12 @@ sub remove_parts {
       'transfer_type_id' => $form->{transfer_type_id},
     };
 
-    map { $transfer->{$_} = $form->{"${_}_${row}"} } qw(src_bin_id chargenumber parts_id qty);
+    map { $transfer->{$_} = $form->{"${_}_${row}"} } qw(src_bin_id chargenumber bestbefore parts_id qty);
 
     my $entry;
 
     foreach (@contents) {
-      if (($_->{binid} == $transfer->{src_bin_id}) && ($_->{parts_id} == $transfer->{parts_id}) && ($_->{chargenumber} eq $transfer->{chargenumber})) {
+      if (($_->{binid} == $transfer->{src_bin_id}) && ($_->{parts_id} == $transfer->{parts_id}) && ($_->{chargenumber} eq $transfer->{chargenumber}) && ($_->{bestbefore} eq $transfer->{bestbefore})) {
         $entry = $_;
         last;
       }
@@ -654,10 +657,10 @@ sub generate_journal {
   $form->{sort}  ||= 'date';
 
   my %filter;
-  my @columns = qw(trans_id date warehouse_from bin_from warehouse_to bin_to partnumber partdescription chargenumber trans_type comment qty employee oe_id projectnumber);
+  my @columns = qw(trans_id date warehouse_from bin_from warehouse_to bin_to partnumber partdescription chargenumber bestbefore trans_type comment qty employee oe_id projectnumber);
 
   # filter stuff
-  map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id partnumber description chargenumber);
+  map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id partnumber description chargenumber bestbefore);
 
   $filter{qty_op} = WH->convert_qty_op($form->{qty_op});
   if ($filter{qty_op}) {
@@ -672,7 +675,7 @@ sub generate_journal {
   my $report = SL::ReportGenerator->new(\%myconfig, $form);
 
   my @hidden_variables = map { "l_${_}" } @columns;
-  push @hidden_variables, qw(warehouse_id bin_id partnumber description chargenumber qty_op qty qty_unit fromdate todate);
+  push @hidden_variables, qw(warehouse_id bin_id partnumber description chargenumber bestbefore qty_op qty qty_unit fromdate todate);
 
   my %column_defs = (
     'date'            => { 'text' => $locale->text('Date'), },
@@ -686,6 +689,7 @@ sub generate_journal {
     'partnumber'      => { 'text' => $locale->text('Part Number'), },
     'partdescription' => { 'text' => $locale->text('Description'), },
     'chargenumber'    => { 'text' => $locale->text('Charge Number'), },
+    'bestbefore'      => { 'text' => $locale->text('Best Before'), },
     'qty'             => { 'text' => $locale->text('Qty'), },
     'employee'        => { 'text' => $locale->text('Employee'), },
     'projectnumber'   => { 'text' => $locale->text('Project Number'), },
@@ -777,8 +781,10 @@ sub report {
 
   show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} });
 
-  $form->{fokus}   = "partnumber";
-  $form->{onload} .= "focus();";
+  $form->{jsscript} = 1;
+
+#  $form->{fokus}   = "partnumber";
+#  $form->{onload} .= "focus();";
   $form->{title}   = $locale->text("Report about wareouse contents");
 
   $form->header();
@@ -804,10 +810,10 @@ sub generate_report {
   my $sort_col     = $form->{sort};
 
   my %filter;
-  my @columns = qw(warehousedescription bindescription partnumber partdescription chargenumber qty stock_value);
+  my @columns = qw(warehousedescription bindescription partnumber partdescription chargenumber bestbefore qty stock_value);
 
   # filter stuff
-  map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id partnumber description chargenumber);
+  map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id partnumber description chargenumber bestbefore);
 
   $filter{qty_op} = WH->convert_qty_op($form->{qty_op});
   if ($filter{qty_op}) {
@@ -824,7 +830,7 @@ sub generate_report {
   my $report = SL::ReportGenerator->new(\%myconfig, $form);
 
   my @hidden_variables = map { "l_${_}" } @columns;
-  push @hidden_variables, qw(warehouse_id bin_id partnumber description chargenumber qty_op qty qty_unit l_warehousedescription l_bindescription);
+  push @hidden_variables, qw(warehouse_id bin_id partnumber description chargenumber bestbefore qty_op qty qty_unit l_warehousedescription l_bindescription);
   push @hidden_variables, qw(include_empty_bins subtotal);
 
   my %column_defs = (
@@ -833,6 +839,7 @@ sub generate_report {
     'partnumber'           => { 'text' => $locale->text('Part Number'), },
     'partdescription'      => { 'text' => $locale->text('Description'), },
     'chargenumber'         => { 'text' => $locale->text('Charge Number'), },
+    'bestbefore'           => { 'text' => $locale->text('Best Before'), },
     'qty'                  => { 'text' => $locale->text('Qty'), },
     'stock_value'          => { 'text' => $locale->text('Stock value'), },
   );
index 9bf5a10..763dd49 100644 (file)
@@ -1212,6 +1212,10 @@ td {
     <td><code>si_chargenumber</code></td>
     <td>Chargennummer</td>
    </tr>
+   <tr>
+    <td><code>si_bestbefore</code></td>
+    <td>Mindesthaltbarkeit</td>
+   </tr>
    <tr>
     <td><code>si_number</code></td>
     <td>Artikelnummer</td>
diff --git a/sql/Pg-upgrade2/warehouse_add_bestbefore.sql b/sql/Pg-upgrade2/warehouse_add_bestbefore.sql
new file mode 100644 (file)
index 0000000..325a9a3
--- /dev/null
@@ -0,0 +1,5 @@
+-- @tag: warehouse_add_bestbefore
+-- @description: Spalten für Mindesthaltbarkeitsdatum
+-- @depends: release_2_6_0
+ALTER TABLE inventory ADD COLUMN bestbefore date;
+ALTER TABLE delivery_order_items_stock ADD COLUMN bestbefore date;
index 42208f2..6b2caab 100644 (file)
@@ -92,6 +92,7 @@
      <th class="listheading"><translate>Warehouse</translate></th>
      <th class="listheading"><translate>Bin</translate></th>
      <th class="listheading"><translate>Charge Number</translate></th>
+     <th class="listheading"><translate>Best Before</translate></th>
      <th align="right" class="listheading"><translate>Qty</translate></th>
      <th align="right" class="listheading"><translate>Unit</translate></th>
     </tr>
      <td>[% HTML.escape(row.warehouse_description) %]</td>
      <td>[% HTML.escape(row.bin_description) %]</td>
      <td>[% HTML.escape(row.chargenumber) %]</td>
+     <td>[% HTML.escape(row.bestbefore) %]</td>
      <td>[% HTML.escape(LxERP.format_amount(row.qty)) %]</td>
      <td>[% HTML.escape(row.unit) %]</td>
 
 
      <td><select name="bin_id_[% loop.count %]" id="bin_id_[% loop.count %]"></select></td>
      <td><input name="chargenumber_[% loop.count %]" value="[% HTML.escape(row.chargenumber) %]"></td>
+
+     <td>
+       <input name="bestbefore_[% loop.count %]" id="bestbefore_[% loop.count %]" value="[% HTML.escape(row.bestbefore) %]" size="11" title="[% myconfig_dateformat %]">
+       <input type="button" name="b_bestbefore_[% loop.count %]" id="bestbefore_trigger_[% loop.count %]" value="?">
+     </td>
+
      <td><input name="qty_[% loop.count %]" size="12" value="[% HTML.escape(LxERP.format_amount(row.qty)) %]"></td>
 
      <td>
   </p>
  </form>
 
+ [%- IF NOT delivered %]
+  <script type="text/javascript">
+    <!--
+    [%- FOREACH row = STOCK_INFO %]
+    Calendar.setup( {
+      inputField : "bestbefore_[% loop.count %]",
+      ifFormat :"[% myconfig_jsc_dateformat %]",
+      align : "BR",
+      button : "bestbefore_trigger_[% loop.count %]"
+    });
+    [%- END %]
+    //-->
+  </script>
+  [%- END %]
+
 </body>
 </html>
 
index 971b6e7..8e77f96 100644 (file)
@@ -60,6 +60,7 @@
      <th class="listheading"><translate>Warehouse</translate></th>
      <th class="listheading"><translate>Bin</translate></th>
      <th class="listheading"><translate>Charge Number</translate></th>
+     <th class="listheading"><translate>Best Before</translate></th>
      [%- UNLESS delivered %]
      <th align="right" class="listheading"><translate>Available qty</translate></th>
      [%- END %]
@@ -73,6 +74,7 @@
      <td>[% HTML.escape(row.warehousedescription) %]</td>
      <td>[% HTML.escape(row.bindescription) %]</td>
      <td>[% HTML.escape(row.chargenumber) %]</td>
+     <td>[% HTML.escape(row.bestbefore) %]</td>
 
      [%- IF delivered %]
 
     <input type="hidden" name="warehouse_id_[% loop.count %]" value="[% HTML.escape(row.warehouse_id) %]">
     <input type="hidden" name="bin_id_[% loop.count %]"       value="[% HTML.escape(row.bin_id) %]">
     <input type="hidden" name="chargenumber_[% loop.count %]" value="[% HTML.escape(row.chargenumber) %]">
+    <input type="hidden" name="bestbefore_[% loop.count %]" value="[% HTML.escape(row.bestbefore) %]">
     [%- END %]
    </table>
   </p>
index c7e2f34..732ed2f 100644 (file)
@@ -20,6 +20,9 @@
      [% IF has_charge %]
      <th class="listheading"><translate>Charge number</translate></th>
      [% END %]
+     [% IF has_bestbefore %]
+     <th class="listheading"><translate>Best Before</translate></th>
+     [% END %]
      [% IF has_ean %]
      <th class="listheading"><translate>EAN</translate></th>
      [% END %]
       [% HTML.escape(part.chargenumber) %]
      </td>
      [% END %]
+     [% IF has_bestbefore %]
+     <td>
+      <input type="hidden" name="new_bestbefore_id_[% loop.count %]" value="[% HTML.escape(part.bestbefore_id) %]">
+      <input type="hidden" name="new_bestbefore_[% loop.count %]" value="[% HTML.escape(part.bestbefore) %]">
+      [% HTML.escape(part.bestbefore) %]
+     </td>
+     [% END %]
      [% IF has_ean %]
      <td>
       <input type="hidden" name="new_ean_[% loop.count %]" value="[% HTML.escape(part.ean) %]">
index c76c06c..946a04c 100644 (file)
         <th align="right" nowrap><translate>Charge Number</translate>:</th>
         <td><input name="chargenumber" size=40></td>
        </tr>
+       <tr>
+        <th align="right" nowrap><translate>Best Before</translate>:</th>
+        <td>
+         <input name="bestbefore" id="bestbefore" size="11" title="[% myconfig_dateformat %]">
+         <input type="button" name="b_bestbefore" id="bestbefore_trigger" value="?">
+        </td>
+       </tr>
        <tr>
         <th align="right" nowrap><translate>Transfer Quantity</translate>:</th>
         <td>
         <td nowrap><label for="l_partnumber"><translate>Part Number</translate></label></td>
         <td align="right"><input name="l_chargenumber" id="l_chargenumber" class="checkbox" type="checkbox" value="Y" checked></td>
         <td nowrap><label for="l_chargenumber"><translate>Charge Number</translate></label></td>
+        <td align="right"><input name="l_bestbefore" id="l_bestbefore" class="checkbox" type="checkbox" value="Y" checked></td>
+        <td nowrap><label for="l_bestbefore"><translate>Best Before</translate></label></td>
        </tr>
        <tr>
         <td align="right"><input name="l_trans_id" id="l_trans_id" class="checkbox" type="checkbox" value="Y"></td>
 
   <script type="text/javascript">
     <!--
+    Calendar.setup( {
+      inputField : "bestbefore",
+      ifFormat :"[% myconfig_jsc_dateformat %]",
+      align : "BR",
+      button : "bestbefore_trigger"
+    });
+
     Calendar.setup( {
       inputField : "fromdate",
       ifFormat :"[% myconfig_jsc_dateformat %]",
index d8e1a44..0f37513 100644 (file)
@@ -34,6 +34,7 @@
      <th class="listheading"><translate>Part Number</translate></th>
      <th class="listheading"><translate>Part Description</translate></th>
      <th class="listheading"><translate>Charge Number</translate></th>
+     <th class="listheading"><translate>Best Before</translate></th>
      <th class="listheading"><translate>EAN</translate></th>
      <th class="listheading"><translate>Available qty</translate></th>
      <th class="listheading"><translate>Removal qty</translate></th>
      <input type="hidden" name="partnumber_[% loop.count %]" value="[% HTML.escape(row.partnumber) %]">
      <input type="hidden" name="partdescription_[% loop.count %]" value="[% HTML.escape(row.partdescription) %]">
      <input type="hidden" name="chargenumber_[% loop.count %]" value="[% HTML.escape(row.chargenumber) %]">
+     <input type="hidden" name="bestbefore_[% loop.count %]" value="[% HTML.escape(row.bestbefore) %]">
      <input type="hidden" name="ean_[% loop.count %]" value="[% HTML.escape(row.ean) %]">
      <td>[% HTML.escape(row.bindescription) %]</td>
      <td>[% HTML.escape(row.partnumber) %]</td>
      <td>[% HTML.escape(row.partdescription) %]</td>
      <td>[% HTML.escape(row.chargenumber) %]</td>
+     <td>[% HTML.escape(row.bestbefore) %]</td>
      <td>[% HTML.escape(row.ean) %]</td>
      <td>[% HTML.escape(row.qty) %]</td>
      <td>
index 30a9e52..0c789a6 100644 (file)
         <th align="right" nowrap><translate>Charge Number</translate>:</th>
         <td><input name="chargenumber" size=40></td>
        </tr>
+       <tr>
+        <th align="right" nowrap><translate>Best Before</translate>:</th>
+        <td>
+         <input name="bestbefore" id="bestbefore" size="11" title="[% myconfig_dateformat %]">
+         <input type="button" name="b_bestbefore" id="bestbefore_trigger" value="?">
+        </td>
+       </tr>
        <tr>
         <th align="right" nowrap><translate>Qty in stock</translate>:</th>
         <td>
         <td nowrap><label for="l_partnumber"><translate>Part Number</translate></label></td>
         <td align="right"><input name="l_chargenumber" id="l_chargenumber" class="checkbox" type="checkbox" value="Y" checked></td>
         <td nowrap><label for="l_chargenumber"><translate>Charge Number</translate></label></td>
+        <td align="right"><input name="l_bestbefore" id="l_bestbefore" class="checkbox" type="checkbox" value="Y" checked></td>
+        <td nowrap><label for="l_bestbefore"><translate>Best Before</translate></label></td>
        </tr>
 
        <tr><td colspan="4"><hr noshade height="1"></td></tr>
   </p>
  </form>
 
+ <script type="text/javascript">
+   <!--
+     Calendar.setup( {
+     inputField : "bestbefore",
+     ifFormat :"[% myconfig_jsc_dateformat %]",
+     align : "BR",
+     button : "bestbefore_trigger"
+     });
+   //-->
+ </script>
+
 </body>
 </html>
index c69572f..8b78a77 100644 (file)
@@ -66,6 +66,7 @@
      <th class="listheading"><translate>Part Number</translate></th>
      <th class="listheading"><translate>Part Description</translate></th>
      <th class="listheading"><translate>Charge Number</translate></th>
+     <th class="listheading"><translate>Best Before</translate></th>
      <th class="listheading"><translate>EAN</translate></th>
      <th class="listheading"><translate>Available qty</translate></th>
      <th class="listheading" colspan="2"><translate>Transfer qty</translate></th>
      <input type="hidden" name="partnumber_[% loop.count %]" value="[% HTML.escape(row.partnumber) %]">
      <input type="hidden" name="partdescription_[% loop.count %]" value="[% HTML.escape(row.partdescription) %]">
      <input type="hidden" name="chargenumber_[% loop.count %]" value="[% HTML.escape(row.chargenumber) %]">
+     <input type="hidden" name="bestbefore_[% loop.count %]" value="[% HTML.escape(row.bestbefore) %]">
      <input type="hidden" name="ean_[% loop.count %]" value="[% HTML.escape(row.ean) %]">
      <td>[% HTML.escape(row.bindescription) %]</td>
      <td>[% HTML.escape(row.partnumber) %]</td>
      <td>[% HTML.escape(row.partdescription) %]</td>
      <td>[% HTML.escape(row.chargenumber) %]</td>
+     <td>[% HTML.escape(row.bestbefore) %]</td>
      <td>[% HTML.escape(row.ean) %]</td>
      <td>[% HTML.escape(row.qty) %]</td>
      <td><input name="qty_[% loop.count %]" size="8" style="text-align: right"></td>
index dd9c865..27f0344 100644 (file)
      <td><input name="chargenumber" size="30" value="[% HTML.escape(chargenumber) %]"></td>
     </tr>
 
+    <tr>
+     <th align="right" nowrap><translate>Best Before</translate></th>
+     <td>
+       <input name="bestbefore" id="bestbefore" size="11" value="[% HTML.escape(bestbefore) %]" title="[% myconfig_dateformat %]">
+       <input type="button" name="b_bestbefore" id="bestbefore_trigger" value="?">
+       </td>
+    </tr>
+
     <tr>
      <th align="right" nowrap><translate>Quantity</translate></th>
      <td>
   </p>
  </form>
 
+ <script type="text/javascript">
+   <!--
+     Calendar.setup( {
+     inputField : "bestbefore",
+     ifFormat :"[% myconfig_jsc_dateformat %]",
+     align : "BR",
+     button : "bestbefore_trigger"
+     });
+   //-->
+ </script>
+
 </body>
 </html>
index 1c9c35f..c6da317 100644 (file)
      <th align="right" nowrap><translate>Charge number</translate></th>
      <td><input name="chargenumber" size="30"></td>
     </tr>
+
+    <tr>
+     <th align="right" nowrap><translate>Best Before</translate></th>
+     <td>
+       <input name="bestbefore" id="bestbefore" size="11" title="[% myconfig_dateformat %]">
+       <input type="button" name="b_bestbefore" id="bestbefore_trigger" value="?">
+     </td>
+    </tr>
+
     <tr>
      <th align="right" nowrap><translate>EAN</translate></th>
      <td><input name="ean" size="30"></td>
   </p>
  </form>
 
+ <script type="text/javascript">
+   <!--
+     Calendar.setup( {
+     inputField : "bestbefore",
+     ifFormat :"[% myconfig_jsc_dateformat %]",
+     align : "BR",
+     button : "bestbefore_trigger"
+     });
+   //-->
+ </script>
+
 </body>
 </html>
index 33bcd76..9b68561 100644 (file)
      <th align="right" nowrap><translate>Charge number</translate></th>
      <td><input name="chargenumber" size="30" value="[% HTML.escape(chargenumber) %]"></td>
     </tr>
+
+    <tr>
+     <th align="right" nowrap><translate>Best Before</translate></th>
+     <td>
+       <input name="bestbefore" id="bestbefore" size="11" value="[% HTML.escape(bestbefore) %]" title="[% myconfig_dateformat %]">
+       <input type="button" name="b_bestbefore" id="bestbefore_trigger" value="?">
+     </td>
+    </tr>
+
     <tr>
      <th align="right" nowrap><translate>EAN</translate></th>
      <td><input name="ean" size="30" value="[% HTML.escape(ean) %]"></td>
   </p>
  </form>
 
+ <script type="text/javascript">
+   <!--
+     Calendar.setup( {
+     inputField : "bestbefore",
+     ifFormat :"[% myconfig_jsc_dateformat %]",
+     align : "BR",
+     button : "bestbefore_trigger"
+     });
+   //-->
+ </script>
+
 </body>
 </html>