svn commit: r611416 - in /ofbiz/trunk/applications: accounting/config/ accounting/entitydef/ accounting/script/org/ofbiz/accounting/fixedasset/ accounting/servicedef/ accounting/webapp/accounting/WEB-INF/ accounting/webapp/accounting/fixedasset/ accoun...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r611416 - in /ofbiz/trunk/applications: accounting/config/ accounting/entitydef/ accounting/script/org/ofbiz/accounting/fixedasset/ accounting/servicedef/ accounting/webapp/accounting/WEB-INF/ accounting/webapp/accounting/fixedasset/ accoun...

mor-2
Author: mor
Date: Sat Jan 12 06:11:54 2008
New Revision: 611416

URL: http://svn.apache.org/viewvc?rev=611416&view=rev
Log:
Applied Patch from Sumit Pandit and Santosh Malviya "Implement fixed asset depreciation (methods) (https://issues.apache.org/jira/browse/OFBIZ-1539)"- OFBIZ-1539 with few modifications.

Thanks to Sumit Pandit, Santosh Malviya for the patch and many thanks to Jacopo, Jacques for there review & help.

Added:
    ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/DepreciationReport.ftl   (with props)
Modified:
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties
    ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml
    ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
    ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml
    ofbiz/trunk/applications/accounting/widget/Menus.xml
    ofbiz/trunk/applications/manufacturing/data/ManufacturingData.xml
    ofbiz/trunk/applications/manufacturing/data/ManufacturingExampleData.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties?rev=611416&r1=611415&r2=611416&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties Sat Jan 12 06:11:54 2008
@@ -159,6 +159,7 @@
 AccountingCustomer=Customer
 AccountingCustNr=Cust.Nr
 AccountingDataExchange=DataExchange
+AccountingDateAcquiredIsEmpty=Field dateAcquired is empty in FixedAsset data.
 AccountingDebitCreditMustEqual=Debit and Credit Totals must be equal to post to GL.
 AccountingDeleteBillingAccountTermPermissionError=Security Error : to run removeBillingAccountTerm you must have the ACCOUNTING_DELETE or ACCOUNTING_ADMIN permission
 AccountingDeleteFixedAssetMaintOrderPermissionError = Security Error: to run deleteFixedAssetMaintOrder you must have the ACCOUNTING_DELETE or ACCOUNTING_ADMIN permission, or the limited ACCOUNTING_ROLE_UPDATE permission
@@ -172,6 +173,7 @@
 AccountingEFTAccount=EFT Account
 AccountingEmptyForMaxAmount=Leave empty for maximum amount
 AccountingEquities=Equities
+AccountingExpEndOfLifeIsEmpty=Field expectedEndOfLife is empty in FixedAsset data.
 AccountingExpirationDate=Expiration Date
 AccountingExternalAccountId=Accounting External Account Id
 AccountingAcctgTranss=Accounting Transactions
@@ -195,6 +197,7 @@
 AccountingFixedAsset=Fixed Asset
 AccountingFixedAssetCalendar=Calendar
 AccountingFixedAssetChildren=Children
+AccountingFixedAssetDepreciation=Depreciation
 AccountingFixedAssetEdit=Create/Update Fixed Asset
 AccountingFixedAssetId=Fixed Asset Id
 AccountingFixedAssetIdAlreadyExists=Fixed Asset Id [${parameters.fixedAssetId}] Already Exists
@@ -501,6 +504,7 @@
 PageTitleFindGlobalGlAccount=Find Global GL Account
 PageTitleFindInvoice=Find Invoice
 PageTitleFindPayment=Find Payment
+PageTitleFixedAssetDepreciationReport=Fixed Asset Depreciation Report
 PageTitleInvoiceItemType=List Invoice Item Type
 PageTitleInvoiceOverview=Invoice Overview
 PageTitleListAccounts=List Accounts

Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml?rev=611416&r1=611415&r2=611416&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Sat Jan 12 06:11:54 2008
@@ -629,6 +629,10 @@
         <field name="serialNumber" type="long-varchar"></field>
         <field name="locatedAtFacilityId" type="id"></field>
         <field name="locatedAtLocationSeqId" type="id"></field>
