Revision d333f237
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/GL.pm | ||
---|---|---|
284 | 284 |
$arwhere .= " AND c.accno = '$form->{accno}'"; |
285 | 285 |
$apwhere .= " AND c.accno = '$form->{accno}'"; |
286 | 286 |
} |
287 |
if ($form->{gifi_accno}) { |
|
288 |
$glwhere .= " AND c.gifi_accno = '$form->{gifi_accno}'"; |
|
289 |
$arwhere .= " AND c.gifi_accno = '$form->{gifi_accno}'"; |
|
290 |
$apwhere .= " AND c.gifi_accno = '$form->{gifi_accno}'"; |
|
291 |
} |
|
292 | 287 |
if ($form->{category} ne 'X') { |
293 | 288 |
$glwhere .= |
294 | 289 |
" AND gl.id in (SELECT trans_id FROM acc_trans ac2 WHERE ac2.chart_id IN (SELECT id FROM chart c2 WHERE c2.category = '$form->{category}'))"; |
... | ... | |
340 | 335 |
} |
341 | 336 |
} |
342 | 337 |
|
343 |
if ($form->{gifi_accno}) { |
|
344 |
|
|
345 |
# get category for account |
|
346 |
$query = qq|SELECT c.category |
|
347 |
FROM chart c |
|
348 |
WHERE c.gifi_accno = '$form->{gifi_accno}'|; |
|
349 |
$sth = $dbh->prepare($query); |
|
350 |
|
|
351 |
$sth->execute || $form->dberror($query); |
|
352 |
($form->{ml}) = $sth->fetchrow_array; |
|
353 |
$sth->finish; |
|
354 |
|
|
355 |
if ($form->{datefrom}) { |
|
356 |
$query = qq|SELECT SUM(ac.amount) |
|
357 |
FROM acc_trans ac, chart c |
|
358 |
WHERE ac.chart_id = c.id |
|
359 |
AND c.gifi_accno = '$form->{gifi_accno}' |
|
360 |
AND ac.transdate < date '$form->{datefrom}' |
|
361 |
|; |
|
362 |
$sth = $dbh->prepare($query); |
|
363 |
$sth->execute || $form->dberror($query); |
|
364 |
|
|
365 |
($form->{balance}) = $sth->fetchrow_array; |
|
366 |
$sth->finish; |
|
367 |
} |
|
368 |
} |
|
369 |
|
|
370 | 338 |
my $false = ($myconfig->{dbdriver} eq 'Pg') ? FALSE: q|'0'|; |
371 | 339 |
|
372 | 340 |
my $sortorder = join ', ', |
... | ... | |
386 | 354 |
my $query = |
387 | 355 |
qq|SELECT ac.oid AS acoid, g.id, 'gl' AS type, $false AS invoice, g.reference, ac.taxkey, c.link, |
388 | 356 |
g.description, ac.transdate, ac.source, ac.trans_id, |
389 |
ac.amount, c.accno, c.gifi_accno, g.notes, t.chart_id, ac.oid
|
|
357 |
ac.amount, c.accno, g.notes, t.chart_id, ac.oid |
|
390 | 358 |
$project_columns |
391 | 359 |
FROM gl g, acc_trans ac $project_join, chart c LEFT JOIN tax t ON |
392 | 360 |
(t.chart_id=c.id) |
... | ... | |
396 | 364 |
UNION |
397 | 365 |
SELECT ac.oid AS acoid, a.id, 'ar' AS type, a.invoice, a.invnumber, ac.taxkey, c.link, |
398 | 366 |
ct.name, ac.transdate, ac.source, ac.trans_id, |
399 |
ac.amount, c.accno, c.gifi_accno, a.notes, t.chart_id, ac.oid
|
|
367 |
ac.amount, c.accno, a.notes, t.chart_id, ac.oid |
|
400 | 368 |
$project_columns |
401 | 369 |
FROM ar a, acc_trans ac $project_join, customer ct, chart c LEFT JOIN tax t ON |
402 | 370 |
(t.chart_id=c.id) |
... | ... | |
407 | 375 |
UNION |
408 | 376 |
SELECT ac.oid AS acoid, a.id, 'ap' AS type, a.invoice, a.invnumber, ac.taxkey, c.link, |
409 | 377 |
ct.name, ac.transdate, ac.source, ac.trans_id, |
410 |
ac.amount, c.accno, c.gifi_accno, a.notes, t.chart_id, ac.oid
|
|
378 |
ac.amount, c.accno, a.notes, t.chart_id, ac.oid |
|
411 | 379 |
$project_columns |
412 | 380 |
FROM ap a, acc_trans ac $project_join, vendor ct, chart c LEFT JOIN tax t ON |
413 | 381 |
(t.chart_id=c.id) |
... | ... | |
588 | 556 |
($form->{account_description}) = $sth->fetchrow_array; |
589 | 557 |
$sth->finish; |
590 | 558 |
} |
591 |
if ($form->{gifi_accno}) { |
|
592 |
$query = |
|
593 |
qq|SELECT g.description FROM gifi g WHERE g.accno = '$form->{gifi_accno}'|; |
|
594 |
$sth = $dbh->prepare($query); |
|
595 |
$sth->execute || $form->dberror($query); |
|
596 | 559 |
|
597 |
($form->{gifi_account_description}) = $sth->fetchrow_array; |
|
598 |
$sth->finish; |
|
599 |
} |
|
600 | 560 |
$main::lxdebug->leave_sub(); |
601 | 561 |
|
602 | 562 |
$dbh->disconnect; |
Auch abrufbar als: Unified diff
Weitere Vorkommen von GIFI entfernt. GIFI müsste bis auf Spalte chart.gifi_accno und Tabelle chart komplett entfernt sein.