"StockCounting.pm.html#L195" data-txt="195">
allow_pdf_export => 1,
allow_csv_export => 1,
);

$report->set_columns(%column_defs);
$report->set_column_order(@columns);
$report->set_export_options(qw(list filter group_counting_items));
$report->set_options_from_form;

$self->models->disable_plugin('paginated') if $report->{options}{output_format} =~ /^(pdf|csv)$/i;
$self->models->add_additional_url_params(filter => $::form->{filter}, group_counting_items => $::form->{group_counting_items});
$self->models->finalize;
$self->models->set_report_generator_sort_options(report => $report, sortable_columns => [keys %sort_columns]);

$report->set_options(
raw_top_info_text => $self->render('stock_counting/report_top', { output => 0 }),
raw_bottom_info_text => $self->render('stock_counting/report_bottom', { output => 0 }, models => $self->models),
attachment_basename => t8('stock_countings') . strftime('_%Y%m%d', localtime time),
);
}

sub make_filter_summary {
my ($self) = @_;

my @filter_strings;

push @filter_strings, t8('Group Counting Items') if $::form->{group_counting_items};

my $filter = $::form->{filter} || {};

my $counting = $filter->{counting_id} ? SL::DB::StockCounting->new(id => $filter->{counting_id})->load->name : '';

my @filters = (
[ $counting, t8('Stock Counting') ],
);

for (@filters) {
push @filter_strings, "$_->[1]: $_->[0]" if $_->[0];
}

$self->{filter_summary} = join ', ', @filter_strings;
}

sub setup_list_action_bar {
my ($self) = @_;

for my $bar ($::request->layout->get('actionbar')) {
$bar->add(
action => [
t8('Update'),
submit => [ '#filter_form', { action => 'StockCounting/list' } ],
accesskey => 'enter',
],
);
}
}

sub get_stocked {
my ($self, $objects) = @_;

$_->{stocked} = $_->part->get_stock(bin_id => $_->bin_id) for @$objects;
}

sub render_count_error {
my ($self, $errors) = @_;

if ($::request->is_mobile) {
$self->render('stock_counting/count', errors => $errors);
} else {
flash('error', @{$errors || [] });
$self->render('stock_counting/count');
}
}

sub setup_select_counting_action_bar {
my ($self) = @_;

for my $bar ($::request->layout->get('actionbar')) {
$bar->add(
action => [
t8('Start Counting'),
submit => [ '#count_form', { action => 'StockCounting/start_counting' } ],
accesskey => 'enter',
],
);
}
}

sub setup_count_action_bar {
my ($self) = @_;
for my $bar ($::request->layout->get('actionbar')) {
$bar->add(
action => [
t8('Do count'),
checks => [ ['kivi.validate_form', '#count_form'] ],
submit => [ '#count_form', { action => 'StockCounting/count' } ],
accesskey => 'enter',
],
);
}
}

1;
(77-77/87)