X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fgl.pl;h=b14fb6f3a1f387850b5d828503fc4a00a81630a2;hb=991315859c7b0f25da49baad4822492510b6b3bb;hp=faaad58280a10c687612e0da15401241730be696;hpb=d629acd82a27e980899a044ca8b0f4becc8e94bb;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index faaad5828..b14fb6f3a 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -32,6 +32,7 @@ #====================================================================== use SL::GL; +use SL::IS; use SL::PE; require "bin/mozilla/arap.pl"; @@ -104,12 +105,14 @@ sub add { } (@{ $form->{all_departments} }); } + $form->{show_details} = $myconfig{show_form_details} unless defined $form->{show_details}; + &display_form(1); $lxdebug->leave_sub(); } -sub edit { +sub prepare_transaction { $lxdebug->enter_sub(); GL->transaction(\%myconfig, \%$form); @@ -178,15 +181,26 @@ sub edit { ($form->datetonum($form->{transdate}, \%myconfig) <= $form->datetonum($form->{closedto}, \%myconfig)); + $lxdebug->leave_sub(); +} + +sub edit { + $lxdebug->enter_sub(); + + prepare_transaction(); + $form->{title} = "Edit"; - &form_header; - &display_rows; - &form_footer; - $lxdebug->leave_sub(); + $form->{show_details} = $myconfig{show_form_details} unless defined $form->{show_details}; + form_header(); + display_rows(); + form_footer(); + + $lxdebug->leave_sub(); } + sub search { $lxdebug->enter_sub(); @@ -227,7 +241,7 @@ sub search { '-labels' => \%project_labels)); # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; + $form->{jsscript} = 1; $jsscript = ""; if ($form->{jsscript}) { @@ -1045,6 +1059,7 @@ sub display_rows { my ($init) = @_; $lxdebug->enter_sub(); + $form->{debit_1} = 0 if !$form->{"debit_1"}; $form->{totaldebit} = 0; $form->{totalcredit} = 0; @@ -1138,7 +1153,7 @@ sub display_rows { if ($init) { $korrektur = - qq||; + qq||; if ($form->{transfer}) { $fx_transaction = qq| @@ -1204,20 +1219,27 @@ sub display_rows { '-labels' => \%project_labels, '-default' => $form->{"project_id_$i"} )); + my $copy2credit = 'onkeyup="copy_debit_to_credit()"' if $i == 1; + print qq| $accno $fx_transaction - + $korrektur - $tax + $tax|; + + if ($form->{show_details}) { + print qq| $source $memo $projectnumber +|; + } + print qq| - - |; +|; } $form->hide_form(qw(rowcount selectaccno)); @@ -1233,11 +1255,14 @@ sub form_header { $form->{title} = $locale->text("$title General Ledger Transaction"); $readonly = ($form->{id}) ? "readonly" : ""; + $show_details_checked = "checked" if $form->{show_details}; + # $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->{javascript} .= qq||; $form->{selectdepartment} =~ s/ selected//; $form->{selectdepartment} =~ @@ -1290,7 +1322,7 @@ sub form_header { } # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; + $form->{jsscript} = 1; $jsscript = ""; if ($form->{jsscript}) { @@ -1311,17 +1343,20 @@ sub form_header { qq||; } + $form->{previous_id} ||= "--"; + $form->{previous_gldate} ||= "--"; + $form->header; print qq|
{script}> +|; -{id}> + $form->hide_form(qw(id closedto locked storno storno_id previous_id previous_gldate)); -{closedto}> -{locked}> + print qq| @@ -1333,6 +1368,14 @@ sub form_header { + + + @@ -1399,6 +1442,12 @@ sub form_header { |; } + + print qq| + + + |; + print qq| - + . $locale->text('Taxkey') . qq||; + + if ($form->{show_details}) { + print qq| + - + +|; + } + + print qq| $jsscript @@ -1466,8 +1520,10 @@ sub form_footer { if ($form->{id}) { - print qq||; + if (!$form->{storno}) { + print qq||; + } # Löschen und Ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich @@ -1485,7 +1541,7 @@ sub form_footer { # } } else { if ($transdate > $closedto) { - print qq|text('Update') . qq|"> |; @@ -1556,6 +1612,8 @@ sub yes { sub post { $lxdebug->enter_sub(); + $form->{title} = $locale->text("$form->{title} General Ledger Transaction"); + # check if there is something in reference and date $form->isblank("reference", $locale->text('Reference missing!')); $form->isblank("transdate", $locale->text('Transaction Date missing!')); @@ -1575,19 +1633,6 @@ sub post { my @flds = qw(accno debit credit projectnumber fx_transaction source memo tax taxchart); - if ($form->{storno}) { - for my $i (1 .. $form->{rowcount}) { - unless (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")) { - if ($form->{"debit_$i"} ne "") { - $form->{"credit_$i"} = $form->{"debit_$i"}; - $form->{"debit_$i"} = ""; - } elsif ($form->{"credit_$i"} ne "") { - $form->{"debit_$i"} = $form->{"credit_$i"}; - $form->{"credit_$i"} = ""; - } - } - } - } for my $i (1 .. $form->{rowcount}) { @@ -1741,7 +1786,10 @@ sub post { $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history - $form->redirect("Buchung gespeichert. Buchungsnummer = " . $form->{id}); + + $form->{callback} = build_std_url("action=add", "show_details"); + $form->redirect($form->{callback}); + $lxdebug->leave_sub(); } @@ -1758,8 +1806,47 @@ sub post_as_new { sub storno { $lxdebug->enter_sub(); - $form->{id} = 0; - $form->{storno} = 1; + if (IS->has_storno(\%myconfig, $form, 'gl')) { + $form->{title} = $locale->text("Cancel General Ledger Transaction"); + $form->error($locale->text("Transaction has already been cancelled!")); + } + + my %keep_keys = map { $_, 1 } qw(login password id stylesheet); + map { delete $form->{$_} unless $keep_keys{$_} } keys %{ $form }; + + prepare_transaction(); + + for my $i (1 .. $form->{rowcount}) { + for (qw(debit credit tax)) { + $form->{"${_}_$i"} = + ($form->{"${_}_$i"}) + ? $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) + : ""; + } + } + + $form->{storno} = 1; + $form->{storno_id} = $form->{id}; + $form->{id} = 0; + + $form->{reference} = "Storno-" . $form->{reference}; + $form->{description} = "Storno-" . $form->{description}; + + for my $i (1 .. $form->{rowcount}) { + next if (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")); + + if ($form->{"debit_$i"} ne "") { + $form->{"credit_$i"} = $form->{"debit_$i"}; + $form->{"debit_$i"} = ""; + + } else { + $form->{"debit_$i"} = $form->{"credit_$i"}; + $form->{"credit_$i"} = ""; + } + } + + post(); + # saving the history if(!exists $form->{addition} && $form->{id} ne "") { $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; @@ -1767,7 +1854,7 @@ sub storno { $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history - &post; + $lxdebug->leave_sub(); }
| + . $locale->text("Previous transnumber text") + . " $form->{previous_id} " + . $locale->text("Previous transdate text") + . " $form->{previous_gldate}" + . qq|
| . $locale->text('Reference') . qq|
| . $locale->text('Show details') . qq|
@@ -1415,12 +1464,17 @@ sub form_header { | . $locale->text('Korrektur') . qq| | - . $locale->text('Taxkey') . qq|| - . $locale->text('Source') . qq|| . $locale->text('Source') . qq| | . $locale->text('Memo') . qq|| - . $locale->text('Project Number') . qq|| . $locale->text('Project Number') . qq|