Revision a4682af2
Von Udo Spallek vor fast 19 Jahren hinzugefügt
SL/GL.pm | ||
---|---|---|
362 | 362 |
} |
363 | 363 |
|
364 | 364 |
my $query = |
365 |
qq|SELECT g.id, 'gl' AS type, $false AS invoice, g.reference, ac.taxkey, t.type AS taxtype,
|
|
365 |
qq|SELECT g.id, 'gl' AS type, $false AS invoice, g.reference, ac.taxkey, c.link,
|
|
366 | 366 |
g.description, ac.transdate, ac.source, ac.trans_id, |
367 | 367 |
ac.amount, c.accno, c.gifi_accno, g.notes, t.chart_id, ac.oid |
368 | 368 |
FROM gl g, acc_trans ac, chart c LEFT JOIN tax t ON |
... | ... | |
371 | 371 |
AND ac.chart_id = c.id |
372 | 372 |
AND g.id = ac.trans_id |
373 | 373 |
UNION |
374 |
SELECT a.id, 'ar' AS type, a.invoice, a.invnumber, ac.taxkey, t.type AS taxtype,
|
|
374 |
SELECT a.id, 'ar' AS type, a.invoice, a.invnumber, ac.taxkey, c.link,
|
|
375 | 375 |
ct.name, ac.transdate, ac.source, ac.trans_id, |
376 | 376 |
ac.amount, c.accno, c.gifi_accno, a.notes, t.chart_id, ac.oid |
377 | 377 |
FROM ar a, acc_trans ac, customer ct, chart c LEFT JOIN tax t ON |
... | ... | |
381 | 381 |
AND a.customer_id = ct.id |
382 | 382 |
AND a.id = ac.trans_id |
383 | 383 |
UNION |
384 |
SELECT a.id, 'ap' AS type, a.invoice, a.invnumber, ac.taxkey, t.type AS taxtype,
|
|
384 |
SELECT a.id, 'ap' AS type, a.invoice, a.invnumber, ac.taxkey, c.link,
|
|
385 | 385 |
ct.name, ac.transdate, ac.source, ac.trans_id, |
386 | 386 |
ac.amount, c.accno, c.gifi_accno, a.notes, t.chart_id, ac.oid |
387 | 387 |
FROM ap a, acc_trans ac, vendor ct, chart c LEFT JOIN tax t ON |
... | ... | |
390 | 390 |
AND ac.chart_id = c.id |
391 | 391 |
AND a.vendor_id = ct.id |
392 | 392 |
AND a.id = ac.trans_id |
393 |
ORDER BY $sortorder transdate, trans_id, taxkey DESC, taxtype DESC,oid|;
|
|
393 |
ORDER BY $sortorder transdate, trans_id, taxkey DESC, oid|; |
|
394 | 394 |
|
395 | 395 |
# Show all $query in Debuglevel LXDebug::QUERY |
396 | 396 |
$callingdetails = (caller (0))[3]; |
... | ... | |
400 | 400 |
$sth->execute || $form->dberror($query); |
401 | 401 |
my $trans_id = ""; |
402 | 402 |
my $trans_id2 = ""; |
403 |
|
|
403 | 404 |
while (my $ref0 = $sth->fetchrow_hashref(NAME_lc)) { |
404 | 405 |
|
405 | 406 |
$trans_id = $ref0->{id}; |
... | ... | |
472 | 473 |
$ref2 = $ref0; |
473 | 474 |
$trans_old =$trans_id2; |
474 | 475 |
$trans_id2 = $ref2->{id}; |
475 |
|
|
476 |
|
|
476 | 477 |
$balance = |
477 | 478 |
(int($balance * 100000) + int(100000 * $ref2->{amount})) / 100000; |
478 | 479 |
|
... | ... | |
483 | 484 |
if ($ref->{debit_tax_accno}{$i} ne "") { |
484 | 485 |
$i++; |
485 | 486 |
} |
486 |
if ($ref2->{taxtype} eq 'U') { |
|
487 |
|
|
488 |
if ($ref2->{link} =~ /AR_tax/) { |
|
487 | 489 |
$ref->{credit_tax}{$j} = $ref2->{amount}; |
488 | 490 |
$ref->{credit_tax_accno}{$j} = $ref2->{accno}; |
489 | 491 |
} |
490 |
if ($ref2->{taxtype} eq 'V') {
|
|
492 |
if ($ref2->{link} =~ /AP_tax/) {
|
|
491 | 493 |
$ref->{debit_tax}{$j} = $ref2->{amount} * -1; |
492 |
$ref->{debit_tax_accno}{$j} = $ref2->{accno};
|
|
494 |
$ref->{debit_tax_accno}{$j} = $ref2->{accno}; |
|
493 | 495 |
} |
494 |
|
|
496 |
|
|
495 | 497 |
} else { |
496 | 498 |
|
497 | 499 |
if ($ref->{debit_accno}{$k} ne "") { |
... | ... | |
509 | 511 |
if ($ref->{credit_tax_accno}{$j} ne "") { |
510 | 512 |
$j++; |
511 | 513 |
} |
512 |
if ($ref2->{taxtype} eq 'U') { |
|
514 |
|
|
515 |
if ($ref2->{link} =~ /AR_tax/) { |
|
513 | 516 |
$ref->{credit_tax}{$j} = $ref2->{amount}; |
514 |
$ref->{credit_tax_accno}{$j} = $ref2->{accno};
|
|
517 |
$ref->{credit_tax_accno}{$j} = $ref2->{accno}; |
|
515 | 518 |
} |
516 |
if ($ref2->{taxtype} eq 'V') {
|
|
519 |
if ($ref2->{link} =~ /AP_tax/) {
|
|
517 | 520 |
$ref->{debit_tax}{$j} = $ref2->{amount} * -1; |
518 |
$ref->{debit_tax_accno}{$j} = $ref2->{accno};
|
|
521 |
$ref->{debit_tax_accno}{$j} = $ref2->{accno}; |
|
519 | 522 |
} |
520 | 523 |
|
521 | 524 |
} else { |
Auch abrufbar als: Unified diff
Solved Bug 246: Buchungsjournal stellt Stornobuchungen verwirrend dar.
Better solution than r1005, without database changes.