svn commit: r1783388 - in /ofbiz/ofbiz-framework/trunk/applications/accounting: minilang/fixedasset/FixedAssetServices.xml widget/FixedAssetScreens.xml

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

svn commit: r1783388 - in /ofbiz/ofbiz-framework/trunk/applications/accounting: minilang/fixedasset/FixedAssetServices.xml widget/FixedAssetScreens.xml

jacopoc
Author: jacopoc
Date: Fri Feb 17 12:45:31 2017
New Revision: 1783388

URL: http://svn.apache.org/viewvc?rev=1783388&view=rev
Log:
Fixed: straight line fixed asset depreciation method was not computing properly
depreciation transactions for assets that are used after their expected end of
life.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/accounting/minilang/fixedasset/FixedAssetServices.xml
    ofbiz/ofbiz-framework/trunk/applications/accounting/widget/FixedAssetScreens.xml

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/minilang/fixedasset/FixedAssetServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/minilang/fixedasset/FixedAssetServices.xml?rev=1783388&r1=1783387&r2=1783388&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/minilang/fixedasset/FixedAssetServices.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/minilang/fixedasset/FixedAssetServices.xml Fri Feb 17 12:45:31 2017
@@ -402,6 +402,9 @@ under the License.
                     </calculate>
                 </if-compare>
                 <set field="depreciationYear" from-field="assetAcquiredYear" type="BigDecimal"/>
+                <if-compare-field field="numberOfYears" operator="less" to-field="intUsageYears" type="BigDecimal">
+                    <set field="intUsageYears" from-field="numberOfYears" type="BigDecimal"/>
+                </if-compare-field>
                 <loop count="${intUsageYears}">
                     <calculate field="purchaseCost">
                         <calcop operator="subtract">
@@ -478,7 +481,13 @@ under the License.
             </then>
         </if>
         <field-to-result field="nextDepreciationAmount"/>
-        <field-to-result field="depreciationTotal" result-name="plannedPastDepreciationTotal"/>
+        <calculate field="plannedPastDepreciationTotal">
+            <calcop operator="subtract">
+                <calcop operator="get" field="depreciationTotal"/>
+                <calcop operator="get" field="fixedAsset.depreciation"/>
+            </calcop>
+        </calculate>
+        <field-to-result field="plannedPastDepreciationTotal"/>
     </simple-method>
 
     <simple-method method-name="doubleDecliningBalanceDepreciation" short-description="Calculate double declining balance depreciation to Fixed Asset">

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/widget/FixedAssetScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/widget/FixedAssetScreens.xml?rev=1783388&r1=1783387&r2=1783388&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/widget/FixedAssetScreens.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/widget/FixedAssetScreens.xml Fri Feb 17 12:45:31 2017
@@ -538,7 +538,6 @@ under the License.
                                             <and>
                                                 <not><if-empty field="assetDepreciationResultMap.plannedPastDepreciationTotal"/></not>
                                                 <not><if-empty field="fixedAsset.partyId"/></not>
-                                                <if-compare-field field="assetDepreciationResultMap.plannedPastDepreciationTotal" to-field="depreciation" operator="greater" type="BigDecimal"/>
                                             </and>
                                         </condition>
                                         <actions>