+        <field name="salvageValue" type="currency-amount"/>
+        <field name="depreciation" type="currency-amount"/>
+        <field name="purchaseCost" type="currency-amount"/>
+        <field name="purchaseCostUomId" type="id"/>
         <prim-key field="fixedAssetId"/>
         <relation type="one" fk-name="FIXEDAST_TYPE" rel-entity-name="FixedAssetType">
             <key-map field-name="fixedAssetTypeId"/>
@@ -687,14 +691,14 @@
     <entity entity-name="FixedAssetDepMethod"
             package-name="org.ofbiz.accounting.fixedasset"
             title="Fixed Asset Depreciation Method Entity">
-      <field name="depreciationMethodId" type="id-ne"></field>
+      <field name="depreciationCustomMethodId" type="id-ne"></field>
       <field name="fixedAssetId" type="id-ne"></field>
       <field name="fromDate" type="date-time"></field>
       <field name="thruDate" type="date-time"></field>
-      <prim-key field="depreciationMethodId"/>
+      <prim-key field="depreciationCustomMethodId"/>
       <prim-key field="fixedAssetId"/>
-      <relation type="one" fk-name="FIXDAST_DM_DPMTH" rel-entity-name="DepreciationMethod">
-        <key-map field-name="depreciationMethodId"/>
+      <relation type="one" fk-name="FIXDAST_DM_CMET" rel-entity-name="CustomMethod">
+        <key-map field-name="depreciationCustomMethodId" rel-field-name="customMethodId"/>
       </relation>
       <relation type="one" fk-name="FIXDAST_DM_FXAST" rel-entity-name="FixedAsset">
         <key-map field-name="fixedAssetId"/>

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml?rev=611416&r1=611415&r2=611416&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml Sat Jan 12 06:11:54 2008
@@ -585,5 +585,174 @@
         <entity-one entity-name="PartyFixedAssetAssignment" value-name="newEntity"/>
         <remove-value value-name="newEntity"/>
     </simple-method>
