Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Trunk
-
None
-
None
Description
The name of the service can be "createAcctgTransForPhysicalInventoryVariance" or similar.
Input field: physicalInventoryId
Output field: acctgTransId
We can use the following template for this service: createAcctgTransForShipmentReceipt in GeneralLedgerServices.xml
The service is triggered by a SECA rule on createPhysicalInventoryAndVariance
The service will do the following tasks:
1) select all the InventoryItemDetails for the given physicalInventoryId
2) iterate the list of InventoryItemDetails and for each InventoryItemDetail:
2a) select the associated InventoryItem
2b) compute the following amount: origAmount = InventoryItemDetail.quantityOnHandDiff * InventoryItem.unitCost
2c) create one AcctgTransEntry for the credit: debitCreditFlag=C, glAcctgTransTypeId=InventoryItemDetail.reasonId, productId=InventoryItem.productId, origAmount=(the value computed in 2b), origCurrencyUomId=InventoryItem.currencyUomId, organizationPartyId=InventoryItem.ownerPartyId
2d) create one AcctgTransEntry for the debit: debitCreditFlag=D, glAcctgTransTypeId=INVENTORY_ACCOUNT, productId=InventoryItem.productId, origAmount=(the value computed in 2b), origCurrencyUomId=InventoryItem.currencyUomId, organizationPartyId=InventoryItem.ownerPartyId
2e) put the two entries in a list (go back to 2a)
3) when the iteration is done, call the createAcctgTransAndEntries with the following fields: acctgTransTypeId=ITEM_VARIANCE_ACCTG_, acctgTransEntries=(the list at 2e), physicalInventoryId=parameters.physicalInventoryId, glFiscalTypeId=ACTUAL
the ECA will be:
<eca service="createPhysicalInventoryAndVariance" event="commit">
<condition field-name="physicalInventoryId" operator="is-not-empty"/>
<action service="createAcctgTransForPhysicalInventoryVariance" mode="sync"/>
</eca>
You can then test the service when you go into an Inventory Item in the facility, and perform a manual inventory variance.