From 4a07e174e74e2b707ecf9bf308917ad689e9f317 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Thu, 10 Jul 2008 00:56:58 +0000 Subject: 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 --- sql/modules/Drafts.sql | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'sql') 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 -- cgit v1.2.3