-        
+    
+    <!-- ==============  Fixed Asset Depreciation methods  ============== -->  
+    <simple-method method-name="straightLineDepreciation" short-description="Calculate straight line depreciation to Fixed Asset[ (PC-SV)/expLife ]">
+        <set field="expEndOfLifeYear" from-field="parameters.expEndOfLifeYear" type="Integer"/>
+        <set field="assetAcquiredYear" from-field="parameters.assetAcquiredYear" type="Integer"/>
+        <set field="purchaseCost" from-field="parameters.purchaseCost" type="Double"/>
+        <set field="salvageValue" from-field="parameters.salvageValue" type="Double"/>
+        <call-object-method obj-field-name="parameters.usageYears" method-name="intValue" ret-field-name="intUsageYears"/>
+        <if-not-empty field-name="parameters.fixedAssetId">
+            <set field="depreciation" value="0.0" type="Double"/>
+            <!--FORMULA :  depreciation = (purchaseCost - salvageValue) / (expectedEndOfLife - dateAcquired) -->
+            <calculate field-name="depreciation" decimal-scale="2" type="Double">
+                <calcop operator="divide">
+                    <calcop operator="subtract">
+                        <calcop operator="get" field-name="purchaseCost"/>
+                        <calcop operator="get" field-name="salvageValue"/>
+                    </calcop>
+                    <calcop operator="subtract">
+                        <calcop operator="get" field-name="expEndOfLifeYear"/>
+                        <calcop operator="get" field-name="assetAcquiredYear"/>
+                    </calcop>
+                </calcop>
+            </calculate>
+            <loop count="${intUsageYears}">
+                <calculate field-name="purchaseCost" type="Double">
+                    <calcop operator="subtract">
+                        <calcop operator="get" field-name="purchaseCost"/>
+                        <calcop operator="get" field-name="depreciation"/>
+                    </calcop>
+                </calculate>
+                <field-to-list list-name="assetDepreciationTillDate" field-name="depreciation"/>
+                <field-to-list list-name="assetNBVAfterDepreciation" field-name="purchaseCost"/>
+            </loop>
+        </if-not-empty>
+        <log level="info" message="Using straight line formula depreciation calculated for fixedAsset (${parameters.fixedAssetId}) is ${depreciation}"/>
+        <field-to-result field-name="assetDepreciationTillDate"/>
+        <field-to-result field-name="assetNBVAfterDepreciation"/>
+    </simple-method>
+    
+    <simple-method method-name="doubleDecliningBalanceDepreciation" short-description="Calculate double declining balance depreciation to Fixed Asset">
+        <set field="expEndOfLifeYear" from-field="parameters.expEndOfLifeYear" type="Integer"/>
+        <set field="assetAcquiredYear" from-field="parameters.assetAcquiredYear" type="Integer"/>
+        <set field="purchaseCost" from-field="parameters.purchaseCost" type="Double"/>
+        <set field="salvageValue" from-field="parameters.salvageValue" type="Double"/>
+        <call-object-method obj-field-name="parameters.usageYears" method-name="intValue" ret-field-name="intUsageYears"/>
+        <if-not-empty field-name="parameters.fixedAssetId">
+            <loop count="${intUsageYears}">
+                <set field="depreciation" value="0.0" type="Double"/>
+                <!--FORMULA : depreciation = (NBV - salvageValue) * 2 / (expectedEndOfLife - dateAcquired) -->
+                <calculate field-name="depreciation" decimal-scale="2" type="Double">
+                    <calcop operator="multiply">
+                        <calcop operator="divide">
+                           <calcop operator="subtract">
+                                <calcop operator="get" field-name="purchaseCost"/>
+                                <calcop operator="get" field-name="salvageValue"/>
+                            </calcop>
+                            <calcop operator="subtract">
+                                <calcop operator="get" field-name="expEndOfLifeYear"/>
+                                <calcop operator="get" field-name="assetAcquiredYear"/>
+                            </calcop>
+                        </calcop>
+                        <number value="2"/>
+                    </calcop>
+                </calculate>
+                <calculate field-name="assetAcquiredYear">
+                    <calcop operator="add">
+                       <calcop operator="get" field-name="assetAcquiredYear"/>
+                       <number value="1"/>
+                    </calcop>
+                </calculate>
+                <calculate field-name="purchaseCost">
+                   <calcop operator="subtract">
+                       <calcop operator="get" field-name="purchaseCost"/>
+                       <calcop operator="get" field-name="depreciation"/>
+                    </calcop>
+                </calculate>
+                <field-to-list list-name="assetDepreciationTillDate" field-name="depreciation"/>
+                <field-to-list list-name="assetNBVAfterDepreciation" field-name="purchaseCost"/>
+            </loop>
+        </if-not-empty>
+        <log level="info" message="Using double decline formula depreciation calculated for fixedAsset (${parameters.fixedAssetId}) is ${assetDepreciationTillDate}"/>
+        <field-to-result field-name="assetDepreciationTillDate"/>
+        <field-to-result field-name="assetNBVAfterDepreciation"/>
+    </simple-method>
+    
+    <simple-method method-name="calculateFixedAssetDepreciation" short-description="Service to calculate the yearly depreciation from dateAcquired year to current financial year">
+        <entity-one entity-name="FixedAsset" value-name="fixedAsset"/>
+        <if-empty field-name="fixedAsset">
+            <add-error><fail-property resource="ManufacturingUiLabels" property="ManufacturingFixedAssetNotExist"/></add-error>
+            <check-errors/>
+        </if-empty>
+        <set field="startIndex" value="0" type="Integer"/>
+        <set field="endIndex" value="4" type="Integer"/>
+
+        <!-- Extract asset end of life year from field expectedEndOfLife -->
+        <if-not-empty field-name="fixedAsset.expectedEndOfLife">
+            <set field="expectedEndOfLife" from-field="fixedAsset.expectedEndOfLife"/>
+            <to-string field-name="expectedEndOfLife"/>
+            <call-object-method method-name="substring" obj-field-name="expectedEndOfLife" ret-field-name="expEndOfLifeYear">
+                <field field-name="startIndex" type="int"/>
+                <field field-name="endIndex" type="int"/>
+            </call-object-method>
+        <else>
+            <add-error><fail-property resource="AccountingUiLabels" property="AccountingExpEndOfLifeIsEmpty"/></add-error>
+            <check-errors/>
+        </else>
+        </if-not-empty>
+
+        <!-- Extract asset acquired year from field dateAcquired -->
+        <if-not-empty field-name="fixedAsset.dateAcquired">
+            <set field="dateAcquired" from-field="fixedAsset.dateAcquired"/>
+            <to-string field-name="dateAcquired"/>
+            <call-object-method method-name="substring" obj-field-name="dateAcquired" ret-field-name="assetAcquiredYear">
+                <field field-name="startIndex"  type="int"/>
+                <field field-name="endIndex" type="int"/>
+            </call-object-method>
+        <else>
+            <add-error><fail-property resource="AccountingUiLabels" property="AccountingDateAcquiredIsEmpty"/></add-error>
+            <check-errors/>
+        </else>
+        </if-not-empty>
+
+        <!-- if any asset's salvage value is empty then set it by 0 -->
+        <if-empty field-name="fixedAsset.salvageValue">
+            <set field="salvageValue" value="0.0" type="Double"/>
+        <else>
+            <set field="salvageValue" from-field="fixedAsset.salvageValue"/>
+        </else>
+        </if-empty>
+
+        <!-- Get running year -->
+        <now-timestamp-to-env env-name="nowTimestamp"/>
+        <to-string field-name="nowTimestamp"/>
+        <call-object-method method-name="substring" obj-field-name="nowTimestamp" ret-field-name="currentYear">
+            <field field-name="startIndex" type="int"/>
+            <field field-name="endIndex" type="int"/>
+        </call-object-method>
+
+        <!-- Calculate asset's total run in years -->
+        <calculate field-name="usageYears" type="Integer">
+            <calcop operator="subtract">
+               <calcop operator="get" field-name="currentYear"/>
+               <calcop operator="get" field-name="assetAcquiredYear"/>
+            </calcop>
+        </calculate>
+
+        <entity-and entity-name="FixedAssetDepMethod" list-name="fixedAssetDepMethods" filter-by-date="true">
+            <field-map field-name="fixedAssetId" env-name="parameters.fixedAssetId"/>
+        </entity-and>
+        <if-not-empty field-name="fixedAssetDepMethods">
+            <first-from-list list-name="fixedAssetDepMethods" entry-name="fixedAssetDepMethod"/>
+            <get-related-one relation-name="CustomMethod" value-name="fixedAssetDepMethod" to-value-name="customMethod"/>
+            <log level="info" message="Depreciation service name for the FixedAsset ${parameters.fixedAssetId} is ${customMethod.customMethodName}"/>
+            
+            <set field="serviceInMap.fixedAssetId" from-field="parameters.fixedAssetId"/>
+            <set field="serviceInMap.expEndOfLifeYear" from-field="expEndOfLifeYear" type="Integer"/>
+            <set field="serviceInMap.assetAcquiredYear" from-field="assetAcquiredYear" type="Integer"/>
+            <set field="serviceInMap.purchaseCost" from-field="fixedAsset.purchaseCost" type="Double"/>
+            <set field="serviceInMap.salvageValue" from-field="salvageValue" type="Double"/>
+            <set field="serviceInMap.usageYears" from-field="usageYears" type="Integer"/>
+            <call-service service-name="${customMethod.customMethodName}" in-map-name="serviceInMap">
+                <result-to-field result-name="assetDepreciationTillDate"/>
+                <result-to-field result-name="assetNBVAfterDepreciation"/>
+            </call-service>
+            <log level="info" message="Asset's depreciation calculated till date are ${assetDepreciationTillDate}"/>
+            <log level="info" message="Asset's Net Book Values (NBV) from acquired date after deducting depreciation are ${assetNBVAfterDepreciation}"/>
+            <field-to-result field-name="assetDepreciationTillDate"/>
+            <field-to-result field-name="assetNBVAfterDepreciation"/>
+        </if-not-empty>    
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml?rev=611416&r1=611415&r2=611416&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml Sat Jan 12 06:11:54 2008
@@ -298,10 +298,40 @@
         <description>Delete Party to Fixed Asset</description>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
