/* Bom State Explorer */
SELECT bo.BOM_ID,
	   bn.BOM_NAME,
	   bo.BOM_VERSION,
	   bo.BOM_LIFECYCLE,
	   bo.IS_READONLY,
	   bo.IS_REJECTED,
	   bo.BOM_COMMENTS,
	   bs.DATE_STAMP AS ARRIVED_DATE,
	   bs.IS_DISPLAYED,
	   usr.FULL_NAME,
	   usr.USER_EMAIL
  FROM BOMS bo,
  	   BOM_STATE bs,
	   BOM_NAMES bn,
	   USERS usr
 WHERE bo.BOM_NAME_ID = bn.BOM_NAME_ID
   AND bs.BOM_ID = bo.BOM_ID
   AND bo.BRANCH_ID = :BRANCH_ID
   AND bs.STATE_ID = :STATE_ID
   AND bs.USER_ID = usr.USER_ID	 
   AND bo.IS_HIDDEN = 'N' 
 ORDER BY UPPER(bn.BOM_NAME), 
		  UPPER(bo.BOM_VERSION ||'.'|| bo.BOM_LIFECYCLE) DESC
