Author: jacopoc
Date: Tue Feb 23 09:51:23 2010
New Revision: 915261
URL: http://svn.apache.org/viewvc?rev=915261&view=rev
Log:
Completed implementation for semi automatic creation of accounting transactions
for fixed asset depreciations from the fixed asset detail screen.
Modified:
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml
Modified:
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=915261&r1=915260&r2=915261&view=diff
==============================================================================
---
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
(original)
+++
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
Tue Feb 23 09:51:23 2010
@@ -444,6 +444,53 @@
<return/>
</if-not-empty>
</if-compare>
+ <!-- fixed asset depreciation -->
+ <if-compare field="parameters.acctgTransTypeId" operator="equals"
value="DEPRECIATION">
+ <if-not-empty field="parameters.fixedAssetId">
+ <entity-condition entity-name="FixedAssetTypeGlAccount"
list="fixedAssetTypeGlAccounts">
+ <condition-expr field-name="fixedAssetId"
from-field="parameters.fixedAssetId"/>
+ </entity-condition>
+ <if-empty field="fixedAssetTypeGlAccounts">
+ <entity-one entity-name="FixedAsset"
value-field="fixedAsset" auto-field-map="false">
+ <field-map field-name="fixedAssetId"
from-field="parameters.fixedAssetId"/>
+ </entity-one>
+ <entity-condition entity-name="FixedAssetTypeGlAccount"
list="fixedAssetTypeGlAccounts">
+ <condition-list combine="and">
+ <condition-expr field-name="fixedAssetId"
value="_NA_"/>
+ <condition-list combine="or">
+ <condition-expr field-name="fixedAssetTypeId"
from-field="fixedAsset.fixedAssetTypeId"/>
+ <condition-expr field-name="fixedAssetTypeId"
value="_NA_"/>
+ </condition-list>
+ </condition-list>
+ </entity-condition>
+ </if-empty>
+ <first-from-list list="fixedAssetTypeGlAccounts"
entry="fixedAssetTypeGlAccount"/>
+ <if>
+ <condition>
+ <and>
+ <not><if-empty
field="fixedAssetTypeGlAccount.accDepGlAccountId"/></not>
+ <if-compare field="parameters.debitCreditFlag"
operator="equals" value="D"/>
+ </and>
+ </condition>
+ <then>
+ <field-to-result
field="fixedAssetTypeGlAccount.accDepGlAccountId" result-name="glAccountId"/>
+ <return/>
+ </then>
+ </if>
+ <if>
+ <condition>
+ <and>
+ <not><if-empty
field="fixedAssetTypeGlAccount.depGlAccountId"/></not>
+ <if-compare field="parameters.debitCreditFlag"
operator="equals" value="C"/>
+ </and>
+ </condition>
+ <then>
+ <field-to-result
field="fixedAssetTypeGlAccount.depGlAccountId" result-name="glAccountId"/>
+ <return/>
+ </then>
+ </if>
+ </if-not-empty>
+ </if-compare>
<!-- check first if there is a party specific account mapping defined
for the account type -->
<if>
<condition>
Modified: ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml?rev=915261&r1=915260&r2=915261&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
(original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Tue Feb
23 09:51:23 2010
@@ -321,6 +321,7 @@
<attribute name="productId" type="String" mode="IN" optional="true"/>
<attribute name="paymentId" type="String" mode="IN" optional="true"/>
<attribute name="invoiceId" type="String" mode="IN" optional="true"/>
+ <attribute name="fixedAssetId" type="String" mode="IN"
optional="true"/>
<attribute name="glAccountId" type="String" mode="OUT"
optional="true"/>
</service>
<service name="getInventoryItemOwner" default-entity-name="InventoryItem"
engine="simple"
Modified: ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml?rev=915261&r1=915260&r2=915261&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml Tue Feb 23
09:51:23 2010
@@ -537,15 +537,35 @@
<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>
+ <and>
+ <if-compare-field
field="assetDepreciationResultMap.plannedPastDepreciationTotal"
to-field="depreciation" operator="greater"/>
+ <not><if-empty
field="fixedAsset.partyId"/></not>
+ </and>
</condition>
+ <actions>
+ <service
service-name="getGlAccountFromAccountType"
result-map="defaultCreditAccountForDepreciationTransactionResult">
+ <field-map
field-name="organizationPartyId" from-field="fixedAsset.partyId"/>
+ <field-map
field-name="acctgTransTypeId" value="DEPRECIATION"/>
+ <field-map
field-name="fixedAssetId" from-field="fixedAsset.fixedAssetId"/>
+ <field-map
field-name="debitCreditFlag" value="C"/>
+ </service>
+ <set
field="defaultCreditAccountForDepreciationTransaction"
from-field="defaultCreditAccountForDepreciationTransactionResult.glAccountId"
default-value=" "/>
+ <service
service-name="getGlAccountFromAccountType"
result-map="defaultDebitAccountForDepreciationTransactionResult">
+ <field-map
field-name="organizationPartyId" from-field="fixedAsset.partyId"/>
+ <field-map
field-name="acctgTransTypeId" value="DEPRECIATION"/>
+ <field-map
field-name="fixedAssetId" from-field="fixedAsset.fixedAssetId"/>
+ <field-map
field-name="debitCreditFlag" value="D"/>
+ </service>
+ <set
field="defaultDebitAccountForDepreciationTransaction"
from-field="defaultDebitAccountForDepreciationTransactionResult.glAccountId"
default-value=" "/>
+ </actions>
<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="debitGlAccountId"
from-field="defaultDebitAccountForDepreciationTransaction"/>
+ <parameter
param-name="creditGlAccountId"
from-field="defaultCreditAccountForDepreciationTransaction"/>
<parameter
param-name="amount"
from-field="assetDepreciationResultMap.plannedPastDepreciationTotal"/>
</link>
</container>