|
Author: jacopoc
Date: Mon Feb 22 17:09:33 2010 New Revision: 912661 URL: http://svn.apache.org/viewvc?rev=912661&view=rev Log: Initial support for semi automatic accounting transactions for fixed asset depreciations. Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml ofbiz/trunk/applications/accounting/widget/GlForms.xml 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=912661&r1=912660&r2=912661&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 Mon Feb 22 17:09:33 2010 @@ -562,6 +562,7 @@ <call-object-method obj-field="parameters.usageYears" method-name="intValue" ret-field="intUsageYears"/> <!-- Past depreciation based on standard formula --> + <set field="depreciationTotal" value="0.0" type="BigDecimal"/> <if> <condition> <and> @@ -571,7 +572,6 @@ </condition> <then> <set field="depreciation" value="0.0" type="BigDecimal"/> - <set field="depreciationTotal" value="0.0" type="BigDecimal"/> <!--FORMULA : depreciation = (purchaseCost - salvageValue) / (expectedEndOfLife - dateAcquired) --> <calculate field="depreciation" decimal-scale="2"> <calcop operator="divide"> @@ -658,6 +658,7 @@ </then> </if> <field-to-result field="nextDepreciationAmount"/> + <field-to-result field="depreciationTotal" result-name="plannedPastDepreciationTotal"/> </simple-method> <simple-method method-name="doubleDecliningBalanceDepreciation" short-description="Calculate double declining balance depreciation to Fixed Asset"> @@ -698,6 +699,7 @@ <field-to-result field="nextDepreciationAmount"/> <!-- Past depreciation based on standard formula --> + <set field="depreciationTotal" value="0.0" type="BigDecimal"/> <if> <condition> <and> @@ -707,7 +709,6 @@ </condition> <then> <set field="depreciationYear" from-field="assetAcquiredYear" type="BigDecimal"/> - <set field="depreciationTotal" value="0.0" type="BigDecimal"/> <loop count="${intUsageYears}"> <set field="depreciation" value="0.0" type="BigDecimal"/> <!--FORMULA : depreciation = (NBV - salvageValue) * 2 / (expectedEndOfLife - dateAcquired) --> @@ -775,6 +776,7 @@ <field-to-result field="assetDepreciationTillDate"/> <field-to-result field="assetNBVAfterDepreciation"/> <field-to-result field="assetDepreciationInfoList"/> + <field-to-result field="depreciationTotal" result-name="plannedPastDepreciationTotal"/> </simple-method> <simple-method method-name="calculateFixedAssetDepreciation" short-description="Service to calculate the yearly depreciation from dateAcquired year to current financial year"> @@ -857,6 +859,7 @@ <result-to-field result-name="assetNBVAfterDepreciation"/> <result-to-field result-name="assetDepreciationInfoList"/> <result-to-field result-name="nextDepreciationAmount"/> + <result-to-field result-name="plannedPastDepreciationTotal"/> </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}"/> @@ -864,6 +867,7 @@ <field-to-result field="assetNBVAfterDepreciation"/> <field-to-result field="assetDepreciationInfoList"/> <field-to-result field="nextDepreciationAmount"/> + <field-to-result field="plannedPastDepreciationTotal"/> <else> <property-to-field resource="AccountingUiLabels" property="AccountingFixedAssetDepreciationMethodNotFound" field="successMessageList[]"/> <return/> Modified: ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml?rev=912661&r1=912660&r2=912661&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml Mon Feb 22 17:09:33 2010 @@ -283,6 +283,7 @@ <attribute name="assetNBVAfterDepreciation" type="List" mode="OUT" optional="false"/> <attribute name="assetDepreciationInfoList" type="List" mode="OUT" optional="false"/> <attribute name="nextDepreciationAmount" type="BigDecimal" mode="OUT" optional="false"/> + <attribute name="plannedPastDepreciationTotal" type="BigDecimal" mode="OUT" optional="false"/> </service> <service name="straightLineDepreciation" engine="simple" default-entity-name="FixedAsset" location="component://accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="straightLineDepreciation" auth="true"> @@ -304,6 +305,7 @@ <attribute name="assetNBVAfterDepreciation" type="List" mode="OUT" optional="true"/> <attribute name="assetDepreciationInfoList" type="List" mode="OUT" optional="true"/> <attribute name="nextDepreciationAmount" type="BigDecimal" mode="OUT" optional="true"/> + <attribute name="plannedPastDepreciationTotal" type="BigDecimal" mode="OUT" optional="true"/> </service> <service name="createFixedAssetTypeGlAccount" engine="simple" default-entity-name="FixedAssetTypeGlAccount" location="component://accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="createFixedAssetTypeGlAccount" auth="true"> Modified: ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml?rev=912661&r1=912660&r2=912661&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml Mon Feb 22 17:09:33 2010 @@ -521,6 +521,7 @@ </service> <set field="assetDepreciationInfoList" from-field="assetDepreciationResultMap.assetDepreciationInfoList"/> <set field="assetDepreciationResultMessages" from-field="assetDepreciationResultMap.successMessageList"/> + <set field="depreciation" from-field="fixedAsset.depreciation" default-value="0.0" type="BigDecimal"/> </actions> <widgets> <decorator-screen name="CommonFixedAssetDecorator" location="${parameters.fixedAssetDecoratorLocation}"> @@ -529,11 +530,27 @@ <widgets> <screenlet title="${uiLabelMap.PageTitleFixedAssetDepreciationHistory}"> <label style="h3">${uiLabelMap.FixedAssetPurchaseCost}: ${fixedAsset.purchaseCost}</label> - <label style="h3">${uiLabelMap.FixedAssetDepreciation}: ${fixedAsset.depreciation}</label> + <label style="h3">${uiLabelMap.FixedAssetDepreciation}: ${depreciation}</label> <label style="h3">${uiLabelMap.FixedAssetSalvageValue}: ${fixedAsset.salvageValue}</label> <label style="h3">${uiLabelMap.FixedAssetDateAcquired}: ${fixedAsset.dateAcquired}</label> <label style="h3">${uiLabelMap.FixedAssetExpectedEndOfLife}: ${fixedAsset.expectedEndOfLife}</label> <label style="h3">${uiLabelMap.FixedAssetNextDepreciationAmount}: ${assetDepreciationResultMap.nextDepreciationAmount}</label> + <section> + <condition> + <if-compare-field field-name="assetDepreciationResultMap.plannedPastDepreciationTotal" to-field="depreciation" operator="greater"/> + <not><if-empty field-name="fixedAsset.partyId"/></not> + </condition> + <widgets> + <container> + <link text="${uiLabelMap.AccountingCreateAnAccountingTransaction}: ${assetDepreciationResultMap.plannedPastDepreciationTotal}" style="buttontext" target="CreateAcctgTransAndEntries"> + <parameter param-name="fixedAssetId" from-field="fixedAsset.fixedAssetId"/> + <parameter param-name="organizationPartyId" from-field="fixedAsset.partyId"/> + <parameter param-name="acctgTransTypeId" value="DEPRECIATION"/> + <parameter param-name="amount" from-field="assetDepreciationResultMap.plannedPastDepreciationTotal"/> + </link> + </container> + </widgets> + </section> </screenlet> <screenlet title="${uiLabelMap.PageTitleFixedAssetDepreciationMethod}"> <include-form name="AddFixedAssetDepMethod" location="component://accounting/widget/FixedAssetForms.xml"/> Modified: ofbiz/trunk/applications/accounting/widget/GlForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/GlForms.xml?rev=912661&r1=912660&r2=912661&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/GlForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/GlForms.xml Mon Feb 22 17:09:33 2010 @@ -455,6 +455,13 @@ <field name="produtId" position="1"><lookup target-form-name="LookupProduct" size="20" maxlength="20"/></field> <field name="workEffortId" position="2"><lookup target-form-name="LookupWorkEffort" size="20" maxlength="20"/></field> <field name="shipmentId" position="1"><lookup target-form-name="LookupShipment" size="20" maxlength="20"/></field> + <field name="fixedAssetId"> + <drop-down allow-empty="true"> + <entity-options entity-name="FixedAsset" description="${fixedAssetId}"> + <entity-order-by field-name="fixedAssetId"/> + </entity-options> + </drop-down> + </field> <field name="debitGlAccountId" use-when="debitGlAccountClassId!=null"> <drop-down> <entity-options entity-name="GlAccountOrganizationAndClass" key-field-name="glAccountId" description="${accountCode} - ${accountName} [${glAccountId}]"> |
| Free forum by Nabble | Edit this page |
