X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fwh.pl;h=e8afc5dae1489d2208eb13ad23e0aaf98f43e310;hb=333003d332756c5f53a33720aea7b714dfd335c8;hp=66594ff685325196f2f959c3e3db04e2c9ffdd6d;hpb=5067d7bd31514962af9730b33323b831d87164f8;p=kivitendo-erp.git diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index 66594ff68..e8afc5dae 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -23,7 +23,8 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1335, USA. # ####################################################################### # @@ -42,7 +43,9 @@ use SL::CT; use SL::IC; use SL::WH; use SL::OE; +use SL::Locale::String qw(t8); use SL::ReportGenerator; +use SL::Presenter::Part; use SL::DB::Part; @@ -68,6 +71,7 @@ use strict; # $locale->text('return_material') # $locale->text('release_material') # $locale->text('assembled') +# $locale->text('stocktaking') # -------------------------------------------------------------------- # Transfer @@ -107,20 +111,17 @@ sub transfer_warehouse_selection { my $content; if ($form->{trans_type} eq 'removal') { - $form->{nextsub} = "removal_parts_selection"; + setup_wh_transfer_warehouse_selection_action_bar("removal_parts_selection"); $form->{title} = $locale->text('Removal from Warehouse'); $content = $form->parse_html_template('wh/warehouse_selection'); - } elsif ($form->{trans_type} eq 'stock') { - $form->{title} = $locale->text('Stock'); - $content = $form->parse_html_template('wh/warehouse_selection_stock'); - } elsif (!$form->{trans_type} || ($form->{trans_type} eq 'transfer')) { - $form->{nextsub} = "transfer_parts_selection"; + setup_wh_transfer_warehouse_selection_action_bar("transfer_parts_selection"); $form->{title} = $locale->text('Transfer'); $content = $form->parse_html_template('wh/warehouse_selection'); } elsif ($form->{trans_type} eq 'assembly') { + setup_wh_transfer_warehouse_selection_assembly_action_bar(); $form->{title} = $locale->text('Produce Assembly'); $content = $form->parse_html_template('wh/warehouse_selection_assembly'); } @@ -142,6 +143,8 @@ sub transfer_parts_selection { transfer_or_removal_prepare_contents('direction' => 'transfer'); + setup_wh_transfer_parts_action_bar(); + $form->{title} = $locale->text('Transfer'); $form->header(); print $form->parse_html_template("wh/transfer_parts_selection"); @@ -181,9 +184,8 @@ sub transfer_or_removal_prepare_contents { "bin_id" => $form->{bin_id}, "chargenumber" => $form->{chargenumber}, "bestbefore" => $form->{bestbefore}, - "partnumber" => $form->{partnumber}, - "ean" => $form->{ean}, - "description" => $form->{description}); + "partsid" => $form->{part_id}, + "ean" => $form->{ean}); 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.")); @@ -307,46 +309,6 @@ sub transfer_parts { # Transfer: stock # -------------------------------------------------------------------- -sub transfer_stock_update_part { - $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}); - - if (!$form->{partnumber} && !$form->{description} && !$form->{ean}) { - delete @{$form}{qw(parts_id partunit ean)}; - transfer_warehouse_selection(); - - } elsif (($form->{partnumber} && ($form->{partnumber} ne $form->{old_partnumber})) || $form->{description} || $form->{ean}) { - -# $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); - - if (!scalar @{ $parts }) { - new_item(action => "transfer_stock_update_part"); - } elsif (scalar @{ $parts } == 1) { - @{$form}{qw(parts_id partnumber description ean warehouse_id bin_id)} = @{$parts->[0]}{qw(id partnumber description ean warehouse_id bin_id)}; - transfer_stock_get_partunit(); - transfer_warehouse_selection(); - - } else { - select_part('transfer_stock_part_selected', @{ $parts }); - } - - } else { - transfer_stock_get_partunit(); - transfer_warehouse_selection(); - } - - $main::lxdebug->leave_sub(); -} - # -------------------------------------------------------------------- # Transfer: assemblies # Dies ist die Auswahlmaske für ein assembly. @@ -356,8 +318,6 @@ sub transfer_stock_update_part { # -------------------------------------------------------------------- sub transfer_assembly_update_part { - $main::lxdebug->enter_sub(); - my $form = $main::form; my %myconfig = %main::myconfig; my $locale = $main::locale; @@ -365,30 +325,18 @@ sub transfer_assembly_update_part { $form->{trans_type} = 'assembly'; $form->{qty} = $form->parse_amount(\%myconfig, $form->{qty}); - if (!$form->{partnumber} && !$form->{description}) { - delete @{$form}{qw(parts_id partunit)}; + if (!$form->{parts_id}) { + delete $form->{partunit}; transfer_warehouse_selection(); + return; - } elsif (($form->{partnumber} && ($form->{partnumber} ne $form->{old_partnumber})) || $form->{description}) { - $form->{assemblies} = 1; - $form->{no_assemblies} = 0; - my $parts = Common->retrieve_parts(\%myconfig, $form, 'description', 1); - if (scalar @{ $parts } == 1) { - @{$form}{qw(parts_id partnumber description)} = @{$parts->[0]}{qw(id partnumber description)}; - transfer_stock_get_partunit(); - transfer_warehouse_selection(); - } else { - select_part('transfer_stock_part_selected', @{ $parts }); - } - - } else { - transfer_stock_get_partunit(); - transfer_warehouse_selection(); } -# hier die oben benannte idee -# my $maxcreate = Common->check_assembly_max_create(assembly_id => $form->{parts_id}, dbh => $my_dbh); - $main::lxdebug->leave_sub(); + my $part = SL::DB::Part->new(id => $::form->{parts_id})->load; + @{$form}{qw(parts_id partnumber description)} = ($part->id, $part->partnumber, $part->description); + + transfer_stock_get_partunit(); + transfer_warehouse_selection(); } sub transfer_stock_part_selected { @@ -435,12 +383,12 @@ sub create_assembly { $form->{qty} = $form->parse_amount(\%myconfig, $form->{qty}); if ($form->{qty} <= 0) { - $form->show_generic_error($locale->text('Invalid quantity.'), 'back_button' => 1); + $form->show_generic_error($locale->text('Invalid quantity.')); } # 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); + # $form->show_generic_error($locale->text('Can not create that quantity with current stock')); + # $form->show_generic_error('Maximale Stückzahl' . $maxcreate); # } # } @@ -472,7 +420,7 @@ sub create_assembly { # Ideen? jb 18.3.09 if ($ret ne "1"){ # Die locale-Funktion kann keine Double-Quotes escapen, deswegen hier erstmal so (ein wahrscheinlich immerwährender Hotfix) s.a. Frage davor jb 25.4.09 - $form->show_generic_error($ret, 'back_button' => 1); + $form->show_generic_error($ret); } delete @{$form}{qw(parts_id partnumber description qty unit chargenumber bestbefore comment)}; @@ -485,47 +433,6 @@ sub create_assembly { $main::lxdebug->leave_sub(); } -sub transfer_stock { - $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); - } - - if (!$form->{warehouse_id} || !$form->{bin_id}) { - $form->error($locale->text('The warehouse or the bin is missing.')); - } - - my $transfer = { - 'transfer_type' => '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}, - 'comment' => $form->{comment}, - }; - - WH->transfer($transfer); - - 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(); - - $main::lxdebug->leave_sub(); -} - # -------------------------------------------------------------------- # Transfer: removal # -------------------------------------------------------------------- @@ -541,6 +448,8 @@ sub removal_parts_selection { transfer_or_removal_prepare_contents('direction' => 'out'); + setup_wh_removal_parts_selection_action_bar(); + $form->{title} = $locale->text('Removal'); $form->header(); print $form->parse_html_template("wh/removal_parts_selection"); @@ -656,6 +565,8 @@ sub journal { show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} }); + setup_wh_journal_action_bar(); + $form->header(); print $form->parse_html_template("wh/journal_filter", { "UNITS" => AM->unit_select_data(AM->retrieve_units(\%myconfig, $form)) }); @@ -680,7 +591,7 @@ sub generate_journal { my @columns = qw(trans_id date warehouse_from bin_from warehouse_to bin_to partnumber type_and_classific partdescription chargenumber bestbefore trans_type comment qty unit partunit employee oe_id projectnumber); # filter stuff - map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id classification_id partnumber description chargenumber bestbefore); + map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id classification_id partnumber description chargenumber bestbefore transtype_id transtype_ids comment projectnumber); $filter{qty_op} = WH->convert_qty_op($form->{qty_op}); if ($filter{qty_op}) { @@ -692,10 +603,33 @@ sub generate_journal { } # /filter stuff + my $allrows = !!($form->{report_generator_output_format} ne 'HTML') ; + + # manual paginating + my $pages = {}; + my $page = $::form->{page} || 1; + $pages->{per_page} = $::form->{per_page} || 15; + my $first_nr = ($page - 1) * $pages->{per_page}; + my $last_nr = $first_nr + $pages->{per_page}; + + # no optimisation if qty op + if ( !$allrows && $form->{maxrows} && !$filter{qty_op}) { + $filter{limit} = $pages->{per_page}; + $filter{offset} = ($page - 1) * $pages->{per_page}; + $first_nr = 0; + $last_nr = $pages->{per_page}; + } + + my @contents = WH->get_warehouse_journal(%filter); + # get maxcount + if (!$form->{maxrows}) { + $form->{maxrows} = scalar @contents ; + } + my $report = SL::ReportGenerator->new(\%myconfig, $form); my @hidden_variables = map { "l_${_}" } @columns; - push @hidden_variables, qw(warehouse_id bin_id partnumber description chargenumber bestbefore qty_op qty qty_unit fromdate todate); + push @hidden_variables, qw(warehouse_id bin_id partnumber description chargenumber bestbefore qty_op qty qty_unit unit partunit fromdate todate transtype_ids comment projectnumber); push @hidden_variables, qw(classification_id); my %column_defs = ( @@ -721,13 +655,22 @@ sub generate_journal { 'oe_id' => { 'text' => $locale->text('Document'), }, ); + if ($form->{transtype_ids} && 'ARRAY' eq ref $form->{transtype_ids}) { + for (my $i = 0; $i < scalar(@{ $form->{transtype_ids} }); $i++) { + delete $form->{transtype_ids}[$i] if $form->{transtype_ids}[$i] eq ''; + } + $form->{transtype_ids} = join(",", @{ $form->{transtype_ids} }); + } + my $href = build_std_url('action=generate_journal', grep { $form->{$_} } @hidden_variables); - my $page = $::form->{page} || 1; + $href .= "&maxrows=".$form->{maxrows}; + map { $column_defs{$_}->{link} = $href ."&page=".$page. "&sort=${_}&order=" . Q($_ eq $form->{sort} ? 1 - $form->{order} : $form->{order}) } @columns; my %column_alignment = map { $_ => 'right' } qw(qty); map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns; + $column_defs{partunit}->{visible} = 1; $column_defs{type_and_classific}->{visible} = 1; $column_defs{type_and_classific}->{link} =''; @@ -745,7 +688,6 @@ sub generate_journal { $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); my %doc_types = ( 'sales_quotation' => { script => 'oe', title => $locale->text('Sales quotation') }, 'sales_order' => { script => 'oe', title => $locale->text('Sales Order') }, @@ -757,23 +699,12 @@ sub generate_journal { 'purchase_invoice' => { script => 'ir', title => $locale->text('Purchase Invoice') }, ); - my $allrows = 0; - $allrows = 1 if $form->{report_generator_output_format} ne 'HTML' ; - - # manual paginating - my $pages = {}; - $pages->{per_page} = $::form->{per_page} || 15; - my $first_nr = ($page - 1) * $pages->{per_page}; - my $last_nr = $first_nr + $pages->{per_page}; - my $idx = 0; + my $idx = 0; foreach my $entry (@contents) { - # type impl $entry->{type_and_classific} = $::request->presenter->type_abbreviation($entry->{type}). - $entry->{type_and_classific} = $::request->presenter->type_abbreviation($entry->{assembly},$entry->{inventory_accno_id}). - $::request->presenter->classification_abbreviation($entry->{classification_id}); - $entry->{qty} = $form->format_amount_units('amount' => $entry->{qty}, - 'part_unit' => $entry->{partunit}, - 'conv_units' => 'convertible'); + $entry->{type_and_classific} = SL::Presenter::Part::type_abbreviation($entry->{part_type}) . + SL::Presenter::Part::classification_abbreviation($entry->{classification_id}); + $entry->{qty} = $form->format_amount(\%myconfig, $entry->{qty}); $entry->{trans_type} = $locale->text($entry->{trans_type}); my $row = { }; @@ -798,18 +729,18 @@ sub generate_journal { } if ( $allrows || ($idx >= $first_nr && $idx < $last_nr )) { - $report->add_data($row); + $report->add_data($row); } $idx++; } if ( ! $allrows ) { - $pages->{max} = SL::DB::Helper::Paginated::ceil($idx, $pages->{per_page}) || 1; + $pages->{max} = SL::DB::Helper::Paginated::ceil($form->{maxrows}, $pages->{per_page}) || 1; $pages->{page} = $page < 1 ? 1: $page > $pages->{max} ? $pages->{max}: $page; $pages->{common} = [ grep { $_->{visible} } @{ SL::DB::Helper::Paginated::make_common_pages($pages->{page}, $pages->{max}) } ]; $report->set_options('raw_bottom_info_text' => $form->parse_html_template('common/paginate', - { 'pages' => $pages , 'base_url' => $href}) ); + { 'pages' => $pages , 'base_url' => $href.'&sort='.$form->{sort}.'&order='.$form->{order}}) ); } $report->generate_with_headers(); @@ -836,10 +767,11 @@ sub report { $form->{title} = $locale->text("Report about warehouse contents"); + setup_wh_report_action_bar(); + $form->header(); print $form->parse_html_template("wh/report_filter", - { "nextsub" => "generate_report", - "WAREHOUSES" => $form->{WAREHOUSES}, + { "WAREHOUSES" => $form->{WAREHOUSES}, "UNITS" => AM->unit_select_data(AM->retrieve_units(\%myconfig, $form)) }); $main::lxdebug->leave_sub(); @@ -856,11 +788,10 @@ sub generate_report { $form->{title} = $locale->text("Report about warehouse contents"); $form->{sort} ||= 'partnumber'; - $form->{sort} ||= 'partunit'; my $sort_col = $form->{sort}; my %filter; - my @columns = qw(warehousedescription bindescription partnumber type_and_classific partdescription chargenumber bestbefore comment qty partunit stock_value); + my @columns = qw(warehousedescription bindescription partnumber type_and_classific partdescription chargenumber bestbefore comment qty partunit list_price purchase_price stock_value); # filter stuff map { $filter{$_} = $form->{$_} if ($form->{$_}) } qw(warehouse_id bin_id classification_id partnumber description chargenumber bestbefore date include_invalid_warehouses); @@ -878,7 +809,7 @@ sub generate_report { SL::DB::Manager::Bin->find_by(id => $form->{bin_id})->description}, partnumber => sub { push @options, $locale->text('Partnumber') . " : $form->{partnumber}"}, classification_id => sub { push @options, $locale->text('Parts Classification'). " : ". - SL::DB::Manager::PartsClassification->get_first(where => [ id => $form->{classification_id} ] )->description; }, + SL::DB::Manager::PartClassification->get_first(where => [ id => $form->{classification_id} ] )->description; }, description => sub { push @options, $locale->text('Description') . " : $form->{description}"}, chargenumber => sub { push @options, $locale->text('Charge Number') . " : $form->{chargenumber}"}, bestbefore => sub { push @options, $locale->text('Best Before') . " : $form->{bestbefore}"}, @@ -901,15 +832,39 @@ sub generate_report { } # /filter stuff + $form->{report_generator_output_format} = 'HTML' if !$form->{report_generator_output_format}; + + # manual paginating + my $allrows = !!($form->{report_generator_output_format} ne 'HTML') ; + my $page = $::form->{page} || 1; + my $pages = {}; + $pages->{per_page} = $::form->{per_page} || 20; + my $first_nr = ($page - 1) * $pages->{per_page}; + my $last_nr = $first_nr + $pages->{per_page}; + + # no optimisation if qty op + if ( !$allrows && $form->{maxrows} && !$filter{qty_op}) { + $filter{limit} = $pages->{per_page}; + $filter{offset} = ($page - 1) * $pages->{per_page}; + $first_nr = 0; + $last_nr = $pages->{per_page}; + } + + my @contents = WH->get_warehouse_report(%filter); + + # get maxcount + if (!$form->{maxrows}) { + $form->{maxrows} = scalar @contents ; + } + $form->{subtotal} = '' if (!first { $_ eq $sort_col } qw(partnumber partdescription)); - $form->{report_generator_output_format} = 'HTML' if !$form->{report_generator_output_format}; my $report = SL::ReportGenerator->new(\%myconfig, $form); my @hidden_variables = map { "l_${_}" } @columns; push @hidden_variables, qw(warehouse_id bin_id partnumber partstypes_id description chargenumber bestbefore qty_op qty qty_unit partunit l_warehousedescription l_bindescription); push @hidden_variables, qw(include_empty_bins subtotal include_invalid_warehouses date); - push @hidden_variables, qw(classification_id); + push @hidden_variables, qw(classification_id stock_value_basis); my %column_defs = ( 'warehousedescription' => { 'text' => $locale->text('Warehouse'), }, @@ -922,16 +877,20 @@ sub generate_report { 'qty' => { 'text' => $locale->text('Qty'), }, 'partunit' => { 'text' => $locale->text('Unit'), }, 'stock_value' => { 'text' => $locale->text('Stock value'), }, + 'purchase_price' => { 'text' => $locale->text('Purchase price'), }, + 'list_price' => { 'text' => $locale->text('List Price'), }, ); my $href = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables); - my $page = $::form->{page} || 1; + $href .= "&maxrows=".$form->{maxrows}; + map { $column_defs{$_}->{link} = $href . "&page=".$page."&sort=${_}&order=" . Q($_ eq $sort_col ? 1 - $form->{order} : $form->{order}) } @columns; - my %column_alignment = map { $_ => 'right' } qw(qty stock_value); + my %column_alignment = map { $_ => 'right' } qw(qty list_price purchase_price stock_value); map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns; + $column_defs{partunit}->{visible} = 1; $column_defs{type_and_classific}->{visible} = 1; $column_defs{type_and_classific}->{link} =''; @@ -950,8 +909,6 @@ sub generate_report { $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 $idx = 0; my @subtotals_columns = qw(qty stock_value); @@ -959,20 +916,10 @@ sub generate_report { my $total_stock_value = 0; - my $allrows = 0; - $allrows = 1 if $form->{report_generator_output_format} ne 'HTML' ; - - # manual paginating - my $pages = {}; - $pages->{per_page} = $::form->{per_page} || 20; - my $first_nr = ($page - 1) * $pages->{per_page}; - my $last_nr = $first_nr + $pages->{per_page}; - foreach my $entry (@contents) { - # type impl $entry->{type_and_classific} = $::request->presenter->type_abbreviation($entry->{type}). - $entry->{type_and_classific} = $::request->presenter->type_abbreviation($entry->{assembly},$entry->{inventory_accno_id}). - $::request->presenter->classification_abbreviation($entry->{classification_id}); + $entry->{type_and_classific} = SL::Presenter::Part::type_abbreviation($entry->{part_type}). + SL::Presenter::Part::classification_abbreviation($entry->{classification_id}); map { $subtotals{$_} += $entry->{$_} } @subtotals_columns; $total_stock_value += $entry->{stock_value} * 1; $entry->{qty} = $form->format_amount(\%myconfig, $entry->{qty}); @@ -980,6 +927,8 @@ sub generate_report { # 'part_unit' => $entry->{partunit}, # 'conv_units' => 'convertible'); $entry->{stock_value} = $form->format_amount(\%myconfig, $entry->{stock_value} * 1, 2); + $entry->{purchase_price} = $form->format_amount(\%myconfig, $entry->{purchase_price} * 1, 2); + $entry->{list_price} = $form->format_amount(\%myconfig, $entry->{list_price} * 1, 2); my $row_set = [ { map { $_ => { 'data' => $entry->{$_}, 'align' => $column_alignment{$_} } } @columns } ]; @@ -993,6 +942,8 @@ sub generate_report { # 'part_unit' => $entry->{partunit}, # 'conv_units' => 'convertible'); $row->{stock_value}->{data} = $form->format_amount(\%myconfig, $subtotals{stock_value} * 1, 2); + $row->{purchase_price}->{data} = $form->format_amount(\%myconfig, $subtotals{purchase_price} * 1, 2); + $row->{list_price}->{data} = $form->format_amount(\%myconfig, $subtotals{list_price} * 1, 2); %subtotals = map { $_ => 0 } @subtotals_columns; @@ -1000,7 +951,7 @@ sub generate_report { } if ( $allrows || ($idx >= $first_nr && $idx < $last_nr )) { - $report->add_data($row_set); + $report->add_data($row_set); } $idx++; } @@ -1018,6 +969,14 @@ sub generate_report { $report->add_data($row); } + if ( ! $allrows ) { + $pages->{max} = SL::DB::Helper::Paginated::ceil($form->{maxrows}, $pages->{per_page}) || 1; + $pages->{page} = $page < 1 ? 1: $page > $pages->{max} ? $pages->{max}: $page; + $pages->{common} = [ grep { $_->{visible} } @{ SL::DB::Helper::Paginated::make_common_pages($pages->{page}, $pages->{max}) } ]; + + $report->set_options('raw_bottom_info_text' => $form->parse_html_template('common/paginate', + {'pages' => $pages , 'base_url' => $href}) ); + } $report->generate_with_headers(); @@ -1116,6 +1075,103 @@ sub stock { call_sub($form->{stock_nextsub} || $form->{nextsub}); } +sub setup_wh_transfer_warehouse_selection_action_bar { + my ($action) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Update'), + submit => [ '#form', { action => $action } ], + accesskey => 'enter', + ], + ); + } +} + +sub setup_wh_transfer_warehouse_selection_assembly_action_bar { + my ($action) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Update'), + submit => [ '#form', { action => 'transfer_assembly_update_part' } ], + accesskey => 'enter', + ], + action => [ + t8('Produce'), + submit => [ '#form', { action => 'create_assembly' } ], + disabled => $::form->{parts_id} ? undef : $::locale->text('No assembly has been selected yet.'), + ], + ); + } +} + +sub setup_wh_transfer_parts_action_bar { + my ($action) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Transfer'), + submit => [ '#form', { action => 'transfer_parts' } ], + accesskey => 'enter', + ], + action => [ + t8('Back'), + call => [ 'kivi.history_back' ], + ], + ); + } +} + +sub setup_wh_removal_parts_selection_action_bar { + my ($action) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Transfer out'), + submit => [ '#form', { action => 'remove_parts' } ], + accesskey => 'enter', + ], + action => [ + t8('Back'), + call => [ 'kivi.history_back' ], + ], + ); + } +} + +sub setup_wh_report_action_bar { + my ($action) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Show'), + submit => [ '#form', { action => 'generate_report' } ], + accesskey => 'enter', + ], + ); + } +} + +sub setup_wh_journal_action_bar { + my ($action) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Show'), + submit => [ '#form', { action => 'generate_journal' } ], + accesskey => 'enter', + ], + ); + } +} + 1; __END__