From f2991e38ef44e1d32b60a7a0182bf458a10bce47 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Wed, 16 Dec 2020 16:42:02 +0100 Subject: [PATCH] =?utf8?q?Buchungsjournal:=20Abteilung=20im=20Bericht=20an?= =?utf8?q?zeigen=20k=C3=B6nnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/GL.pm | 13 ++++++++++--- bin/mozilla/gl.pl | 8 +++++--- templates/webpages/gl/search.html | 4 ++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/SL/GL.pm b/SL/GL.pm index 1fb118b8b..6212d5b34 100644 --- a/SL/GL.pm +++ b/SL/GL.pm @@ -356,6 +356,7 @@ sub all_transactions { 'reference' => [ qw(lower_reference id) ], 'description' => [ qw(lower_description id) ], 'accno' => [ qw(accno transdate id) ], + 'department' => [ qw(department transdate id) ], ); my %lowered_columns = ( 'reference' => { 'gl' => 'g.reference', 'arap' => 'a.invnumber', }, @@ -381,11 +382,13 @@ sub all_transactions { ac.acc_trans_id, g.id, 'gl' AS type, FALSE AS invoice, g.reference, ac.taxkey, c.link, g.description, ac.transdate, ac.gldate, ac.source, ac.trans_id, ac.amount, c.accno, g.notes, t.chart_id, + d.description AS department, CASE WHEN (COALESCE(e.name, '') = '') THEN e.login ELSE e.name END AS employee $project_columns $columns_for_sorting{gl} FROM gl g - LEFT JOIN employee e ON (g.employee_id = e.id), + LEFT JOIN employee e ON (g.employee_id = e.id) + LEFT JOIN department d ON (g.department_id = d.id), acc_trans ac $project_join, chart c LEFT JOIN tax t ON (t.chart_id = c.id) WHERE $glwhere @@ -397,11 +400,13 @@ sub all_transactions { SELECT ac.acc_trans_id, a.id, 'ar' AS type, a.invoice, a.invnumber, ac.taxkey, c.link, ct.name, ac.transdate, ac.gldate, ac.source, ac.trans_id, ac.amount, c.accno, a.notes, t.chart_id, + d.description AS department, CASE WHEN (COALESCE(e.name, '') = '') THEN e.login ELSE e.name END AS employee $project_columns $columns_for_sorting{arap} FROM ar a - LEFT JOIN employee e ON (a.employee_id = e.id), + LEFT JOIN employee e ON (a.employee_id = e.id) + LEFT JOIN department d ON (a.department_id = d.id), acc_trans ac $project_join, customer ct, chart c LEFT JOIN tax t ON (t.chart_id=c.id) WHERE $arwhere @@ -414,11 +419,13 @@ sub all_transactions { SELECT ac.acc_trans_id, a.id, 'ap' AS type, a.invoice, a.invnumber, ac.taxkey, c.link, ct.name, ac.transdate, ac.gldate, ac.source, ac.trans_id, ac.amount, c.accno, a.notes, t.chart_id, + d.description AS department, CASE WHEN (COALESCE(e.name, '') = '') THEN e.login ELSE e.name END AS employee $project_columns $columns_for_sorting{arap} FROM ap a - LEFT JOIN employee e ON (a.employee_id = e.id), + LEFT JOIN employee e ON (a.employee_id = e.id) + LEFT JOIN department d ON (a.department_id = d.id), acc_trans ac $project_join, vendor ct, chart c LEFT JOIN tax t ON (t.chart_id=c.id) WHERE $apwhere diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 40fdc453b..79e50859e 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -422,7 +422,8 @@ sub generate_report { transdate gldate id reference description notes source doccnt debit debit_accno credit credit_accno debit_tax debit_tax_accno - credit_tax credit_tax_accno balance projectnumbers employee + credit_tax credit_tax_accno balance projectnumbers + department employee ); # add employee here, so that variable is still known and passed in url when choosing a different sort order in resulting table @@ -481,10 +482,11 @@ sub generate_report { 'credit_tax_accno' => { 'text' => $locale->text('Credit Tax Account'), }, 'balance' => { 'text' => $locale->text('Balance'), }, 'projectnumbers' => { 'text' => $locale->text('Project Numbers'), }, + 'department' => { 'text' => $locale->text('Department'), }, 'employee' => { 'text' => $locale->text('Employee'), }, ); - foreach my $name (qw(id transdate gldate reference description debit_accno credit_accno debit_tax_accno credit_tax_accno)) { + foreach my $name (qw(id transdate gldate reference description debit_accno credit_accno debit_tax_accno credit_tax_accno department)) { my $sortname = $name =~ m/accno/ ? 'accno' : $name; my $sortdir = $sortname eq $form->{sort} ? 1 - $form->{sortdir} : $form->{sortdir}; $column_defs{$name}->{link} = $callback . "&sort=$sortname&sortdir=$sortdir"; @@ -572,7 +574,7 @@ sub generate_report { $row->{balance}->{data} = $data; $row->{projectnumbers}->{data} = join ", ", sort { lc($a) cmp lc($b) } keys %{ $ref->{projectnumbers} }; - map { $row->{$_}->{data} = $ref->{$_} } qw(id reference description notes gldate employee); + map { $row->{$_}->{data} = $ref->{$_} } qw(id reference description notes gldate employee department); map { $row->{$_}->{data} = \@{ $rows{$_} }; } qw(transdate debit credit debit_accno credit_accno debit_tax_accno credit_tax_accno source); diff --git a/templates/webpages/gl/search.html b/templates/webpages/gl/search.html index 72f7568f5..da3cb7b22 100644 --- a/templates/webpages/gl/search.html +++ b/templates/webpages/gl/search.html @@ -93,6 +93,10 @@ [% 'Source' | $T8 %] [% 'Account' | $T8 %] + [%- IF ALL_DEPARTMENTS %] + + [% 'Department' | $T8 %] + [%- END %] -- 2.20.1