[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4888] trunk/sql/modules/Drafts.sql
- Subject: SF.net SVN: ledger-smb:[4888] trunk/sql/modules/Drafts.sql
- From: ..hidden..
- Date: Mon, 11 Jun 2012 10:50:25 +0000
Revision: 4888
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4888&view=rev
Author: einhverfr
Date: 2012-06-11 10:50:25 +0000 (Mon, 11 Jun 2012)
Log Message:
-----------
Adding sufficient info to draft search to do hrefs back to original documents
Modified Paths:
--------------
trunk/sql/modules/Drafts.sql
Modified: trunk/sql/modules/Drafts.sql
===================================================================
--- trunk/sql/modules/Drafts.sql 2012-06-11 02:47:14 UTC (rev 4887)
+++ trunk/sql/modules/Drafts.sql 2012-06-11 10:50:25 UTC (rev 4888)
@@ -1,6 +1,9 @@
+DROP TYPE IF EXISTS draft_search_result CASCADE;
+
CREATE TYPE draft_search_result AS (
id int,
transdate date,
+ invoice bool,
reference text,
description text,
amount numeric
@@ -13,8 +16,8 @@
DECLARE out_row RECORD;
BEGIN
FOR out_row IN
- SELECT trans.id, trans.transdate, trans.reference,
- trans.description,
+ SELECT trans.id, trans.transdate, trans.invoice,
+ trans.reference, trans.description,
sum(case when lower(in_type) = 'ap' AND chart.link = 'AP'
THEN line.amount
WHEN lower(in_type) = 'ar' AND chart.link = 'AR'
@@ -25,18 +28,18 @@
END) as amount
FROM (
SELECT id, transdate, reference,
- description,
+ description, false as invoice
approved from gl
WHERE lower(in_type) = 'gl'
UNION
SELECT id, transdate, invnumber as reference,
(SELECT name FROM eca__get_entity(entity_credit_account)),
- approved from ap
+ invoice, approved from ap
WHERE lower(in_type) = 'ap'
UNION
SELECT id, transdate, invnumber as reference,
description,
- approved from ar
+ invoice, approved from ar
WHERE lower(in_type) = 'ar'
) trans
JOIN acc_trans line ON (trans.id = line.trans_id)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.