Revision 05c6840d
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
SL/CA.pm | ||
---|---|---|
34 | 34 |
# |
35 | 35 |
#====================================================================== |
36 | 36 |
|
37 |
use utf8; |
|
38 |
use strict; |
|
39 |
|
|
37 | 40 |
package CA; |
38 | 41 |
use Data::Dumper; |
39 | 42 |
use SL::DBUtils; |
40 | 43 |
|
41 |
use strict; |
|
42 |
|
|
43 | 44 |
sub all_accounts { |
44 | 45 |
$main::lxdebug->enter_sub(); |
45 | 46 |
|
... | ... | |
50 | 51 |
# connect to database |
51 | 52 |
my $dbh = $form->dbconnect($myconfig); |
52 | 53 |
|
53 |
# bug 1071 Warum sollte bei Erreichen eines neuen Jahres die Konten?bersicht nur noch die
|
|
54 |
# bug 1071 Warum sollte bei Erreichen eines neuen Jahres die Kontenübersicht nur noch die
|
|
54 | 55 |
# bereits bebuchten Konten anzeigen? |
55 | 56 |
# Folgende Erweiterung: |
56 |
# 1.) Gehe zur?ck bis zu dem Datum an dem die B?cher geschlossen wurden
|
|
57 |
# 2.) Falls die B?cher noch nie geschlossen wurden, gehe zur?ck bis zum Bearbeitungsstart
|
|
57 |
# 1.) Gehe zurück bis zu dem Datum an dem die Bücher geschlossen wurden
|
|
58 |
# 2.) Falls die Bücher noch nie geschlossen wurden, gehe zurück bis zum Bearbeitungsstart
|
|
58 | 59 |
# COALESCE((SELECT closedto FROM defaults),(SELECT itime FROM defaults)) |
59 | 60 |
|
60 | 61 |
my $closedto_sql = "COALESCE((SELECT closedto FROM defaults),(SELECT itime FROM defaults))"; |
61 | 62 |
|
62 |
if ($form->{method} eq "cash") { # E?R
|
|
63 |
if ($form->{method} eq "cash") { # EÜR
|
|
63 | 64 |
$acc_cash_where = qq| AND (a.trans_id IN (SELECT id FROM ar WHERE datepaid>= $closedto_sql |
64 | 65 |
UNION SELECT id FROM ap WHERE datepaid>= $closedto_sql |
65 | 66 |
UNION SELECT id FROM gl WHERE transdate>= $closedto_sql |
... | ... | |
284 | 285 |
$query = |
285 | 286 |
qq|SELECT a.id, a.reference, a.description, ac.transdate, ac.chart_id, | . |
286 | 287 |
qq| $false AS invoice, ac.amount, 'gl' as module, | . |
287 |
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 ? .
|
|
288 |
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 § .
|
|
288 | 289 |
qq|FROM acc_trans ac, gl a | . |
289 | 290 |
$dpt_join . |
290 | 291 |
qq|WHERE | . $where . $dpt_where . $project . |
... | ... | |
296 | 297 |
|
297 | 298 |
qq|SELECT a.id, a.invnumber, c.name, ac.transdate, ac.chart_id, | . |
298 | 299 |
qq| a.invoice, ac.amount, 'ar' as module, | . |
299 |
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 ? .
|
|
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 § .
|
|
300 | 301 |
qq|FROM acc_trans ac, customer c, ar a | . |
301 | 302 |
$dpt_join . |
302 | 303 |
qq|WHERE | . $where . $dpt_where . $project . |
... | ... | |
309 | 310 |
|
310 | 311 |
qq|SELECT a.id, a.invnumber, v.name, ac.transdate, ac.chart_id, | . |
311 | 312 |
qq| a.invoice, ac.amount, 'ap' as module, | . |
312 |
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 ? .
|
|
313 |
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 § .
|
|
313 | 314 |
qq|FROM acc_trans ac, vendor v, ap a | . |
314 | 315 |
$dpt_join . |
315 | 316 |
qq|WHERE | . $where . $dpt_where . $project . |
... | ... | |
345 | 346 |
|
346 | 347 |
qq|SELECT a.id, a.invnumber, c.name, a.transdate, | . |
347 | 348 |
qq| a.invoice, ac.qty * ac.sellprice AS sellprice, 'ar' as module, | . |
348 |
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 ? .
|
|
349 |
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 § .
|
|
349 | 350 |
qq|FROM ar a | . |
350 | 351 |
qq|JOIN invoice ac ON (ac.trans_id = a.id) | . |
351 | 352 |
qq|JOIN parts p ON (ac.parts_id = p.id) | . |
... | ... | |
360 | 361 |
|
361 | 362 |
qq|SELECT a.id, a.invnumber, v.name, a.transdate, | . |
362 | 363 |
qq| a.invoice, ac.qty * ac.sellprice AS sellprice, 'ap' as module, | . |
363 |
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 ? .
|
|
364 |
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 § .
|
|
364 | 365 |
qq|FROM ap a | . |
365 | 366 |
qq|JOIN invoice ac ON (ac.trans_id = a.id) | . |
366 | 367 |
qq|JOIN parts p ON (ac.parts_id = p.id) | . |
Auch abrufbar als: Unified diff
Dateiencodings auf UTF-8 geändert
Fix für Bug 1375.