summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-07-10 00:56:58 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-07-10 00:56:58 +0000
commit4a07e174e74e2b707ecf9bf308917ad689e9f317 (patch)
treeea33c7361684335cf804581738d22a7c7e5da6d4 /sql
parent87a7da4dcf11934fafdb8b6393694557182d6a8f (diff)
Correcting the last errors for the draft approval on secondary test instance
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2203 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'sql')
-rw-r--r--sql/modules/Drafts.sql16
1 files changed, 9 insertions, 7 deletions
diff --git a/sql/modules/Drafts.sql b/sql/modules/Drafts.sql
index c2fc5abb..9e8a95c2 100644
--- a/sql/modules/Drafts.sql
+++ b/sql/modules/Drafts.sql
@@ -24,17 +24,19 @@ BEGIN
ELSE 0
END) as amount
FROM (
+ SELECT id, transdate, reference, description,
+ approved from gl
+ WHERE in_type = 'gl'
+ UNION
SELECT id, transdate, invnumber as reference,
- description, approved from ap
+ description::text,
+ approved from ap
WHERE in_type = 'ap'
UNION
SELECT id, transdate, invnumber as reference,
- description, approved from ar
+ description,
+ approved from ar
WHERE in_type = 'ar'
- UNION
- SELECT id, transdate, reference, description,
- approved from gl
- WHERE in_type = 'gl'
) trans
JOIN acc_trans line ON (trans.id = line.trans_id)
JOIN chart ON (line.chart_id = chart.id)
@@ -43,7 +45,7 @@ BEGIN
or trans.transdate <= in_to_date)
AND trans.approved IS FALSE
AND trans.id NOT IN (select trans_id from voucher)
- GROUP BY trans.id, trans.transdate, trans.description
+ GROUP BY trans.id, trans.transdate, trans.description, trans.reference
HAVING (in_with_accno IS NULL or in_with_accno =
ANY(as_array(chart.accno)))
LOOP