266 |
266 |
$query =
|
267 |
267 |
qq|SELECT a.id, a.reference, a.description, ac.transdate, ac.chart_id, | .
|
268 |
268 |
qq| FALSE AS invoice, ac.amount, 'gl' as module, | .
|
269 |
|
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 § .
|
|
269 |
qq§(SELECT CASE WHEN ac.tax_id = 0 and ac.taxkey = 0 THEN '' ELSE accno||'--'||rate END 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 § .
|
270 |
270 |
qq|FROM acc_trans ac, gl a | .
|
271 |
271 |
$dpt_join .
|
272 |
272 |
qq|WHERE | . $where . $dpt_where . $project .
|
... | ... | |
278 |
278 |
|
279 |
279 |
qq|SELECT a.id, a.invnumber, c.name, ac.transdate, ac.chart_id, | .
|
280 |
280 |
qq| a.invoice, ac.amount, 'ar' as module, | .
|
281 |
|
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 § .
|
|
281 |
qq§(SELECT CASE WHEN ac.tax_id = 0 and ac.taxkey = 0 THEN '' ELSE accno||'--'||rate END 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 § .
|
282 |
282 |
qq|FROM acc_trans ac, customer c, ar a | .
|
283 |
283 |
$dpt_join .
|
284 |
284 |
qq|WHERE | . $where . $dpt_where . $project .
|
... | ... | |
291 |
291 |
|
292 |
292 |
qq|SELECT a.id, a.invnumber, v.name, ac.transdate, ac.chart_id, | .
|
293 |
293 |
qq| a.invoice, ac.amount, 'ap' as module, | .
|
294 |
|
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 § .
|
|
294 |
qq§(SELECT CASE WHEN ac.tax_id = 0 and ac.taxkey = 0 THEN '' ELSE accno||'--'||rate END 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 § .
|
295 |
295 |
qq|FROM acc_trans ac, vendor v, ap a | .
|
296 |
296 |
$dpt_join .
|
297 |
297 |
qq|WHERE | . $where . $dpt_where . $project .
|
298 |
|
-
|