From f15f5e4321df31d2279edb480e9c7fc15c3af31c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Thu, 7 Apr 2022 13:27:27 +0200 Subject: [PATCH] Lieferwertbericht um Filter nach Warengruppen erweitert --- SL/Controller/DeliveryValueReport.pm | 13 +++++++++---- .../webpages/delivery_value_report/_filter.html | 6 ++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/SL/Controller/DeliveryValueReport.pm b/SL/Controller/DeliveryValueReport.pm index 5fa5c454d..ae2032fcc 100644 --- a/SL/Controller/DeliveryValueReport.pm +++ b/SL/Controller/DeliveryValueReport.pm @@ -17,7 +17,7 @@ use Carp; use Data::Dumper; use Rose::Object::MakeMethods::Generic ( - 'scalar --get_set_init' => [ qw(models vc all_employees all_businesses) ], + 'scalar --get_set_init' => [ qw(models vc all_employees all_businesses all_partsgroups) ], ); __PACKAGE__->run_before(sub { $::auth->assert('delivery_value_report'); }); @@ -141,13 +141,14 @@ sub prepare_report { sub make_filter_summary { my ($self) = @_; my $vc = $self->vc; - my ($business, $employee); + my ($business, $employee, $partsgroup); my $filter = $::form->{filter} || {}; my @filter_strings; - $business = SL::DB::Business->new(id => $filter->{order}{customer}{"business_id"})->load->description if $filter->{order}{customer}{"business_id"}; - $employee = SL::DB::Employee->new(id => $filter->{order}{employee_id})->load->name if $filter->{order}{employee_id}; + $business = SL::DB::Business->new(id => $filter->{order}{customer}{"business_id"})->load->description if $filter->{order}{customer}{"business_id"}; + $employee = SL::DB::Employee->new(id => $filter->{order}{employee_id})->load->name if $filter->{order}{employee_id}; + $partsgroup = SL::DB::PartsGroup->new(id => $filter->{part}{partsgroup_id})->load->partsgroup if $filter->{part}{partsgroup_id}; my @filters = ( [ $filter->{order}{"ordnumber:substr::ilike"}, $::locale->text('Number') ], @@ -163,6 +164,7 @@ sub make_filter_summary { [ $filter->{order}{customer}{"customernumber:substr::ilike"}, $::locale->text('Customer Number') ], [ $business, $::locale->text('Customer type') ], [ $employee, $::locale->text('Employee') ], + [ $partsgroup, $::locale->text('Partsgroup') ], ); # flags for with_object 'part' @@ -217,6 +219,9 @@ sub init_all_employees { sub init_all_businesses { return SL::DB::Manager::Business->get_all_sorted; } +sub init_all_partsgroups { + return SL::DB::Manager::PartsGroup->get_all_sorted; +} sub link_to { diff --git a/templates/webpages/delivery_value_report/_filter.html b/templates/webpages/delivery_value_report/_filter.html index d16a9f27b..c94135f40 100644 --- a/templates/webpages/delivery_value_report/_filter.html +++ b/templates/webpages/delivery_value_report/_filter.html @@ -78,6 +78,12 @@ style => 'width: 200px') %] + [%- IF SELF.all_partsgroups.size %] + + [% 'Partsgroup' | $T8 %] + [%- L.select_tag('filter.part.partsgroup_id', SELF.all_partsgroups, default=filter.part.partsgroup_id, title_key='partsgroup', value_key='id', with_empty=1 style='width: 200px') %] + + [% END %] [% 'Type' | $T8 %] -- 2.20.1