X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fgl.pl;h=15b49d2e1968df40ac66fbeb1ea4eaae8a032dfa;hb=bb5ee43d0ddff8f8b57ce0f15a5664b26c110d1f;hp=0f5f944528ae8f194ae4a81e0beac7e9ed799dee;hpb=fff0fe48e0d986e64c8434226d1f4997ebed88f6;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 0f5f94452..15b49d2e1 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -260,7 +260,7 @@ sub search { $button1 = qq| text('button') . qq|> + . $locale->text('button') . qq|> |; $button2 = qq| @@ -497,9 +497,9 @@ sub generate_report { 'projectnumbers' => { 'text' => $locale->text('Project Numbers'), }, ); - foreach my $name (qw(id transdate reference source description debit_accno credit_accno debit_tax_accno credit_tax_accno)) { + foreach my $name (qw(id transdate reference description debit_accno credit_accno debit_tax_accno credit_tax_accno)) { my $sortname = $name =~ m/accno/ ? 'accno' : $name; - my $sortdir = $sortname eq $name ? 1 - $form->{sortdir} : $form->{sortdir}; + my $sortdir = $sortname eq $form->{sort} ? 1 - $form->{sortdir} : $form->{sortdir}; $column_defs{$name}->{link} = $callback . "&sort=$sortname&sortdir=$sortdir"; } @@ -516,7 +516,7 @@ sub generate_report { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('generate_report', @hidden_variables); + $report->set_export_options('generate_report', @hidden_variables, qw(sort sortdir)); $report->set_sort_indicator($form->{sort} eq 'accno' ? 'debit_accno' : $form->{sort}, $form->{sortdir}); @@ -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,12 +546,17 @@ 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); } } - foreach my $key (qw(debit_accno credit_accno debit_tax_accno credit_tax_accno ac_transdate)) { + foreach my $key (qw(debit_accno credit_accno debit_tax_accno credit_tax_accno ac_transdate source)) { my $col = $key eq 'ac_transdate' ? 'transdate' : $key; $rows{$col} = [ map { $ref->{$key}->{$_} } sort keys(%{ $ref->{$key} }) ]; } @@ -572,12 +564,23 @@ 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 source notes); + map { $row->{$_}->{data} = $ref->{$_} } qw(id reference description notes); - map { $row->{$_}->{data} = \@{ $rows{$_} }; } qw(transdate debit credit debit_accno credit_accno debit_tax_accno credit_tax_accno); + map { $row->{$_}->{data} = \@{ $rows{$_} }; } qw(transdate debit credit debit_accno credit_accno debit_tax_accno credit_tax_accno source); foreach my $col (qw(debit_accno credit_accno debit_tax_accno credit_tax_accno)) { $row->{$col}->{link} = [ map { "${callback}&accno=" . E($_) } @{ $rows{$col} } ]; @@ -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; @@ -701,22 +713,20 @@ sub update { $form->{"taxchart_$i"} = "0--0.00"; $form->{"tax_$i"} = 0; } - if (!$form->{"korrektur_$i"}) { - ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"}); - if ($taxkey > 1) { - if ($debitcredit) { - $debittax = 1; - } else { - $credittax = 1; - } - if ($form->{taxincluded}) { - $form->{"tax_$i"} = $amount / ($rate + 1) * $rate; - } else { - $form->{"tax_$i"} = $amount * $rate; - } + ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"}); + if ($taxkey > 1) { + if ($debitcredit) { + $debittax = 1; } else { - $form->{"tax_$i"} = 0; + $credittax = 1; } + if ($form->{taxincluded}) { + $form->{"tax_$i"} = $amount / ($rate + 1) * $rate; + } else { + $form->{"tax_$i"} = $amount * $rate; + } + } else { + $form->{"tax_$i"} = 0; } for (@flds) { $a[$j]->{$_} = $form->{"${_}_$i"} } @@ -813,14 +823,17 @@ sub display_rows { for $i (1 .. $form->{rowcount}) { - $source = qq| - |; - $memo = qq| - |; - $source_hidden = qq| - |; - $memo_hidden = qq| - |; + if ($form->{show_details}) { + $source = qq| + |; + $memo = qq| + |; + } else { + $source_hidden = qq| + |; + $memo_hidden = qq| + |; + } my $selected_accno_full; my ($accno_row) = split(/--/, $form->{"accno_$i"}); @@ -862,8 +875,6 @@ sub display_rows { . qq||; if ($init) { - $korrektur = - qq||; if ($form->{transfer}) { $fx_transaction = qq| @@ -898,14 +909,9 @@ sub display_rows { $x |; } - $checked = ($form->{"korrektur_$i"}) ? "checked" : ""; - $korrektur = - qq||; $form->hide_form("accno_$i"); } else { - $korrektur = - qq||; if ($form->{transfer}) { $fx_transaction = qq| @@ -936,8 +942,7 @@ sub display_rows { $fx_transaction - - $korrektur + $form->{"tax_$i"} $tax|; if ($form->{show_details}) { @@ -1048,7 +1053,7 @@ sub form_header { $button1 = qq| text('button') . qq|> + . $locale->text('button') . qq|> |; #write Trigger @@ -1069,7 +1074,6 @@ sub form_header { print qq| -
@@ -1128,7 +1132,7 @@ sub form_header { |; } - print qq| + print qq| $department|; if ($form->{id}) { print qq| @@ -1197,8 +1201,6 @@ sub form_header { | . $locale->text('Tax') . qq| | - . $locale->text('Korrektur') . qq| - | . $locale->text('Taxkey') . qq||; if ($form->{show_details}) { @@ -1246,7 +1248,7 @@ sub form_footer { $form->{totaldebit} - $form->{totalcredit} + $form->{totalcredit} @@ -1277,7 +1279,7 @@ $follow_ups_block |; } - print qq| + print qq| save_history($form->dbconnect(\%myconfig)); } - # /saving the history + # /saving the history $form->redirect($locale->text('Transaction deleted!')) } $form->error($locale->text('Cannot delete transaction!')); @@ -1421,33 +1423,25 @@ sub post_transaction { $form->{"taxchart_$i"} = "0--0.00"; $form->{"tax_$i"} = 0; } - if (!$form->{"korrektur_$i"}) { - ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"}); - if ($taxkey > 1) { + ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"}); + if ($taxkey > 1) { + if ($debitcredit) { + $debittax = 1; + } else { + $credittax = 1; + } + if ($form->{taxincluded}) { + $form->{"tax_$i"} = $amount / ($rate + 1) * $rate; if ($debitcredit) { - $debittax = 1; - } else { - $credittax = 1; - } - if ($form->{taxincluded}) { - $form->{"tax_$i"} = $amount / ($rate + 1) * $rate; - if ($debitcredit) { - $form->{"debit_$i"} = $form->{"debit_$i"} - $form->{"tax_$i"}; - } else { - $form->{"credit_$i"} = $form->{"credit_$i"} - $form->{"tax_$i"}; - } + $form->{"debit_$i"} = $form->{"debit_$i"} - $form->{"tax_$i"}; } else { - $form->{"tax_$i"} = $amount * $rate; + $form->{"credit_$i"} = $form->{"credit_$i"} - $form->{"tax_$i"}; } } else { - $form->{"tax_$i"} = 0; - } - } elsif ($form->{taxincluded}) { - if ($debitcredit) { - $form->{"debit_$i"} = $form->{"debit_$i"} - $form->{"tax_$i"}; - } else { - $form->{"credit_$i"} = $form->{"credit_$i"} - $form->{"tax_$i"}; + $form->{"tax_$i"} = $amount * $rate; } + } else { + $form->{"tax_$i"} = 0; } for (@flds) { $a[$j]->{$_} = $form->{"${_}_$i"} } @@ -1474,7 +1468,7 @@ sub post_transaction { $credit += $cr + $tax if $cr; $taxtotal += $tax if $form->{taxincluded} } - + $form->{taxincluded} = 0 if !$taxtotal; # this is just for the wise guys @@ -1483,11 +1477,11 @@ sub post_transaction { if ($form->round_amount($debit, 2) != $form->round_amount($credit, 2)) { $form->error($locale->text('Out of balance transaction!')); } - + if ($form->round_amount($debit, 2) + $form->round_amount($credit, 2) == 0) { $form->error($locale->text('Empty transaction!')); } - + if (($errno = GL->post_transaction(\%myconfig, \%$form)) <= -1) { $errno *= -1; $err[1] = $locale->text('Cannot have a value in both Debit and Credit!'); @@ -1501,10 +1495,10 @@ sub post_transaction { if(!exists $form->{addition} && $form->{id} ne "") { $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; $form->{addition} = "SAVED"; - $form->{what_done} = $locale->text("Buchungsnummer") . " = " . $form->{id}; + $form->{what_done} = $locale->text("Buchungsnummer") . " = " . $form->{id}; $form->save_history($form->dbconnect(\%myconfig)); } - # /saving the history + # /saving the history $lxdebug->leave_sub(); } @@ -1555,9 +1549,9 @@ sub storno { $form->{addition} = "STORNO"; $form->save_history($form->dbconnect(\%myconfig)); } - # /saving the history + # /saving the history - $form->redirect(sprintf $locale->text("Transaction %d cancelled."), $form->{storno_id}); + $form->redirect(sprintf $locale->text("Transaction %d cancelled."), $form->{storno_id}); $lxdebug->leave_sub(); }