protected String doIt() throws Exception {
  setup();
  for (  MWarehouse warehouse : warehouses)   for (  MCostType costType : costTypes)   for (  MCostElement costElement : costElements)   for (  int productId : products)   generateInventoryValue(productId,costType.getM_CostType_ID(),costElement.getM_CostElement_ID(),warehouse.getM_Warehouse_ID());
  pstmt.executeBatch();
  commitEx();
  DB.close(pstmt);
  DB.executeUpdate("UPDATE T_InventoryValue SET Cost = CASE WHEN QtyOnHand <> 0 THEN (CostAmt + CostAmtLL) / QtyOnHand ELSE  0 END  ,  CumulatedAmt = CASE WHEN QtyOnHand <> 0  THEN  CostAmt + CostAmtLL ELSE 0 END ,  DateValue = " + DB.TO_DATE(p_DateValue) + " WHERE AD_PInstance_ID=?",getAD_PInstance_ID(),get_TrxName());
  return "@Ok@ " + count;
}

protected String doIt ( ) throws Exception { setup ( ) ; for ( MWarehouse warehouse : warehouses ) for ( MCostType costType : costTypes ) for ( MCostElement costElement : costElements ) for ( int productId : products ) generateInventoryValue ( productId , costType . getM_CostType_ID ( ) , costElement . getM_CostElement_ID ( ) , warehouse . getM_Warehouse_ID ( ) ) ; pstmt . executeBatch ( ) ; commitEx ( ) ; DB . close ( pstmt ) ; DB . executeUpdate ( "UPDATE T_InventoryValue SET Cost = CASE WHEN QtyOnHand <> 0 THEN (CostAmt + CostAmtLL) / QtyOnHand ELSE  0 END  ,  CumulatedAmt = CASE WHEN QtyOnHand <> 0  THEN  CostAmt + CostAmtLL ELSE 0 END ,  DateValue = " + DB . TO_DATE ( p_DateValue ) + " WHERE AD_PInstance_ID=?" , getAD_PInstance_ID ( ) , get_TrxName ( ) ) ; return "@Ok@ " + count ; }
execute the valuation effective date
