X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fgl.pl;h=6d2b0a5597325094af7d57eb3c0061fe7ef97457;hb=3286128e8253b38ae4e996b327beaf243661a5ef;hp=e642f7e420594973debe96e77194953cc5837a9e;hpb=694ced449e7ba97d19119d6a03080f8c5d0f3e04;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index e642f7e42..6d2b0a559 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -31,6 +31,9 @@ # #====================================================================== +use utf8; +use strict; + use POSIX qw(strftime); use List::Util qw(sum); @@ -44,8 +47,6 @@ require "bin/mozilla/common.pl"; require "bin/mozilla/drafts.pl"; require "bin/mozilla/reportgenerator.pl"; -use strict; - # this is for our long dates # $locale->text('January') # $locale->text('February') @@ -241,7 +242,8 @@ sub search { | if $form->{selectdepartment}; $form->get_lists("projects" => { "key" => "ALL_PROJECTS", - "all" => 1 }); + "all" => 1}, + "employees" => "ALL_EMPLOYEES" ); my %project_labels = (); my @project_values = (""); @@ -255,6 +257,20 @@ sub search { '-values' => \@project_values, '-labels' => \%project_labels)); + my %employee_labels = (); + my @employee_values = (""); + foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) { + # value in Form "1234--Name" übergeben + my $id = "$item->{'id'}--$item->{'name'}"; + push(@employee_values, "$id"); + $employee_labels{$id} = $item->{"name"}; + } + + my $employeenumber = + NTI($cgi->popup_menu('-name' => "employee", + '-values' => \@employee_values, + '-labels' => \%employee_labels)); + # use JavaScript Calendar or not $form->{jsscript} = 1; my $jsscript = ""; @@ -295,7 +311,7 @@ sub search {
- + @@ -328,6 +344,19 @@ sub search { + + + + + + + + + + $button1 $button2 @@ -356,7 +385,9 @@ sub search { - + + + @@ -379,6 +410,8 @@ sub search { + +
| . $locale->text('From') . qq|
| . $locale->text('Employee') . qq|$employeenumber
| . $locale->text('Date Sorting') . qq| +  | . $locale->text('Booking Date') . qq| +  | . $locale->text('Invoice Date') . qq| +
| . $locale->text('From') . qq|| . $locale->text('To (time)') . qq| | . $locale->text('ID') . qq| | . $locale->text('Date') . qq|| . $locale->text('Invoice Date') . qq|| . $locale->text('Booking Date') . qq| | . $locale->text('Reference') . qq| | . $locale->text('Subtotal') . qq| | . $locale->text('Project Number') . qq|| . $locale->text('Employee') . qq|
@@ -435,7 +468,26 @@ sub generate_report { my %myconfig = %main::myconfig; my $locale = $main::locale; - report_generator_set_default_sort('transdate', 1); + # generate_report wird beim ersten Aufruf per Weiter-Knopf und POST mit der hidden Variablen sort mit Wert "datesort" (früher "transdate" als Defaultsortiervariable) übertragen + + # + # # form->{sort} setzen + # + + # anhand von neuer Variable datesort wird jetzt $form->{sort} auf transdate oder gldate gesetzt + # damit ist die Hidden Variable "sort" wahrscheinlich sogar überflüssig + + # ändert man die Sortierreihenfolge per Klick auf eine der Überschriften wird die Variable "sort" per GET übergeben, z.B. id,transdate, gldate, ... + # gl.pl?action=generate_report&employee=18383--Jan%20B%c3%bcren&datesort=transdate&category=X&l_transdate=Y&l_gldate=Y&l_id=Y&l_reference=Y&l_description=Y&l_source=Y&l_debit=Y&l_credit=Y&sort=gldate&sortdir=0 + + if ( $form->{sort} eq 'datesort' ) { # sollte bei einem Post (Aufruf aus Suchmaske) immer wahr sein + # je nachdem ob in Suchmaske "transdate" oder "gldate" ausgesucht wurde erstes Suchergebnis entsprechend sortieren + $form->{sort} = $form->{datesort}; + }; + + # was passiert hier? + report_generator_set_default_sort("$form->{datesort}", 1); +# report_generator_set_default_sort('transdate', 1); GL->all_transactions(\%myconfig, \%$form); @@ -456,14 +508,18 @@ sub generate_report { my $ml = ($form->{ml} =~ /(A|E|Q)/) ? -1 : 1; my @columns = qw( - transdate id reference description - notes source debit debit_accno + gldate transdate id reference description + notes source debit debit_accno credit credit_accno debit_tax debit_tax_accno - credit_tax credit_tax_accno projectnumbers balance + credit_tax credit_tax_accno projectnumbers balance employee ); - my @hidden_variables = qw(accno source reference department description notes project_id datefrom dateto category l_subtotal); + # add employee here, so that variable is still known and passed in url when choosing a different sort order in resulting table + my @hidden_variables = qw(accno source reference department description notes project_id datefrom dateto employee datesort category l_subtotal); push @hidden_variables, map { "l_${_}" } @columns; + foreach ( @hidden_variables ) { + print URL "$_\n"; + }; my (@options, @date_options); push @options, $locale->text('Account') . " : $form->{accno} $form->{account_description}" if ($form->{accno}); @@ -471,7 +527,9 @@ sub generate_report { push @options, $locale->text('Reference') . " : $form->{reference}" if ($form->{reference}); push @options, $locale->text('Description') . " : $form->{description}" if ($form->{description}); push @options, $locale->text('Notes') . " : $form->{notes}" if ($form->{notes}); - + push @options, $locale->text('Employee') . " : $form->{employee_name}" if ($form->{employee_name}); + my $datesorttext = $form->{datesort} eq 'transdate' ? $locale->text('Invoice Date') : $locale->text('Booking Date'); + push @date_options, "$datesorttext" if ($form->{datesort} and ($form->{datefrom} or $form->{dateto})); push @date_options, $locale->text('From'), $locale->date(\%myconfig, $form->{datefrom}, 1) if ($form->{datefrom}); push @date_options, $locale->text('Bis'), $locale->date(\%myconfig, $form->{dateto}, 1) if ($form->{dateto}); push @options, join(' ', @date_options) if (scalar @date_options); @@ -483,18 +541,23 @@ sub generate_report { my $callback = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables); + print URL $callback; + close URL; $form->{l_credit_accno} = 'Y'; $form->{l_debit_accno} = 'Y'; $form->{l_credit_tax} = 'Y'; $form->{l_debit_tax} = 'Y'; +# $form->{l_gldate} = 'Y'; # Spalte mit gldate immer anzeigen $form->{l_credit_tax_accno} = 'Y'; + $form->{l_datesort} = 'Y'; $form->{l_debit_tax_accno} = 'Y'; $form->{l_balance} = $form->{accno} ? 'Y' : ''; my %column_defs = ( 'id' => { 'text' => $locale->text('ID'), }, - 'transdate' => { 'text' => $locale->text('Date'), }, + 'transdate' => { 'text' => $locale->text('Invoice Date'), }, + 'gldate' => { 'text' => $locale->text('Booking Date'), }, 'reference' => { 'text' => $locale->text('Reference'), }, 'source' => { 'text' => $locale->text('Source'), }, 'description' => { 'text' => $locale->text('Description'), }, @@ -509,9 +572,10 @@ sub generate_report { 'credit_tax_accno' => { 'text' => $locale->text('Credit Tax Account'), }, 'balance' => { 'text' => $locale->text('Balance'), }, 'projectnumbers' => { 'text' => $locale->text('Project Numbers'), }, + 'employee' => { 'text' => $locale->text('Employee'), }, ); - foreach my $name (qw(id transdate 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)) { 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"; @@ -522,7 +586,7 @@ sub generate_report { my %column_alignment; map { $column_alignment{$_} = 'right' } qw(balance id debit credit debit_tax credit_tax balance); - map { $column_alignment{$_} = 'center' } qw(reference debit_accno credit_accno debit_tax_accno credit_tax_accno); + map { $column_alignment{$_} = 'center' } qw(transdate gldate reference debit_accno credit_accno debit_tax_accno credit_tax_accno); map { $column_alignment{$_} = 'left' } qw(description source notes); map { $column_defs{$_}->{align} = $column_alignment{$_} } keys %column_alignment; @@ -594,7 +658,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); + map { $row->{$_}->{data} = $ref->{$_} } qw(id reference description notes gldate employee); map { $row->{$_}->{data} = \@{ $rows{$_} }; } qw(transdate debit credit debit_accno credit_accno debit_tax_accno credit_tax_accno source); @@ -817,8 +881,8 @@ sub display_rows { my %charts = (); my $taxchart_init; foreach my $item (@{ $form->{ALL_CHARTS} }) { - if ($item->{charttype} eq 'H'){ #falls überschrift - next; #überspringen (Bug 1150) + if ($item->{charttype} eq 'H'){ #falls überschrift + next; #überspringen (Bug 1150) } my $key = $item->{accno} . "--" . $item->{tax_id}; $taxchart_init = $item->{tax_id} unless (@chart_values); @@ -1333,7 +1397,7 @@ $follow_ups_block print qq||; } - # Löschen und Ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich + # Löschen und Ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich if (!$form->{locked} && $radieren) { print qq| @@ -1609,7 +1673,7 @@ sub post { remove_draft() if $form->{remove_draft}; - $form->{callback} = build_std_url("action=add", "show_details"); + $form->{callback} = build_std_url("action=add&DONT_LOAD_DRAFT=1", "show_details"); $form->redirect($form->{callback}); $main::lxdebug->leave_sub();