Revision 6ff01fdb
Von Moritz Bunkus vor mehr als 15 Jahren hinzugefügt
SL/GL.pm | ||
---|---|---|
344 | 344 |
|
345 | 345 |
my $query = |
346 | 346 |
qq|SELECT |
347 |
ac.oid AS acoid, g.id, 'gl' AS type, $false AS invoice, g.reference, ac.taxkey, c.link,
|
|
347 |
ac.acc_trans_id, g.id, 'gl' AS type, $false AS invoice, g.reference, ac.taxkey, c.link,
|
|
348 | 348 |
g.description, ac.transdate, ac.source, ac.trans_id, |
349 |
ac.amount, c.accno, g.notes, t.chart_id, ac.oid |
|
349 |
ac.amount, c.accno, g.notes, t.chart_id, |
|
350 |
CASE WHEN (COALESCE(e.name, '') = '') THEN e.login ELSE e.name END AS employee |
|
350 | 351 |
$project_columns |
351 | 352 |
$columns_for_sorting{gl} |
352 | 353 |
FROM gl g, acc_trans ac $project_join, chart c |
... | ... | |
357 | 358 |
|
358 | 359 |
UNION |
359 | 360 |
|
360 |
SELECT ac.oid AS acoid, a.id, 'ar' AS type, a.invoice, a.invnumber, ac.taxkey, c.link,
|
|
361 |
SELECT ac.acc_trans_id, a.id, 'ar' AS type, a.invoice, a.invnumber, ac.taxkey, c.link,
|
|
361 | 362 |
ct.name, ac.transdate, ac.source, ac.trans_id, |
362 |
ac.amount, c.accno, a.notes, t.chart_id, ac.oid |
|
363 |
ac.amount, c.accno, a.notes, t.chart_id, |
|
364 |
CASE WHEN (COALESCE(e.name, '') = '') THEN e.login ELSE e.name END AS employee |
|
363 | 365 |
$project_columns |
364 | 366 |
$columns_for_sorting{arap} |
365 | 367 |
FROM ar a, acc_trans ac $project_join, customer ct, chart c |
... | ... | |
371 | 373 |
|
372 | 374 |
UNION |
373 | 375 |
|
374 |
SELECT ac.oid AS acoid, a.id, 'ap' AS type, a.invoice, a.invnumber, ac.taxkey, c.link,
|
|
376 |
SELECT ac.acc_trans_id, a.id, 'ap' AS type, a.invoice, a.invnumber, ac.taxkey, c.link,
|
|
375 | 377 |
ct.name, ac.transdate, ac.source, ac.trans_id, |
376 |
ac.amount, c.accno, a.notes, t.chart_id, ac.oid |
|
378 |
ac.amount, c.accno, a.notes, t.chart_id, |
|
379 |
CASE WHEN (COALESCE(e.name, '') = '') THEN e.login ELSE e.name END AS employee |
|
377 | 380 |
$project_columns |
378 | 381 |
$columns_for_sorting{arap} |
379 | 382 |
FROM ap a, acc_trans ac $project_join, vendor ct, chart c |
... | ... | |
383 | 386 |
AND (a.vendor_id = ct.id) |
384 | 387 |
AND (a.id = ac.trans_id) |
385 | 388 |
|
386 |
ORDER BY $sortorder, acoid $sortdir|;
|
|
389 |
ORDER BY $sortorder, acc_trans_id $sortdir|;
|
|
387 | 390 |
|
388 | 391 |
my @values = (@glvalues, @arvalues, @apvalues); |
389 | 392 |
|
... | ... | |
635 | 638 |
ORDER BY startdate DESC LIMIT 1)) |
636 | 639 |
WHERE (a.trans_id = ?) |
637 | 640 |
AND (a.fx_transaction = '0') |
638 |
ORDER BY a.oid, a.transdate|;
|
|
641 |
ORDER BY a.acc_trans_id, a.transdate|;
|
|
639 | 642 |
$form->{GL} = selectall_hashref_query($form, $dbh, $query, conv_i($form->{id})); |
640 | 643 |
|
641 | 644 |
} else { |
Auch abrufbar als: Unified diff
Einführung einer ID-Spalte in acc_trans
Die Benutzung der von PostgreSQL zur Verfügung gestellten
Spalte "oid" hat ihre Tücken. Über diese wird in Lx-Office die
Reihenfolge der Einträge in acc_trans geregelt. Wird aber ein
UPDATE-SQL-Query auf acc_trans ausgeführt, so kann es (anscheinend
je nach Datenbankversion) dazu kommen, dass die Zeile eine neue
oid erhält, wodurch die Reihenfolge nicht mehr stimmt.