-    
     <service name="fixedAssetPermissionCheck" engine="simple"
             location="component://accounting/script/org/ofbiz/accounting/permissions/PermissionServices.xml" invoke="basePermissionCheck">
         <description>Fixed Asset Permission Checking Logic</description>
         <implements service="permissionInterface"/>
     </service>
-</services>
+    
+    <!-- Fixed Asset Depreciation Services -->
+    <service name="fixedAssetDepCalcInterface" engine="interface">
+        <description>Interface to describe base parameters for Depreciation Calculation Services</description>
+        <attribute name="expEndOfLifeYear" type="Integer" mode="IN" optional="false"/>
+        <attribute name="assetAcquiredYear" type="Integer" mode="IN" optional="false"/>
+        <attribute name="purchaseCost" type="Double" mode="IN" optional="false"/>
+        <attribute name="salvageValue" type="Double" mode="IN" optional="false"/>
+        <attribute name="usageYears" type="Integer" mode="IN" optional="false"/>
+        <attribute name="assetDepreciationTillDate" type="List" mode="OUT" optional="false"/>
+        <attribute name="assetNBVAfterDepreciation" type="List" mode="OUT" optional="false"/>
+    </service>
+    <service name="straightLineDepreciation" engine="simple" default-entity-name="FixedAsset"
+                location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="straightLineDepreciation" auth="true">
+        <description>Straight line depreciation service to Fixed Asset</description>
+        <implements service="fixedAssetDepCalcInterface"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+    </service>
+    <service name="doubleDecliningBalanceDepreciation" engine="simple" default-entity-name="FixedAsset"
+                location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="doubleDecliningBalanceDepreciation" auth="true">
+        <description>Double declining balance depreciation service to Fixed Asset</description>
+        <implements service="fixedAssetDepCalcInterface"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+    </service>
+    <service name="calculateFixedAssetDepreciation" engine="simple" default-entity-name="FixedAssetDepMethod"
+                location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="calculateFixedAssetDepreciation" auth="true">
+        <description>Select the depreciation method according to the entry in FixedAssetDepMethod</description>
+        <attribute name="fixedAssetId" type="String" mode="IN"/>
+        <attribute name="assetDepreciationTillDate" type="List" mode="OUT" optional="false"/>
+        <attribute name="assetNBVAfterDepreciation" type="List" mode="OUT" optional="false"/>
+    </service>
+</services>
\ No newline at end of file

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=611416&r1=611415&r2=611416&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Sat Jan 12 06:11:54 2008
@@ -1762,6 +1762,16 @@
         <response name="error" type="view" value="ComparativeBalanceSheet"/>        
     </request-map>
     <request-map uri="TransactionTotals"><security https="true" auth="true"/><response name="success" type="view" value="TransactionTotals"/></request-map>
