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

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



Revision: 3065
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3065&view=rev
Author:   einhverfr
Date:     2010-09-22 18:02:54 +0000 (Wed, 22 Sep 2010)

Log Message:
-----------
correcting issue for imported and partially disposed assets.

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	2010-09-21 21:06:06 UTC (rev 3064)
+++ addons/1.3/assets/trunk/sql/modules/Assets.sql	2010-09-22 18:02:54 UTC (rev 3065)
@@ -464,14 +464,14 @@
 $$
    SELECT ai.id, ai.tag, ai.description, ai.start_depreciation, r.report_date,
           dm.short_label, ai.purchase_value, 
-          sum (CASE WHEN pr.report_class = 1 THEN prl.amount ELSE 0 END) 
+          sum (CASE WHEN pr.report_class in (1,3) THEN prl.amount ELSE 0 END) 
           as accum_dep,
           l.amount, 
-          ai.purchase_value - sum(CASE WHEN pr.report_class = 1 
+          ai.purchase_value - sum(CASE WHEN pr.report_class in (1,3) 
                                        THEN prl.amount 
                                        ELSE 0 
                                    END) as adjusted_basis,
-          l.amount - ai.purchase_value + sum(CASE WHEN pr.report_class = 1
+          l.amount - ai.purchase_value + sum(CASE WHEN pr.report_class in (1,3)
                                                   THEN prl.amount 
                                                   ELSE 0 
                                               END) as gain_loss
@@ -825,7 +825,7 @@
        (report_id, asset_id, amount, department_id, warehouse_id)
 select $15, id, $16, department_id, location_id
   from asset__save
-       (NULL, $13, $1, $2, $6, $3, $5, $4, $7, $8, $9, $14, $10, $11, $12);
+       (NULL, $13, $1, $2, $6, $3, $5, coalesce($4, 0), $7, $8, $9, $14, $10, $11, $12);
 
 UPDATE asset_item 
    SET obsolete_by = currval('asset_item_id_seq')


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