DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PAYROLL_CONTACT_PKG

Source


1 PACKAGE BODY pay_payroll_contact_pkg AS
2 /* $Header: pycoprco.pkb 120.0 2005/05/29 04:08:44 appldev noship $ */
3 
4 
5 --
6   /* Name      : range_cursor
7      Purpose   : This returns the select statement that is used to created the
8                  range rows.
9      Arguments :
10      Notes     :
11   */
12 procedure range_cursor (pactid in number, sqlstr out nocopy varchar2) is
13 begin
14 --
15        sqlstr := 'select  distinct asg.person_id
16                   from
17                           per_all_assignments_f      asg,
18                           pay_payroll_actions    pa1
19                    where  pa1.payroll_action_id    = :payroll_action_id
20                    and    asg.business_group_id    = pa1.business_group_id
21                   order by asg.person_id';
22 --
23 end range_cursor;
24 --
25  /* Name    : action_creation
26   Purpose   : This creates the assignment actions for a specific chunk.
27   Arguments :
28   Notes     :
29  */
30 --
31 procedure action_creation(p_pactid in number,
32                           p_stperson in number,
33                           p_endperson in number,
34                           p_chunk in number) is
35 --
36   cursor c_bgp_asg (cp_pactid number,
37                     cp_stperson  number,
38                     cp_endperson number
39                    ) is
40   select distinct paf.assignment_id
41     from per_periods_of_service pos,
42          per_all_assignments_f      paf,
43          pay_payroll_actions    ppa
44    where ppa.payroll_action_id = cp_pactid
45      and ppa.business_group_id = paf.business_group_id
46      and pos.period_of_service_id = paf.period_of_service_id
47      and pos.person_id between cp_stperson and cp_endperson;
48 --
49 l_action_id pay_assignment_actions.assignment_action_id%type;
50 --
51 begin
52 --
53   for asgrec in c_bgp_asg(p_pactid, p_stperson, p_endperson) loop
54 --
55      select pay_assignment_actions_s.nextval
56        into l_action_id
57        from dual;
58 --
59       hr_nonrun_asact.insact(lockingactid       => l_action_id,
60                              pactid             => p_pactid,
61                              chunk              => p_chunk,
62                              object_id          => asgrec.assignment_id,
63                              object_type        => 'ASG',
64                              p_transient_action => TRUE);
65 --
66   end loop;
67 --
68 end action_creation;
69 --
70  /* Name      : archinit
71     Purpose   : This performs the US specific initialisation section.
72     Arguments :
73     Notes     :
74  */
75 procedure archinit(p_payroll_action_id in number) is
76       jurisdiction_code      pay_state_rules.jurisdiction_code%TYPE;
77       l_state                VARCHAR2(30);
78 begin
79    null;
80 end archinit;
81 --
82 
83   /* Name      : process_data
84      Purpose   :
85      Arguments :
86      Notes     :
87   */
88 procedure process_data(p_assactid in number, p_effective_date in date) is
89 --
90 cursor c_asg_id(p_ass_act_id number
91                ,p_eff_date date)
92 is
93 select paf.assignment_id
94 ,      paf.business_group_id
95 from   pay_temp_object_actions toa
96 ,      per_all_assignments_f paf
97 where  toa.object_action_id = p_ass_act_id
98 and    toa.object_type = 'ASG'
99 and    toa.object_id = paf.assignment_id
100 and    p_eff_date between paf.effective_start_date
101                       and paf.effective_end_date;
102 --
103 l_assignment_id  number;
104 l_bg_id          number;
105 l_formula_id     number;
106 l_effective_date date;
107 l_inputs         ff_exec.inputs_t;
108 l_outputs        ff_exec.outputs_t;
109 l_loop_cnt       number;
110 l_in_cnt         number;
111 l_out_cnt        number;
112 --
113 BEGIN
114 --
115 select
116 pay_core_utils.get_parameter('FORM_ID', ppa.legislative_parameters)
117 into l_formula_id
118 from pay_payroll_actions ppa
119 ,    pay_temp_object_actions toa
120 where ppa.payroll_action_id = toa.payroll_action_id
121 and   toa.object_action_id = p_assactid;
122 --
123 l_effective_date := p_effective_date;
124 open c_asg_id(p_assactid,p_effective_date);
125 fetch c_asg_id into l_assignment_id, l_bg_id;
126 if c_asg_id%notfound then
127   --
128   hr_utility.trace('no assignment found');
129   --
130   close c_asg_id;
131 else
132   close c_asg_id;
133   --
134   -- Initialise the formula.
135   --
136   ff_exec.init_formula(l_formula_id, l_effective_date, l_inputs, l_outputs);
137   --
138   -- We are now in a position to execute the formula.
139   -- Setup the inputs table
140   --
141   for l_in_cnt in l_inputs.first..l_inputs.last loop
142     if(l_inputs(l_in_cnt).name = 'ASSIGNMENT_ID') then
143       l_inputs(l_in_cnt).value := l_assignment_id;
144     elsif (l_inputs(l_in_cnt).name = 'DATE_EARNED') then
145       l_inputs(l_in_cnt).value := fnd_date.date_to_canonical(l_effective_date);
146     elsif (l_inputs(l_in_cnt).name = 'BUSINESS_GROUP_ID') then
147       l_inputs(l_in_cnt).value := l_bg_id;
148     end if;
149   end loop;
150   --
151   -- run the formula
152   --
153   ff_exec.run_formula(l_inputs, l_outputs);
154   --
155 end if;
156 end process_data;
157 
158   /* Name      : deinitialise
159      Purpose   : This procedure simply removes all the actions processed
160                  in this run
161      Arguments :
162      Notes     :
163   */
164   procedure deinitialise (pactid in number)
165   is
166 --
167     l_remove_act     varchar2(10);
168     cnt_incomplete_actions number;
169     l_bus_grp_id pay_payroll_actions.business_group_id%type;
170     l_leg_code   per_business_groups.legislation_code%type;
171   begin
172 --
173      select
174             pay_core_utils.get_parameter('REMOVE_ACT',
175                                          ppa.legislative_parameters),
176             ppa.business_group_id,
177             pbg.legislation_code
178        into
179             l_remove_act,
180             l_bus_grp_id,
181             l_leg_code
182        from pay_payroll_actions ppa,
183             per_business_groups pbg
184       where ppa.payroll_action_id = pactid
185         and pbg.business_group_id = ppa.business_group_id;
186 --
187      select count(*)
188        into cnt_incomplete_actions
189        from pay_temp_object_actions
190       where payroll_action_id = pactid
191         and action_status <> 'C';
192 --
193 --
194       if (cnt_incomplete_actions = 0) then
195 --
196          if (l_remove_act is null or l_remove_act = 'Y') then
197            pay_archive.remove_report_actions(pactid);
198          end if;
199       end if;
200 --
201 end deinitialise;
202 --
203 END pay_payroll_contact_pkg;