DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_MX_FINAL_PROCESS_EMP

Source


1 package body hrdpp_MX_FINAL_PROCESS_EMP as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2007/01/03 23:01:24
4  * Generated for API: HR_MX_EX_EMPLOYEE_API.MX_FINAL_PROCESS_EMP
5  */
6 --
7 dh constant date := hr_api.g_date;
8 nh constant number := hr_api.g_number;
9 vh constant varchar2(64) := hr_api.g_varchar2;
10 c_sot constant date := to_date('01010001','DDMMYYYY');
11 cn constant varchar2(32) := '<NULL>';
12 dn constant date := null;
13 nn constant number := null;
14 vn constant varchar2(1) := null;
15 --
16 function dc(p in date) return varchar2 is
17 begin
18 if p<c_sot then
19  if p<>trunc(p) then
20   return to_char(p,'SYYYY/MM/DD HH24:MI:SS');
21  end if;
22  return to_char(p,'SYYYY/MM/DD');
23 elsif p<>trunc(p) then
24  return to_char(p,'YYYY/MM/DD HH24:MI:SS');
25 end if;
26 return to_char(p,'YYYY/MM/DD');
27 end dc;
28 function d(p in varchar2) return date is
29 begin
30 if length(p)=10 then
31 return to_date(p,'YYYY/MM/DD');
32 elsif length(p)=19 then
33 return to_date(p,'YYYY/MM/DD HH24:MI:SS');
34 elsif length(p)=11 then
35 return to_date(p,'SYYYY/MM/DD');
36 elsif length(p)=20 then
37 return to_date(p,'SYYYY/MM/DD HH24:MI:SS');
38 end if;
39 -- Try default format as last resort.
40 return to_date(p,'YYYY/MM/DD');
41 end d;
42 function n(p in varchar2) return number is
43 begin
44 return to_number(p);
45 end n;
46 function dd(p in date,i in varchar2)
47 return varchar2 is
48 begin
49 if upper(i) = 'N' then return dc(p);
50 else return cn; end if;
51 end dd;
52 function nd(p in number,i in varchar2)
53 return varchar2 is
54 begin
55 if upper(i) = 'N' then return to_char(p);
56 else return cn; end if;
57 end nd;
58 --
59 procedure iuk
60 (p_batch_line_id  in number,
61 p_user_key_value in varchar2,
62 p_unique_key_id  in number)
63 is
64 begin
65 hr_data_pump.entry('ins_user_key');
66 insert into hr_pump_batch_line_user_keys
67 (user_key_id, batch_line_id,user_key_value,unique_key_id)
68 values
69 (hr_pump_batch_line_user_keys_s.nextval,
70 p_batch_line_id,
71 p_user_key_value,
72 p_unique_key_id);
73 hr_data_pump.exit('ins_user_key');
74 end iuk;
75 --
76 procedure insert_batch_lines
77 (p_batch_id      in number
78 ,p_data_pump_batch_line_id in number default null
79 ,p_data_pump_business_grp_name in varchar2 default null
80 ,p_user_sequence in number default null
81 ,p_link_value    in number default null
82 ,P_SS_LEAVING_REASON in varchar2 default null
83 ,P_FINAL_PROCESS_DATE in date
84 ,P_PERSON_USER_KEY in varchar2) is
85 blid number := p_data_pump_batch_line_id;
86 begin
87 if blid is not null then
88 delete from hr_pump_batch_lines where batch_line_id = blid;
89 delete from hr_pump_batch_exceptions
90 where source_type = 'BATCH_LINE' and source_id = blid;
91 end if;
92 insert into hr_pump_batch_lines
93 (batch_id
94 ,batch_line_id
95 ,business_group_name
96 ,api_module_id
97 ,line_status
98 ,user_sequence
99 ,link_value
100 ,pval001
101 ,pval002
102 ,pval006)
103 values
104 (p_batch_id
105 ,nvl(blid,hr_pump_batch_lines_s.nextval)
106 ,p_data_pump_business_grp_name
107 ,3863
108 ,'U'
109 ,p_user_sequence
110 ,p_link_value
111 ,P_SS_LEAVING_REASON
112 ,dc(P_FINAL_PROCESS_DATE)
113 ,P_PERSON_USER_KEY);
114 end insert_batch_lines;
115 --
116 procedure call
117 (p_business_group_id in number,
118 p_batch_line_id     in number) is
119 cursor cr is
120 select l.rowid myrowid,
121 decode(l.pval001,cn,vn,vn,vh,
122  hr_pump_get.gl(l.pval001,'MX_STAT_IMSS_LEAVING_REASON',dn,vn)) p1,
123 l.pval001 d1,
124 decode(l.pval002,cn,dn,d(l.pval002)) p2,
125 l.pval003 p3,
126 l.pval004 p4,
127 l.pval005 p5,
128 decode(l.pval006,cn,vn,l.pval006) p6
129 from hr_pump_batch_lines l
130 where l.batch_line_id = p_batch_line_id;
131 --
132 c cr%rowtype;
133 l_validate boolean := false;
134 L_ORG_NOW_NO_MANAGER_WARNING boolean;
135 L_ASG_FUTURE_CHANGES_WARNING boolean;
136 L_PERIOD_OF_SERVICE_ID number;
137 L_OBJECT_VERSION_NUMBER number;
138 --
139 begin
140 hr_data_pump.entry('call');
141 open cr;
142 fetch cr into c;
143 if cr%notfound then
144 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
145 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
146 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
147 hr_utility.set_message_token('VALUE',p_batch_line_id);
148 hr_utility.raise_error;
149 end if;
150 --
151 if c.p6 is null then
152 L_PERIOD_OF_SERVICE_ID:=nn;
153 else
154 L_PERIOD_OF_SERVICE_ID := 
155 hr_pump_get.GET_FP_PERIOD_OF_SERVICE_ID
156 (P_PERSON_USER_KEY => c.p6
157 ,P_BUSINESS_GROUP_ID => P_BUSINESS_GROUP_ID);
158 end if;
159 --
160 if c.p6 is null then
161 L_OBJECT_VERSION_NUMBER:=nn;
162 else
163 L_OBJECT_VERSION_NUMBER := 
164 hr_pump_get.GET_FP_PERIOD_OF_SERVICE_OVN
165 (P_PERSON_USER_KEY => c.p6
166 ,P_BUSINESS_GROUP_ID => P_BUSINESS_GROUP_ID);
167 end if;
168 --
169 hr_data_pump.api_trc_on;
170 HR_MX_EX_EMPLOYEE_API.MX_FINAL_PROCESS_EMP
171 (p_validate => l_validate
172 ,P_PERIOD_OF_SERVICE_ID => L_PERIOD_OF_SERVICE_ID
173 ,P_SS_LEAVING_REASON => c.p1
174 ,P_OBJECT_VERSION_NUMBER => L_OBJECT_VERSION_NUMBER
175 ,P_FINAL_PROCESS_DATE => c.p2
176 ,P_ORG_NOW_NO_MANAGER_WARNING => L_ORG_NOW_NO_MANAGER_WARNING
177 ,P_ASG_FUTURE_CHANGES_WARNING => L_ASG_FUTURE_CHANGES_WARNING
178 ,P_ENTRIES_CHANGED_WARNING => c.p5);
179 hr_data_pump.api_trc_off;
180 --
181 if L_ORG_NOW_NO_MANAGER_WARNING then
182 c.p3 := 'TRUE';
183 else
184 c.p3 := 'FALSE';
185 end if;
186 --
187 if L_ASG_FUTURE_CHANGES_WARNING then
188 c.p4 := 'TRUE';
189 else
190 c.p4 := 'FALSE';
191 end if;
192 --
193 update hr_pump_batch_lines l set
194 l.pval002 = decode(c.p2,null,cn,dc(c.p2)),
195 l.pval003 = decode(c.p3,null,cn,c.p3),
196 l.pval004 = decode(c.p4,null,cn,c.p4),
197 l.pval005 = decode(c.p5,null,cn,c.p5)
198 where l.rowid = c.myrowid;
199 --
200 close cr;
201 --
202 hr_data_pump.exit('call');
203 exception
204  when hr_multi_message.error_message_exist then
205    if cr%isopen then
206     close cr;
207    end if;
208    hr_pump_utils.set_multi_msg_error_flag(true);
209  when others then
210  if cr%isopen then
211   close cr;
212  end if;
213  raise;
214 end call;
215 end hrdpp_MX_FINAL_PROCESS_EMP;