SELECT EAC_PK, EAC_EVENT, EAC_ACT,
(SELECT uco_desc FROM r5ucodes where uco_code = EAC_TYPE and uco_rentity = 'ATTP') EAC_TYPE_DESC,
EAC_DATEWORKED, EAC_VMRS_DESC, EAC_ACTION_DESC,
EAC_QUANTITY, EAC_UOM, EAC_CREATEDBY, EAC_CREATED, EAC_UPDATEDBY, EAC_UPDATED
FROM R5EVENTACCOMPLISHMENTS WHERE EAC_EVENT = <param.jobnum>
ORDER BY EAC_ACT, EAC_DATEWORKED DESC, CASE EAC_TYPE WHEN 'P' THEN 1 WHEN 'A' THEN 2 END, EAC_VMRS_DESC, EAC_ACTION_DESC;