+
+
+    <!-- ================ Depreciation Calculation Report requests ================ -->
+    <request-map uri="showFixedAssetDepreciation">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="calculateFixedAssetDepreciation"/>
+        <response name="success" type="view" value="ShowFixedAssetDepreciation"/>
+        <response name="error" type="view" value="ShowFixedAssetDepreciation"/>
+    </request-map>
+
     <!-- end of request mappings -->
 
     <!-- View Mappings -->
@@ -1861,6 +1871,9 @@
     <view-map name="EditFixedAssetMaintMeters" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#EditFixedAssetMaintMeters"/>
     <view-map name="EditFixedAssetMaintOrders" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#EditFixedAssetMaintOrders"/>
 
+    <!-- Depreciation Calculation   -->
+    <view-map name="ShowFixedAssetDepreciation" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#ShowFixedAssetDepreciation"/>
+  
     <!-- Agreement -->
     <view-map name="FindAgreement" type="screen" page="component://accounting/widget/AgreementScreens.xml#FindAgreement"/>
     <view-map name="EditAgreement" type="screen" page="component://accounting/widget/AgreementScreens.xml#EditAgreement"/>

Added: ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/DepreciationReport.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/DepreciationReport.ftl?rev=611416&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/DepreciationReport.ftl (added)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/DepreciationReport.ftl Sat Jan 12 06:11:54 2008
@@ -0,0 +1,68 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<#if assetDepreciationTillDate?has_content && assetNBVAfterDepreciation?has_content>
+  <br/><br/>
+  <#assign listSize = assetDepreciationTillDate.size()>
+  <table width="50%" cellspacing="0" border="1">
+    <tr>
+      <th>
+        Sequence No.
+      </th>
+      <th>
+        Depreciation
+      </th>
+      <th>
+        Sum of Depreciation
+      </th>
+      <th>
+        Net Book Value
+      </th>
+    </tr>
+    <tr>
+      <td>
+        <#list 1.. listSize as i>
+          ${i} <br/>
+        </#list>
+      </td>
+      <td>
+        <#list assetDepreciationTillDate as assetDepreciation>
+          ${assetDepreciation} <br/>
+        </#list>
+      </td>
+      <td>
+        <#assign i = 0/>
+        <#assign cumulativeDep = 0/>
+        <#list assetDepreciationTillDate as assetDepreciation>
+          <#if i <= listSize>
+            <#assign cumulativeDep = cumulativeDep + assetDepreciation>
+            ${cumulativeDep} <br/>
+            <#assign i = i + 1/>
+          </#if>
+          <#assign cumulativeDep = cumulativeDep>
+        </#list>
+      </td>
+      <td>
+        <#list assetNBVAfterDepreciation as assetNBVDepreciation>
+          ${assetNBVDepreciation}<br/>
+        </#list>
+      </td>
+    </tr>
+  </table>
+</#if>
\ No newline at end of file

Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/DepreciationReport.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/DepreciationReport.ftl
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/DepreciationReport.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml?rev=611416&r1=611415&r2=611416&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml Sat Jan 12 06:11:54 2008
@@ -345,4 +345,30 @@
             </widgets>
         </section>
     </screen>
