+
+ |
+ . $locale->text("Previous transnumber text")
+ . " $form->{previous_id} "
+ . $locale->text("Previous transdate text")
+ . " $form->{previous_gldate}"
+ . qq| |
+
| . $locale->text('Reference') . qq| |
|
@@ -1401,6 +1442,12 @@ sub form_header {
|;
}
+
+ print qq|
+ | . $locale->text('Show details') . qq| |
+ |
+ |;
+
print qq|
@@ -1417,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
@@ -1439,8 +1491,7 @@ sub form_footer {
$radieren = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
map {
- $form->{$_} =
- $form->format_amount(\%myconfig, $form->{$_}, 2, " ")
+ $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 2, " ")
} qw(totaldebit totalcredit);
print qq|
@@ -1455,7 +1506,6 @@ sub form_footer {
-{path}>
{login}>
{password}>
@@ -1469,29 +1519,22 @@ 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
-
if (!$form->{locked} && $radieren) {
print qq|
-
- |;
+
+ |;
}
- # if ($transdate > $closedto) {
- # print qq|
- # |;
- # }
} else {
if ($transdate > $closedto) {
- print qq|
- |;
+ print qq|
+
+ |;
}
}
@@ -1544,7 +1587,7 @@ sub yes {
if (GL->delete_transaction(\%myconfig, \%$form)){
# saving the history
if(!exists $form->{addition} && $form->{id} ne "") {
- $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$form->{addition} = "DELETED";
$form->save_history($form->dbconnect(\%myconfig));
}
@@ -1559,6 +1602,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!'));
@@ -1578,19 +1623,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}) {
@@ -1738,13 +1770,16 @@ sub post {
undef($form->{callback});
# saving the history
if(!exists $form->{addition} && $form->{id} ne "") {
- $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$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});
+
+ $form->{callback} = build_std_url("action=add", "show_details");
+ $form->redirect($form->{callback});
+
$lxdebug->leave_sub();
}
@@ -1761,16 +1796,55 @@ 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->{snumber} = qq|ordnumber_| . $form->{ordnumber};
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$form->{addition} = "STORNO";
$form->save_history($form->dbconnect(\%myconfig));
}
# /saving the history
- &post;
+
$lxdebug->leave_sub();
}
|