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';
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);
}
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);
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);
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};
}
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);
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;
"${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},
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);
$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}) {
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);
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);
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
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.
# 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
} 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();
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};
"partdescription" => "p.description",
"bindescription" => "b.description",
"chargenumber" => "i1.chargenumber",
+ "bestbefore" => "i1.bestbefore",
"warehousedescription" => "w.description",
"partunit" => "p.unit",
"bin_from" => "b1.description",
# - 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
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} . '%';
"bindescription" => "b.description",
"binid" => "b.id",
"chargenumber" => "i.chargenumber",
+ "bestbefore" => "i.bestbefore",
"ean" => "p.ean",
"chargeid" => "c.id",
"warehousedescription" => "w.description",
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};
}
$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;
"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 });
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);
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});
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);
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);
}
'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,
$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;
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});
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'));
$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});
$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});
'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;
}
'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},
$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';
'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},
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';
$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});
'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;
}
$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}) {
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'), },
'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'), },
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();
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}) {
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 = (
'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'), },
);
<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>
--- /dev/null
+-- @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;
<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>
<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 %]
<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>
[% 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) %]">
<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 %]",
<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>
<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>
<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>
<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>
<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>
<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>