+    <!-- ===========Fixed Asset Depreciation Screen========== -->
+    <screen name="ShowFixedAssetDepreciation">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleFixedAssetDepreciationReport"/>
+                <set field="tabButtonItem" value="FixedAssetDepreciation"/>
+                <set field="labelTitleProperty" value="PageTitleFixedAssetDepreciationReport"/>
+                <set field="fixedAssetId" from-field="parameters.fixedAssetId"/>
+                <set field="assetDepreciationTillDate" from-field="parameters.assetDepreciationTillDate"/>
+                <set field="assetNBVAfterDepreciation" from-field="parameters.assetNBVAfterDepreciation"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonFixedAssetDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <section>
+                            <widgets>
+                                <platform-specific>
+                                    <html><html-template location="component://accounting/webapp/accounting/fixedasset/DepreciationReport.ftl"/></html>
+                                </platform-specific>
+                            </widgets>
+                        </section>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 </screens>

Modified: ofbiz/trunk/applications/accounting/widget/Menus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/Menus.xml?rev=611416&r1=611415&r2=611416&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/Menus.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/Menus.xml Sat Jan 12 06:11:54 2008
@@ -386,6 +386,10 @@
         <menu-item name="EditPartyFixedAssetAssignments" title="${uiLabelMap.AccountingPartyFixedAssetAssignments}">
             <link target="EditPartyFixedAssetAssignments?fixedAssetId=${fixedAssetId}"/>
         </menu-item>
