Revision d740b61d
Von Moritz Bunkus vor etwa 11 Jahren hinzugefügt
SL/Controller/FinancialControllingReport.pm | ||
---|---|---|
127 | 127 |
$self->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable); |
128 | 128 |
|
129 | 129 |
$self->disable_pagination if $report->{options}{output_format} =~ /^(pdf|csv)$/i; |
130 |
|
|
131 |
$self->{report_data} = { |
|
132 |
column_defs => \%column_defs, |
|
133 |
columns => \@columns, |
|
134 |
}; |
|
135 | 130 |
} |
136 | 131 |
|
137 | 132 |
sub calculate_data { |
... | ... | |
194 | 189 |
|
195 | 190 |
sub list_objects { |
196 | 191 |
my ($self) = @_; |
197 |
my $column_defs = $self->{report_data}->{column_defs}; |
|
198 |
|
|
199 |
for my $obj (@{ $self->{orders} || [] }) { |
|
200 |
my %data = map { |
|
201 |
$_ => { |
|
202 |
data => $column_defs->{$_}{sub} ? $column_defs->{$_}{sub}->($obj) |
|
203 |
: $obj->can($_) ? $obj->$_ |
|
204 |
: $obj->{$_}, |
|
205 |
link => $column_defs->{$_}{obj_link} ? $column_defs->{$_}{obj_link}->($obj) : '', |
|
206 |
}, |
|
207 |
} @{ $self->{report_data}{columns} || {} }; |
|
208 |
|
|
209 |
map { $data{$_}->{data} = defined $data{$_}->{data} ? int($data{$_}->{data}) : '' } grep { m/_p$/ } @{ $self->{number_columns} }; |
|
210 |
map { $data{$_}->{data} = $::form->format_amount(\%::myconfig, $data{$_}->{data}, 2) } grep { !m/_p$/ } @{ $self->{number_columns} }; |
|
211 |
|
|
212 |
$self->{report}->add_data(\%data); |
|
213 |
} |
|
192 |
my $modify_data = sub { |
|
193 |
my ($data) = @_; |
|
194 |
map { $data->{$_}->{data} = defined $data->{$_}->{data} ? int($data->{$_}->{data}) : '' } grep { m/_p$/ } @{ $self->{number_columns} }; |
|
195 |
map { $data->{$_}->{data} = $::form->format_amount(\%::myconfig, $data->{$_}->{data}, 2) } grep { !m/_p$/ } @{ $self->{number_columns} }; |
|
196 |
}; |
|
214 | 197 |
|
215 |
return $self->{report}->generate_with_headers;
|
|
198 |
return $self->report_generator_list_objects(report => $self->{report}, objects => $self->{orders}, data_callback => $modify_data);
|
|
216 | 199 |
} |
217 | 200 |
|
218 | 201 |
sub make_filter_summary { |
Auch abrufbar als: Unified diff
Refactoring: list_objects() aus Controllern in ReportGenerator-Helfer verschieben