X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fgl.pl;h=5154a3fcfb613637575545fb3182555151bad666;hb=9fd46de37d7906b7c104c17112b34bae7d534d67;hp=f17680865a5f9a68b81af25e8f580ed53e796e1a;hpb=134ecd713fae927536c69259fbd3489f0925fc3f;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index f17680865..5154a3fcf 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -81,24 +81,14 @@ sub add { # we use this only to set a default date GL->transaction(\%myconfig, \%$form); - map { - $chart .= - "" - } @{ $form->{chart} }; map { $tax .= qq|" - } @{ $form->{chart} }; map { $tax .= @@ -134,10 +120,6 @@ sub edit { . ($_->{rate} * 100) . qq| %| } @{ $form->{TAX} }; - $form->{chart} = $chart; - - $form->{taxchart} = $tax; - $form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2); # departments @@ -166,6 +148,8 @@ sub edit { $form->{"credit_$j"} += $form->{"tax_$j"}; } } + $form->{"project_id_$j"} = $ref->{project_id}; + } else { $form->{"accno_$i"} = "$ref->{accno}--$ref->{tax_id}"; for (qw(fx_transaction source memo)) { $form->{"${_}_$i"} = $ref->{$_} } @@ -177,6 +161,7 @@ sub edit { $form->{"credit_$i"} = $ref->{amount}; } $form->{"taxchart_$i"} = "0--0.00"; + $form->{"project_id_$i"} = $ref->{project_id}; $i++; } if ($ref->{taxaccno} && !$tax) { @@ -186,7 +171,6 @@ sub edit { $taxaccno = ""; $tax = 0; } - } $form->{rowcount} = $i; @@ -494,10 +478,14 @@ sub generate_report { . $locale->date(\%myconfig, $form->{dateto}, 1); } - @columns = - qw(transdate id reference description notes source debit debit_accno credit - credit_accno debit_tax debit_tax_accno credit_tax credit_tax_accno accno - gifi_accno projectnumbers); + @columns = $form->sort_columns( qw( + transdate id reference description + notes source debit debit_accno + credit credit_accno debit_tax debit_tax_accno + credit_tax credit_tax_accno accno gifi_accno + projectnumbers + ) + ); if ($form->{accno} || $form->{gifi_accno}) { @columns = grep !/(accno|gifi_accno)/, @columns; @@ -833,6 +821,12 @@ sub generate_report { map { $column_data{$_} = " " } @column_index; + my $balanced_ledger = $totaldebit + + $totaldebittax + - $totalcredit + - $totalcredittax; + # = 0 for balanced ledger + $column_data{debit} = "" . $form->format_amount(\%myconfig, $totaldebit, 2, " ") . ""; @@ -857,6 +851,27 @@ sub generate_report { print qq| + |; + + + if ( abs($balanced_ledger) > 0.001 ) { + + print qq|| + . $locale->text('Unbalanced Ledger') + . ": " + . $form->format_amount(\%myconfig, $balanced_ledger, 3, " ") + + } elsif ( abs($balanced_ledger) <= 0.001 ) { + + print qq|| + . $locale->text('Balanced Ledger') + + } + + + print qq| + + @@ -1050,10 +1065,6 @@ sub display_rows { $form->{totaldebit} = 0; $form->{totalcredit} = 0; - my $chart = $form->{chart}; - $chart = $form->unquote($chart); - $form->{taxchart} = $form->unquote($form->{taxchart}); - $taxchart = $form->{taxchart}; my @old_project_ids = (); map({ push(@old_project_ids, $form->{"project_id_$_"}) @@ -1061,7 +1072,10 @@ sub display_rows { $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 0, - "old_id" => \@old_project_ids }); + "old_id" => \@old_project_ids }, + "charts" => { "key" => "ALL_CHARTS", + "transdate" => $form->{transdate} }, + "taxcharts" => "ALL_TAXCHARTS"); my %project_labels = (); my @project_values = (""); @@ -1070,6 +1084,26 @@ sub display_rows { $project_labels{$item->{"id"}} = $item->{"projectnumber"}; } + my %chart_labels = (); + my @chart_values = (); + my $taxchart_init; + foreach my $item (@{ $form->{ALL_CHARTS} }) { + my $key = Q($item->{accno}) . "--" . Q($item->{tax_id}); + $taxchart_init = $item->{taxkey_id} unless (@chart_values); + push(@chart_values, $key); + $chart_labels{$key} = H($item->{accno}) . "--" . H($item->{description}); + } + + my %taxchart_labels = (); + my @taxchart_values = (); + foreach my $item (@{ $form->{ALL_TAXCHARTS} }) { + my $key = Q($item->{id}) . "--" . Q($item->{rate}); + $taxchart_init = $key if ($taxchart_init eq $item->{taxkey}); + push(@taxchart_values, $key); + $taxchart_labels{$key} = H($item->{taxdescription}) . " " . + H($item->{rate} * 100) . ' %'; + } + for $i (1 .. $form->{rowcount}) { $source = qq| @@ -1079,15 +1113,25 @@ sub display_rows { |; - if ($init) { - $accno = qq| - |; - $tax = - qq||; + $accno = qq|| . + $cgi->popup_menu('-name' => "accno_$i", + '-onChange' => "setTaxkey(this, $i)", + '-style' => 'width:200px', + '-tabindex' => ($i + 5 + (($i - 1) * 8)), + '-values' => \@chart_values, + '-labels' => \%chart_labels, + '-default' => $init ? '' : $form->{"accno_$i"}) + . qq||; + $tax = qq|| . + $cgi->popup_menu('-name' => "taxchart_$i", + '-style' => 'width:200px', + '-tabindex' => ($i + 10 + (($i - 1) * 8)), + '-values' => \@taxchart_values, + '-labels' => \%taxchart_labels, + '-default' => $init ? $taxchart_init : $form->{"taxchart_$i"}) + . qq||; + if ($init) { $korrektur = qq|{rowcount}) { - - $accno = $chart; - $chart_selected = $form->{"accno_$i"}; - $accno =~ - s/value=\"$chart_selected\"/value=\"$chart_selected\" selected/; - $accno = - qq||; - $tax = $taxchart; - $tax_selected = $form->{"taxchart_$i"}; - $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/; - $tax = - qq||; - if ($form->{transfer}) { $checked = ($form->{"fx_transaction_$i"}) ? "1" : ""; $x = ($checked) ? "x" : ""; @@ -1151,14 +1178,6 @@ sub display_rows { $form->hide_form("accno_$i"); } else { - - $accno = qq| - |; - $tax = qq| - |; - $korrektur = qq|{closedto}> {locked}> - - @@ -1457,7 +1474,7 @@ sub form_footer { 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| @@ -1501,7 +1518,7 @@ sub delete { {script}> |; - map { $form->{$_} =~ s/\"/"/g } qw(reference description chart taxchart); + map { $form->{$_} =~ s/\"/"/g } qw(reference description); delete $form->{header}; @@ -1526,9 +1543,15 @@ sub delete { sub yes { $lxdebug->enter_sub(); - - $form->redirect($locale->text('Transaction deleted!')) - if (GL->delete_transaction(\%myconfig, \%$form)); + if (GL->delete_transaction(\%myconfig, \%$form)){ + # saving the history + if(!exists $form->{addition} && $form->{id} ne "") { + $form->{addition} = "DELETED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history + $form->redirect($locale->text('Transaction deleted!')) + } $form->error($locale->text('Cannot delete transaction!')); $lxdebug->leave_sub(); @@ -1714,6 +1737,13 @@ sub post { $form->error($err[$errno]); } undef($form->{callback}); + # saving the history + if(!exists $form->{addition} && $form->{id} ne "") { + $form->{addition} = "SAVED"; + $form->{what_done} = $locale->text("Buchungsnummer") . " = " . $form->{id}; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history $form->redirect("Buchung gespeichert. Buchungsnummer = " . $form->{id}); $lxdebug->leave_sub(); @@ -1733,6 +1763,12 @@ sub storno { $form->{id} = 0; $form->{storno} = 1; + # saving the history + if(!exists $form->{addition} && $form->{id} ne "") { + $form->{addition} = "STORNO"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &post; $lxdebug->leave_sub();