Revision 76c486e3
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
SL/GL.pm | ||
---|---|---|
41 | 41 |
use Data::Dumper; |
42 | 42 |
use SL::DBUtils; |
43 | 43 |
|
44 |
use strict; |
|
45 |
|
|
44 | 46 |
sub delete_transaction { |
45 | 47 |
my ($self, $myconfig, $form) = @_; |
46 | 48 |
$main::lxdebug->enter_sub(); |
... | ... | |
86 | 88 |
$form->{taxincluded} = 0; |
87 | 89 |
} |
88 | 90 |
|
89 |
my ($query, $sth); |
|
91 |
my ($query, $sth, @values, $taxkey, $rate, $posted);
|
|
90 | 92 |
|
91 | 93 |
if ($form->{id}) { |
92 | 94 |
|
... | ... | |
196 | 198 |
|
197 | 199 |
# connect to database |
198 | 200 |
my $dbh = $form->dbconnect($myconfig); |
199 |
my ($query, $sth, $source, $null); |
|
201 |
my ($query, $sth, $source, $null, $space);
|
|
200 | 202 |
|
201 | 203 |
my ($glwhere, $arwhere, $apwhere) = ("1 = 1", "1 = 1", "1 = 1"); |
202 | 204 |
my (@glvalues, @arvalues, @apvalues); |
... | ... | |
294 | 296 |
push(@apvalues, $project_id, $project_id); |
295 | 297 |
} |
296 | 298 |
|
297 |
my ($project_columns, %project_join);
|
|
299 |
my ($project_columns, $project_join);
|
|
298 | 300 |
if ($form->{"l_projectnumbers"}) { |
299 | 301 |
$project_columns = qq|, ac.project_id, pr.projectnumber|; |
300 | 302 |
$project_join = qq|LEFT JOIN project pr ON (ac.project_id = pr.id)|; |
... | ... | |
315 | 317 |
} |
316 | 318 |
} |
317 | 319 |
|
318 |
my $false = ($myconfig->{dbdriver} eq 'Pg') ? FALSE: q|'0'|;
|
|
320 |
my $false = ($myconfig->{dbdriver} eq 'Pg') ? "FALSE" : q|'0'|;
|
|
319 | 321 |
|
320 | 322 |
my %sort_columns = ( |
321 | 323 |
'id' => [ qw(id) ], |
... | ... | |
342 | 344 |
map { $columns_for_sorting{$_} .= sprintf(', lower(%s) AS lower_%s', $lowered_columns{$column}->{$_}, $column) } qw(gl arap); |
343 | 345 |
} |
344 | 346 |
|
345 |
my $query =
|
|
347 |
$query = |
|
346 | 348 |
qq|SELECT |
347 | 349 |
ac.acc_trans_id, g.id, 'gl' AS type, $false AS invoice, g.reference, ac.taxkey, c.link, |
348 | 350 |
g.description, ac.transdate, ac.source, ac.trans_id, |
... | ... | |
388 | 390 |
my @values = (@glvalues, @arvalues, @apvalues); |
389 | 391 |
|
390 | 392 |
# Show all $query in Debuglevel LXDebug::QUERY |
391 |
$callingdetails = (caller (0))[3]; |
|
392 |
dump_query(LXDebug::QUERY, "$callingdetails", $query, @values);
|
|
393 |
my $callingdetails = (caller (0))[3];
|
|
394 |
dump_query(LXDebug->QUERY(), "$callingdetails", $query, @values);
|
|
393 | 395 |
|
394 | 396 |
$sth = prepare_execute_query($form, $dbh, $query, @values); |
395 | 397 |
my $trans_id = ""; |
396 | 398 |
my $trans_id2 = ""; |
399 |
my $balance; |
|
397 | 400 |
|
398 | 401 |
my ($i, $j, $k, $l, $ref, $ref2); |
399 | 402 |
|
400 | 403 |
$form->{GL} = []; |
401 |
while (my $ref0 = $sth->fetchrow_hashref(NAME_lc)) {
|
|
404 |
while (my $ref0 = $sth->fetchrow_hashref("NAME_lc")) {
|
|
402 | 405 |
|
403 | 406 |
$trans_id = $ref0->{id}; |
404 | 407 |
|
... | ... | |
489 | 492 |
} else { # following lines of a booking, line increasing |
490 | 493 |
|
491 | 494 |
$ref2 = $ref0; |
492 |
$trans_old = $trans_id2;
|
|
495 |
# $trans_old = $trans_id2; # doesn't seem to be used anymore
|
|
493 | 496 |
$trans_id2 = $ref2->{id}; |
494 | 497 |
|
495 | 498 |
$balance = |
... | ... | |
596 | 599 |
if ($form->{id}) { |
597 | 600 |
$query = |
598 | 601 |
qq|SELECT g.reference, g.description, g.notes, g.transdate, g.storno, g.storno_id, |
599 |
d.description AS department, e.name AS employee, g.taxincluded, g.gldate,
|
|
602 |
d.description AS department, e.name AS employee, g.taxincluded, g.gldate, |
|
600 | 603 |
g.ob_transaction, g.cb_transaction |
601 | 604 |
FROM gl g |
602 | 605 |
LEFT JOIN department d ON (d.id = g.department_id) |
... | ... | |
701 | 704 |
|
702 | 705 |
# now copy acc_trans entries |
703 | 706 |
$query = qq|SELECT * FROM acc_trans WHERE trans_id = ?|; |
704 |
my $rowref = selectall_hashref_query($form, $dbh, $query, $id);
|
|
707 |
my $rowref = selectall_hashref_query($form, $dbh, $query, $id); |
|
705 | 708 |
|
706 | 709 |
for my $row (@$rowref) { |
707 | 710 |
delete @$row{qw(itime mtime)}; |
Auch abrufbar als: Unified diff
Und wieder ein Schwung strict.