+
+ |
+ . $locale->text("Previous transnumber text")
+ . " $form->{previous_id} "
+ . $locale->text("Previous transdate text")
+ . " $form->{previous_gldate}"
+ . qq| |
+
| . $locale->text('Reference') . qq| |
|
@@ -1399,6 +1442,12 @@ sub form_header {
|;
}
+
+ print qq|
+ | . $locale->text('Show details') . qq| |
+ |
+ |;
+
print qq|
@@ -1415,12 +1464,17 @@ sub form_header {
| |
. $locale->text('Korrektur') . qq| |
|
- . $locale->text('Taxkey') . qq| |
- |
- . $locale->text('Source') . qq| |
+ . $locale->text('Taxkey') . qq||;
+
+ if ($form->{show_details}) {
+ print qq|
+ | . $locale->text('Source') . qq| |
| . $locale->text('Memo') . qq| |
- |
- . $locale->text('Project Number') . qq| |
+ | . $locale->text('Project Number') . 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();
}
|