svn commit: r600844 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml servicedef/secas_ledger.xml servicedef/services_ledger.xml

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

svn commit: r600844 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml servicedef/secas_ledger.xml servicedef/services_ledger.xml

apatel-2
Author: apatel
Date: Tue Dec  4 00:57:55 2007
New Revision: 600844

URL: http://svn.apache.org/viewvc?rev=600844&view=rev
Log:
Implement an automatic GL posting service triggered when inventory is issued to a work effort, Jira issue 1473 and 1474.

Thanks Sachin Chourasia 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=600844&r1=600843&r2=600844&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 Dec  4 00:57:55 2007
@@ -868,5 +868,63 @@
         </call-service>
         <field-to-result field-name="acctgTransId" result-name="acctgTransId"/>
     </simple-method>
-
+    <!--automatic GL posting service triggered when inventory is issued to a work effort-->
+  
+    <simple-method method-name="createAcctgTransForWorkEffortIssuance" short-description="Create an accounting transaction for inventory that is issued to a work effort (Type: INVENTORY D: RAWMAT_INVENTORY, C: WIP_INVENTORY)">
+        <!-- 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"/>
+        <log level="info" message="Using ledger decimals [${ledgerDecimals}] and rounding [${roundingMode}]"/>
+        <entity-one entity-name="WorkEffort" value-name="workEffort">
+            <field-map field-name="workEffortId" env-name="parameters.workEffortId"/>
+        </entity-one>
+        <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>
+        <entity-one entity-name="WorkEffortInventoryAssign" value-name="workEffortInventoryAssign">
+            <field-map field-name="workEffortId" env-name="parameters.workEffortId"/>
+            <field-map field-name="inventoryItemId" env-name="parameters.inventoryItemId"/>
+        </entity-one>        
+        <get-related-one value-name="workEffortInventoryAssign" relation-name="InventoryItem" to-value-name="inventoryItem"/>
+        <!-- TODO: handle serialized inventory -->
+        <calculate field-name="origAmount" type="BigDecimal" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
+            <calcop operator="multiply">
+                <calcop operator="get" field-name="workEffortInventoryAssign.quantity"/>
+                <calcop operator="get" field-name="inventoryItem.unitCost"/>
+            </calcop>
+        </calculate>
+        <!--Credit -->
+        <make-value entity-name="AcctgTransEntry" value-name="creditEntry"/>
+        <set field="creditEntry.debitCreditFlag" value="C"/>
+        <set field="creditEntry.glAccountTypeId" value="WIP_INVENTORY"/>
+        <set field="creditEntry.organizationPartyId" from-field="inventoryItem.ownerPartyId"/>
+        <set field="creditEntry.productId" from-field="workEffortGoodStandard.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="RAWMAT_INVENTORY"/>
+        <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.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=600844&r1=600843&r2=600844&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml Tue Dec  4 00:57:55 2007
@@ -60,5 +60,9 @@
         <condition-field field-name="ownerPartyId" operator="not-equals" to-field-name="oldOwnerPartyId"/>
         <action service="createAcctgTransForInventoryItemOwnerChange" mode="sync"/>
     </eca>
+    
+    <eca service="assignInventoryToWorkEffort" event="commit">
+        <action service="createAcctgTransForWorkEffortIssuance" 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=600844&r1=600843&r2=600844&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Tue Dec  4 00:57:55 2007
@@ -376,7 +376,13 @@
         <description>Basic General Ledger Permission Checking Logic</description>
         <implements service="permissionInterface"/>
     </service>
-
+    <service name="createAcctgTransForWorkEffortIssuance" engine="simple" auth="true"
+        location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForWorkEffortIssuance">
+        <description>Create an accounting transaction for inventory that is issued to a work effort (Type: INVENTORY D: RAWMAT_INVENTORY, C: WIP_INVENTORY)</description>
+        <attribute name="workEffortId" type="String" mode="IN" optional="false"/>
+        <attribute name="inventoryItemId" type="String" mode="IN" optional="false"/>
+        <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
+    </service>
 <!-- Service for the automatic creation of AcctgTransForPhysicalInventoryVariance, triggered by SECAs -->
     <service name="createAcctgTransForPhysicalInventoryVariance" engine="simple"
                 location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForPhysicalInventoryVariance">