Author: apatel
Date: Mon Dec 3 17:47:51 2007 New Revision: 600766 URL: http://svn.apache.org/viewvc?rev=600766&view=rev Log: Implement an automatic GL posting service triggered when an actual cost record is created for a work effort Thanks Brajesh Patel 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=600766&r1=600765&r2=600766&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 Mon Dec 3 17:47:51 2007 @@ -744,5 +744,58 @@ <field-to-result field-name="acctgTransId" result-name="acctgTransId"/> </simple-method> + <simple-method method-name="createAcctgTransForWorkEffortCost" + short-description="Create an accounting transaction for inventory that is issued to a work effort cost (Type: INVENTORY D: INVENTORY_ACCOUNT , C: UNINVOICED_SHIP_RCPT or COGS_ACCOUNT)"> + <entity-one entity-name="CostComponent" value-name="costComponent"> + <field-map field-name="costComponentId" env-name="parameters.costComponentId"/> + </entity-one> + <get-related-one value-name="costComponent" relation-name="CostComponentCalc" to-value-name="costComponentCalc"/> + <entity-one entity-name="WorkEffort" value-name="workEffort"> + <field-map field-name="workEffortId" env-name="parameters.workEffortId"/> + </entity-one> + <get-related-one value-name="workEffort" relation-name="Facility" to-value-name="facility"/> + <if-compare field-name="workEffort.workEffortTypeId" operator="equals" value="PROD_ORDER_TASK"> + <if-not-empty field-name="workEffort.workEffortParentId"> + <entity-and entity-name="WorkEffortGoodStandard" list-name="workEffortGoodStandards"> + <field-map field-name="workEffortId" env-name="workEffort.workEffortParentId"/> + <field-map field-name="workEffortGoodStdTypeId" value="PRUN_PROD_DELIV"/> + <order-by field-name="-fromDate"/> + </entity-and> + <first-from-list list-name="workEffortGoodStandards" entry-name="workEffortGoodStandard"/> + </if-not-empty> + </if-compare> + <!-- Credit --> + <make-value entity-name="AcctgTransEntry" value-name="creditEntry"/> + <set field="creditEntry.debitCreditFlag" value="C"/> + <set field="creditEntry.glAccountTypeId" value="costComponentCalc.costGlAccountTypeId"/> + <set field="creditEntry.organizationPartyId" from-field="facility.ownerPartyId"/> + <set field="creditEntry.productId" from-field="workEffortGoodStandard.productId"/> + <set field="creditEntry.origAmount" from-field="costComponent.cost"/> + <set field="creditEntry.origCurrencyUomId" from-field="facility.currencyUomId"/> + <set field="acctgTransEntries[]" from-field="creditEntry" type="Object"/> + <!-- Debit --> + <make-value entity-name="AcctgTransEntry" value-name="debitEntry"/> + <set field="debitEntry.debitCreditFlag" value="D"/> + <if-not-empty field-name="costComponentCalc.offsettingGlAccountTypeId"> + <set field="debitEntry.glAccountTypeId" value="costComponentCalc.offsettingGlAccountTypeId"/> + <else> + <set field="debitEntry.glAccountTypeId" value="WIP_INVENTORY"/> + </else> + </if-not-empty> + <set field="debitEntry.organizationPartyId" from-field="facility.ownerPartyId"/> + <set field="debitEntry.productId" from-field="workEffortGoodStandard.productId"/> + <set field="debitEntry.origAmount" from-field="costComponent.cost"/> + <set field="debitEntry.origCurrencyUomId" from-field="facility.currencyUomId"/> + <set field="acctgTransEntries[]" from-field="debitEntry" type="Object"/> + <!-- Set header fields (AcctgTrans) --> + <set field="createAcctgTransAndEntriesInMap.workEffortId" from-field="parameters.workEffortId"/> + <set field="createAcctgTransAndEntriesInMap.acctgTransTypeId" value="MANUFACTURING"/> + <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=600766&r1=600765&r2=600766&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml Mon Dec 3 17:47:51 2007 @@ -49,4 +49,10 @@ <action service="createAcctgTransForWorkEffortInventoryProduced" mode="sync"/> </eca> + <eca service="createWorkEffortInventoryProduced" event="commit"> + <condition field-name="workEffortId" operator="is-not-empty"/> + <condition field-name="costComponentTypeId" operator="not-equals" value="ACTUAL_MAT_COST"/> + <action service="createAcctgTransForWorkEffortCost" 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=600766&r1=600765&r2=600766&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Mon Dec 3 17:47:51 2007 @@ -392,4 +392,14 @@ <attribute name="inventoryItemId" type="String" mode="IN" optional="false"/> <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/> </service> + + <!--Accounting transaction for cost record related to work effort--> + <service name="createAcctgTransForWorkEffortCost" engine="simple" auth="true" + location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForWorkEffortCost"> + <description>Create an accounting transaction for cost record created for a work effort</description> + <attribute name="workEffortId" type="String" mode="IN" optional="false"/> + <attribute name="costComponentId" type="String" mode="IN" optional="false"/> + <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/> + </service> + </services> |
Free forum by Nabble | Edit this page |