Author: apatel
Date: Thu Dec 6 13:01:31 2007 New Revision: 601855 URL: http://svn.apache.org/viewvc?rev=601855&view=rev Log: Implement an automatic GL posting service triggered when inventory is issued for fixed asset maintenance Thanks Paranay Panday for providing implementation And also our thanks to Vikas Mayur, Ashish Vijaywargiya, Mridul Pathak, Pankaj Savita and others for managing and helping the team implementing these services. Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml ofbiz/trunk/applications/accounting/servicedef/services_ledger.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=601855&r1=601854&r2=601855&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 Thu Dec 6 13:01:31 2007 @@ -940,4 +940,51 @@ </call-service> <field-to-result field-name="acctgTransId" result-name="acctgTransId"/> </simple-method> + + <!-- Service for the automatic creation of accounting transaction for inventory that is issued for fixed asset maintenance --> + <simple-method method-name="createAcctgTransForFixedAssetMaintIssuance" short-description="Create an accounting transaction for inventory that is issued for fixed asset maintenance (Type: INVENTORY D: INVENTORY_ACCOUNT, C: FIXED_ASSET_MAINT)"> + <!-- retrieve ledger rounding properties --> + <property-to-field resource="arithmetic" property="ledger.decimals" field-name="ledgerDecimals"/> + <property-to-field resource="arithmetic" property="ledger.rounding" field-name="roundingMode"/> + + <entity-one entity-name="ItemIssuance" value-name="itemIssuance"/> + <get-related-one value-name="itemIssuance" relation-name="InventoryItem" to-value-name="inventoryItem"/> + + <calculate field-name="origAmount" type="BigDecimal" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}"> + <calcop operator="multiply"> + <calcop operator="get" field-name="itemIssuance.quantity"/> + <calcop operator="get" field-name="inventoryItem.unitCost"/> + </calcop> + </calculate> + + <!-- prepare the double posting (D/C) entries (AcctgTransEntry) --> + <!-- Credit --> + <make-value entity-name="AcctgTransEntry" value-name="creditEntry"/> + <set field="creditEntry.debitCreditFlag" value="C"/> + <set field="creditEntry.glAccountTypeId" value="INVENTORY_ACCOUNT"/> + <set field="creditEntry.organizationPartyId" from-field="inventoryItem.ownerPartyId"/> + <set field="creditEntry.productId" from-field="inventoryItem.productId"/> + <set field="creditEntry.origAmount" from-field="origAmount"/> + <set field="creditEntry.origCurrencyUomId" from-field="inventoryItem.currencyUomId"/> + <set field="acctgTransEntries[]" from-field="creditEntry" type="Object"/> + <!-- Debit --> + <make-value entity-name="AcctgTransEntry" value-name="debitEntry"/> + <set field="debitEntry.debitCreditFlag" value="D"/> + <set field="debitEntry.glAccountTypeId" value="FIXED_ASSET_MAINT"/> + <set field="debitEntry.organizationPartyId" from-field="inventoryItem.ownerPartyId"/> + <set field="debitEntry.productId" from-field="inventoryItem.productId"/> + <set field="debitEntry.origAmount" from-field="origAmount"/> + <set field="debitEntry.origCurrencyUomId" from-field="inventoryItem.currencyUomId"/> + <set field="acctgTransEntries[]" from-field="debitEntry" type="Object"/> + <!-- Set header fields (AcctgTrans) --> + <set field="createAcctgTransAndEntriesInMap.glFiscalTypeId" value="ACTUAL"/> + <set field="createAcctgTransAndEntriesInMap.acctgTransTypeId" value="INVENTORY"/> + <set field="createAcctgTransAndEntriesInMap.fixedAssetId" from-field="itemIssuance.fixedAssetId"/> + <set field="createAcctgTransAndEntriesInMap.acctgTransEntries" from-field="acctgTransEntries"/> + <call-service service-name="createAcctgTransAndEntries" in-map-name="createAcctgTransAndEntriesInMap"> + <result-to-field result-name="acctgTransId"/> + </call-service> + <field-to-result field-name="acctgTransId" result-name="acctgTransId"/> + </simple-method> + </simple-methods> Modified: ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml?rev=601855&r1=601854&r2=601855&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml Thu Dec 6 13:01:31 2007 @@ -78,4 +78,10 @@ <action service="createAcctgTransForPhysicalInventoryVariance" mode="sync"/> </eca> + <!--create the accounting transactions when Fixed AssetMaint Issuance issues Inventory for fixed asset maintenance--> + <eca service="createItemIssuance" event="commit"> + <condition field-name="fixedAssetId" operator="is-not-empty"/> + <action service="createAcctgTransForFixedAssetMaintIssuance" mode="sync"/> + </eca> + </service-eca> Modified: ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml?rev=601855&r1=601854&r2=601855&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Thu Dec 6 13:01:31 2007 @@ -417,4 +417,12 @@ <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/> </service> + <!-- An automatic GL Acct transaction service triggered when inventory is issued for fixed asset maintenance--> + <service name="createAcctgTransForFixedAssetMaintIssuance" engine="simple" auth="true" + location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForFixedAssetMaintIssuance"> + <description>Create an accounting transaction for inventory that is issued for fixed asset maintenance (Type: INVENTORY D: INVENTORY_ACCOUNT, C: FIXED_ASSET_MAINT)</description> + <attribute name="itemIssuanceId" type="String" mode="IN" optional="false"/> + <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/> + </service> + </services> |
Free forum by Nabble | Edit this page |