From 7d0e997b23aad589dc6d052a177bb277122cdf42 Mon Sep 17 00:00:00 2001
From: Philip Reetz
Date: Tue, 24 Jun 2008 10:26:02 +0000
Subject: [PATCH] Sortierfunktion und Zwischensummen bei Kontenuebersichten
eingebaut
---
SL/CA.pm | 2 +-
bin/mozilla/ca.pl | 44 ++++++++++++++++++++++++++++----------------
locale/de/ca | 1 +
3 files changed, 30 insertions(+), 17 deletions(-)
diff --git a/SL/CA.pm b/SL/CA.pm
index a208e2e3e..4604f13e3 100644
--- a/SL/CA.pm
+++ b/SL/CA.pm
@@ -405,7 +405,7 @@ sub all_transactions {
}
$ca->{index} = join "--", map { $ca->{$_} } qw(id reference description transdate);
-
+# $ca->{index} = $ca->{$form->{sort}};
push(@{ $form->{CA} }, $ca);
}
diff --git a/bin/mozilla/ca.pl b/bin/mozilla/ca.pl
index 08856b9ca..372004e1b 100644
--- a/bin/mozilla/ca.pl
+++ b/bin/mozilla/ca.pl
@@ -349,6 +349,9 @@ $checked>
. qq|
|
+
+ | . $locale->text('Subtotal') . qq| |
+
$jsscript
|
@@ -519,6 +522,13 @@ sub list_transactions {
'ustkonto' => { 'text' => $locale->text('USt-Konto'), },
'ustrate' => { 'text' => $locale->text('Satz %'), },
);
+
+ my @hidden_variables = qw(accno fromdate todate description accounttype l_heading subtotal department projectnumber project_id sort);
+
+ my $link = build_std_url('action=list_transactions', grep { $form->{$_} } @hidden_variables);
+
+ $form->{callback} = $link . '&sort=' . E($form->{sort});
+
my %column_alignment = map { $_ => 'right' } qw(debit credit);
@custom_headers = ();
@@ -540,9 +550,9 @@ sub list_transactions {
];
# Zeile 2:
push @custom_headers, [
- { 'text' => $locale->text('Date'), },
- { 'text' => $locale->text('Reference'), },
- { 'text' => $locale->text('Description'), },
+ { 'text' => $locale->text('Date'), 'link' => $link . "&sort=transdate", },
+ { 'text' => $locale->text('Reference'), 'link' => $link . "&sort=reference", },
+ { 'text' => $locale->text('Description'), 'link' => $link . "&sort=description", },
{ 'text' => $locale->text('Gegenkonto'), },
{ 'text' => $locale->text('Debit'), },
{ 'text' => $locale->text('Credit'), },
@@ -552,12 +562,7 @@ sub list_transactions {
- my @hidden_variables = qw(accno fromdate todate description accounttype l_heading l_subtotal department projectnumber project_id sort);
- my $link = build_std_url('action=list_transactions', grep { $form->{$_} } @hidden_variables);
- map { $column_defs{$_}->{link} = $link . "&sort=$_" } qw(transdate reference description);
-
- $form->{callback} = $link . '&sort=' . E($form->{sort});
my $report = SL::ReportGenerator->new(\%myconfig, $form);
$report->set_custom_headers(@custom_headers);
@@ -595,6 +600,12 @@ sub list_transactions {
$ca->{$_} = $form->format_amount(\%myconfig, $ca->{$_}, 2) if ($ca->{$_} != 0);
}
+ my $do_subtotal = 0;
+ if (($form->{subtotal})
+ && (($idx == scalar @{ $form->{CA} } - 1)
+ || ($ca->{$form->{sort}} ne $form->{CA}->[$idx + 1]->{$form->{sort}}))) {
+ $do_subtotal = 1;
+ }
my $row = { };
@@ -622,27 +633,28 @@ sub list_transactions {
}
if ($ca->{index} ne $previous_index) {
- $report->add_data($row_set) if ($row_set);
+# $report->add_data($row_set) if ($row_set);
- $row_set = [ ];
+# $row_set = [ ];
$previous_index = $ca->{index};
$row->{reference}->{link} = build_std_url("script=$ca->{module}.pl", 'action=edit', 'id=' . E($ca->{id}), 'callback');
- } else {
+ } elsif ($ca->{index} eq $previous_index) {
map { $row->{$_}->{data} = '' } qw(reference description);
$row->{transdate}->{data} = '' if ($form->{sort} eq 'transdate');
}
+ my $row_set = [];
+
push @{ $row_set }, $row;
- if (($form->{l_subtotal} eq 'Y')
- && (($idx == scalar @{ $form->{CA} } - 1)
- || ($ca->{$form->{sort}} ne $form->{CA}->[$idx + 1]->{$form->{sort}}))) {
- $report->add_data(create_subtotal_row(\%subtotals, \@columns, \%column_alignment, 'listsubtotal'));
- }
+ push @{ $row_set }, create_subtotal_row(\%subtotals, \@columns, \%column_alignment, 'listsubtotal') if ($do_subtotal);
+
$idx++;
+ $report->add_data($row_set);
+
}
$report->add_data($row_set) if ($row_set);
diff --git a/locale/de/ca b/locale/de/ca
index e2c3773cf..462950484 100644
--- a/locale/de/ca
+++ b/locale/de/ca
@@ -123,6 +123,7 @@ $self->{texts} = {
'Storno Invoice' => 'Stornorechnung',
'Storno Packing List' => 'Stornolieferschein',
'Subject' => 'Betreff',
+ 'Subtotal' => 'Zwischensumme',
'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
'The LDAP server "#1:#2" is unreachable. Please check config/authentication.pl.' => 'Der LDAP-Server "#1:#2" ist nicht erreichbar. Bitte überprüfen Sie die Angaben in config/authentication.pl.',
'The config file "config/authentication.pl" contained invalid Perl code:' => 'Die Konfigurationsdatei "config/authentication.pl" enthielt ungütigen Perl-Code:',
--
2.20.1