/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2013 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 VIEW xxas_salary_basis_v
AS
select ppb.pay_basis_id id
      ,ppb.name value
      ,ppb.pay_basis
      ,ppb.pay_annualization_factor
      ,ppb.rate_id
      ,pet.input_currency_code as currency_code
      ,piv.uom
      ,ppb.name as sort_order2 
      ,ppb.rate_basis
      ,ppb.grade_annualization_factor
      ,ppb.business_group_id
from  per_pay_bases ppb
	 ,pay_input_values_f piv
	 ,pay_element_types_f pet
where ppb.input_value_id = piv.input_value_id
and   piv.element_type_id = pet.element_type_id
and  TRUNC(SYSDATE) between pet.effective_start_date and pet.effective_end_date
and  TRUNC(SYSDATE) between piv.effective_start_date and piv.effective_end_date
/*AND  ppb.business_group_id = (SELECT business_group_id FROM per_all_people_f WHERE person_id = fnd_global.employee_id
                              AND trunc(sysdate) BETWEEN effective_start_date AND effective_end_date)*/
order by sort_order2;

BEGIN
  xxas_fnd_dictionary_pkg.add_view
   (p_application_short_name => xxas_util_pkg.app
   ,p_view_name              => 'xxas_salary_basis_v'
   ,p_description            => 'Applaud Salary Basis View');
END;
/

COMMIT;
EXIT;
