95 |
95 |
$self->models->disable_plugin('paginated') if $report->{options}{output_format} =~ /^(pdf|csv)$/i;
|
96 |
96 |
$self->models->finalize; # for filter laundering
|
97 |
97 |
$self->models->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable);
|
|
98 |
$self->{assembly_item_number} = $::form->{assembly_item_number} ? $::form->{assembly_item_number} : undef;
|
98 |
99 |
$report->set_options(
|
99 |
100 |
raw_top_info_text => $self->render('delivery_plan/report_top', { output => 0 }),
|
100 |
101 |
raw_bottom_info_text => $self->render('delivery_plan/report_bottom', { output => 0 }, models => $self->models),
|
... | ... | |
115 |
116 |
sub make_filter_summary {
|
116 |
117 |
my ($self) = @_;
|
117 |
118 |
my $vc = $self->vc;
|
118 |
|
my ($business, $employee, $department);
|
|
119 |
my ($business, $employee, $department, $assembly_item_number);
|
119 |
120 |
|
120 |
121 |
my $filter = $::form->{filter} || {};
|
121 |
122 |
my @filter_strings;
|
... | ... | |
123 |
124 |
$business = SL::DB::Business->new(id => $filter->{order}{customer}{"business_id"})->load->description if $filter->{order}{customer}{"business_id"};
|
124 |
125 |
$employee = SL::DB::Employee->new(id => $filter->{order}{employee_id})->load->name if $filter->{order}{employee_id};
|
125 |
126 |
$department = SL::DB::Department->new(id => $filter->{order}{department_id})->load->description if $filter->{order}{department_id};
|
|
127 |
$assembly_item_number = $::form->{assembly_item_number};
|
126 |
128 |
|
127 |
129 |
my @filters = (
|
128 |
130 |
[ $filter->{order}{"ordnumber:substr::ilike"}, $::locale->text('Number') ],
|
... | ... | |
139 |
141 |
[ $business, $::locale->text('Customer type') ],
|
140 |
142 |
[ $department, $::locale->text('Department') ],
|
141 |
143 |
[ $employee, $::locale->text('Employee') ],
|
|
144 |
[ $assembly_item_number, $::locale->text('Assembly Item Number') ],
|
142 |
145 |
);
|
143 |
146 |
|
144 |
147 |
my %flags = (
|
... | ... | |
218 |
221 |
|
219 |
222 |
my $query = $self->delivery_plan_query_linked_items;
|
220 |
223 |
|
|
224 |
if ($::form->{assembly_item_number}) {
|
|
225 |
|
|
226 |
my $assembly_parts = SL::DB::Manager::Part->get_all(where => [ partnumber => { ilike => '%' . $::form->{assembly_item_number} . '%' } ]);
|
|
227 |
|
|
228 |
my @assemblies;
|
|
229 |
|
|
230 |
foreach my $assembly_part (@{ $assembly_parts }) {
|
|
231 |
push @assemblies, SL::DB::Manager::Assembly->get_all(where => [parts_id =>$assembly_part->id]);
|
|
232 |
}
|
|
233 |
|
|
234 |
if (scalar @assemblies > 0) {
|
|
235 |
my %assembly_ids;
|
|
236 |
foreach my $list (@assemblies) {
|
|
237 |
foreach my $assembly (@{ $list }) {
|
|
238 |
$assembly_ids{$assembly->id} = 1;
|
|
239 |
}
|
|
240 |
}
|
|
241 |
my @assembly_ids_array = (keys %assembly_ids);
|
|
242 |
$::form->{filter}{part}{id} = { or => [ @assembly_ids_array ] };
|
|
243 |
}
|
|
244 |
}
|
|
245 |
|
221 |
246 |
SL::Controller::Helper::GetModels->new(
|
222 |
247 |
controller => $self,
|
223 |
248 |
model => 'OrderItem',
|
Lieferplan, auch nach Erzeugnisbestandteilen filtern