pgsql/investigations/ar-debitmemo.sql
authorEdward <edward@roojs.com>
Tue, 4 Feb 2014 10:11:47 +0000 (18:11 +0800)
committerEdward <edward@roojs.com>
Tue, 4 Feb 2014 10:11:47 +0000 (18:11 +0800)
pgsql/investigations/ar-debitmemo.sql

index 793a6b8..9214fbc 100644 (file)
@@ -86,15 +86,9 @@ BEGIN
             gltrans
     
     WHERE
-            CASE WHEN _ar.aropen_applyto IS NULL OR _ar.aropen_applyto = '' THEN
-                gltrans_docnumber  = _ar.aropen_docnumber
-                AND
-                gltrans_doctype = 'CM'
-            ELSE
-                gltrans_docnumber = _ar.aropen_applyto
-                AND
-                gltrans_doctype = 'IN'
-            END
+            gltrans_docnumber  = _ar.aropen_docnumber
+        AND
+            gltrans_doctype = 'DM'
         AND
             gltrans_accnt_id = v_ar_accnt_id
         AND