Revision 9f910c04
Von Ronny Zimmermann vor mehr als 4 Jahren hinzugefügt
SL/CA.pm | ||
---|---|---|
265 | 265 |
|
266 | 266 |
# get all transactions |
267 | 267 |
$query = |
268 |
qq|SELECT a.id, a.reference, a.description, ac.transdate, ac.chart_id, | . |
|
268 |
qq|SELECT ac.itime, a.id, a.reference, a.description, ac.transdate, ac.chart_id, | .
|
|
269 | 269 |
qq| FALSE AS invoice, ac.amount, 'gl' as module, | . |
270 | 270 |
qq§(SELECT accno||'--'||rate FROM tax LEFT JOIN chart ON (tax.chart_id=chart.id) WHERE tax.id = (SELECT tax_id FROM taxkeys WHERE taxkey_id = ac.taxkey AND taxkeys.startdate <= ac.transdate ORDER BY taxkeys.startdate DESC LIMIT 1)) AS taxinfo, ac.source || ' ' || ac.memo AS memo § . |
271 | 271 |
qq|FROM acc_trans ac, gl a | . |
... | ... | |
277 | 277 |
|
278 | 278 |
qq|UNION ALL | . |
279 | 279 |
|
280 |
qq|SELECT a.id, a.invnumber, c.name, ac.transdate, ac.chart_id, | . |
|
280 |
qq|SELECT ac.itime, a.id, a.invnumber, c.name, ac.transdate, ac.chart_id, | .
|
|
281 | 281 |
qq| a.invoice, ac.amount, 'ar' as module, | . |
282 | 282 |
qq§(SELECT accno||'--'||rate FROM tax LEFT JOIN chart ON (tax.chart_id=chart.id) WHERE tax.id = (SELECT tax_id FROM taxkeys WHERE taxkey_id = ac.taxkey AND taxkeys.startdate <= ac.transdate ORDER BY taxkeys.startdate DESC LIMIT 1)) AS taxinfo, ac.source || ' ' || ac.memo AS memo § . |
283 | 283 |
qq|FROM acc_trans ac, customer c, ar a | . |
... | ... | |
290 | 290 |
|
291 | 291 |
qq|UNION ALL | . |
292 | 292 |
|
293 |
qq|SELECT a.id, a.invnumber, v.name, ac.transdate, ac.chart_id, | . |
|
293 |
qq|SELECT ac.itime, a.id, a.invnumber, v.name, ac.transdate, ac.chart_id, | .
|
|
294 | 294 |
qq| a.invoice, ac.amount, 'ap' as module, | . |
295 | 295 |
qq§(SELECT accno||'--'||rate FROM tax LEFT JOIN chart ON (tax.chart_id=chart.id) WHERE tax.id = (SELECT tax_id FROM taxkeys WHERE taxkey_id = ac.taxkey AND taxkeys.startdate <= ac.transdate ORDER BY taxkeys.startdate DESC LIMIT 1)) AS taxinfo, ac.source || ' ' || ac.memo AS memo § . |
296 | 296 |
qq|FROM acc_trans ac, vendor v, ap a | . |
... | ... | |
326 | 326 |
$query .= |
327 | 327 |
qq|UNION ALL | . |
328 | 328 |
|
329 |
qq|SELECT a.id, a.invnumber, c.name, a.transdate, | . |
|
329 |
qq|SELECT ac.itime, a.id, a.invnumber, c.name, a.transdate, | .
|
|
330 | 330 |
qq| a.invoice, ac.qty * ac.sellprice AS sellprice, 'ar' as module, | . |
331 | 331 |
qq§(SELECT accno||'--'||rate FROM tax LEFT JOIN chart ON (tax.chart_id=chart.id) WHERE tax.id = (SELECT tax_id FROM taxkeys WHERE taxkey_id = ac.taxkey AND taxkeys.startdate <= ac.transdate ORDER BY taxkeys.startdate DESC LIMIT 1)) AS taxinfo § . |
332 | 332 |
qq|FROM ar a | . |
... | ... | |
341 | 341 |
$project . |
342 | 342 |
qq|UNION ALL | . |
343 | 343 |
|
344 |
qq|SELECT a.id, a.invnumber, v.name, a.transdate, | . |
|
344 |
qq|SELECT ac.itime, a.id, a.invnumber, v.name, a.transdate, | .
|
|
345 | 345 |
qq| a.invoice, ac.qty * ac.sellprice AS sellprice, 'ap' as module, | . |
346 | 346 |
qq§(SELECT accno||'--'||rate FROM tax LEFT JOIN chart ON (tax.chart_id=chart.id) WHERE tax.id = (SELECT tax_id FROM taxkeys WHERE taxkey_id = ac.taxkey AND taxkeys.startdate <= ac.transdate ORDER BY taxkeys.startdate DESC LIMIT 1)) AS taxinfo § . |
347 | 347 |
qq|FROM ap a | . |
... | ... | |
367 | 367 |
} |
368 | 368 |
|
369 | 369 |
my $sort = grep({ $form->{sort} eq $_ } qw(transdate reference description)) ? $form->{sort} : 'transdate'; |
370 |
my $sort2 = ($sort eq 'reference')?'transdate':'reference'; |
|
370 |
$sort = ($sort eq 'transdate') ? 'transdate, itime' : $sort; |
|
371 |
my $sort2 = ($sort eq 'reference') ? 'transdate, itime' : 'reference'; |
|
371 | 372 |
$query .= qq|ORDER BY $sort , $sort2 |; |
372 | 373 |
my $sth = prepare_execute_query($form, $dbh, $query, @values); |
373 | 374 |
|
Auch abrufbar als: Unified diff
Buchungen in Konten wenn nach Datum sortiert zusätzlich nach Init-TS sortieren.
Siehe Forum: https://forum.kivitendo.ch/1368/buchung-werden-nicht-der-gebuchten-reihenfolge-angezeigt