+        <menu-item name="FixedAssetDepreciation" title="${uiLabelMap.AccountingFixedAssetDepreciation}">
+            <link target="showFixedAssetDepreciation?fixedAssetId=${fixedAssetId}"/>
+        </menu-item>
+
     </menu>
     
     <menu name="FinAccountTabBar" default-menu-item-name="EditFinAccount" default-selected-style="selected"

Modified: ofbiz/trunk/applications/manufacturing/data/ManufacturingData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/data/ManufacturingData.xml?rev=611416&r1=611415&r2=611416&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/data/ManufacturingData.xml (original)
+++ ofbiz/trunk/applications/manufacturing/data/ManufacturingData.xml Sat Jan 12 06:11:54 2008
@@ -45,4 +45,9 @@
     <CustomMethodType customMethodTypeId="COST_FORMULA" description="Formula for calculating costs for tasks"/>
     <CustomMethodType customMethodTypeId="TASK_FORMULA" description="Formula for calculating time estimates for tasks"/>
     <CustomMethodType customMethodTypeId="BOM_FORMULA" description="Formula for calculating material estimates for boms"/>
+    <CustomMethodType customMethodTypeId="DEPRECIATION_FORMULA" description="Formula for calculating depreciatiion for fixed asset"/>
+
+    <!--Depreciation Formulae-->
+    <CustomMethod customMethodId="STR_LINE_DEP_FORMULA" customMethodTypeId="DEPRECIATION_FORMULA" customMethodName="straightLineDepreciation" description="Straight Line depreciatiion algorithm for fixed asset((purchaseCost - salvageCost)/expectedLifeInYears)"/>
+    <CustomMethod customMethodId="DBL_DECL_DEP_FORMULA" customMethodTypeId="DEPRECIATION_FORMULA" customMethodName="doubleDecliningBalanceDepreciation" description="Double decline depreciatiion algorithm for fixed asset((NetBookValue - salvageCost)*2/remainingLifeInYears)"/>
 </entity-engine-xml>

Modified: ofbiz/trunk/applications/manufacturing/data/ManufacturingExampleData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/data/ManufacturingExampleData.xml?rev=611416&r1=611415&r2=611416&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/data/ManufacturingExampleData.xml (original)
+++ ofbiz/trunk/applications/manufacturing/data/ManufacturingExampleData.xml Sat Jan 12 06:11:54 2008
@@ -35,4 +35,10 @@
     
     <FixedAsset fixedAssetId="DEMO_FOOD_GROUP" fixedAssetTypeId="GROUP_EQUIPMENT" fixedAssetName="Demo Food Group"/>
     <FixedAsset fixedAssetId="DEMO_FOOD" fixedAssetName="Demo Food" fixedAssetTypeId="PRODUCTION_EQUIPMENT" parentFixedAssetId="DEMO_FOOD_GROUP" calendarId="DEMO_CALENDAR"/>
+    
+    <FixedAsset fixedAssetId="DEMO_PROD_EQUIPMT_1" fixedAssetName="Demo Production Equipment One" fixedAssetTypeId="PRODUCTION_EQUIPMENT" dateAcquired="2005-1-1 00:01:00.0" expectedEndOfLife="2010-1-1" calendarId="DEMO_CALENDAR" salvageValue="50" purchaseCost="1000"/>
+    <FixedAsset fixedAssetId="DEMO_PROD_EQUIPMT_2" fixedAssetName="Demo Production Equipment Two" fixedAssetTypeId="PRODUCTION_EQUIPMENT" dateAcquired="2005-1-1 00:01:00.0" expectedEndOfLife="2010-1-1" calendarId="DEMO_CALENDAR" salvageValue="50" purchaseCost="1000"/>
+    
+    <FixedAssetDepMethod depreciationCustomMethodId="STR_LINE_DEP_FORMULA" fixedAssetId="DEMO_PROD_EQUIPMT_1"/>
+    <FixedAssetDepMethod depreciationCustomMethodId="DBL_DECL_DEP_FORMULA" fixedAssetId="DEMO_PROD_EQUIPMT_2"/>
 </entity-engine-xml>