require "bin/mozilla/common.pl";
require "bin/mozilla/reportgenerator.pl";
+use strict;
+
# parserhappy(R):
# contents of the "transfer_type" table:
# --------------------------------------------------------------------
sub transfer_warehouse_selection {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('warehouse_management');
- $auth->assert('warehouse_management');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES',
'bins' => 'BINS', });
show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} });
my $units = AM->retrieve_units(\%myconfig, $form);
- $form->{UNITS} = AM->unit_select_data($units, $form->{unit}, 0, $form->{partunit});
+ # der zweite Parameter von unit_select_data gibt den default-Namen (selected) vor
+ $form->{UNITS} = AM->unit_select_data($units, $form->{partunit}, 0, $form->{partunit});
if (scalar @{ $form->{WAREHOUSES} }) {
$form->{warehouse_id} ||= $form->{WAREHOUSES}->[0]->{id};
$form->header();
print $content;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub transfer_parts_selection {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('warehouse_management');
- $auth->assert('warehouse_management');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
transfer_or_removal_prepare_contents('direction' => 'transfer');
$form->header();
print $form->parse_html_template("wh/transfer_parts_selection");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub transfer_or_removal_prepare_contents {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('warehouse_management');
+ $main::auth->assert('warehouse_management');
my %args = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES',
'bins' => 'BINS', });
$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},
- "partnumber" => $form->{partnumber},
- "ean" => $form->{ean},
+ "bestbefore" => $form->{bestbefore},
+ "partnumber" => $form->{partnumber},
+ "ean" => $form->{ean},
"description" => $form->{description});
- $form->show_generic_error($locale->text("The selected warehouse is empty.")) if (0 == scalar(@contents));
+ if (0 == scalar(@contents)) {
+ $form->show_generic_error($locale->text("The selected warehouse is empty, or no stocked items where found that match the filter settings."));
+ }
my $all_units = AM->retrieve_units(\%myconfig, $form);
$form->{CONTENTS} = \@contents;
$form->{TRANSFER_TYPES} = $transfer_types;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub transfer_parts {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('warehouse_management');
+ $main::auth->assert('warehouse_management');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES', 'bins' => 'BINS' });
$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;
}
if (!scalar @transfers) {
$form->show_generic_information($locale->text('Nothing has been selected for transfer.'));
- exit 0;
+ ::end_of_request();
}
WH->transfer(@transfers);
transfer_warehouse_selection();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# --------------------------------------------------------------------
# --------------------------------------------------------------------
sub transfer_stock_update_part {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{trans_type} = 'stock';
$form->{qty} = $form->parse_amount(\%myconfig, $form->{qty});
} elsif (($form->{partnumber} && ($form->{partnumber} ne $form->{old_partnumber})) || $form->{description} || $form->{ean}) {
- $form->{no_services} = 1;
- $form->{no_assemblies} = 0; # assemblies duerfen eingelagert werden (z.B. bei retouren)
+# $form->{no_services} = 1; # services may now be transfered. fix for Bug 1383.
+ $form->{no_assemblies} = 0; # assemblies duerfen eingelagert werden (z.B. bei retouren)
my $parts = Common->retrieve_parts(\%myconfig, $form, 'description', 1);
transfer_warehouse_selection();
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# --------------------------------------------------------------------
# --------------------------------------------------------------------
sub transfer_assembly_update_part {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{trans_type} = 'assembly';
$form->{qty} = $form->parse_amount(\%myconfig, $form->{qty});
# hier die oben benannte idee
# my $maxcreate = Common->check_assembly_max_create(assembly_id => $form->{parts_id}, dbh => $my_dbh);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
+
sub transfer_stock_part_selected {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my $part = shift;
+ my $form = $main::form;
+
@{$form}{qw(parts_id partnumber description ean)} = @{$part}{qw(id partnumber description ean)};
transfer_stock_get_partunit();
transfer_warehouse_selection();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub transfer_stock_get_partunit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
if ($form->{parts_id}) {
my $part_info = IC->get_basic_part_info('id' => $form->{parts_id});
$form->{partunit} = $part_info->{unit};
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# vorüberlegung jb 22.2.2009
# Laut Absprache in KW11 09 übernimmt mb hier den rest im April ... jb 18.3.09
sub create_assembly {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{qty} = $form->parse_amount(\%myconfig, $form->{qty});
if ($form->{qty} <= 0) {
$form->show_generic_error($locale->text('Invalid quantity.'), 'back_button' => 1);
}
# TODO Es wäre schön, hier schon die maximale Anzahl der zu fertigenden Erzeugnisse zu haben
- #else { if ($form->{qty} > $maxcreate) { #s.o.
- # $form->show_generic_error($locale->text('Can not create that quantity with current stock'), 'back_button' => 1);
- # $form->show_generic_error('Maximale Stückzahl' . $maxcreate , 'back_button' => 1);
- # }
+ #else { if ($form->{qty} > $maxcreate) { #s.o.
+ # $form->show_generic_error($locale->text('Can not create that quantity with current stock'), 'back_button' => 1);
+ # $form->show_generic_error('Maximale Stückzahl' . $maxcreate , 'back_button' => 1);
+ # }
# }
if (!$form->{warehouse_id} || !$form->{bin_id}) {
$form->error($locale->text('The warehouse or the bin is missing.'));
}
+
+ if (!$::lx_office_conf{features}->{show_best_before}) {
+ $form->{bestbefore} = '';
+ }
+
# WIESO war das nicht vorher schon ein %HASH?? ein hash ist ein hash! das hat mich mehr als eine Stunde gekostet herauszufinden. grr. jb 3.3.2009
# Anm. jb 18.3. vielleicht auch nur meine unwissenheit in perl-datenstrukturen
my %TRANSFER = (
'transfer_type' => 'assembly',
- 'login' => $form->{login},
+ 'login' => $form->{login},
'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';
transfer_warehouse_selection();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub transfer_stock {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{qty} = $form->parse_amount(\%myconfig, $form->{qty});
'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 ean)};
$form->{saved_message} = $locale->text('The parts have been stocked.');
$form->{trans_type} = 'stock';
transfer_warehouse_selection();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# --------------------------------------------------------------------
# --------------------------------------------------------------------
sub removal_parts_selection {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('warehouse_management');
- $auth->assert('warehouse_management');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
transfer_or_removal_prepare_contents('direction' => 'out');
$form->header();
print $form->parse_html_template("wh/removal_parts_selection");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub remove_parts {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('warehouse_management');
- $auth->assert('warehouse_management');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES',
'bins' => 'BINS', });
$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;
}
if (!scalar @transfers) {
$form->show_generic_information($locale->text('Nothing has been selected for removal.'));
- exit 0;
+ ::end_of_request();
}
WH->transfer(@transfers);
transfer_warehouse_selection();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# --------------------------------------------------------------------
# --------------------------------------------------------------------
sub journal {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('warehouse_management');
- $auth->assert('warehouse_management');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ $form->{title} = $locale->text('Report about warehouse transactions');
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES',
'bins' => 'BINS', });
$form->header();
print $form->parse_html_template("wh/journal_filter", { "UNITS" => AM->unit_select_data(AM->retrieve_units(\%myconfig, $form)) });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub generate_journal {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('warehouse_management');
+ $main::auth->assert('warehouse_management');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{title} = $locale->text("WHJournal");
$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 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}) {
- $form->isblank(qty, $locale->text('Quantity missing.'));
- $form->isblank(qty_unit, $locale->text('Unit missing.'));
+ $form->isblank("qty", $locale->text('Quantity missing.'));
+ $form->isblank("qty_unit", $locale->text('Unit missing.'));
$filter{qty} = $form->{qty};
$filter{qty_unit} = $form->{qty_unit};
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'), },
'bin_from' => { 'text' => $locale->text('Bin From'), },
'bin_to' => { 'text' => $locale->text('Bin To'), },
'partnumber' => { 'text' => $locale->text('Part Number'), },
- 'partdescription' => { 'text' => $locale->text('Description'), },
+ 'partdescription' => { 'text' => $locale->text('Part 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'), },
+ 'oe_id' => { 'text' => $locale->text('Document'), },
);
my $href = build_std_url('action=generate_journal', grep { $form->{$_} } @hidden_variables);
'title' => $form->{title},
'attachment_basename' => strftime($locale->text('warehouse_journal_list') . '_%Y%m%d', localtime time));
$report->set_options_from_form();
+ $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv';
my $all_units = AM->retrieve_units(\%myconfig, $form);
my @contents = WH->get_warehouse_journal(%filter);
- foreach $entry (@contents) {
+ my %doc_types = ( 'sales_quotation' => { script => 'oe', title => $locale->text('Sales quotation') },
+ 'sales_order' => { script => 'oe', title => $locale->text('Sales Order') },
+ 'request_quotation' => { script => 'oe', title => $locale->text('Request quotation') },
+ 'purchase_order' => { script => 'oe', title => $locale->text('Purchase Order') },
+ 'sales_delivery_order' => { script => 'do', title => $locale->text('Sales delivery order') },
+ 'purchase_delivery_order' => { script => 'do', title => $locale->text('Purchase delivery order') },
+ 'sales_invoice' => { script => 'is', title => $locale->text('Sales Invoice') },
+ 'purchase_invoice' => { script => 'ir', title => $locale->text('Purchase Invoice') },
+ );
+
+ foreach my $entry (@contents) {
$entry->{qty} = $form->format_amount_units('amount' => $entry->{qty},
'part_unit' => $entry->{partunit},
'conv_units' => 'convertible');
my $row = { };
foreach my $column (@columns) {
- next if ($column eq 'trans_type');
-
$row->{$column} = {
'data' => $entry->{$column},
'align' => $column_alignment{$column},
};
}
- $row->{trans_type} = {
- 'raw_data' => $entry->{trans_type},
- 'align' => $column_alignment{trans_type},
- };
+ $row->{trans_type}->{raw_data} = $entry->{trans_type};
+
+ if ($form->{l_oe_id}) {
+ $row->{oe_id}->{data} = '';
+ my $info = $entry->{oe_id_info};
+
+ if ($info && $info->{id} && $info->{type} && $doc_types{$info->{type}}) {
+ $row->{oe_id} = { data => $doc_types{ $info->{type} }->{title} . ' ' . $info->{number},
+ link => build_std_url('script=' . $doc_types{ $info->{type} }->{script} . '.pl', 'action=edit', 'id=' . $info->{id}, 'type=' . $info->{type}) };
+ }
+ }
$report->add_data($row);
}
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# --------------------------------------------------------------------
# --------------------------------------------------------------------
sub report {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('warehouse_contents | warehouse_management');
+ $main::auth->assert('warehouse_contents | warehouse_management');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES',
'bins' => 'BINS', });
show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} });
- $form->{fokus} = "partnumber";
- $form->{onload} .= "focus();";
- $form->{title} = $locale->text("Report about wareouse contents");
+ $form->{jsscript} = 1;
+
+# $form->{fokus} = "partnumber";
+# $form->{onload} .= "focus();";
+ $form->{title} = $locale->text("Report about warehouse contents");
$form->header();
print $form->parse_html_template("wh/report_filter",
"WAREHOUSES" => $form->{WAREHOUSES},
"UNITS" => AM->unit_select_data(AM->retrieve_units(\%myconfig, $form)) });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub generate_report {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('warehouse_contents | warehouse_management');
- $auth->assert('warehouse_contents | warehouse_management');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $form->{title} = $locale->text("Report about wareouse contents");
+ $form->{title} = $locale->text("Report about warehouse contents");
$form->{sort} ||= 'partnumber';
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}) {
- $form->isblank(qty, $locale->text('Quantity missing.'));
- $form->isblank(qty_unit, $locale->text('Unit missing.'));
+ $form->isblank("qty", $locale->text('Quantity missing.'));
+ $form->isblank("qty_unit", $locale->text('Unit missing.'));
$filter{qty} = $form->{qty};
$filter{qty_unit} = $form->{qty_unit};
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 = (
'warehousedescription' => { 'text' => $locale->text('Warehouse'), },
'bindescription' => { 'text' => $locale->text('Bin'), },
'partnumber' => { 'text' => $locale->text('Part Number'), },
- 'partdescription' => { 'text' => $locale->text('Description'), },
+ 'partdescription' => { 'text' => $locale->text('Part 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'), },
);
'title' => $form->{title},
'attachment_basename' => strftime($locale->text('warehouse_report_list') . '_%Y%m%d', localtime time));
$report->set_options_from_form();
+ $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv';
my $all_units = AM->retrieve_units(\%myconfig, $form);
my @contents = WH->get_warehouse_report(%filter);
my $total_stock_value = 0;
- foreach $entry (@contents) {
+ foreach my $entry (@contents) {
map { $subtotals{$_} += $entry->{$_} } @subtotals_columns;
$total_stock_value += $entry->{stock_value} * 1;
'conv_units' => 'convertible');
$entry->{stock_value} = $form->format_amount(\%myconfig, $entry->{stock_value} * 1, 2);
- $row_set = [ { map { $_ => { 'data' => $entry->{$_}, 'align' => $column_alignment{$_} } } @columns } ];
+ my $row_set = [ { map { $_ => { 'data' => $entry->{$_}, 'align' => $column_alignment{$_} } } @columns } ];
if (($form->{subtotal} eq 'Y')
&& (($idx == (scalar @contents - 1))
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# --------------------------------------------------------------------
# --------------------------------------------------------------------
sub show_no_warehouses_error {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
my $msg = $locale->text('No warehouse has been created yet or the quantity of the bins is not configured yet.') . ' ';
- if ($auth->check_right($form->{login}, 'config')) {
+ if ($main::auth->check_right($form->{login}, 'config')) {
$msg .= $locale->text('You can create warehouses and bins via the menu "System -> Warehouses".');
} else {
$msg .= $locale->text('Please ask your administrator to create warehouses and bins.');
$form->show_generic_error($msg);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub get_warehouse_idx {
my ($warehouse_id) = @_;
+ my $form = $main::form;
+
for (my $i = 0; $i < scalar @{$form->{WAREHOUSES}}; $i++) {
return $i if ($form->{WAREHOUSES}->[$i]->{id} == $warehouse_id);
}
sub get_bin_idx {
my ($warehouse_index, $bin_id) = @_;
+ my $form = $main::form;
+
my $warehouse = $form->{WAREHOUSES}->[$warehouse_index];
return -1 if (!$warehouse);
return -1;
}
-=item new_item
-
-call new item dialogue from warehouse masks.
-
-PARAMS:
- action => name of sub to be called when new item is done
-
-=cut
sub new_item {
$main::lxdebug->enter_sub();
my %params = @_;
+ my $form = $main::form;
+
# change callback
$form->{old_callback} = $form->escape($form->{callback}, 1);
$form->{callback} = $form->escape("$form->{script}?action=$params{action}", 1);
# save all form variables except action in a previousform variable
my $previousform = join '&', map { my $value = $form->{$_}; $value =~ s/&/%26/; "$_=$value" } grep { !/action/ } keys %$form;
+ my @HIDDENS = ();
# push @HIDDENS, { 'name' => 'previousform', 'value' => $form->escape($previousform, 1) };
push @HIDDENS, map +{ 'name' => $_, 'value' => $form->{$_} }, qw(partnumber description unit vc sellprice ean);
}
sub update {
+ my $form = $main::form;
call_sub($form->{update_nextsub} || $form->{nextsub});
}
sub continue {
+ my $form = $main::form;
call_sub($form->{continue_nextsub} || $form->{nextsub});
}
sub stock {
+ my $form = $main::form;
call_sub($form->{stock_nextsub} || $form->{nextsub});
}
1;
+
+__END__
+
+=head1 NAME
+
+bin/mozilla/wh.pl - Warehouse frontend.
+
+=head1 FUNCTIONS
+
+=over 4
+
+=item new_item
+
+call new item dialogue from warehouse masks.
+
+PARAMS:
+ action => name of sub to be called when new item is done
+
+=back
+
+=cut