/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2012 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

SET VERIFY OFF
SET FEEDBACK OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK

CREATE OR REPLACE FORCE VIEW xxas_perf_plan_enrollments_v
AS
SELECT xppe.perf_plan_enrollment_id
      ,xppe.perf_plan_id
      ,xppe.person_id
      ,xppe.assignment_id
      ,xppe.title
      ,xppe.creator_type
      ,xppe.status_code
      ,fl.meaning      status_meaning
      ,xppe.start_date
      ,xppe.end_date
      ,xppe.created_by
      ,xppe.creation_date
      ,xppe.last_update_date
      ,xppe.last_updated_by
      ,xppe.last_update_login
      ,xppe.goal_setting_status_code
      ,f2.meaning   goal_setting_status_meaning
      ,xppe.attribute_category
      ,xppe.attribute1
      ,xppe.attribute2
      ,xppe.attribute3
      ,xppe.attribute4
      ,xppe.attribute5
      ,xppe.attribute6
      ,xppe.attribute7
      ,xppe.attribute8
      ,xppe.attribute9
      ,xppe.attribute10
      ,xppe.attribute11
      ,xppe.attribute12
      ,xppe.attribute13
      ,xppe.attribute14
      ,xppe.attribute15
      ,xppe.attribute16
      ,xppe.attribute17
      ,xppe.attribute18
      ,xppe.attribute19
      ,xppe.attribute20
      ,xppe.attribute21
      ,xppe.attribute22
      ,xppe.attribute23
      ,xppe.attribute24
      ,xppe.attribute25
      ,xppe.attribute26
      ,xppe.attribute27
      ,xppe.attribute28
      ,xppe.attribute29
      ,xppe.attribute30
FROM  xxas_perf_plan_enrollments xppe
     ,hr_lookups fl
     ,hr_lookups f2
WHERE  xppe.status_code = fl.lookup_code(+)
AND    fl.lookup_type (+) = 'XXAS_PERF_PLAN_ENROL_STATUS'
AND    xppe.goal_setting_status_code = f2.lookup_code(+)
AND    f2.lookup_type (+) = 'XXAS_PERF_ENROL_GOAL_STATUS';

BEGIN
  xxas_fnd_dictionary_pkg.add_view
   (p_application_short_name => xxas_util_pkg.app
   ,p_view_name              => 'XXAS_PERF_PLAN_ENROLLMENTS_V'
   ,p_description            => 'Applaud Performance Plan Enrollment View');
END;
/
COMMIT;
EXIT;
