Revision 6b8ce220
Von Sven Schöling vor mehr als 15 Jahren hinzugefügt
SL/CA.pm | ||
---|---|---|
64 | 64 |
my $where = "AND c.id = $chart_id" if ($chart_id ne ''); |
65 | 65 |
|
66 | 66 |
$query = qq{ |
67 |
SELECT
|
|
67 |
SELECT |
|
68 | 68 |
c.accno, |
69 | 69 |
c.id, |
70 | 70 |
c.description, |
... | ... | |
91 | 91 |
WHERE 1=1 |
92 | 92 |
$where |
93 | 93 |
GROUP BY c.accno, c.id, c.description, c.charttype, c.gifi_accno, |
94 |
c.category, c.link, c.pos_bwa, c.pos_bilanz, c.pos_eur, c.valid_from,
|
|
94 |
c.category, c.link, c.pos_bwa, c.pos_bilanz, c.pos_eur, c.valid_from, |
|
95 | 95 |
c.datevautomatik |
96 | 96 |
ORDER BY c.accno |
97 | 97 |
}; |
... | ... | |
203 | 203 |
FROM acc_trans ac |
204 | 204 |
JOIN chart c ON (ac.chart_id = c.id) |
205 | 205 |
$dpt_join |
206 |
WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) AND ac.ob_transaction
|
|
206 |
WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) AND ac.ob_transaction |
|
207 | 207 |
$dpt_where |
208 | 208 |
$project |
209 | 209 |
AND c.accno = ? $acc_cash_where|; |
210 |
|
|
210 |
|
|
211 | 211 |
($form->{beginning_balance}) = selectrow_query($form, $dbh, $query, $form->{fromdate}, $form->{accno}); |
212 | 212 |
|
213 | 213 |
# get last transaction date |
... | ... | |
247 | 247 |
@values = (); |
248 | 248 |
|
249 | 249 |
foreach my $id (@id) { |
250 |
|
|
250 |
|
|
251 | 251 |
# NOTE: Postgres is really picky about the order of implicit CROSS |
252 | 252 |
# JOINs with ',' if you alias the tables and want to use the |
253 | 253 |
# alias later in another JOIN. the alias you want to use has to |
... | ... | |
273 | 273 |
|
274 | 274 |
qq|SELECT a.id, a.invnumber, c.name, ac.transdate, ac.chart_id, | . |
275 | 275 |
qq| a.invoice, ac.amount, 'ar' as module, | . |
276 |
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 ? .
|
|
276 |
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 ? . |
|
277 | 277 |
qq|FROM acc_trans ac, customer c, ar a | . |
278 | 278 |
$dpt_join . |
279 | 279 |
qq|WHERE | . $where . $dpt_where . $project . |
... | ... | |
397 | 397 |
} else { |
398 | 398 |
$trans->{credit} = $trans->{amount}; |
399 | 399 |
$trans->{debit} = 0; |
400 |
}
|
|
400 |
} |
|
401 | 401 |
push(@{ $ca->{GEGENKONTO} }, $trans); |
402 | 402 |
} else { |
403 | 403 |
next; |
Auch abrufbar als: Unified diff
Whitespace