Revision 93c5375c
Von Kivitendo Admin vor mehr als 1 Jahr hinzugefügt
SL/CA.pm | ||
---|---|---|
266 | 266 |
# get all transactions |
267 | 267 |
$query = |
268 | 268 |
qq|SELECT ac.itime, a.id, a.reference, a.description, ac.transdate, ac.chart_id, | . |
269 |
qq| case when cleared.cleared_group_id is null then false else true end as cleared, | . |
|
269 | 270 |
qq| FALSE AS invoice, ac.amount, 'gl' as module, | . |
270 | 271 |
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 | 272 |
qq|FROM acc_trans ac | . |
272 | 273 |
qq| JOIN gl a ON (ac.trans_id = a.id) | . |
274 |
qq| LEFT JOIN cleared on (ac.acc_trans_id = cleared.acc_trans_id) | . |
|
273 | 275 |
$dpt_join . |
274 | 276 |
qq|WHERE | . $where . $dpt_where . $project . |
275 | 277 |
qq| AND ac.chart_id = ? | . |
... | ... | |
278 | 280 |
qq|UNION ALL | . |
279 | 281 |
|
280 | 282 |
qq|SELECT ac.itime, a.id, a.invnumber, c.name, ac.transdate, ac.chart_id, | . |
283 |
qq| case when cleared.cleared_group_id is null then false else true end as cleared, | . |
|
281 | 284 |
qq| a.invoice, ac.amount, 'ar' as module, | . |
282 | 285 |
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 | 286 |
qq|FROM acc_trans ac | . |
284 | 287 |
qq| JOIN ar a ON (ac.trans_id = a.id) | . |
285 | 288 |
qq| JOIN customer c ON (a.customer_id = c.id) | . |
289 |
qq|LEFT JOIN cleared on (ac.acc_trans_id = cleared.acc_trans_id) | . |
|
286 | 290 |
$dpt_join . |
287 | 291 |
qq|WHERE | . $where . $dpt_where . $project . |
288 | 292 |
qq| AND ac.chart_id = ? | . |
... | ... | |
291 | 295 |
qq|UNION ALL | . |
292 | 296 |
|
293 | 297 |
qq|SELECT ac.itime, a.id, a.invnumber, v.name, ac.transdate, ac.chart_id, | . |
298 |
qq| case when cleared.cleared_group_id is null then false else true end as cleared, | . |
|
294 | 299 |
qq| a.invoice, ac.amount, 'ap' as module, | . |
295 | 300 |
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 | 301 |
qq|FROM acc_trans ac | . |
297 | 302 |
qq| JOIN ap a ON (ac.trans_id = a.id) | . |
298 | 303 |
qq| JOIN vendor v ON (a.vendor_id = v.id) | . |
304 |
qq|LEFT JOIN cleared on (ac.acc_trans_id = cleared.acc_trans_id) | . |
|
299 | 305 |
$dpt_join . |
300 | 306 |
qq|WHERE | . $where . $dpt_where . $project . |
301 | 307 |
qq| AND ac.chart_id = ? | . |
Auch abrufbar als: Unified diff
Konten ausziffern - CA all_transactions erweitert