X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/05fea791dddc88e5b129c64824cd147692f7c2dd..69822fd215cb15e1bb017f1af6f0a185f62a31e2:/SL/GL.pm diff --git a/SL/GL.pm b/SL/GL.pm index 27aa179e6..1b4a59e8c 100644 --- a/SL/GL.pm +++ b/SL/GL.pm @@ -70,13 +70,6 @@ sub post_transaction { my $i; - # check if debit and credit balances - - if ($form->{storno}) { - $form->{reference} = "Storno-" . $form->{reference}; - $form->{description} = "Storno-" . $form->{description}; - } - # connect to database, turn off AutoCommit my $dbh = $form->dbconnect_noauto($myconfig); @@ -119,11 +112,13 @@ sub post_transaction { $query = qq|UPDATE gl SET reference = ?, description = ?, notes = ?, - transdate = ?, department_id = ?, taxincluded = ? + transdate = ?, department_id = ?, taxincluded = ?, + storno = ?, storno_id = ? WHERE id = ?|; @values = ($form->{reference}, $form->{description}, $form->{notes}, conv_date($form->{transdate}), $department_id, $form->{taxincluded}, + $form->{storno} ? 't' : 'f', conv_i($form->{storno_id}), conv_i($form->{id})); do_query($form, $dbh, $query, @values); @@ -180,13 +175,16 @@ sub post_transaction { } } + if ($form->{storno} && $form->{storno_id}) { + do_query($form, $dbh, qq|UPDATE gl SET storno = 't' WHERE id = ?|, conv_i($form->{storno_id})); + } + # commit and redirect my $rc = $dbh->commit; $dbh->disconnect; $main::lxdebug->leave_sub(); - $rc; - + return $rc; } sub all_transactions { @@ -379,6 +377,8 @@ sub all_transactions { my $trans_id = ""; my $trans_id2 = ""; + my ($i, $j, $k, $l, $ref, $ref2); + $form->{GL} = []; while (my $ref0 = $sth->fetchrow_hashref(NAME_lc)) { @@ -557,7 +557,7 @@ sub transaction { if ($form->{id}) { $query = - qq|SELECT g.reference, g.description, g.notes, g.transdate, + qq|SELECT g.reference, g.description, g.notes, g.transdate, g.storno, g.storno_id, d.description AS department, e.name AS employee, g.taxincluded, g.gldate FROM gl g LEFT JOIN department d ON (d.id = g.department_id)