X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fgl.pl;h=0f34f1b94ff387f1d891996915acaf4b37561182;hb=e74c2ab4728dfdc932cd290db005ce2250e9d61b;hp=58266b54f030d3024df551d0ae07cbe9e5c36614;hpb=6c7334b32c2219f4eb46ab2ca56e3a044a22db80;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 58266b54f..0f34f1b94 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -507,7 +507,7 @@ sub generate_report { map { $column_defs{$_}->{visible} = 0 } qw(debit_accno credit_accno debit_tax_accno credit_tax_accno) if $form->{accno}; my %column_alignment; - map { $column_alignment{$_} = 'right' } qw(balance id debit credit debit_tax credit_tax); + map { $column_alignment{$_} = 'right' } qw(balance id debit credit debit_tax credit_tax balance); map { $column_alignment{$_} = 'center' } qw(transdate reference description source notes debit_accno credit_accno debit_tax_accno credit_tax_accno); map { $column_defs{$_}->{align} = $column_alignment{$_} } keys %column_alignment; @@ -530,18 +530,6 @@ sub generate_report { # add sort to callback $form->{callback} = "$callback&sort=" . E($form->{sort}) . "&sortdir=" . E($form->{sortdir}); - $form->{balance} *= $ml; - - if ($form->{accno} && $form->{balance}) { - my $row = { - 'balance' => { - 'data' => $form->format_amount(\%myconfig, $form->{balance}, 2), - 'align' => 'right', - }, - }; - - $report->add_data($row); - } my @totals_columns = qw(debit credit debit_tax credit_tax); my %subtotals = map { $_ => 0 } @totals_columns; @@ -549,7 +537,6 @@ sub generate_report { my $idx = 0; foreach $ref (@{ $form->{GL} }) { - $form->{balance} *= $ml; my %rows; @@ -559,7 +546,12 @@ sub generate_report { my $value = $ref->{$key}->{$idx}; $subtotals{$key} += $value; $totals{$key} += $value; - $form->{balance} = abs($form->{balance}) - abs($value); + if ($key =~ /debit.*/) { + $ml = -1; + } else { + $ml = 1; + } + $form->{balance} = $form->{balance} + $value * $ml; push @{ $rows{$key} }, $form->format_amount(\%myconfig, $value, 2); } } @@ -572,7 +564,18 @@ sub generate_report { my $row = { }; map { $row->{$_} = { 'data' => '', 'align' => $column_alignment{$_} } } @columns; - $row->{balance}->{data} = $form->format_amount(\%myconfig, $form->{balance}, 2); + my $sh = ""; + if ($form->{balance} < 0) { + $sh = " S"; + $ml = -1; + } elsif ($form->{balance} > 0) { + $sh = " H"; + $ml = 1; + } + my $data = $form->format_amount(\%myconfig, ($form->{balance} * $ml), 2); + $data .= $sh; + + $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); @@ -606,11 +609,20 @@ sub generate_report { my $balanced_ledger = $totals{debit} + $totals{debit_tax} - $totals{credit} - $totals{credit_tax}; my $row = create_subtotal_row(\%totals, \@columns, \%column_alignment, [ qw(debit credit debit_tax credit_tax) ], 'listtotal'); - $row->{balance} = { - 'data' => $form->format_amount(\%myconfig, $form->{balance} * $ml, 2), - 'align' => 'right', - 'class' => 'listtotal', - }; + + my $sh = ""; + if ($form->{balance} < 0) { + $sh = " S"; + $ml = -1; + } elsif ($form->{balance} > 0) { + $sh = " H"; + $ml = 1; + } + my $data = $form->format_amount(\%myconfig, ($form->{balance} * $ml), 2); + $data .= $sh; + + $row->{balance}->{data} = $data; + $report->add_data($row); my $raw_bottom_info_text; @@ -768,17 +780,6 @@ sub display_rows { $form->{totaldebit} = 0; $form->{totalcredit} = 0; - my @old_project_ids = (); - map({ push(@old_project_ids, $form->{"project_id_$_"}) - if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"})); - - $form->get_lists("projects" => { "key" => "ALL_PROJECTS", - "all" => 0, - "old_id" => \@old_project_ids }, - "charts" => { "key" => "ALL_CHARTS", - "transdate" => $form->{transdate} }, - "taxcharts" => "ALL_TAXCHARTS"); - my %project_labels = (); my @project_values = (""); foreach my $item (@{ $form->{"ALL_PROJECTS"} }) { @@ -810,7 +811,6 @@ sub display_rows { } for $i (1 .. $form->{rowcount}) { - if ($form->{show_details}) { $source = qq| |; @@ -927,6 +927,7 @@ sub display_rows { print qq| $accno +   $fx_transaction @@ -959,6 +960,19 @@ sub form_header { $auth->assert('general_ledger'); + my @old_project_ids = (); + map({ push(@old_project_ids, $form->{"project_id_$_"}) + if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"})); + + $form->get_lists("projects" => { "key" => "ALL_PROJECTS", + "all" => 0, + "old_id" => \@old_project_ids }, + "charts" => { "key" => "ALL_CHARTS", + "transdate" => $form->{transdate} }, + "taxcharts" => "ALL_TAXCHARTS"); + + GL->get_chart_balances('charts' => $form->{ALL_CHARTS}); + $title = $form->{title}; $form->{title} = $locale->text("$title General Ledger Transaction"); $readonly = ($form->{id}) ? "readonly" : ""; @@ -996,10 +1010,11 @@ sub form_header { var txt = document.getElementsByName('debit_1')[0].value; document.getElementsByName('credit_2')[0].value = txt; }; - //--> - |; - $form->{javascript} .= qq||; + + + +|; $form->{selectdepartment} =~ s/ selected//; $form->{selectdepartment} =~ @@ -1057,6 +1072,8 @@ sub form_header { $form->{previous_id} ||= "--"; $form->{previous_gldate} ||= "--"; + $jsscript .= $form->parse_html_template('gl/form_header_chart_balances_js'); + $form->header; print qq| @@ -1182,6 +1199,7 @@ sub form_header { | . $locale->text('Account') . qq| + | . $locale->text('Chart balance') . qq| | . $locale->text('Debit') . qq| | @@ -1234,8 +1252,7 @@ sub form_footer { print qq| - - $form->{totaldebit} + $form->{totaldebit} $form->{totalcredit}