[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[2816] addons/1.3/assets/trunk/sql/modules/Assets. sql



Revision: 2816
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2816&view=rev
Author:   einhverfr
Date:     2009-12-10 21:49:24 +0000 (Thu, 10 Dec 2009)

Log Message:
-----------
correcting issue with deprecition utility function

Modified Paths:
--------------
    addons/1.3/assets/trunk/sql/modules/Assets.sql

Modified: addons/1.3/assets/trunk/sql/modules/Assets.sql
===================================================================
--- addons/1.3/assets/trunk/sql/modules/Assets.sql	2009-12-10 21:45:45 UTC (rev 2815)
+++ addons/1.3/assets/trunk/sql/modules/Assets.sql	2009-12-10 21:49:24 UTC (rev 2816)
@@ -8,10 +8,10 @@
 (in_last_dep date, in_dep_date date, in_total_used numeric, in_usable_life numeric)
 RETURNS numeric AS
 $$
-select CASE WHEN extract('MONTHS' FROM (in_dep_date - in_last_date)) 
-                 > in_usable_life
-            THEN in_usable_life
-            ELSE extract('MONTHS' FROM (in_dep_date - in_last_date))
+select CASE WHEN extract('MONTHS' FROM (date_trunc('day', $2) - date_trunc('day', $1))) 
+                 > $4
+            THEN $4
+            ELSE extract('MONTHS' FROM (date_trunc('day', $2) - date_trunc('day', $1)))::numeric
             END;
 $$ language sql;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.