Revision 5a82ea7f
Von Kivitendo Admin vor mehr als 1 Jahr hinzugefügt
SL/CA.pm | ||
---|---|---|
268 | 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 |
qq|FROM acc_trans ac, gl a | . |
|
271 |
qq|FROM acc_trans ac | . |
|
272 |
qq| JOIN gl a ON (ac.trans_id = a.id) | . |
|
272 | 273 |
$dpt_join . |
273 | 274 |
qq|WHERE | . $where . $dpt_where . $project . |
274 | 275 |
qq| AND ac.chart_id = ? | . |
275 |
qq| AND ac.trans_id = a.id | . |
|
276 | 276 |
qq| AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) | . |
277 | 277 |
|
278 | 278 |
qq|UNION ALL | . |
... | ... | |
280 | 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 |
qq|FROM acc_trans ac, customer c, ar a | . |
|
283 |
qq|FROM acc_trans ac | . |
|
284 |
qq| JOIN ar a ON (ac.trans_id = a.id) | . |
|
285 |
qq| JOIN customer c ON (a.customer_id = c.id) | . |
|
284 | 286 |
$dpt_join . |
285 | 287 |
qq|WHERE | . $where . $dpt_where . $project . |
286 | 288 |
qq| AND ac.chart_id = ? | . |
287 |
qq| AND ac.trans_id = a.id | . |
|
288 |
qq| AND a.customer_id = c.id | . |
|
289 | 289 |
qq| AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL)| . |
290 | 290 |
|
291 | 291 |
qq|UNION ALL | . |
... | ... | |
293 | 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 |
qq|FROM acc_trans ac, vendor v, ap a | . |
|
296 |
qq|FROM acc_trans ac | . |
|
297 |
qq| JOIN ap a ON (ac.trans_id = a.id) | . |
|
298 |
qq| JOIN vendor v ON (a.vendor_id = v.id) | . |
|
297 | 299 |
$dpt_join . |
298 | 300 |
qq|WHERE | . $where . $dpt_where . $project . |
299 | 301 |
qq| AND ac.chart_id = ? | . |
300 |
qq| AND ac.trans_id = a.id | . |
|
301 |
qq| AND a.vendor_id = v.id | . |
|
302 | 302 |
qq| AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL)|; |
303 | 303 |
push(@values, |
304 | 304 |
@where_values, @department_values, @project_values, $id, |
Auch abrufbar als: Unified diff
Refactor CA.pm all_transactions
Umschreiben der Joins, expliziter gemacht und für zukünftige Änderungen
besser vorbereitet