Revision dde9d68d
Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt
SL/DN.pm | ||
---|---|---|
598 | 598 |
push(@values, $form->{dunningto}); |
599 | 599 |
} |
600 | 600 |
|
601 |
$query = |
|
601 |
my %sort_columns = ( |
|
602 |
'dunning_description' => [ qw(dn.dunning_description customername invnumber) ], |
|
603 |
'customername' => [ qw(customername invnumber) ], |
|
604 |
'invnumber' => [ qw(a.invnumber) ], |
|
605 |
'transdate' => [ qw(a.transdate a.invnumber) ], |
|
606 |
'duedate' => [ qw(a.duedate a.invnumber) ], |
|
607 |
'dunning_date' => [ qw(dunning_date a.invnumber) ], |
|
608 |
'dunning_duedate' => [ qw(dunning_duedate a.invnumber) ], |
|
609 |
); |
|
610 |
|
|
611 |
my $sortdir = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC'; |
|
612 |
my $sortkey = $sort_columns{$form->{sort}} ? $form->{sort} : 'customername'; |
|
613 |
my $sortorder = join ', ', map { "$_ $sortdir" } @{ $sort_columns{$sortkey} }; |
|
614 |
|
|
615 |
my $query = |
|
602 | 616 |
qq|SELECT a.id, a.ordnumber, a.invoice, a.transdate, a.invnumber, a.amount, |
603 | 617 |
ct.name AS customername, ct.id AS customer_id, a.duedate, da.fee, |
604 | 618 |
da.interest, dn.dunning_description, da.transdate AS dunning_date, |
... | ... | |
607 | 621 |
JOIN customer ct ON (a.customer_id = ct.id), dunning da |
608 | 622 |
LEFT JOIN dunning_config dn ON (da.dunning_config_id = dn.id) |
609 | 623 |
$where |
610 |
ORDER BY name, a.id|;
|
|
624 |
ORDER BY $sortorder|;
|
|
611 | 625 |
|
612 | 626 |
$form->{DUNNINGS} = selectall_hashref_query($form, $dbh, $query, @values); |
613 | 627 |
|
bin/mozilla/dn.pl | ||
---|---|---|
287 | 287 |
my @filter_field_list = qw(customer_id customer dunning_level department_id invnumber ordnumber |
288 | 288 |
transdatefrom transdateto dunningfrom dunningto notes showold); |
289 | 289 |
|
290 |
report_generator_set_default_sort('customername', 1); |
|
291 |
|
|
290 | 292 |
DN->get_dunning(\%myconfig, \%$form); |
291 | 293 |
|
292 | 294 |
if (!$form->{callback}) { |
... | ... | |
310 | 312 |
'title' => $form->{title}); |
311 | 313 |
$report->set_export_options('show_dunning', @filter_field_list); |
312 | 314 |
|
313 |
$report->set_columns(
|
|
315 |
my %column_defs = (
|
|
314 | 316 |
'checkbox' => { 'text' => '', 'visible' => 'HTML' }, |
315 | 317 |
'dunning_description' => { 'text' => $locale->text('Dunning Level') }, |
316 | 318 |
'customername' => { 'text' => $locale->text('Customername') }, |
... | ... | |
324 | 326 |
'interest' => { 'text' => $locale->text('Interest') }, |
325 | 327 |
); |
326 | 328 |
|
329 |
$report->set_columns(%column_defs); |
|
327 | 330 |
$report->set_column_order(qw(checkbox dunning_description customername invnumber transdate |
328 | 331 |
duedate amount dunning_date dunning_duedate fee interest)); |
332 |
$report->set_sort_indicator($form->{sort}, $form->{sortdir}); |
|
329 | 333 |
|
330 | 334 |
my $edit_url = build_std_url('script=is.pl', 'action=edit', 'callback') . '&id='; |
331 | 335 |
my $print_url = build_std_url('action=print_dunning', 'format=pdf', 'media=screen') . '&dunning_id='; |
336 |
my $sort_url = build_std_url('action=show_dunning', grep { $form->{$_} } @filter_field_list); |
|
337 |
|
|
338 |
foreach my $name (qw(dunning_description customername invnumber transdate duedate dunning_date dunning_duedate)) { |
|
339 |
my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir}; |
|
340 |
$column_defs{$name}->{link} = $sort_url . "&sort=$name&sortdir=$sortdir"; |
|
341 |
} |
|
332 | 342 |
|
333 | 343 |
my %alignment = map { $_ => 'right' } qw(transdate duedate amount dunning_date dunning_duedate fee interest); |
334 | 344 |
|
Auch abrufbar als: Unified diff
Bericht über Mahnungen sortierbar gemacht.