/* $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_payslip_eei_v 
AS
SELECT eai.action_context_id
      ,eai.tax_unit_id
      ,eai.effective_date
      ,eai.assignment_id
      ,eai.full_name
      ,eai.organization_id
      ,eai.national_identifier
      ,eai.pay_basis
      ,eai.frequency
      ,eai.grade
      ,eai.bargaining_unit
      ,eai.collective_agreement
      ,eai.employee_number
      ,eai.employee_date_start
      ,eai.original_hire_date
      ,eai.adjusted_service_date
      ,eai.assignment_number
      ,eai.organization_name
      ,eai.employer_address1
      ,eai.employer_address2
      ,eai.employer_address3
      ,eai.employer_city
      ,eai.employer_state
      ,eai.employer_zip_code
      ,eai.employer_country
      ,eai.payroll_name
      ,eai.job
      ,eai.gre_name
      ,eai.position
      ,eai.location_name
      ,eai.contract
      ,eai.working_hours_start
      ,eai.working_hours_end
      ,eai.pay_calculation_method
      ,eai.shift
      ,eai.employer_phone_number
      ,eai.hourly_salaried_code
      ,eai.agreement_grade
      ,eai.employee_address1
      ,eai.employee_address2
      ,eai.employee_address3
      ,eai.employee_city
      ,eai.employee_state
      ,eai.employee_zip_code
      ,eai.employee_country
      ,eai.pay_rate
      ,eai.annual_salary
      ,eai.period_type
      ,eai.period_num
      ,eai.beginning_date
      ,eai.ending_date
      ,eai.payment_date
      ,eai.regular_payment_date
      ,pai.action_information_id pai_action_information_id
      ,pai.action_context_type pai_action_context_type
      ,pai.jurisdiction_code jurisdiction_code
      ,pai.source_id
      ,pai.source_text
      ,pai.action_information_category pai_category
      ,pai.action_information1 pai_action_information1
      ,pai.action_information2 pai_action_information2
      ,pai.action_information3 pai_action_information3
      ,pai.action_information4 pai_action_information4
      ,pai.action_information5 pai_action_information5
      ,pai.action_information6 pai_action_information6
      ,pai.action_information7 pai_action_information7
      ,pai.action_information8 pai_action_information8
      ,pai.action_information9 pai_action_information9
      ,pai.action_information10 pai_action_information10
      ,pai.action_information11 pai_action_information11
      ,pai.action_information12 pai_action_information12
      ,pai.action_information13 pai_action_information13
      ,pai.action_information14 pai_action_information14
      ,pai.action_information15 pai_action_information15
      ,pai.action_information16 pai_action_information16
      ,pai.action_information17 pai_action_information17
      ,pai.action_information18 pai_action_information18
      ,pai.action_information19 pai_action_information19
      ,pai.action_information20 pai_action_information20
      ,pai.action_information21 pai_action_information21
      ,pai.action_information22 pai_action_information22
      ,pai.action_information23 pai_action_information23
      ,pai.action_information24 pai_action_information24
      ,pai.action_information25 pai_action_information25
      ,pai.action_information26 pai_action_information26
      ,pai.action_information27 pai_action_information27
      ,pai.action_information28 pai_action_information28
      ,pai.action_information29 pai_action_information29
      ,pai.action_information30 pai_action_information30
      ,aai.action_context_type aai_action_context_type
      ,aai.action_information_category
      ,aai.action_information1 aai_action_information1
      ,aai.action_information2 aai_action_information2
      ,aai.action_information3 aai_action_information3
      ,aai.action_information4 aai_action_information4
      ,aai.action_information5 aai_action_information5
      ,aai.action_information6 aai_action_information6
      ,aai.action_information7 aai_action_information7
      ,aai.action_information8 aai_action_information8
      ,aai.action_information9 aai_action_information9
      ,aai.action_information10 aai_action_information10
      ,aai.action_information11 aai_action_information11
      ,aai.action_information12 aai_action_information12
      ,aai.action_information13 aai_action_information13
      ,aai.action_information14 aai_action_information14
      ,aai.action_information15 aai_action_information15
      ,aai.action_information16 aai_action_information16
      ,aai.action_information17 aai_action_information17
      ,aai.action_information18 aai_action_information18
      ,aai.action_information19 aai_action_information19
      ,aai.action_information20 aai_action_information20
FROM   pay_employee_action_info_v eai
      ,pay_action_information pai
      ,pay_addl_emp_action_info_v aai
WHERE  eai.action_context_id = pai.action_context_id
AND    pai.action_context_id = aai.action_context_id
AND    pai.action_context_type = 'AAP'
AND    pai.action_information_category = 'ADDRESS DETAILS'
AND    pai.action_information14 = 'Employee Address';

BEGIN
  xxas_fnd_dictionary_pkg.add_view
   (p_application_short_name => xxas_util_pkg.app
   ,p_view_name              => 'XXAS_PAYSLIP_EEI_V'
   ,p_description            => 'Applaud Payslip EEI');
END;
/

COMMIT;
EXIT;
