Query zur besseren Lesbarkeit formartiert.
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 6 May 2009 09:32:10 +0000 (09:32 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 6 May 2009 09:32:10 +0000 (09:32 +0000)
SL/RP.pm

index ebc0dd6..e5f4327 100644 (file)
--- a/SL/RP.pm
+++ b/SL/RP.pm
@@ -644,7 +644,27 @@ sub trial_balance {
 
 
   if ($form->{method} eq "cash") {
-    $acc_cash_where = qq| AND (ac.trans_id IN (SELECT id FROM ar WHERE datepaid>='$form->{fromdate}' AND datepaid<='$form->{todate}' UNION SELECT id FROM ap WHERE datepaid>='$form->{fromdate}' AND datepaid<='$form->{todate}' UNION SELECT id FROM gl WHERE transdate>='$form->{fromdate}' AND transdate<='$form->{todate}')) |;
+    $acc_cash_where =
+      qq| AND (ac.trans_id IN (
+            SELECT id
+            FROM ar
+            WHERE datepaid >= '$form->{fromdate}'
+              AND datepaid <= '$form->{todate}'
+
+            UNION
+
+            SELECT id
+            FROM ap
+            WHERE datepaid >= '$form->{fromdate}'
+              AND datepaid <= '$form->{todate}'
+
+            UNION
+
+            SELECT id
+            FROM gl
+            WHERE transdate >= '$form->{fromdate}'
+              AND transdate <= '$form->{todate}'
+          )) |;
 #    $ar_ap_cash_where = qq| AND (a.datepaid>='$form->{fromdate}' AND a.datepaid<='$form->{todate}') |;
   }