From 7e7b6b431c1a451c1e5f4a453afa5d5144551fd7 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 12 Aug 2008 12:13:44 +0000 Subject: [PATCH] =?utf8?q?1.=20Tabellenaliasnamen=20in=20Queries=20benutze?= =?utf8?q?n,=20weil=20PostgreSQL=20ansonsten=20einen=20Fehler=20rauswirft.?= =?utf8?q?=202.=20Wenn=20bei=20E/=C3=9C-Rechnung=20ein=20Projekt=20ausgew?= =?utf8?q?=C3=A4hlt=20ist,=20dann=20wurde=20vorher=20ein=20Teil=20des=20SQ?= =?utf8?q?L-Codes=20nicht=20im=20eigentlichen=20Query=20untergebracht=20so?= =?utf8?q?ndern=20in=20eine=20danach=20nicht=20mehr=20benutzte=20Variable?= =?utf8?q?=20geschrieben.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/RP.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/SL/RP.pm b/SL/RP.pm index d536bf88a..f8fd245a8 100644 --- a/SL/RP.pm +++ b/SL/RP.pm @@ -609,7 +609,7 @@ sub get_accounts_g { if ($form->{method} eq 'cash') { $subwhere .= " AND (transdate >= $fromdate)"; $glwhere = " AND (ac.transdate >= $fromdate)"; - $prwhere = " AND (ar.transdate >= $fromdate)"; + $prwhere = " AND (a.transdate >= $fromdate)"; } else { $where .= " AND (ac.transdate >= $fromdate)"; } @@ -619,7 +619,7 @@ sub get_accounts_g { $todate = conv_dateq($todate); $subwhere .= " AND (transdate <= $todate)"; $where .= " AND (ac.transdate <= $todate)"; - $prwhere .= " AND (ar.transdate <= $todate)"; + $prwhere .= " AND (a.transdate <= $todate)"; } if ($department_id) { @@ -666,13 +666,11 @@ sub get_accounts_g { WHERE $where $dpt_where $glwhere AND NOT ((c.link = 'AR') OR (c.link = 'AP')) $project - - $project_union - GROUP BY c.$category + GROUP BY c.$category |; if ($form->{project_id}) { - $project_union = qq| + $query .= qq| UNION SELECT SUM(ac.sellprice * ac.qty * chart_category_to_sgn(c.category)) AS amount, c.$category -- 2.20.1