Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4b48d335

Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt

  • ID 4b48d335511464f7a37b92e6d5c0cbed616fe48d
  • Vorgänger 44244279
  • Nachfolger 1eaf4978

Buchungsjournal auf- und absteigend sortierbar gemacht.

Unterschiede anzeigen:

bin/mozilla/gl.pl
421 421

  
422 422
  $auth->assert('general_ledger');
423 423

  
424
  $form->{sort} ||= "transdate";
424
  report_generator_set_default_sort('transdate', 1);
425 425

  
426 426
  GL->all_transactions(\%myconfig, \%$form);
427 427

  
......
468 468
  }
469 469

  
470 470

  
471
  my $callback = build_std_url('action=generate_report', @hidden_variables);
471
  my $callback = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables);
472 472

  
473 473
  $form->{l_credit_accno}     = 'Y';
474 474
  $form->{l_debit_accno}      = 'Y';
......
497 497
    'projectnumbers'   => { 'text' => $locale->text('Project Numbers'), },
498 498
  );
499 499

  
500
  map { $column_defs{$_}->{link}    = $callback . "&sort=${_}" }  qw(id transdate reference source description);
501
  map { $column_defs{$_}->{link}    = $callback . "&sort=accno" } qw(debit_accno credit_accno debit_tax_accno credit_tax_accno debit_tax credit_tax);
500
  foreach my $name (qw(id transdate reference source description debit_accno credit_accno debit_tax_accno credit_tax_accno)) {
501
    my $sortname                = $name =~ m/accno/ ? 'accno' : $name;
502
    my $sortdir                 = $sortname eq $name ? 1 - $form->{sortdir} : $form->{sortdir};
503
    $column_defs{$name}->{link} = $callback . "&sort=$sortname&sortdir=$sortdir";
504
  }
505

  
502 506
  map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns;
503 507
  map { $column_defs{$_}->{visible} = 0 } qw(debit_accno credit_accno debit_tax_accno credit_tax_accno) if $form->{accno};
504 508

  
505 509
  my %column_alignment;
506
  map { $column_alignment{$_} = 'right' }  qw(balance id debit credit debit_tax credit_tax);
507
  map { $column_alignment{$_} = 'center' } qw(transdate reference description source notes debit_accno credit_accno debit_tax_accno credit_tax_accno);
510
  map { $column_alignment{$_}     = 'right'  } qw(balance id debit credit debit_tax credit_tax);
511
  map { $column_alignment{$_}     = 'center' } qw(transdate reference description source notes debit_accno credit_accno debit_tax_accno credit_tax_accno);
512
  map { $column_defs{$_}->{align} = $column_alignment{$_} } keys %column_alignment;
508 513

  
509 514
  my $report = SL::ReportGenerator->new(\%myconfig, $form);
510 515

  
......
513 518

  
514 519
  $report->set_export_options('generate_report', @hidden_variables);
515 520

  
516
  $report->set_sort_indicator($form->{sort}, 1);
521
  $report->set_sort_indicator($form->{sort} eq 'accno' ? 'debit_accno' : $form->{sort}, $form->{sortdir});
517 522

  
518 523
  $report->set_options('top_info_text'        => join("\n", @options),
519 524
                       'output_format'        => 'HTML',
......
523 528
  $report->set_options_from_form();
524 529

  
525 530
  # add sort to callback
526
  $form->{callback} = "$callback&sort=" . E($form->{sort});
531
  $form->{callback} = "$callback&sort=" . E($form->{sort}) . "&sortdir=" . E($form->{sortdir});
527 532

  
528 533
  $form->{balance} *= $ml;
529 534

  

Auch abrufbar als: Unified diff