Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7d0e997b

Von Philip Reetz vor mehr als 16 Jahren hinzugefügt

  • ID 7d0e997b23aad589dc6d052a177bb277122cdf42
  • Vorgänger 1bfdd83b
  • Nachfolger 1f14e3b9

Sortierfunktion und Zwischensummen bei Kontenuebersichten eingebaut

Unterschiede anzeigen:

bin/mozilla/ca.pl
349 349
      . qq|</th>
350 350
             <td><input name=decimalplaces size=3 value="2"></td>
351 351
         </tr>
352
         <tr>
353
            <td><input name="subtotal" class=checkbox type=checkbox value=1> | . $locale->text('Subtotal') . qq|</td>
354
         </tr>
352 355
                                    
353 356
$jsscript
354 357
  <tr><td colspan=5 ><hr size=3 noshade></td></tr>
......
519 522
    'ustkonto'     => { 'text' => $locale->text('USt-Konto'), },
520 523
     'ustrate'     => { 'text' => $locale->text('Satz %'), },
521 524
 );
525

  
526
  my @hidden_variables = qw(accno fromdate todate description accounttype l_heading subtotal department projectnumber project_id sort);
527

  
528
  my $link = build_std_url('action=list_transactions', grep { $form->{$_} } @hidden_variables);
529

  
530
  $form->{callback} = $link . '&sort=' . E($form->{sort});
531

  
522 532
  my %column_alignment = map { $_ => 'right' } qw(debit credit);
523 533

  
524 534
  @custom_headers = ();
......
540 550
 ];
541 551
 # Zeile 2:
542 552
 push @custom_headers, [
543
   { 'text' => $locale->text('Date'), },
544
   { 'text' => $locale->text('Reference'), },
545
   { 'text' => $locale->text('Description'), },
553
   { 'text' => $locale->text('Date'), 'link' => $link . "&sort=transdate", },
554
   { 'text' => $locale->text('Reference'), 'link' => $link . "&sort=reference",  },
555
   { 'text' => $locale->text('Description'), 'link' => $link . "&sort=description",  },
546 556
   { 'text' => $locale->text('Gegenkonto'), },
547 557
   { 'text' => $locale->text('Debit'), },
548 558
   { 'text' => $locale->text('Credit'), },
......
552 562

  
553 563

  
554 564

  
555
  my @hidden_variables = qw(accno fromdate todate description accounttype l_heading l_subtotal department projectnumber project_id sort);
556 565

  
557
  my $link = build_std_url('action=list_transactions', grep { $form->{$_} } @hidden_variables);
558
  map { $column_defs{$_}->{link} = $link . "&sort=$_" } qw(transdate reference description);
559

  
560
  $form->{callback} = $link . '&sort=' . E($form->{sort});
561 566

  
562 567
  my $report = SL::ReportGenerator->new(\%myconfig, $form);
563 568
  $report->set_custom_headers(@custom_headers);
......
595 600
      $ca->{$_}       = $form->format_amount(\%myconfig, $ca->{$_}, 2) if ($ca->{$_} != 0);
596 601
    }
597 602

  
603
    my $do_subtotal = 0;
604
    if (($form->{subtotal})
605
        && (($idx == scalar @{ $form->{CA} } - 1)
606
            || ($ca->{$form->{sort}} ne $form->{CA}->[$idx + 1]->{$form->{sort}}))) {
607
      $do_subtotal = 1;
608
    }
598 609

  
599 610
    my $row = { };
600 611

  
......
622 633
    }
623 634

  
624 635
    if ($ca->{index} ne $previous_index) {
625
      $report->add_data($row_set) if ($row_set);
636
#       $report->add_data($row_set) if ($row_set);
626 637

  
627
      $row_set         = [ ];
638
#       $row_set         = [ ];
628 639
      $previous_index  = $ca->{index};
629 640

  
630 641
      $row->{reference}->{link} = build_std_url("script=$ca->{module}.pl", 'action=edit', 'id=' . E($ca->{id}), 'callback');
631 642

  
632
    } else {
643
    } elsif ($ca->{index} eq $previous_index) {
633 644
      map { $row->{$_}->{data} = '' } qw(reference description);
634 645
      $row->{transdate}->{data} = '' if ($form->{sort} eq 'transdate');
635 646
    }
636 647

  
648
    my $row_set = [];
649

  
637 650
    push @{ $row_set }, $row;
638 651

  
639
    if (($form->{l_subtotal} eq 'Y')
640
        && (($idx == scalar @{ $form->{CA} } - 1)
641
            || ($ca->{$form->{sort}} ne $form->{CA}->[$idx + 1]->{$form->{sort}}))) {
642
      $report->add_data(create_subtotal_row(\%subtotals, \@columns, \%column_alignment, 'listsubtotal'));
643
    }
652
    push @{ $row_set }, create_subtotal_row(\%subtotals, \@columns, \%column_alignment, 'listsubtotal') if ($do_subtotal);
653

  
644 654

  
645 655
    $idx++;
656
    $report->add_data($row_set);
657

  
646 658
  }
647 659

  
648 660
  $report->add_data($row_set) if ($row_set);

Auch abrufbar als: Unified diff