Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 94e596e5

Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt

  • ID 94e596e55cef6b9ef9b80b5a4dba8204e0c29c9f
  • Vorgänger f6a2cdd5
  • Nachfolger bbc63419

Berichte über Zahlungsein- und ausgänge auf und absteigend sortierbar gemacht.

Unterschiede anzeigen:

SL/RP.pm
1632 1632
    $where .= " AND (ac.memo ILIKE " . $dbh->quote('%' . $form->{memo} . '%') . ") ";
1633 1633
  }
1634 1634

  
1635
  my $sortorder = join(', ', qw(name invnumber ordnumber transdate source));
1636
  $sortorder = $form->{sort} if ($form->{sort} && grep({ $_ eq $form->{sort} } qw(transdate invnumber name source memo)));
1635
  my %sort_columns =  (
1636
    'transdate'    => [ qw(transdate lower_invnumber lower_name) ],
1637
    'invnumber'    => [ qw(lower_invnumber lower_name transdate) ],
1638
    'name'         => [ qw(lower_name transdate)                 ],
1639
    'source'       => [ qw(lower_source)                         ],
1640
    'memo'         => [ qw(lower_memo)                           ],
1641
    );
1642
  my %lowered_columns =  (
1643
    'invnumber'       => { 'gl' => 'g.reference',   'arap' => 'a.invnumber', },
1644
    'memo'            => { 'gl' => 'ac.memo',       'arap' => 'ac.memo',     },
1645
    'source'          => { 'gl' => 'ac.source',     'arap' => 'ac.source',   },
1646
    'name'            => { 'gl' => 'g.description', 'arap' => 'c.name',      },
1647
    );
1648

  
1649
  my $sortdir   = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC';
1650
  my $sortkey   = $sort_columns{$form->{sort}} ? $form->{sort} : 'transdate';
1651
  my $sortorder = join ', ', map { "$_ $sortdir" } @{ $sort_columns{$sortkey} };
1652

  
1653

  
1654
  my %columns_for_sorting = ( 'gl' => '', 'arap' => '', );
1655
  foreach my $spec (@{ $sort_columns{$sortkey} }) {
1656
    next if ($spec !~ m/^lower_(.*)$/);
1657

  
1658
    my $column = $1;
1659
    map { $columns_for_sorting{$_} .= sprintf(', lower(%s) AS lower_%s', $lowered_columns{$column}->{$_}, $column) } qw(gl arap);
1660
  }
1637 1661

  
1638 1662
  $query = qq|SELECT id, accno, description FROM chart WHERE accno = ?|;
1639 1663
  my $sth = prepare_query($form, $dbh, $query);
......
1642 1666
      qq|SELECT c.name, a.invnumber, a.ordnumber,
1643 1667
           ac.transdate, ac.amount * $ml AS paid, ac.source,
1644 1668
           a.invoice, a.id, ac.memo, '${arap}' AS module
1669
           $columns_for_sorting{arap}
1645 1670
         FROM acc_trans ac
1646 1671
         JOIN $arap a ON (ac.trans_id = a.id)
1647 1672
         JOIN $table c ON (c.id = a.${table}_id)
......
1655 1680
         SELECT g.description, g.reference, NULL AS ordnumber,
1656 1681
           ac.transdate, ac.amount * $ml AS paid, ac.source,
1657 1682
           '0' as invoice, g.id, ac.memo, 'gl' AS module
1683
           $columns_for_sorting{gl}
1658 1684
         FROM acc_trans ac
1659 1685
         JOIN gl g ON (g.id = ac.trans_id)
1660 1686
         $dpt_join
bin/mozilla/rp.pl
2346 2346
    $option = $locale->text('Department') . " : $department";
2347 2347
  }
2348 2348

  
2349
  report_generator_set_default_sort('transdate', 1);
2350

  
2349 2351
  RP->payments(\%myconfig, \%$form);
2350 2352

  
2351 2353
  my @hidden_variables = qw(account title department reference source memo fromdate todate
......
2365 2367
  );
2366 2368
  my %column_alignment = ('paid' => 'right');
2367 2369

  
2368
  map { $column_defs{$_}->{link} = $href . "&sort=$_" } grep { $_ ne 'paid' } @columns;
2370
  foreach my $name (grep { $_ ne 'paid' } @columns) {
2371
    my $sortdir                 = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir};
2372
    $column_defs{$name}->{link} = $href . "&sort=${name}&sortdir=$sortdir";
2373
  }
2369 2374

  
2370 2375
  my @options;
2371 2376
  if ($form->{fromdate}) {
......
2392 2397

  
2393 2398
  $report->set_export_options('list_payments', @hidden_variables);
2394 2399

  
2395
  $report->set_sort_indicator($form->{sort}, 1);
2400
  $report->set_sort_indicator($form->{sort}, $form->{sortdir});
2396 2401

  
2397 2402
  my $total_paid    = 0;
2398 2403

  

Auch abrufbar als: Unified diff