[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4741] trunk/sql/modules/COGS.sql
- Subject: SF.net SVN: ledger-smb:[4741] trunk/sql/modules/COGS.sql
- From: ..hidden..
- Date: Mon, 21 May 2012 07:24:06 +0000
Revision: 4741
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4741&view=rev
Author: einhverfr
Date: 2012-05-21 07:24:06 +0000 (Mon, 21 May 2012)
Log Message:
-----------
Now treating GL transactions as AP ones for COGS purposes, allowing for manufacturing lots and initial data import to use this.
Modified Paths:
--------------
trunk/sql/modules/COGS.sql
Modified: trunk/sql/modules/COGS.sql
===================================================================
--- trunk/sql/modules/COGS.sql 2012-05-21 01:27:52 UTC (rev 4740)
+++ trunk/sql/modules/COGS.sql 2012-05-21 07:24:06 UTC (rev 4741)
@@ -24,8 +24,10 @@
FOR t_inv IN
SELECT i.*
FROM invoice i
- JOIN ap a ON a.id = i.trans_id
- WHERE qty + allocated < 0
+ JOIN (select id, approved from ap
+ union
+ select id, approved from gl) a ON a.id = i.trans_id
+ WHERE qty + allocated < 0 and a.approved
ORDER BY a.transdate DESC, a.id DESC, i.id DESC
LOOP
IF t_alloc > qty THEN
@@ -66,7 +68,9 @@
FOR t_inv IN
SELECT i.*
FROM invoice i
- JOIN ap a ON a.id = i.trans_id
+ JOIN (select id, approved from ap
+ union
+ select id, approved from gl) a ON a.id = i.trans_id
WHERE qty + allocated < 0
ORDER BY a.transdate, a.id, i.id
LOOP
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.