X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fgl.pl;h=a46cad00cdc32288aacbcb519435acc41ffc11d9;hb=075bd42af8885aee3c18fe055a2c82b8b43f4cea;hp=f4f87cc8f23142c731edcfa2bef7c45a63917093;hpb=73be6af449d872825d1fbdffe536b9061ca649c8;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index f4f87cc8f..a46cad00c 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -217,16 +217,11 @@ sub search { $::form->all_departments(\%::myconfig); $::form->get_lists( projects => { key => "ALL_PROJECTS", all => 1 }, - employees => "ALL_EMPLOYEES", ); - - my $onload = "focus()" - . qq|;setupDateFormat('|. $::myconfig{dateformat} . qq|', '| . $::locale->text("Falsches Datumsformat!") . qq|')| - . qq|;setupPoints('|. $::myconfig{numberformat} . qq|', '| . $::locale->text("wrongformat") . qq|')|; + $::form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]); $::form->header; print $::form->parse_html_template('gl/search', { - onload => $onload, department_label => sub { ("$_[0]{description}--$_[0]{id}")x2 }, employee_label => sub { "$_[0]{id}--$_[0]{name}" }, }); @@ -466,7 +461,7 @@ sub generate_report { my $row_set = [ $row ]; - if (($form->{l_subtotal} eq 'Y') + if ( ($form->{l_subtotal} eq 'Y' && !$form->{report_generator_csv_options_for_import} ) && (($idx == (scalar @{ $form->{GL} } - 1)) || ($ref->{ $form->{sort} } ne $form->{GL}->[$idx + 1]->{ $form->{sort} }))) { push @{ $row_set }, create_subtotal_row(\%subtotals, \@columns, \%column_alignment, [ qw(debit credit) ], 'listsubtotal'); @@ -477,8 +472,6 @@ sub generate_report { $idx++; } - $report->add_separator(); - # = 0 for balanced ledger my $balanced_ledger = $totals{debit} + $totals{debit_tax} - $totals{credit} - $totals{credit_tax}; @@ -497,7 +490,10 @@ sub generate_report { $row->{balance}->{data} = $data; - $report->add_data($row); + if ( !$form->{report_generator_csv_options_for_import} ) { + $report->add_separator(); + $report->add_data($row); + } my $raw_bottom_info_text; @@ -849,385 +845,73 @@ sub display_rows { } sub form_header { - my ($init) = @_; - $main::lxdebug->enter_sub(); - - $main::auth->assert('general_ledger'); + $::lxdebug->enter_sub; + $::auth->assert('general_ledger'); - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; + my ($init) = @_; - my @old_project_ids = (); - map({ push(@old_project_ids, $form->{"project_id_$_"}) - if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"})); + my @old_project_ids = grep { $_ } map{ $::form->{"project_id_$_"} } 1..$::form->{rowcount}; - $form->get_lists("projects" => { "key" => "ALL_PROJECTS", + $::form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 0, "old_id" => \@old_project_ids }, "charts" => { "key" => "ALL_CHARTS", - "transdate" => $form->{transdate} }, + "transdate" => $::form->{transdate} }, "taxcharts" => "ALL_TAXCHARTS"); - GL->get_chart_balances('charts' => $form->{ALL_CHARTS}); - - my $title = $form->{title}; - $form->{title} = $locale->text("$title General Ledger Transaction"); - my $readonly = ($form->{id}) ? "readonly" : ""; - - my $show_details_checked = $form->{show_details} ? "checked" : ''; - my $ob_transaction_checked = $form->{ob_transaction} ? "checked" : ''; - my $cb_transaction_checked = $form->{cb_transaction} ? "checked" : ''; + GL->get_chart_balances('charts' => $::form->{ALL_CHARTS}); + my $title = $::form->{title}; + $::form->{title} = $::locale->text("$title General Ledger Transaction"); # $locale->text('Add General Ledger Transaction') # $locale->text('Edit General Ledger Transaction') - map { $form->{$_} =~ s/\"/"/g } - qw(reference description chart taxchart); - - $form->{javascript} = qq| - - -|; - - $form->{selectdepartment} =~ s/ selected//; - $form->{selectdepartment} =~ - s/option>\Q$form->{department}\E/option selected>$form->{department}/; - - my $description; - if ((my $rows = $form->numtextrows($form->{description}, 50)) > 1) { - $description = - qq||; - } else { - $description = - qq||; - } - - my $taxincluded = ($form->{taxincluded}) ? "checked" : ""; + map { $::form->{$_} =~ s/\"/"/g } + qw(chart taxchart); - if ($init) { - $taxincluded = "checked"; - } + $::form->{selectdepartment} =~ s/ selected//; + $::form->{selectdepartment} =~ + s/option>\Q$::form->{department}\E/option selected>$::form->{department}/; - my $department; - $department = qq| - - | . $locale->text('Department') . qq| - - - -| if $form->{selectdepartment}; if ($init) { - $form->{fokus} = "gl.reference"; - } else { - $form->{fokus} = qq|gl.accno_$form->{rowcount}|; - } - - # use JavaScript Calendar or not - $form->{jsscript} = 1; - my $jsscript = ""; - my ($button1, $button2); - if ($form->{jsscript}) { - - # with JavaScript Calendar - $button1 = qq| - - text('button') . qq|> - |; - - #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "1", "transdate", "BL", "trigger1"); - } else { - - # without JavaScript Calendar - $button1 = - qq||; - } - - $form->{previous_id} ||= "--"; - $form->{previous_gldate} ||= "--"; - - $jsscript .= $form->parse_html_template('gl/form_header_chart_balances_js'); - - $form->header; - - print qq| - - - - -
-|; - - $form->hide_form(qw(id closedto locked storno storno_id previous_id previous_gldate)); - - print qq| - - - - - - - - - - - | . - - ($form->{saved_message} ? qq| - - | : '') . - -qq| - - -
$form->{title}
$form->{saved_message} -
- - - - - - - - - |; - if ($form->{id}) { - print qq| - - - - - |; - } - print qq| - $department|; - if ($form->{id}) { - print qq| - - - - - - |; + $::request->{layout}->focus("#reference"); + $::form->{taxincluded} = "1"; } else { - print qq| - - - - - |; + $::request->{layout}->focus("#accno_$::form->{rowcount}"); } - print qq| - - - - - - |; - - print qq| - - - -
| - . $locale->text("Previous transnumber text") - . " $form->{previous_id} " - . $locale->text("Previous transdate text") - . " $form->{previous_gldate}" - . qq|
| . $locale->text('Reference') . qq| - - - - $button1 - -
| . $locale->text('Date') . qq|
-
| . $locale->text('Belegnummer') . qq| - - - - - -
| . $locale->text('Buchungsdatum') . qq|{gldate} $readonly onBlur=\"check_right_date_format(this)\">
-
| . $locale->text('Description') . qq|$description - - - - - -
| . $locale->text('MwSt. inkl.') . qq|
-
- - - - - -
| . $locale->text('Mitarbeiter') . qq|
-
| . $locale->text('Description') . qq|$description - - - - - -
| . $locale->text('MwSt. inkl.') . qq|
-
- - -
- | . $locale->text('OB Transaction') . qq| - - | . $locale->text('CB Transaction') . qq| -
| . $locale->text('Show details') . qq|
- - - - - - - - |; - - if ($form->{show_details}) { - print qq| - - - -|; - } + $::form->{previous_id} ||= "--"; + $::form->{previous_gldate} ||= "--"; - print qq| - + $::form->header; + print $::form->parse_html_template('gl/form_header', { + hide_title => $title, + }); -$jsscript -|; - $main::lxdebug->leave_sub(); + $::lxdebug->leave_sub; } sub form_footer { - $main::lxdebug->enter_sub(); - - $main::auth->assert('general_ledger'); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - my $cgi = $::request->{cgi}; - - my $follow_ups_block; - if ($form->{id}) { - my $follow_ups = FU->follow_ups('trans_id' => $form->{id}); - - if (@{ $follow_ups} ) { - my $num_due = sum map { $_->{due} * 1 } @{ $follow_ups }; - $follow_ups_block = qq|

| . $locale->text("There are #1 unfinished follow-ups of which #2 are due.", scalar @{ $follow_ups }, $num_due) . qq|

|; - } - } - - my ($dec) = ($form->{totaldebit} =~ /\.(\d+)/); - $dec = length $dec; - my $decimalplaces = ($dec > 2) ? $dec : 2; - my $radieren = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0; - - map { - $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 2, " ") - } qw(totaldebit totalcredit); - - print qq| - - - - - -
| - . $locale->text('Account') . qq|| . $locale->text('Chart balance') . qq|| - . $locale->text('Debit') . qq|| - . $locale->text('Credit') . qq|| - . $locale->text('Tax') . qq|| - . $locale->text('Taxkey') . qq|| . $locale->text('Source') . qq|| . $locale->text('Memo') . qq|| . $locale->text('Project Number') . qq|
$form->{totaldebit} $form->{totalcredit}
-
- - - -$follow_ups_block - -
-|; - - my $transdate = $form->datetonum($form->{transdate}, \%myconfig); - my $closedto = $form->datetonum($form->{closedto}, \%myconfig); - - if ($form->{id}) { - - if (!$form->{storno}) { - print qq||; - } - - # Löschen und Ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich - if (!$form->{locked} && $radieren) { - print qq| - - |; - } + $::lxdebug->enter_sub; + $::auth->assert('general_ledger'); - print qq| - - |; + my ($follow_ups, $follow_ups_due); - } else { - if ($form->{draft_id}) { - my $remove_draft_checked = $form->{remove_draft} ? 'checked' : ''; - print qq|

\n| - . qq| | - . qq| \n| - . qq|

\n|; - } - - print qq| - - | - . NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), '-class' => 'submit')) - . $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}]) - . $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}]); + if ($::form->{id}) { + $follow_ups = FU->follow_ups('trans_id' => $::form->{id}); + $follow_ups_due = sum map { $_->{due} * 1 } @{ $follow_ups || [] }; } - print " - + my $radieren = $::form->current_date(\%::myconfig) eq $::form->{gldate}; - - -"; - $main::lxdebug->leave_sub(); + print $::form->parse_html_template('gl/form_footer', { + radieren => $radieren, + follow_ups => $follow_ups, + follow_ups_due => $follow_ups_due, + }); + $::lxdebug->leave_sub; } sub delete { @@ -1239,8 +923,6 @@ sub delete { $form->header; print qq| - -
|;