/* $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_review_templates_v
AS
SELECT xprt.perf_review_template_id
      ,xxas_com_msg_pkg.get_string(xprt.title_message)  title
      ,xprt.title_message
      ,xxas_com_msg_pkg.get_string(xprt.description_message)  description 
      ,xprt.description_message
      ,(SELECT COUNT(1) FROM xxas_perf_review_forms WHERE perf_review_template_id = xprt.perf_review_template_id) "TEMPLATE_USAGE"
      ,xprt.enabled_flag
      ,xprt.questionnaire_dff_structure
      ,xprt.created_by
      ,xprt.creation_date
      ,xprt.last_update_date
      ,xprt.last_updated_by
      ,xprt.last_update_login
FROM  xxas_perf_review_templates xprt;
BEGIN
  xxas_fnd_dictionary_pkg.add_view
   (p_application_short_name => xxas_util_pkg.app
   ,p_view_name              => 'XXAS_PERF_REVIEW_TEMPLATES_V'
   ,p_description            => 'Applaud Performance Review Template View');
END;
/
COMMIT;
EXIT;
