DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_CPDF_CHECK7

Source


1 package body GHR_CPDF_CHECK7 as
2 /* $Header: ghcpdf07.pkb 120.7.12000000.4 2007/04/20 09:25:51 utokachi noship $ */
3 
4    max_basic_pay		number(10,2);
5    min_basic_pay		number(10,2);
6 
7 -- PRIOR BASIC PAY
8 
9 procedure chk_prior_basic_pay
10   (p_prior_pay_plan			 	in	varchar2	/* Non-SF52 Data Item */
11   ,p_pay_determinant_code                 in    varchar2
12   ,p_prior_pay_rate_det_code		      in	varchar2	/* Non-SF52 Data Item */
13   ,p_prior_basic_pay				in	varchar2	/* Non-SF52 Data Item */
14   ,p_retained_pay_plan				in 	varchar2	/* Non-SF52 Data Item */
15   ,p_retained_grade				in 	varchar2	/* Non-SF52 Data Item */
16   ,p_retained_step				in	varchar2	/* Non-SF52 Data Item */
17   ,p_agency_subelement				in	varchar2	/* Non-SF52 Data Item */
18   ,p_prior_grade_or_level			in	varchar2	/* Non-SF52 Data Item */
19   ,p_prior_step_or_rate				in 	varchar2	/* Non-SF52 Data Item */
20   ,p_prior_pay_basis				in 	varchar2	/* Non-SF52 Data Item */
21   ,p_first_noac_lookup_code			in  	varchar2
22   ,p_to_basic_pay	                        in    varchar2
23   ,p_to_pay_basis	                        in    varchar2
24   ,P_effective_date				in 	date
25   ,p_prior_effective_date                 in    date
26   ) is
27 
28 l_table_pay				   pay_user_column_instances_f.value%type;
29 begin
30  hr_utility.set_location('before call to get basic pay',1);
31    hr_utility.set_location('eff date '|| p_prior_effective_date,1);
32    hr_utility.set_location('grade '|| p_prior_grade_or_level,1);
33    hr_utility.set_location('Step '|| p_prior_step_or_rate,1);
34    l_table_pay := GHR_CPDF_CHECK.get_basic_pay(
35                                  '0000 Oracle Federal Standard Pay Table (AL, ES, EX, GS, GG) No. 0000',
36                                  'GS' || '-' || p_prior_grade_or_level,
37                                  p_prior_step_or_rate,
38                                  p_prior_effective_date);
39  hr_utility.set_location('after call to get basic pay',1);
40 
41 -- 570.02.2
42 -- Venkat 06/08/03
43 -- This edit bypassed when the 866 action and Temporary Promotion Step is not null
44 --
45 -- Madhuri    19-MAY-04   From the Start      Including the Pay Plan VP in Prior Pay Plan list
46 --
47 IF GHR_GHRWS52L.g_temp_step is NULL
48 OR (GHR_GHRWS52L.g_temp_step is NOT NULL
49     AND p_first_noac_lookup_code <> '866' ) THEN
50   if (
51 	p_prior_pay_plan in ('GS','VP') and (p_prior_pay_rate_det_code = '0' or
52        p_prior_pay_rate_det_code= '7') and
53 	(p_prior_grade_or_level between '01' and '15') and
54 	(p_prior_step_or_rate between '01' and '10')
55      ) then
56 	  if not (
57 		    (l_table_pay = to_number(p_prior_basic_pay)) or
58                 (p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0)
59 	 	   ) then
60        GHR_GHRWS52L.CPDF_Parameter_Check;
61 	    hr_utility.set_message(8301,'GHR_37746_ALL_PROCEDURE_FAIL');
62 	    hr_utility.raise_error;
63 	  end if;
64   end if;
65 END IF;
66 
67 -- 570.23.2
68   if  (p_prior_pay_plan = 'FG'  and
69        (
70 	  p_prior_pay_rate_det_code = '0' or
71         p_prior_pay_rate_det_code = '7'
72        ) and
73 	  (p_prior_grade_or_level between '01' and '15') and
74 	  (p_prior_step_or_rate between '01' and '10')
75 
76        ) then
77 	  if not (l_table_pay = to_number(p_prior_basic_pay) or
78                (p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0)) then
79            GHR_GHRWS52L.CPDF_Parameter_Check;
80            hr_utility.set_message(8301,'GHR_37708_ALL_PROCEDURE_FAIL');
81            hr_utility.raise_error;
82 	  end if;
83   end if;
84 
85 -- 570.28.2
86 --            12/8/00   vravikan    From the Start         Add 871 to 'other than' (not equal to ) list
87 --            08/19/02  vravikan    From the Start         Added one more and condition
88 --                                                          prior_pay_basis = to_pay_basis
89 --            30/10/03  Ashley      From the Start         Added nature of action 849 to the list
90 --            01/30/04  Venkat      From the Start         Excluded SES Pay Plans
91 -- upd50      06-Feb-07	 Raju       From 01-Oct-2006	   Bug#5745356 delete NOA 849
92 -- upd51     06-Feb-07  Raju        From 01-Jan-2007	   Bug#5745356 delete 815-817, 825
93  --                                                        840-848,878-879. Add 890
94  -- upd53  20-Apr-07  Raju          From 01-Jan-2007	   Bug#5996938 added 815-817, 825
95  --                                                        827,840-849,878-879.
96 
97    if p_effective_date < fnd_date.canonical_to_date('2006/10/01') then
98        if (
99         (substr(p_first_noac_lookup_code,1,1) in ('7','8') and
100          p_first_noac_lookup_code not in
101          (	  '702','703','713','721','740','741','815','816','817','825','840','841',
102               '842','843','844','845','846','847','848','849','855','866','867','868',
103               '871','878','879','891','892','893','894','897' )
104           ) and
105             p_prior_pay_plan not in  ('ES','EP','IE','FE') and
106         (
107          ((p_prior_basic_pay is not null and to_number(p_prior_basic_pay) <> 0) and
108           (p_to_basic_pay is not null and to_number(p_to_basic_pay) <> 0) and
109               (p_prior_pay_basis = p_to_pay_basis) ) and
110            to_number(p_prior_basic_pay) <> to_number(p_to_basic_pay))
111          ) then
112            GHR_GHRWS52L.CPDF_Parameter_Check;
113          hr_utility.set_message(8301,'GHR_37713_ALL_PROCEDURE_FAIL');
114          hr_utility.set_message_token('NOA_CODE','702, 703, 713, 721, 740, 741, 815-817, 825, 840-849, 855, 866-868, 871,878-879, 891-894');
115          hr_utility.raise_error;
116       end if;
117     ELSif p_effective_date < fnd_date.canonical_to_date('2007/01/01') then
118       if (
119         (substr(p_first_noac_lookup_code,1,1) in ('7','8') and
120          p_first_noac_lookup_code not in
121          (	  '702','703','713','721','740','741','815','816','817','825','840','841',
122               '842','843','844','845','846','847','848','855','866','867','868',
123               '871','878','879','891','892','893','894' )
124           ) and
125             p_prior_pay_plan not in  ('ES','EP','IE','FE') and
126         (
127          ((p_prior_basic_pay is not null and to_number(p_prior_basic_pay) <> 0) and
128           (p_to_basic_pay is not null and to_number(p_to_basic_pay) <> 0) and
129               (p_prior_pay_basis = p_to_pay_basis) ) and
130            to_number(p_prior_basic_pay) <> to_number(p_to_basic_pay))
131          ) then
132            GHR_GHRWS52L.CPDF_Parameter_Check;
133          hr_utility.set_message(8301,'GHR_37713_ALL_PROCEDURE_FAIL');
134           hr_utility.set_message_token('NOA_CODE','702, 703, 713, 721, 740, 741, 815-817, 825, 840-848, 855, 866-868, 871,878-879, 891-894');
135          hr_utility.raise_error;
136       end if;
137      ELSE
138       if (
139         (substr(p_first_noac_lookup_code,1,1) in ('7','8') and
140          p_first_noac_lookup_code not in
141          (	  '702','703','713','721','740','741','815','816','817','825','827','840','841',
142               '842','843','844','845','846','847','848','849','855','866','867','868',
143               '871','878','879','890','891','892','893','894','896','897' )
144           ) and
145             p_prior_pay_plan not in  ('ES','EP','IE','FE') and
146         (
147          ((p_prior_basic_pay is not null and to_number(p_prior_basic_pay) <> 0) and
148           (p_to_basic_pay is not null and to_number(p_to_basic_pay) <> 0) and
149               (p_prior_pay_basis = p_to_pay_basis) ) and
150            to_number(p_prior_basic_pay) <> to_number(p_to_basic_pay))
151          ) then
152            GHR_GHRWS52L.CPDF_Parameter_Check;
153          hr_utility.set_message(8301,'GHR_37625_ALL_PROCEDURE_FAIL');
154          hr_utility.raise_error;
155       end if;
156     END IF;
157 
158 -- 570.50.2
159 -- Commented the edit in Dec'00 Patch.
160 -- Uncommented and modified the edit
161 -- Utokachi Modified on 24-oct-2005 Validate for actions after 01-MAY-2005
162 
163   IF p_effective_date >= to_date('2005/05/01','YYYY/MM/DD') THEN
164      if ( p_prior_pay_plan = 'GS' and
165           p_prior_pay_rate_det_code in ('5','6')
166         ) then
167           if ((to_number(p_prior_basic_pay) < to_number(l_table_pay)) and
168             (p_prior_basic_pay is not null and to_number(p_prior_basic_pay) <> 0)
169               ) then
170                GHR_GHRWS52L.CPDF_Parameter_Check;
171                hr_utility.set_message(8301,'GHR_37719_ALL_PROCEDURE_FAIL');
172                hr_utility.raise_error;
173           end if;
174       end if;
175   END IF;
176 
177 -- 570.80.2
178   if (
179 	p_prior_pay_plan = 'GG' and
180 	(
181 	 p_prior_grade_or_level between '01' and '15' and
182 	 p_prior_step_or_rate between '01' and '10' and
183 	 p_prior_pay_rate_det_code in ('0','7')
184 	)
185      ) then
186           l_table_pay := GHR_CPDF_CHECK.get_basic_pay(
187                                  '0000 Oracle Federal Standard Pay Table (AL, ES, EX, GS, GG) No. 0000',
188                                  'GG' || '-' || p_prior_grade_or_level,
189                                   p_prior_step_or_rate,
190                                   p_prior_effective_date);
191 	  if not (
192 	          p_prior_basic_pay = l_table_pay or (p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0)
193 	     	   ) then
194            GHR_GHRWS52L.CPDF_Parameter_Check;
195            hr_utility.set_message(8301,'GHR_37726_ALL_PROCEDURE_FAIL');
196            hr_utility.raise_error;
197 	  end if;
198   end if;
199 
200 /* Commenting the edit as per Sept.2000 patch -- refer to doc cpdf_edits_00_sep.doc
201 570.03.2  If prior pay plan is NH,and prior pay rate determinant is
202           0,5,6 or 7, Then prior basic pay must be within the range
203           for the prior grade on Table 37 or Table 38
204           (depending on prior pay rate determinant) or be asterisks.
205           Default:  Insert asterisks in pay basis and basic pay.
206 
207   if p_effective_date > fnd_date.canonical_to_date('1998/03/01') and
208      p_prior_pay_plan = 'NH' and
209      p_prior_pay_rate_det_code in ('0','5','6','7') then -- added for bug 726125
210      if p_prior_pay_rate_det_code in ('0','7')  then
211          min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 37',
212                           p_prior_grade_or_level ,
213                           'Minimum Basic Pay',p_effective_date);
214          max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 37',
215                           p_prior_grade_or_level ,
216                           'Maximum Basic Pay',p_effective_date);
217      elsif p_prior_pay_rate_det_code in ('5','6')  then
218          min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 38',
219                           p_prior_grade_or_level ,
220                           'Minimum Basic Pay',p_effective_date);
221          max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 38',
222                           p_prior_grade_or_level ,
223                           'Maximum Basic Pay',p_effective_date);
224      end if;
225      if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
226         (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
227         or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
228      then
229         GHR_GHRWS52L.CPDF_Parameter_Check;
230         hr_utility.set_message(8301,'GHR_37865_ALL_PROCEDURE_FAIL');
231         hr_utility.raise_error;
232      end if;
233   end if;
234 */
235 
236 /* 570.04.2  If prior pay plan is GS,
237           And prior pay rate determinant is 2, 3, 4, J, K, or R,
238           Then prior basic pay must be equal to or exceed the
239           minimum basic pay for prior grade on Table 2 or be
240           asterisks.
241 
242           Default:  Insert asterisks in prior pay basis and prior
243                     basic pay.*/
244 --upd47  26-Jun-06	Raju	   From 01-Apr-2003		             Terminate the edit
245 if p_effective_date < fnd_date.canonical_to_date('2003/04/01') then
246 	if p_prior_pay_plan = 'GS'  and
247 	   p_prior_pay_rate_det_code in ('2','3','4','J','K','R') then
248 
249 	   min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 2',
250 						p_prior_grade_or_level || '-' || p_prior_step_or_rate,
251 						'Minimum Basic Pay',
252 						p_prior_effective_date);
253 	   if min_basic_pay IS NOT NULL and
254 		  (not(to_number(p_prior_basic_pay) >= min_basic_pay)
255 		  or p_prior_basic_pay is null)
256 	   then
257 		  GHR_GHRWS52L.CPDF_Parameter_Check;
258 		  hr_utility.set_message(8301,'GHR_37701_ALL_PROCEDURE_FAIL');
259 		  hr_utility.raise_error;
260 	   end if;
261 	end if;
262 end if;
263 
264 /* Commenting the edit as per Sept.2000 patch -- refer to doc cpdf_edits_00_sep.doc
265 570.05.2  If prior pay plan is NJ,and prior pay rate determinant is
266           0,5,6 or 7, Then prior basic pay must be within the range
267           for the prior grade on Table 39 or Table 40
268           (depending on prior pay rate determinant) or be asterisks.
269           Default:  Insert asterisks in pay basis and basic pay.
270 
271   if p_effective_date > fnd_date.canonical_to_date('1998/03/01') and
272      p_prior_pay_plan = 'NJ' and
273      p_prior_pay_rate_det_code in ('0','5','6','7') then -- added for bug 726125
274      if p_prior_pay_rate_det_code in ('0','7')  then
275          min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 39',
276                           p_prior_grade_or_level ,
277                           'Minimum Basic Pay',p_effective_date);
278          max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 39',
279                           p_prior_grade_or_level ,
280                           'Maximum Basic Pay',p_effective_date);
281      elsif p_prior_pay_rate_det_code in ('5','6')  then
282          min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 40',
283                           p_prior_grade_or_level ,
284                           'Minimum Basic Pay',p_effective_date);
285          max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 40',
286                           p_prior_grade_or_level ,
287                           'Maximum Basic Pay',p_effective_date);
288      end if;
289      if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
290         (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
291         or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
292      then
293         GHR_GHRWS52L.CPDF_Parameter_Check;
294         hr_utility.set_message(8301,'GHR_37866_ALL_PROCEDURE_FAIL');
295         hr_utility.raise_error;
296      end if;
297   end if;
298 */
299 
300 /* Commenting the edit as per Sept.2000 patch -- refer to doc cpdf_edits_00_sep.doc
301 570.06.2  If prior pay plan is NK,and prior pay rate determinant is
302           0,5,6 or 7, Then prior basic pay must be within the range
303           for the prior grade on Table 41 or Table 42
304           (depending on pay rate determinant) or be asterisks.
305           Default:  Insert asterisks in pay basis and basic pay.
306 
307   if p_effective_date > fnd_date.canonical_to_date('1998/03/01') and
308      p_prior_pay_plan = 'NK' and
309      p_prior_pay_rate_det_code in ('0','5','6','7') then -- added for bug 726125
310      if p_prior_pay_rate_det_code in ('0','7')  then
311          min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 41',
312                           p_prior_grade_or_level ,
313                           'Minimum Basic Pay',p_effective_date);
314          max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 41',
315                           p_prior_grade_or_level ,
316                           'Maximum Basic Pay',p_effective_date);
317      elsif p_prior_pay_rate_det_code in ('5','6')  then
318          min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 42',
319                           p_prior_grade_or_level ,
320                           'Minimum Basic Pay',p_effective_date);
321          max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 42',
322                           p_prior_grade_or_level ,
323                           'Maximum Basic Pay',p_effective_date);
324      end if;
325      if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
326         (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
327         or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
328      then
329         GHR_GHRWS52L.CPDF_Parameter_Check;
330         hr_utility.set_message(8301,'GHR_37867_ALL_PROCEDURE_FAIL');
331         hr_utility.raise_error;
332      end if;
333   end if;
334 */
335 
336 /*570.07.2  If prior pay plan is GM,
337           And prior pay rate determinant is 0 or 7,
338           Then prior basic pay must fall within the appropriate
339           range for prior grade and step or rate on Table 3 or be
340           asterisks.
341 
342           Default:  Insert asterisks in prior pay basis and prior
343                     basic pay. */
344 --           17-Aug-00   vravikan   1-Jan-2000        Modify Edit to remove step or rate
345 if p_effective_date >= to_date('2000/01/01','yyyy/mm/dd') then
346 if p_prior_pay_plan = 'GM'  and
347    p_prior_pay_rate_det_code in ('0','7') then
348 
349    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 3',
350                     p_prior_grade_or_level ,
351                     'Minimum Basic Pay',
352                     p_prior_effective_date);
353 
354    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 3',
355                     p_prior_grade_or_level ,
356                     'Maximum Basic Pay',
357                     p_prior_effective_date);
358    if min_basic_pay IS NOT NULL and
359       max_basic_pay IS NOT NULL and
360       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
361         or p_prior_basic_pay is null)
362    then
363       GHR_GHRWS52L.CPDF_Parameter_Check;
364       hr_utility.set_message(8301,'GHR_37702_ALL_PROCEDURE_FAIL');
365       hr_utility.raise_error;
366    end if;
367 end if;
368 else
369 if p_prior_pay_plan = 'GM'  and
370    p_prior_pay_rate_det_code in ('0','7') then
371 
372    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 3',
373                     p_prior_grade_or_level || '-' || p_prior_step_or_rate,
374                     'Minimum Basic Pay',
375                     p_prior_effective_date);
376 
377    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 3',
378                     p_prior_grade_or_level || '-' || p_prior_step_or_rate,
379                     'Maximum Basic Pay',
380                     p_prior_effective_date);
381    if min_basic_pay IS NOT NULL and
382       max_basic_pay IS NOT NULL and
383       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
384         or p_prior_basic_pay is null)
385    then
386       GHR_GHRWS52L.CPDF_Parameter_Check;
387       hr_utility.set_message(8301,'GHR_37702_ALL_PROCEDURE_FAIL');
388       hr_utility.raise_error;
389    end if;
390 end if;
391 end if;
392 
393  --            12/8/00   vravikan    From Start     Change Edit
394  --                                                 Table 4 to Table 2
395 
396  /*570.10.2  If prior pay plan is GM or GH,
397           And prior pay rate determinant is 2, 3, 4, J, K, or R,
398           Then prior basic pay must equal or exceed the minimum
399           basic pay for prior grade on Table 4 or be asterisks.
400 
401           Default:  Insert asterisks in prior pay basis and prior
402                     basic pay.*/
403 --upd47  26-Jun-06	Raju	   From 01-Apr-2006		Added pay plan GS
404 
405 if p_effective_date < fnd_date.canonical_to_date('2006/04/01') then
406     if p_prior_pay_plan in ('GH', 'GM') and
407        p_prior_pay_rate_det_code in ('2','3','4','J','K','R')  then
408        min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 2',
409                         p_prior_grade_or_level || '-' || p_prior_step_or_rate,
410                         'Minimum Basic Pay',
411                         p_prior_effective_date);
412        if min_basic_pay IS NOT NULL and
413           (not(to_number(p_prior_basic_pay) >= min_basic_pay)
414            or p_prior_basic_pay is null)
415        then
416           GHR_GHRWS52L.CPDF_Parameter_Check;
417           hr_utility.set_message(8301,'GHR_37703_ALL_PROCEDURE_FAIL');
418           hr_utility.set_message_token('PAY_PLAN','GM or GH');
419           hr_utility.raise_error;
420        end if;
421     end if;
422 else
423     if p_prior_pay_plan in ('GH', 'GM','GS') and
424        p_prior_pay_rate_det_code in ('2','3','4','J','K','R')  then
425        min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 2',
426                         p_prior_grade_or_level || '-' || p_prior_step_or_rate,
427                         'Minimum Basic Pay',
428                         p_prior_effective_date);
429        if min_basic_pay IS NOT NULL and
430           (not(to_number(p_prior_basic_pay) >= min_basic_pay)
431            or p_prior_basic_pay is null)
432        then
433           GHR_GHRWS52L.CPDF_Parameter_Check;
434           hr_utility.set_message(8301,'GHR_37703_ALL_PROCEDURE_FAIL');
435           hr_utility.set_message_token('PAY_PLAN','GH, GM, or GS');
436           hr_utility.raise_error;
437        end if;
438     end if;
439 end if;
440 
441 /*570.13.2  If prior pay plan is EX,
442           And prior pay rate determinant is 0,
443           Then prior basic pay must match the entry for prior
444           grade on Table 5 or be asterisks.
445 
446           Default:  Insert asterisks in prior pay basis and prior
447                     basic pay.*/
448 if p_prior_pay_plan = 'EX'  and
449    p_prior_pay_rate_det_code = '0' then
450 
451    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 5',
452                     p_prior_grade_or_level,
453                     'Maximum Basic Pay',
454                     p_prior_effective_date);
455    if max_basic_pay IS NOT NULL and
456       (to_number(p_prior_basic_pay) <> max_basic_pay
457       or p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0)
458    then
459       GHR_GHRWS52L.CPDF_Parameter_Check;
460       hr_utility.set_message(8301,'GHR_37704_ALL_PROCEDURE_FAIL');
461       hr_utility.raise_error;
462    end if;
463 end if;
464 
465 /*570.16.2  If prior pay plan is ES or FE,
466           And prior pay rate determinant is not C,
467           Then prior basic pay must match the entry for prior
468           step or rate on Table 6 or be asterisks.
469 
470           Default:  Insert asterisks in prior pay basis and prior
471                     basic pay.*/
472 -- NAME           EFFECTIVE      COMMENTS
473 -- Madhuri        21-JAN-2004    End Dating this edit as on 10-JAN-04
474 --				 For SES Pay Calculations
475 --
476  -- end dating the edit as on 10-JAN-2004
477 IF p_effective_date < to_date('2004/01/11', 'yyyy/mm/dd') then
478 
479  if (p_prior_pay_plan in ('ES', 'FE') and
480    p_prior_pay_rate_det_code <> 'C' ) then
481 
482    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 6',
483                     p_prior_step_or_rate,
484                     'Maximum Basic Pay',
485                     p_prior_effective_date);
486    if max_basic_pay IS NOT NULL and
487       (p_prior_basic_pay <> max_basic_pay
488       or p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0)
489    then
490       GHR_GHRWS52L.CPDF_Parameter_Check;
491       hr_utility.set_message(8301,'GHR_37705_ALL_PROCEDURE_FAIL');
492       hr_utility.raise_error;
493    end if;
494  end if;
495 END IF; -- end dating the edit as on 10-JAN-2004
496 
497 -- NEW EDIT as on 19-MAY-2004
498 /* 570.17.2:	If prior pay plan is ES or FE,
499 		and prior pay rate determinant is not C,
500 		Then prior basic pay must be within the range on Table 55 */
501 
502 -- Name			Effective Date		Comments
503 -- Madhuri               19-MAY-2004		Added this Edit
504 --
505 IF ( p_effective_date >= to_date('2004/01/11', 'yyyy/mm/dd') )
506   and
507   ( p_prior_pay_plan in ('ES', 'FE') and  p_prior_pay_rate_det_code <> 'C' )
508   THEN
509 	min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 55',
510                         p_prior_pay_plan,
511                         'Minimum Basic Pay',
512                         p_effective_date);
513 	max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 55',
514                         p_prior_pay_plan,
515                         'Maximum Basic Pay',
516                         p_effective_date);
517 
518       if not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
519       then
520         GHR_GHRWS52L.CPDF_Parameter_Check;
521         hr_utility.set_message(8301,'GHR_38885_ALL_PROCEDURE_FAIL');
522 -- NEED TO ADD A NEW MESSAGE HERE
523         hr_utility.raise_error;
524       end if;
525 END IF;
526 
527 /*570.19.2  If prior pay plan is W-, XE, XF, XG, or XH,
528           And prior pay rate determinant is 0,
529           Then prior basic pay must fall within the range for
530           prior pay plan on Table 11 or be asterisks.
531 
532           Default:  Insert asterisks in prior pay basis and prior
533                     basic pay.*/
534 
535  -- Update Date   Updated By	Effective Date			Comments
536  -----------------------------------------------------------------------------------------------------------
537  -- 18/10/2004    Madhuri	From the start of the edit	Deleting the edit
538  -----------------------------------------------------------------------------------------------------------
539 /*
540 if substr(p_prior_pay_plan,1,1) = 'W' or p_prior_pay_plan in ('XE', 'XF', 'XG', 'XH') then
541    min_basic_pay := NULL;
542    max_basic_pay := NULL;
543    if substr(p_prior_pay_plan,1,1) = 'W' then
544       if p_prior_pay_plan not in ('WG','WL','WM','WS') then
545          max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 11',
546                                                        p_prior_pay_plan,
547                                                        'Maximum Basic Pay', p_prior_effective_date);
548       else
549          min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 11',
550                                                        p_prior_pay_plan||'-'||p_prior_grade_or_level,
551                                                       'Minimum Basic Pay', p_prior_effective_date);
552          max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 11',
553                                                        p_prior_pay_plan||'-'||p_prior_grade_or_level,
554                                                        'Maximum Basic Pay', p_prior_effective_date);
555       end if;
556    else
557       if p_prior_pay_plan = 'XE' then
558          min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 11',
559                                                        p_prior_pay_plan,
560                                                        'Minimum Basic Pay', p_prior_effective_date);
561          max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 11',
562                                                        p_prior_pay_plan,
563                                                        'Maximum Basic Pay', p_prior_effective_date);
564       elsif p_prior_pay_plan in ('XF', 'XG', 'XH') then
565          min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 11',
566                                                        p_prior_pay_plan||'-'||p_prior_grade_or_level,
567                                                        'Minimum Basic Pay', p_prior_effective_date);
568          max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 11',
569                                                        p_prior_pay_plan||'-'||p_prior_grade_or_level,
570                                                        'Maximum Basic Pay', p_prior_effective_date);
571       end if;
572    end if;
573    if max_basic_pay IS NOT NULL then
574       if p_prior_pay_rate_det_code = '0'
575          and (not(to_number(p_prior_basic_pay) between nvl(min_basic_pay,0) and nvl(max_basic_pay,0))
576          or p_prior_basic_pay is null)
577       then
578          GHR_GHRWS52L.CPDF_Parameter_Check;
579          hr_utility.set_message(8301,'GHR_37706_ALL_PROCEDURE_FAIL');
580          hr_utility.raise_error;
581       end if;
582     end if;
583 end if; */
584 -------------------------------------------------------------------------------------------------------
585 
586 /*570.22.2  If prior pay plan is KA,
587           Then prior basic pay must fall within the range on
588           Table 17 or be asterisks.
589 
590           Default:  Insert asterisks in prior pay basis and prior
591                     basic pay. */
592 -------------------------------------------------------------------------------
593 -- Modified by       Date             Comments
594 -------------------------------------------------------------------------------
595 -- Madhuri          01-MAR-05         Retroactively end dating as of 31-JAN-2002
596 -------------------------------------------------------------------------------
597 IF p_prior_effective_date <= fnd_date.canonical_to_date('20'||'02/01/31') THEN
598  if p_prior_pay_plan = 'KA' then
599    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 17',
600                     p_prior_pay_plan ,
601                     'Minimum Basic Pay',
602                     p_prior_effective_date);
603    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 17',
604                     p_prior_pay_plan ,
605                     'Maximum Basic Pay',
606                     p_prior_effective_date);
607    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL then
608       if (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay) or
609          p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0) then
610          GHR_GHRWS52L.CPDF_Parameter_Check;
611          hr_utility.set_message(8301,'GHR_37707_ALL_PROCEDURE_FAIL');
612          hr_utility.raise_error;
613       end if;
614    end if;
615  end if;
616 END IF;
617 -------------------------------------------------------------------------------
618 
619 /*570.24.2  If prior pay plan is FB, FJ, or FX,
620           Then prior basic pay must be no less than step 1 on
621           Table 6 and no more than step 6 on Table 6, or be
622           asterisks.
623           Default:  Insert asterisks in prior pay basis and prior
624                     basic pay.*/
625 --
626 -- Madhuri   19-MAY-2004    End dated the Edit as of 10-JAN-04
627 --
628 IF p_effective_date < to_date('2004/01/11', 'yyyy/mm/dd') then
629  if p_prior_pay_plan in ('FB', 'FJ', 'FX') then
630    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 6',
631                                                  '01',
632                                                  'Maximum Basic Pay',
633                                                   p_prior_effective_date);
634    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 6',
635                                                  '06',
636                                                  'Maximum Basic Pay',
637                                                   p_prior_effective_date);
638 
639    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL then
640       if (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay) or
641          p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0)
642       then
643          GHR_GHRWS52L.CPDF_Parameter_Check;
644          hr_utility.set_message(8301,'GHR_37709_ALL_PROCEDURE_FAIL');
645          hr_utility.raise_error;
646       end if;
647    end if;
648  end if;
649 END IF;
650 
651 /*570.25.2  If prior pay plan is FT,
652           Then prior basic pay must be within the range on Table
653           21 or be asterisks.
654 
655           Default:  Insert asterisks in prior pay basis and prior
656                     basic pay.*/
657 if p_prior_pay_plan = 'FT' then
658    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 21',
659                                                  p_prior_pay_plan ,
660                                                  'Minimum Basic Pay',
661                                                  p_prior_effective_date);
662    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 21',
663                                                  p_prior_pay_plan ,
664                                                  'Maximum Basic Pay',
665                                                  p_prior_effective_date);
666    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL then
667       if (not (to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
668           or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
669       then
670          GHR_GHRWS52L.CPDF_Parameter_Check;
671          hr_utility.set_message(8301,'GHR_37710_ALL_PROCEDURE_FAIL');
672          hr_utility.raise_error;
673       end if;
674    end if;
675 end if;
676 
677 /*570.26.2  If prior pay plan is FL, FS, or FW,
678           Then prior basic pay must be no less than the minimum
679           for pay plan WG on Table 11 and no more than the
680           maximum for pay plan WS on Table 11, or be asterisks.
681 
682           Default:  Insert asterisks in prior pay basis and prior
683                    basic pay.*/
684  -- Update Date   Updated By	Effective Date			Comments
685  -----------------------------------------------------------------------------------------------------------
686  -- 18/10/2004    Madhuri	From the start of the edit	Deleting the edit
687  -----------------------------------------------------------------------------------------------------------
688 
689 /*if p_prior_pay_plan in ('FL', 'FS', 'FW') then
690    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 11',
691                     'WG'||'-'||p_prior_grade_or_level,
692                     'Minimum Basic Pay',p_prior_effective_date);
693    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 11',
694                     'WS'||'-'||p_prior_grade_or_level,
695                     'Maximum Basic Pay',p_prior_effective_date);
696 
697    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL then
698       if (not (to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
699           or p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0)
700       then
701           GHR_GHRWS52L.CPDF_Parameter_Check;
702           hr_utility.set_message(8301,'GHR_37711_ALL_PROCEDURE_FAIL');
703           hr_utility.raise_error;
704       end if;
705    end if;
706 end if; */
707  -----------------------------------------------------------------------------------------------------------
708 
709 /*570.27.2  If prior pay plan is FM,
710           And prior pay rate determinant is 0 or 7,
711           Then prior basic pay must match the entry for prior
712           grade and prior step or rate on Table 3 or be
713           asterisks.
714           Default:  Insert asterisks in prior pay basis and prior
715                     basic pay.*/
716 --           17-Aug-00    vravikan   1-Jan-2000       Modify Edit to remove prior step or rate
717 if p_effective_date >= to_date('2000/01/01','yyyy/mm/dd') then
718 if p_prior_pay_plan = 'FM' and
719    p_prior_pay_rate_det_code in ('0','7') then
720 
721    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 3',
722                     p_prior_grade_or_level ,
723                     'Minimum Basic Pay',p_prior_effective_date);
724    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 3',
725                     p_prior_grade_or_level ,
726                     'Maximum Basic Pay',p_prior_effective_date);
727    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
728       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
729          or p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0)
730    then
731       GHR_GHRWS52L.CPDF_Parameter_Check;
732       hr_utility.set_message(8301,'GHR_37712_ALL_PROCEDURE_FAIL');
733       hr_utility.raise_error;
734    end if;
735 end if;
736 else
737 if p_prior_pay_plan = 'FM' and
738    p_prior_pay_rate_det_code in ('0','7') then
739 
740    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 3',
741                     p_prior_grade_or_level || '-' || p_prior_step_or_rate,
742                     'Minimum Basic Pay',p_prior_effective_date);
743    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 3',
744                     p_prior_grade_or_level || '-' || p_prior_step_or_rate,
745                     'Maximum Basic Pay',p_prior_effective_date);
746    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
747       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
748          or p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0)
749    then
750       GHR_GHRWS52L.CPDF_Parameter_Check;
751       hr_utility.set_message(8301,'GHR_37712_ALL_PROCEDURE_FAIL');
752       hr_utility.raise_error;
753    end if;
754 end if;
755 end if;
756 
757 /* Commenting the edit as per Sept.2000 patch -- refer to doc cpdf_edits_00_sep.doc
758 570.29.2  If prior pay plan is DR,
759           And prior pay rate determinant is 0 or 7,
760           Then prior basic pay must be within the range for the
761           prior grade and prior pay rate determinant on Table 28
762           or be asterisks.
763 
764           Default:  Insert asterisks in prior pay basis and prior
765                     basic pay.
766 if p_prior_pay_plan = 'DR' and
767    p_prior_pay_rate_det_code in ('0','7') then
768 
769    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 28',
770                     p_prior_grade_or_level ,
771                     'Minimum Basic Pay',p_prior_effective_date);
772    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 28',
773                     p_prior_grade_or_level ,
774                     'Maximum Basic Pay',p_prior_effective_date);
775 
776    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
777       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
778       or p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0)
779    then
780       GHR_GHRWS52L.CPDF_Parameter_Check;
781       hr_utility.set_message(8301,'GHR_38405_ALL_PROCEDURE_FAIL');
782       hr_utility.raise_error;
783    end if;
784 end if;
785 */
786 
787 /* Commenting the edit as per Sept.2000 patch -- refer to doc cpdf_edits_00_sep.doc
788 570.30.2  If prior pay plan is DR,
789           And prior pay rate determinant is 5 or 6,
790           Then prior basic pay must be within the range for the
791           prior grade and prior pay rate determinant on Table 29
792           or be asterisks.
793 
794           Default:  Insert asterisks in prior pay basis and prior
795                     basic pay.
796 if p_prior_pay_plan = 'DR' and
797    p_prior_pay_rate_det_code in ('5','6') then
798 
799    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 29',
800                     p_prior_grade_or_level ,
801                     'Minimum Basic Pay',p_prior_effective_date);
802    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 29',
803                     p_prior_grade_or_level ,
804                     'Maximum Basic Pay',p_prior_effective_date);
805    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
806       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
807       or p_prior_basic_pay is null or  to_number(p_prior_basic_pay) = 0)
808    then
809       GHR_GHRWS52L.CPDF_Parameter_Check;
810       hr_utility.set_message(8301,'GHR_38406_ALL_PROCEDURE_FAIL');
811       hr_utility.raise_error;
812    end if;
813 end if;
814 */
815 
816 /*570.31.2  If prior pay plan is NY,
817           Then prior basic pay must be within the range on
818           Table 26 or be asterisks.
819 
820           Default:  Insert asterisks in prior pay basis and prior
821                     basic pay.*/
822 if p_prior_pay_plan = 'NY' then
823    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 26',
824                     p_prior_grade_or_level ,
825                    'Minimum Basic Pay',p_prior_effective_date);
826    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 26',
827                     p_prior_grade_or_level ,
828                     'Maximum Basic Pay',p_prior_effective_date);
829    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
830       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
831       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
832    then
833       GHR_GHRWS52L.CPDF_Parameter_Check;
834       hr_utility.set_message(8301,'GHR_37714_ALL_PROCEDURE_FAIL');
835       hr_utility.raise_error;
836    end if;
837 end if;
838 
839 /*570.32.2  If prior pay plan is NX,
840           Then prior basic pay must be within the range for the
841           prior grade on Table 27 or be asterisks.
842 
843           Default:  Insert asterisks in prior pay basis and prior
844                     basic pay.*/
845 if p_prior_pay_plan = 'NX' then
846 
847    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 27',
848                     p_prior_grade_or_level ,
849                     'Minimum Basic Pay',p_prior_effective_date);
850    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 27',
851                     p_prior_grade_or_level ,
852                     'Maximum Basic Pay',p_prior_effective_date);
853 
854    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
855       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
856       or p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0)
857    then
858       GHR_GHRWS52L.CPDF_Parameter_Check;
859       hr_utility.set_message(8301,'GHR_37715_ALL_PROCEDURE_FAIL');
860       hr_utility.raise_error;
861    end if;
862 end if;
863 
864 /*570.37.2  If prior pay plan is FC,
865           And prior pay rate determinant is not C,
866           Then Prior Basic Pay must be within the range for prior
867           grade on Table 8 or be asterisks.
868 
869           Default:  Insert asterisks in prior pay basis and prior
870                     basic pay. */
871 -- Update    Date         By       		Comments
872 -- 20/2    27-Feb-2003   Madhuri   	Modified the Requirement
873 --            			From	Then Prior Basic Pay must match the entry for the grade on Table 8 or be asterisks.
874 --           			to	Then Prior Basic Pay must be within the range for prior grade on Table 8 or be asterisks.
875 --
876 
877 if p_prior_pay_plan = 'FC' and
878    p_prior_pay_rate_det_code <> 'C' then
879 
880    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 8',
881                     p_prior_grade_or_level || '-' || p_prior_step_or_rate,
882                     'Minimum Basic Pay',p_prior_effective_date);
883 
884    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 8',
885                     p_prior_grade_or_level || '-' || p_prior_step_or_rate,
886                     'Maximum Basic Pay',p_prior_effective_date);
887 
888    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
889       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
890       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
891    then
892       GHR_GHRWS52L.CPDF_Parameter_Check;
893       hr_utility.set_message(8301,'GHR_37716_ALL_PROCEDURE_FAIL');
894       hr_utility.raise_error;
895    end if;
896 end if;
897 
898 /*570.43.2  If prior pay plan is AF, FO, or FP,
899           And prior pay rate determinant is not C,
900           Then prior basic pay must fall within the range for
901           prior grade on Table 10 or be asterisks.
902           Default:  Insert asterisks in prior pay basis and prior
903                     basic pay.*/
904 if p_prior_pay_plan in ('AF','FO','FP') and
905    p_prior_pay_rate_det_code <> 'C' then
906 
907    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 10',
908                     p_prior_grade_or_level || '-' || p_prior_step_or_rate,
909                     'Minimum Basic Pay',p_prior_effective_date);
910    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 10',
911                     p_prior_grade_or_level || '-' || p_prior_step_or_rate,
912                     'Maximum Basic Pay',p_prior_effective_date);
913    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
914       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay )
915       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
916    then
917       GHR_GHRWS52L.CPDF_Parameter_Check;
918       hr_utility.set_message(8301,'GHR_37717_ALL_PROCEDURE_FAIL');
919       hr_utility.raise_error;
920    end if;
921 end if;
922 
923 -- 570.45.2  If prior pay plan is FA,
924 --           And agency/subelement is ST,
925 --           And prior pay rate determinant is 0,
926 --           And prior grade is 13 or 14,
927 --           Then prior basic pay must equal entry for the grade on
928 --           Table 7 or be asterisks.
929 --
930 --           Default:  Insert asterisks in prior pay basis and prior basic pay.
931 
932 -- Update     Date        By  		Comments
933 -- 20/2    27-Feb-2003   Madhuri   	Modified the Requirement
934 --				from	And prior grade is 01 thru 04 or 13 or 14.
935 --				to	And prior grade is 13 or 14.
936 --         19-MAR-2003  NarasimhaRao    Changed the parameter from p_prior_grade_or_level
937 --                                      to p_prior_step_or_rate
938  -- upd50  06-Feb-07	  Raju       From 01-Sep-2004	    Bug#5745356 delete Edit
939 
940 if p_effective_date < to_date('2004/09/01','yyyy/mm/dd') then
941     if p_prior_pay_plan = 'FA'  and
942        p_agency_subelement = 'ST'  and
943        p_prior_pay_rate_det_code = '0'  and
944        p_prior_grade_or_level in ('13','14') then
945 
946        max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 7',
947                                                       p_prior_step_or_rate,
948                                                      'Maximum Basic Pay',
949                                                       p_prior_effective_date);
950 
951        if max_basic_pay IS NOT NULL and
952           (to_number(p_prior_basic_pay) <> max_basic_pay
953           or p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0)
954        then
955           GHR_GHRWS52L.CPDF_Parameter_Check;
956           hr_utility.set_message(8301,'GHR_37718_ALL_PROCEDURE_FAIL');
957           hr_utility.raise_error;
958        end if;
959     end if;
960 end if;
961 
962 /*570.53.2  If prior pay plan is GS,
963           And prior pay rate determinant is 5, 6, or M,
964           Then prior basic pay must be equal to or less than the
965           entry for prior grade on Table 19 or be asterisks.
966 
967           Default:  Insert asterisks in prior pay basis and prior
968                     basic pay.*/
969 /*   Commenting the edit as per the Bug 3147737.
970 if p_prior_pay_plan = 'GS'  and
971    p_prior_pay_rate_det_code in ('5','6','M')  then
972 
973    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 19',
974                                                  p_prior_grade_or_level,
975                                                  'Maximum Basic Pay',
976                                                  p_prior_effective_date);
977 
978    if max_basic_pay IS NOT NULL and
979       (not(to_number(p_prior_basic_pay) <= max_basic_pay)
980       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
981    then
982       GHR_GHRWS52L.CPDF_Parameter_Check;
983       hr_utility.set_message(8301,'GHR_37720_ALL_PROCEDURE_FAIL');
984       hr_utility.raise_error;
985    end if;
986 end if;
987 */
988 
989 /* Commenting the edit as per Sept.2000 patch -- refer to doc cpdf_edits_00_sep.doc
990 --570.38.2
991 -- Update     Date        By        Effective Date   Comment
992  --   9/5      08/12/99   vravikan   01-Apr-99       New Edit
993 If prior pay plan is NC, And prior pay rate determinant is 0, 5, 6, or 7,
994  Then prior basic pay must be within the range for the prior grade on Table 44
995 or Table 45 (depending on prior pay rate determinant).  If prior pay rate determinant
996  is 0 or 7 then compare to table 44.  If prior pay rate determinant is 5 or 6
997 then compare to table 45.
998 
999 
1000 if p_effective_date >= fnd_date.canonical_to_date('19'||'99/04/01') then
1001   if p_prior_pay_plan = 'NC' then
1002     if p_prior_pay_rate_det_code in ('0','7')
1003 then
1004 
1005    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 44',
1006                     p_prior_grade_or_level,
1007                     'Minimum Basic Pay',p_prior_effective_date);
1008    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 44',
1009                     p_prior_grade_or_level,
1010                     'Maximum Basic Pay',p_prior_effective_date);
1011    elsif p_prior_pay_rate_det_code in ('5','6')  then
1012    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 45',
1013                     p_prior_grade_or_level,
1014                     'Minimum Basic Pay',p_prior_effective_date);
1015    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 45',
1016                     p_prior_grade_or_level,
1017                     'Maximum Basic Pay',p_prior_effective_date);
1018 
1019 end if;
1020 end if;
1021    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
1022       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
1023       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
1024    then
1025       GHR_GHRWS52L.CPDF_Parameter_Check;
1026       hr_utility.set_message(8301,'GHR_37074_ALL_PROCEDURE_FAIL');
1027       hr_utility.raise_error;
1028    end if;
1029 end if;
1030 */
1031 
1032 /* Commenting the edit as per Sept.2000 patch -- refer to doc cpdf_edits_00_sep.doc
1033 --570.39.2
1034 -- Update     Date        By        Effective Date   Comment
1035  --   9/5      08/12/99   vravikan   01-Apr-99       New Edit
1036 
1037 If prior pay plan is NO, And prior pay rate determinant is 0, 5, 6, or 7,
1038  Then prior basic pay must be within the range for the prior grade on
1039 Table 46 or Table 47 (depending on prior pay rate determinant).
1040 If prior pay rate determinant is 0 or 7 then compare to table 46.
1041   If prior pay rate determinant is 5 or 6 then compare to table 47.
1042 
1043 if p_effective_date >= fnd_date.canonical_to_date('19'||'99/04/01') then
1044   if p_prior_pay_plan = 'NO' then
1045     if p_prior_pay_rate_det_code in ('0','7')
1046 then
1047 
1048    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 46',
1049                     p_prior_grade_or_level,
1050                     'Minimum Basic Pay',p_prior_effective_date);
1051    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 46',
1052                     p_prior_grade_or_level,
1053                     'Maximum Basic Pay',p_prior_effective_date);
1054    elsif p_prior_pay_rate_det_code in ('5','6')  then
1055    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 47',
1056                     p_prior_grade_or_level,
1057                     'Minimum Basic Pay',p_prior_effective_date);
1058    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 47',
1059                     p_prior_grade_or_level,
1060                     'Maximum Basic Pay',p_prior_effective_date);
1061 
1062 end if;
1063 end if;
1064    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
1065       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
1066       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
1067    then
1068       GHR_GHRWS52L.CPDF_Parameter_Check;
1069       hr_utility.set_message(8301,'GHR_37075_ALL_PROCEDURE_FAIL');
1070       hr_utility.raise_error;
1071    end if;
1072 end if;
1073 */
1074 /* Commenting the edit as per Sept.2000 patch -- refer to doc cpdf_edits_00_sep.doc
1075 --570.40.2
1076 -- Update     Date        By        Effective Date   Comment
1077  --   9/5      08/12/99   vravikan   01-Apr-99       New Edit
1078 
1079 If prior pay plan is NP, And prior pay rate determinant is 0, 5, 6, or 7,
1080 Then prior basic pay must be within the range for the prior grade on Table 48
1081  or Table 49 (depending on prior pay rate determinant).
1082  If prior pay rate determinant is 0 or 7 then compare to table 48.
1083 If prior pay rate determinant is 5 or 6 then compare to table 49.
1084 
1085 if p_effective_date >= fnd_date.canonical_to_date('19'||'99/04/01') then
1086   if p_prior_pay_plan = 'NP' then
1087     if p_prior_pay_rate_det_code in ('0','7')
1088 then
1089 
1090    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 48',
1091                     p_prior_grade_or_level,
1092                     'Minimum Basic Pay',p_prior_effective_date);
1093    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 48',
1094                     p_prior_grade_or_level,
1095                     'Maximum Basic Pay',p_prior_effective_date);
1096    elsif p_prior_pay_rate_det_code in ('5','6')  then
1097    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 49',
1098                     p_prior_grade_or_level,
1099                     'Minimum Basic Pay',p_prior_effective_date);
1100    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 49',
1101                     p_prior_grade_or_level,
1102                     'Maximum Basic Pay',p_prior_effective_date);
1103 
1104 end if;
1105 end if;
1106 
1107    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
1108       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
1109       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
1110    then
1111       GHR_GHRWS52L.CPDF_Parameter_Check;
1112       hr_utility.set_message(8301,'GHR_37076_ALL_PROCEDURE_FAIL');
1113       hr_utility.raise_error;
1114    end if;
1115 end if;
1116 */
1117 /* Commenting the edit as per Sept.2000 patch -- refer to doc cpdf_edits_00_sep.doc
1118 --570.41.2
1119 -- Update     Date        By        Effective Date   Comment
1120  --   9/5      08/12/99   vravikan   01-Apr-99       New Edit
1121 
1122 If prior pay plan is NR, And prior pay rate determinant is 0, 5, 6, or 7,
1123  Then prior basic pay must be within the range for the prior grade on
1124  Table 50 or Table 51 (depending on prior pay rate determinant).
1125  If prior pay rate determinant is 0 or 7 then compare to table 50.
1126  If prior pay rate determinant is 5 or 6 then compare to table 51.
1127 
1128 
1129 if p_effective_date >= fnd_date.canonical_to_date('19'||'99/04/01') then
1130   if p_prior_pay_plan = 'NR' then
1131     if p_prior_pay_rate_det_code in ('0','7')
1132 then
1133 
1134    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 50',
1135                     p_prior_grade_or_level,
1136                     'Minimum Basic Pay',p_prior_effective_date);
1137    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 50',
1138                     p_prior_grade_or_level,
1139                     'Maximum Basic Pay',p_prior_effective_date);
1140    elsif p_prior_pay_rate_det_code in ('5','6')  then
1141    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 51',
1142                     p_prior_grade_or_level,
1143                     'Minimum Basic Pay',p_prior_effective_date);
1144    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 51',
1145                     p_prior_grade_or_level,
1146                     'Maximum Basic Pay',p_prior_effective_date);
1147 
1148 end if;
1149 end if;
1150 
1151    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
1152       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
1153       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
1154    then
1155       GHR_GHRWS52L.CPDF_Parameter_Check;
1156       hr_utility.set_message(8301,'GHR_37077_ALL_PROCEDURE_FAIL');
1157       hr_utility.raise_error;
1158    end if;
1159 end if;
1160 */
1161 /*570.56.2  If prior pay plan is GM,
1162           And prior pay rate determinant is 5, 6, or M,
1163           Then prior basic pay must fall within the range for the
1164           prior grade on Table 20 or be asterisks.
1165 
1166           Default:  Insert asterisks in prior pay basis and prior
1167                     basic pay.*/
1168 /* Commented as per the bug 3147737
1169 
1170 if p_prior_pay_plan = 'GM' and
1171    p_prior_pay_rate_det_code in ('5', '6', 'M') then
1172 
1173    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 20',
1174                     p_prior_grade_or_level,
1175                     'Minimum Basic Pay',p_prior_effective_date);
1176    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 20',
1177                     p_prior_grade_or_level,
1178                     'Maximum Basic Pay',p_prior_effective_date);
1179 
1180    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
1181       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
1182       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
1183    then
1184       GHR_GHRWS52L.CPDF_Parameter_Check;
1185       hr_utility.set_message(8301,'GHR_37721_ALL_PROCEDURE_FAIL');
1186       hr_utility.raise_error;
1187    end if;
1188 end if;
1189 */
1190 /*570.60.2  If prior pay plan is AL,
1191           And prior pay rate determinant is not C,
1192           Then prior basic pay must match the entry for the prior
1193           grade and prior step or rate on Table 22 or be
1194           asterisks.
1195 
1196           Default:  Insert asterisks in prior pay basis and prior
1197                     basic pay.
1198           Basis for Edit:  5 U.S.C. 5372 */
1199 
1200 if p_prior_pay_plan = 'AL' and
1201    p_prior_pay_rate_det_code <> 'C'  then
1202 
1203   if p_prior_grade_or_level in ('01', '02') then
1204      max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 22',
1205                       p_prior_grade_or_level,
1206                       'Minimum Basic Pay',
1207                       p_prior_effective_date);
1208   else
1209      max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 22',
1210                       p_prior_grade_or_level || '-' || p_prior_step_or_rate,
1211                       'Minimum Basic Pay',
1212                       p_prior_effective_date);
1213   end if;
1214 
1215    if max_basic_pay IS NOT NULL and
1216       (to_number(p_prior_basic_pay) <> max_basic_pay
1217       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
1218    then
1219       GHR_GHRWS52L.CPDF_Parameter_Check;
1220       hr_utility.set_message(8301,'GHR_37722_ALL_PROCEDURE_FAIL');
1221       hr_utility.raise_error;
1222    end if;
1223 end if;
1224 
1225 /*570.65.2  If prior pay plan is CA,
1226           And prior pay rate determinant is not C,
1227           Then prior basic pay must match the entry on Table 23
1228           for the prior grade or be asterisks.
1229 
1230           Default:  Insert asterisks in prior pay basis and prior
1231                     basic pay.
1232 
1233           Basis for Edit:  5 U.S.C. 5372a*/
1234 if p_prior_pay_plan = 'CA' and
1235    p_prior_pay_rate_det_code <> 'C' then
1236 
1237    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 23',
1238                     p_prior_grade_or_level,
1239                    'Minimum Basic Pay',p_prior_effective_date);
1240 
1241    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
1242       (to_number(p_prior_basic_pay) <> max_basic_pay
1243       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
1244    then
1245       GHR_GHRWS52L.CPDF_Parameter_Check;
1246       hr_utility.set_message(8301,'GHR_37723_ALL_PROCEDURE_FAIL');
1247       hr_utility.raise_error;
1248    end if;
1249 end if;
1250 
1251 /*570.70.2  If prior pay plan is SL or ST,
1252           And prior pay rate determinant is not C,
1253           Then prior basic pay must be within the range in
1254           Table 21 or be asterisks.
1255 
1256           Default:  Insert asterisks in prior pay basis and prior
1257                     basic pay.
1258           Basis for Edit:  5 U.S.C. 5376*/
1259 
1260 if p_prior_pay_plan in ('ST', 'SL') and
1261    p_prior_pay_rate_det_code <> 'C' then
1262 
1263    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 21',
1264                     p_prior_pay_plan ,
1265                     'Minimum Basic Pay',p_prior_effective_date);
1266 
1267    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 21',
1268                     p_prior_pay_plan ,
1269                     'Maximum Basic Pay',p_prior_effective_date);
1270 
1271    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
1272       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
1273       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
1274    then
1275       GHR_GHRWS52L.CPDF_Parameter_Check;
1276       hr_utility.set_message(8301,'GHR_37724_ALL_PROCEDURE_FAIL');
1277       hr_utility.raise_error;
1278    end if;
1279 end if;
1280 
1281 /* Commenting the edit as per Sept.2000 patch -- refer to doc cpdf_edits_00_sep.doc
1282 570.71.2  If prior pay plan is ND,
1283           And prior pay rate determinant is 0, 5, 6, or 7,
1284           Then prior basic pay must be within the range for the
1285           prior grade on Table 30 or Table 31 (depending on prior
1286           pay rate determinant) or be asterisks.
1287 
1288           Default:  Insert asterisks in prior pay basis and prior
1289                     basic pay.
1290 
1291 -- added extra if for bug 726125
1292 if p_prior_pay_plan = 'ND' and
1293    p_prior_pay_rate_det_code in ('0','5','6','7') then
1294    if p_prior_pay_rate_det_code in ('0','7') then
1295       min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 30',
1296                                                     p_prior_grade_or_level ,
1297                                                    'Minimum Basic Pay',
1298                                                     p_prior_effective_date);
1299       max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 30',
1300                                                     p_prior_grade_or_level ,
1301                                                     'Maximum Basic Pay',
1302                                                     p_prior_effective_date);
1303    elsif p_prior_pay_rate_det_code in ('5','6') then
1304       min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 31',
1305                                                     p_prior_grade_or_level ,
1306                                                     'Minimum Basic Pay',
1307                                                     p_prior_effective_date);
1308       max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 31',
1309                                                     p_prior_grade_or_level ,
1310                                                     'Maximum Basic Pay',
1311                                                     p_prior_effective_date);
1312    end if;
1313 
1314    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL then
1315       if not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
1316          or p_prior_basic_pay is null
1317       then
1318          GHR_GHRWS52L.CPDF_Parameter_Check;
1319          hr_utility.set_message(8301,'GHR_38407_ALL_PROCEDURE_FAIL');
1320          hr_utility.raise_error;
1321      end if;
1322    end if;
1323 end if;
1324 */
1325 
1326 /* Commenting the edit as per Sept.2000 patch -- refer to doc cpdf_edits_00_sep.doc
1327 570.72.2  If prior pay plan is NG,
1328           And prior pay rate determinant is 0, 5, 6, or 7,
1329           Then prior basic pay must be within the range for the
1330           prior grade on Table 32 or Table 33 (depending on prior
1331           pay rate determinant) or be asterisks.
1332 
1333           Default:  Insert asterisks in prior pay basis and prior
1334                     basic pay.
1335 
1336 -- added extra if for bug 726125
1337 if p_prior_pay_plan = 'NG' and
1338    p_prior_pay_rate_det_code in ('0','5','6','7') then
1339    if p_prior_pay_rate_det_code in ('0','7') then
1340       min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 32',
1341                                                      p_prior_grade_or_level ,
1342                                                     'Minimum Basic Pay',
1343                                                      p_prior_effective_date);
1344       max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 32',
1345                                                     p_prior_grade_or_level ,
1346                                                     'Maximum Basic Pay',
1347                                                     p_prior_effective_date);
1348    elsif p_prior_pay_rate_det_code in ('5','6') then
1349       min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 33',
1350                                                      p_prior_grade_or_level ,
1351                                                      'Minimum Basic Pay',
1352                                                      p_prior_effective_date);
1353       max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 33',
1354                                                      p_prior_grade_or_level,
1355                                                      'Maximum Basic Pay',
1356                                                      p_prior_effective_date);
1357    end if;
1358 
1359    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL then
1360       if (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
1361          or p_prior_basic_pay is null)
1362       then
1363          GHR_GHRWS52L.CPDF_Parameter_Check;
1364          hr_utility.set_message(8301,'GHR_38408_ALL_PROCEDURE_FAIL');
1365          hr_utility.raise_error;
1366       end if;
1367    end if;
1368 end if;
1369 */
1370 
1371 /* Commenting the edit as per Sept.2000 patch -- refer to doc cpdf_edits_00_sep.doc
1372 570.73.2  If prior pay plan is NT,
1373           And prior pay rate determinant is 0, 5, 6, or 7,
1374           Then prior basic pay must be within the range for the
1375           prior grade on Table 34 or Table 35 (depending on prior
1376           pay rate determinant) or be asterisks.
1377 
1378           Default:  Insert asterisks in prior pay basis and prior
1379                     basic pay.
1380 
1381 if p_prior_pay_plan = 'NT' and
1382    p_prior_pay_rate_det_code in ('0','5','6','7') then -- added for bug 726125
1383    if p_prior_pay_rate_det_code in ('0','7') then
1384       min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 34',
1385                        p_prior_grade_or_level ,'Minimum Basic Pay',p_prior_effective_date);
1386       max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 34',
1387                        p_prior_grade_or_level ,'Maximum Basic Pay',p_prior_effective_date);
1388    elsif p_prior_pay_rate_det_code in ('5','6') then
1389       min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 35',
1390                        p_prior_grade_or_level ,'Minimum Basic Pay',p_prior_effective_date);
1391       max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 35',
1392                        p_prior_grade_or_level ,'Maximum Basic Pay',p_prior_effective_date);
1393    end if;
1394 
1395    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL then
1396       if (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
1397          or p_prior_basic_pay is null)
1398       then
1399          GHR_GHRWS52L.CPDF_Parameter_Check;
1400          hr_utility.set_message(8301,'GHR_38409_ALL_PROCEDURE_FAIL');
1401          hr_utility.raise_error;
1402       end if;
1403    end if;
1404 end if;
1405 */
1406 
1407 /* Commented -- Dec 2001 Patch
1408 570.75.2  If prior pay plan is TP,
1409           And prior pay basis is SY,
1410           Then prior basic pay must be within the range on
1411           Table 24 or be asterisks.
1412 
1413           Default:  Insert asterisks in prior pay basis and prior
1414                     basic pay.
1415 if p_prior_pay_plan = 'TP' and
1416    p_prior_pay_basis = 'SY'  then
1417 
1418    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 24',
1419                                                  p_prior_pay_plan ,
1420                                                  'Minimum Basic Pay',
1421                                                  p_prior_effective_date);
1422    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 24',
1423                                                  p_prior_pay_plan ,
1424                                                  'Maximum Basic Pay',
1425                                                  p_prior_effective_date);
1426    if max_basic_pay IS NOT NULL and
1427       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
1428       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
1429    then
1430       GHR_GHRWS52L.CPDF_Parameter_Check;
1431       hr_utility.set_message(8301,'GHR_37725_ALL_PROCEDURE_FAIL');
1432       hr_utility.raise_error;
1433    end if;
1434 end if;
1435 */
1436 
1437 /*570.82.2  If prior pay plan is GG,
1438           And prior grade is SL,
1439           And prior pay rate determinant is 0,
1440           Then prior basic pay must be within the range on
1441           Table 21 or be asterisks.
1442 
1443           Default:  Insert asterisks in prior pay basis and prior
1444                     basic pay.*/
1445 if p_prior_pay_plan = 'CG' and
1446    p_prior_pay_rate_det_code = '0' and
1447    p_prior_grade_or_level = 'SL'  then
1448 
1449    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 21',
1450                                                  p_prior_pay_plan ,
1451                                                  'Minimum Basic Pay',
1452                                                  p_prior_effective_date);
1453 
1454    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 21',
1455                                                  p_prior_pay_plan ,
1456                                                  'Maximum Basic Pay',
1457                                                  p_prior_effective_date);
1458    if max_basic_pay IS NOT NULL and min_basic_pay is not null and
1459       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
1460       or p_prior_basic_pay is null and to_number(p_prior_basic_pay) = 0)
1461    then
1462       GHR_GHRWS52L.CPDF_Parameter_Check;
1463       hr_utility.set_message(8301,'GHR_37727_ALL_PROCEDURE_FAIL');
1464       hr_utility.raise_error;
1465    end if;
1466 end if;
1467 
1468 /*570.83.2  If prior pay plan is IJ,
1469           And prior pay rate determinant is 0 or 7,
1470           Then prior basic pay must match the entry for the prior
1471           step or rate on Table 36 or be asterisks.
1472 
1473           Default:  Insert asterisks in prior pay basis and prior
1474                     basic pay.*/
1475 if p_prior_pay_plan = 'IJ' and
1476    p_prior_pay_rate_det_code in ('0','7') then
1477 
1478    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 36',
1479                                                  p_prior_step_or_rate ,
1480                                                  'Maximum Basic Pay',
1481                                                  p_prior_effective_date);
1482    if max_basic_pay IS NOT NULL and
1483       (not(to_number(p_prior_basic_pay) <> max_basic_pay)
1484       or p_prior_basic_pay is null)
1485    then
1486       GHR_GHRWS52L.CPDF_Parameter_Check;
1487       hr_utility.set_message(8301,'GHR_38410_ALL_PROCEDURE_FAIL');
1488       hr_utility.raise_error;
1489    end if;
1490 end if;
1491 
1492 /*570.84.2  If prior pay plan is GG,
1493           And prior grade is 01 through 15,
1494           And prior pay rate determinant is 2, 3, 4, J, K, or R,
1495           Then prior basic pay must be equal to or exceed the
1496           minimum for prior grade on Table 2 or be asterisks.
1497 
1498           Default:  Insert asterisks in prior pay basis and prior
1499                     basic pay.*/
1500 
1501 if p_prior_pay_plan = 'CG'  and
1502    p_prior_grade_or_level between '01' and '15'  and
1503    p_prior_pay_rate_det_code in ('2','3','4','J','K','R') then
1504 
1505    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 2',
1506                                                   p_prior_grade_or_level||'-'||p_prior_step_or_rate ,
1507                                                   'Minimum Basic Pay',
1508                                                   p_prior_effective_date);
1509    if min_basic_pay IS NOT NULL and
1510       (not(to_number(p_prior_basic_pay) >= min_basic_pay)
1511       or p_prior_basic_pay is null or to_number(p_prior_basic_pay) = 0)
1512    then
1513       GHR_GHRWS52L.CPDF_Parameter_Check;
1514       hr_utility.set_message(8301,'GHR_37728_ALL_PROCEDURE_FAIL');
1515       hr_utility.raise_error;
1516    end if;
1517 end if;
1518 
1519 /*570.86.2  If prior pay plan is GH,
1520           And prior pay rate determinant is 0 or 7,
1521           Then prior basic pay must be within the range for the
1522           appropriate prior grade on Table 3 or be asterisks.
1523 
1524           Default:  Insert asterisks in prior pay basis and prior
1525                     basic pay.*/
1526 if p_prior_pay_plan = 'GH' and
1527    p_prior_pay_rate_det_code in ('0','7')  then
1528 
1529    min_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 3',
1530                                                  p_prior_grade_or_level||'-'||p_prior_step_or_rate ,
1531                                                  'Minimum Basic Pay',
1532                                                  p_prior_effective_date);
1533    max_basic_pay := GHR_CPDF_CHECK.get_basic_pay('CPDF Oracle Federal Table 3',
1534                                                  p_prior_grade_or_level||'-'||p_prior_step_or_rate ,
1535                                                  'Maximum Basic Pay',
1536                                                  p_prior_effective_date);
1537 
1538    if min_basic_pay IS NOT NULL and max_basic_pay IS NOT NULL and
1539       (not(to_number(p_prior_basic_pay) between min_basic_pay and max_basic_pay)
1540       or p_prior_basic_pay is null
1541       or to_number(p_prior_basic_pay) = 0)
1542    then
1543       GHR_GHRWS52L.CPDF_Parameter_Check;
1544       hr_utility.set_message(8301,'GHR_37729_ALL_PROCEDURE_FAIL');
1545       hr_utility.raise_error;
1546    end if;
1547 end if;
1548 end chk_prior_basic_pay;
1549 --
1550 --
1551 -- Name: Locality Adjustment
1552 /* Table 25 contains up to a maximum of 3 percentages.
1553    The locality adjustment amount will pass the lookup if, as a percentage of basic pay,
1554    it represents any percentage shown for the locality area, with the "as of date" of the
1555    file falling within the date range, on Table 25.  (If a more percise check is needed,
1556    as is the case of area 41, a subsequent relationship edit will catch the error.)
1557    Locality pay is generated within CPDF according to the duty station.  For definitions,
1558    see the Guide to Personnel Data Standards. */
1559 --
1560 --
1561 procedure chk_locality_adj
1562   (p_to_pay_plan			            in    varchar2
1563   ,p_to_basic_pay                         in    varchar2
1564   ,p_pay_rate_determinant_code		in	varchar2
1565   ,p_retained_pay_plan				in	varchar2
1566   ,p_prior_pay_plan                       in    varchar2
1567   ,p_prior_pay_rate_det_code		      in	varchar2	/* Non-SF52 Data Item */
1568   ,p_locality_pay_area				in	varchar2	/* Non-SF52 Data Item */
1569   ,p_to_locality_adj				in	varchar2
1570   ,p_effective_date				in	date
1571   ,p_as_of_date                           in    date            /* Non-SF52 */
1572   ,p_first_noac_lookup_code               in    varchar2
1573   ,p_agency_subelement                    in    varchar2
1574   ,p_duty_station_Code                    in    varchar2
1575   ,p_special_pay_table_id                 in    varchar2 --Bug# 5745356(upd50)
1576   ) is
1577   l_lpa_area	       	     ghr_locality_pay_areas_f.locality_pay_area_code%type;
1578   l_lpa_pct		                 ghr_locality_pay_areas_f.adjustment_percentage%type;
1579   l_leo_pct                        ghr_locality_pay_areas_f.leo_adjustment_percentage%type;
1580   l_lpa_effective_start_date       ghr_locality_pay_areas_f.effective_start_date%type;
1581   l_lpa_effective_end_date         ghr_locality_pay_areas_f.effective_end_date%type;
1582   l_lpa_pct_max 	     		     ghr_locality_pay_areas_f.adjustment_percentage%type;
1583   l_lpa_pct_min		           ghr_locality_pay_areas_f.adjustment_percentage%type;
1584   l_effective_date                 date;
1585   l_pay_table				VARCHAR2(4); --Bug# 5745356(upd50)
1586 
1587   CURSOR c1 is
1588          SELECT effective_start_date, effective_end_date,
1589                 NVL(adjustment_percentage,0),
1590                 NVL(leo_adjustment_percentage,0)
1591 	   FROM   ghr_locality_pay_areas_f
1592 	   WHERE  locality_pay_area_code = p_locality_pay_area
1593            AND  trunc(l_effective_date) between effective_start_date
1594                                             and nvl(effective_end_date, l_effective_date);
1595 
1596 begin
1597  IF p_first_noac_lookup_code = '866' THEN
1598     l_effective_date := p_effective_date + 1;
1599   END IF;
1600 
1601   open c1;
1602   fetch c1 into l_lpa_effective_start_date, l_lpa_effective_end_date,
1603                 l_lpa_pct, l_leo_pct;
1604   close c1;
1605 --
1606 -- 27-jul-98
1607 -- all the edits where the locality adj as a percentage of basic pay was being compared
1608 -- to the lpa_pct has been modified to include leo_pct.
1609 -- bug #703978
1610 --
1611 
1612 /*
1613 -- This edit is DELETED as per update 8 of the edit manual.
1614 -- commented out for delete by skutteti on 12-oct-1998
1615 --
1616 -- 652.05.2
1617   if ( p_locality_pay_area in ('02','05','08','11','14','15','17','20','23','26','29','32','35',
1618        '38','41','42','43','45','47','55','56','57','58','59','62','71','74','77','80','88','98')) then
1619      if ((trunc(p_effective_date) not between l_lpa_effective_start_date and
1620             				          nvl(l_lpa_effective_end_date, p_effective_date)) and
1621         (p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0)) then
1622         GHR_GHRWS52L.CPDF_Parameter_Check;
1623         hr_utility.set_message(8301,'GHR_37730_ALL_PROCEDURE_FAIL');
1624         hr_utility.raise_error;
1625      end if;
1626   end if;
1627 */
1628 
1629 
1630 -- 652.10.1
1631 --  'p_as_of_date' has been determined to be effective date.
1632 -------------------------------------------------------------------------------
1633 --- Modified by    Date          Comments
1634 -------------------------------------------------------------------------------
1635 --- Madhuri       01-MAR-05      Change the condition 'And locality pay area is 02 through 88'
1636 ---			  	To:'And locality pay area is other than ZY or ZZ' as of 09-JAN-2005
1637 --  Raju    	  08-Nov-2005	 UPD 42(Bug 4567571) Delete PRD 3,J and K as of 01-May-2005
1638 -- amrchakr       28-Sep-2006    Remove locality pay area 'ZY' effective 01-jul-2006
1639 -------------------------------------------------------------------------------
1640 IF ( p_effective_date < to_date('09/01/2005', 'dd/mm/yyyy')) THEN
1641 	if (
1642 	p_to_pay_plan in ('GS','GM','GG','GH','FO','FP') and
1643 	p_pay_rate_determinant_code in ('0','3','7','J','K') and
1644 	p_locality_pay_area between '02' and '88' and
1645 	(p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0) and
1646 	(p_to_basic_pay is not null and to_number(p_to_basic_pay) <> 0)
1647      ) then
1648 	if (
1649 	    l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
1650 	    l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
1651 	   ) then
1652        GHR_GHRWS52L.CPDF_Parameter_Check;
1653 	    hr_utility.set_message(8301,'GHR_37731_ALL_PROCEDURE_FAIL');
1654 	    --hr_utility.set_message_token('LOC_PAY','02 through 88');
1655 	    hr_utility.raise_error;
1656      end if;
1657   end if;
1658 ELSIF ( p_effective_date < to_date('01/05/2005', 'dd/mm/yyyy')) THEN
1659  if (
1660 	p_to_pay_plan in ('GS','GM','GG','GH','FO','FP') and
1661 	p_pay_rate_determinant_code in ('0','3','7','J','K') and
1662 	p_locality_pay_area NOT IN ('ZY','ZZ') and
1663 	(p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0) and
1664 	(p_to_basic_pay is not null and to_number(p_to_basic_pay) <> 0)
1665      ) then
1666 	if (
1667 	    l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
1668 	    l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
1669 	   ) then
1670        GHR_GHRWS52L.CPDF_Parameter_Check;
1671 	    hr_utility.set_message(8301,'GHR_38928_ALL_PROCEDURE_FAIL ');
1672 		hr_utility.set_message_token('PRD_LIST','0, 3, 7, J, or K');
1673 		hr_utility.raise_error;
1674     end if;
1675  end if;
1676 
1677  ELSIF (( p_effective_date >= to_date('01/05/2005', 'dd/mm/yyyy'))
1678        AND
1679 	( p_effective_date < to_date('01/07/2006', 'dd/mm/yyyy'))
1680        )
1681        THEN
1682  if (
1683 	p_to_pay_plan in ('GS','GM','GG','GH','FO','FP') and
1684 	p_pay_rate_determinant_code in ('0','7') and
1685 	p_locality_pay_area NOT IN ('ZY','ZZ') and
1686 	(p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0) and
1687 	(p_to_basic_pay is not null and to_number(p_to_basic_pay) <> 0)
1688      ) then
1689 	if (
1690 	    l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
1691 	    l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
1692 	   ) then
1693        GHR_GHRWS52L.CPDF_Parameter_Check;
1694 	   hr_utility.set_message(8301,'GHR_38928_ALL_PROCEDURE_FAIL');
1695        hr_utility.set_message_token('PRD_LIST','0, or 7');
1696 		hr_utility.raise_error;
1697     end if;
1698  end if;
1699 
1700  ELSIF ( p_effective_date >= to_date('01/07/2005', 'dd/mm/yyyy')) THEN
1701  if (
1702 	p_to_pay_plan in ('GS','GM','GG','GH','FO','FP') and
1703 	p_pay_rate_determinant_code in ('0','7') and
1704 	p_locality_pay_area NOT IN ('ZZ') and
1705 	(p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0) and
1706 	(p_to_basic_pay is not null and to_number(p_to_basic_pay) <> 0)
1707      )
1708        then
1709        if (
1710 	    l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
1711 	    l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
1712 	   ) then
1713        GHR_GHRWS52L.CPDF_Parameter_Check;
1714 	   hr_utility.set_message(8301,'GHR_37694_ALL_PROCEDURE_FAIL');
1715            hr_utility.raise_error;
1716        end if;
1717  end if;
1718 
1719 
1720 END IF;
1721 -------------------------------------------------------------------------------
1722 
1723 -- 652.10.2
1724 /*  'p_as_of_date' has been determined to be effective date' */
1725 -------------------------------------------------------------------------------
1726 --- Modified by    Date          Comments
1727 -------------------------------------------------------------------------------
1728 --- Madhuri       01-MAR-05      Change the condition 'And locality pay area is 02 through 88'
1729 ---			  	To:'And locality pay area is other than ZY or ZZ' as of 09-JAN-2005
1730 --  Raju    	  08-Nov-2005	 UPD 42(Bug 4567571) Delete PRD 3,J and K as of 01-May-2005
1731 --  amrchakr      28-sep-2006    Remove locality pay area 'ZY' effective 01-jul-2006
1732 -------------------------------------------------------------------------------
1733 IF ( p_effective_date < to_date('09/01/2005', 'dd/mm/yyyy')) THEN
1734 	if (
1735 	p_to_pay_plan in ('GS','GM','GG','GH','FO','FP') and
1736 	p_pay_rate_determinant_code in ('0','3','7','J','K') and
1737         p_locality_pay_area between '02' and '88' and
1738       (p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0) and
1739 	(p_to_basic_pay is not null or to_number(p_to_basic_pay) <> 0)
1740      ) then
1741 	if (l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
1742           l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
1743 	   ) then
1744        GHR_GHRWS52L.CPDF_Parameter_Check;
1745 	    hr_utility.set_message(8301,'GHR_37747_ALL_PROCEDURE_FAIL');
1746 	    hr_utility.raise_error;
1747      end if;
1748   end if;
1749 ELSIF ( p_effective_date < to_date('01/05/2005', 'dd/mm/yyyy')) THEN
1750 	if (
1751 	p_to_pay_plan in ('GS','GM','GG','GH','FO','FP') and
1752 	p_pay_rate_determinant_code in ('0','3','7','J','K') and
1753 	p_locality_pay_area NOT IN ('ZY','ZZ') and
1754       (p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0) and
1755 	(p_to_basic_pay is not null or to_number(p_to_basic_pay) <> 0)
1756      ) then
1757 	if (l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
1758           l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
1759 	   ) then
1760        GHR_GHRWS52L.CPDF_Parameter_Check;
1761 	    hr_utility.set_message(8301,'GHR_38929_ALL_PROCEDURE_FAIL');
1762 		hr_utility.set_message_token('PRD_LIST','0, 3, 7, J, or K');
1763 	    hr_utility.raise_error;
1764      end if;
1765   end if;
1766 
1767   ELSIF (( p_effective_date >= to_date('01/05/2005', 'dd/mm/yyyy'))
1768         AND
1769 	 ( p_effective_date < to_date('01/07/2006', 'dd/mm/yyyy'))
1770 	)
1771 	THEN
1772 	if (
1773 	p_to_pay_plan in ('GS','GM','GG','GH','FO','FP') and
1774 	p_pay_rate_determinant_code in ('0','7') and
1775 	p_locality_pay_area NOT IN ('ZY','ZZ') and
1776       (p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0) and
1777 	(p_to_basic_pay is not null or to_number(p_to_basic_pay) <> 0)
1778      ) then
1779 	if (l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
1780           l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
1781 	   ) then
1782        GHR_GHRWS52L.CPDF_Parameter_Check;
1783 	    hr_utility.set_message(8301,'GHR_38929_ALL_PROCEDURE_FAIL');
1784 		hr_utility.set_message_token('PRD_LIST','0, or 7');
1785 	    hr_utility.raise_error;
1786      end if;
1787   end if;
1788 
1789   ELSIF ( p_effective_date >= to_date('01/07/2006', 'dd/mm/yyyy')) THEN
1790 	if (
1791 	p_to_pay_plan in ('GS','GM','GG','GH','FO','FP') and
1792 	p_pay_rate_determinant_code in ('0','7') and
1793 	p_locality_pay_area NOT IN ('ZZ') and
1794       (p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0) and
1795 	(p_to_basic_pay is not null or to_number(p_to_basic_pay) <> 0)
1796      ) then
1797 	if (l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
1798           l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
1799 	   ) then
1800        GHR_GHRWS52L.CPDF_Parameter_Check;
1801 	    hr_utility.set_message(8301,'GHR_37695_ALL_PROCEDURE_FAIL');
1802 	    hr_utility.raise_error;
1803      end if;
1804   end if;
1805 
1806 END IF;
1807 -------------------------------------------------------------------------------
1808 -- 652.15.1
1809        /* If pay plan is GS, GM, GG, or GH,
1810           And pay rate determinant is 5, 6, E, F, or M,
1811           And locality pay area is 02 through 88,
1812           Then the locality adjustment amount may not be spaces
1813           or an amount greater than the highest percentage
1814           present and currently valid for the locality pay area
1815           on Table 25.
1816 
1817           Default:  Insert asterisks in locality adjustment. */
1818 
1819    --  'p_as_of_date' has been determined to be effective_date.
1820    --  Adds pay rate determinants E and F effective 01-mar-1998
1821 -------------------------------------------------------------------------------
1822 --- Modified by    Date          Comments
1823 -------------------------------------------------------------------------------
1824 --- Madhuri       01-MAR-05      Change the condition 'And locality pay area is 02 through 88'
1825 ---			  	To:'And locality pay area is other than ZY or ZZ' as of 09-JAN-2005
1826 --  Raju		  31/1/06		 Commented the code effective from 01-May-2005
1827 -- upd50  06-Feb-07	  Raju       From 01-Oct-2006	    Bug#5745356
1828 -------------------------------------------------------------------------------
1829 IF  p_effective_date < fnd_date.canonical_to_date('1998/03/01')  then
1830       if (
1831 	   p_to_pay_plan in ('GS','GM','GG','GH') and
1832          p_pay_rate_determinant_code in ('6','5','M') and
1833          p_locality_pay_area between '02' and '88' and
1834          (p_to_locality_adj is not null or to_number(p_to_locality_adj) <> 0) and
1835          (p_to_basic_pay is not null or to_number(p_to_basic_pay) <> 0)
1836           ) then
1837          if (
1838               l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
1839               l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
1840             ) then
1841             GHR_GHRWS52L.CPDF_Parameter_Check;
1842             hr_utility.set_message(8301,'GHR_37732_ALL_PROCEDURE_FAIL');
1843 	      hr_utility.raise_error;
1844          end if;
1845       end if;
1846 ELSE --- meaning effective_date is greater than '1998/03/01'
1847      -- this check is for dates from 01-MAR-1998 to 08-JAN-2005
1848 
1849    IF ( p_effective_date < to_date('09/01/2005', 'dd/mm/yyyy') ) THEN
1850 	 if (p_to_pay_plan in ('GS','GM','GG','GH') and
1851 		 p_pay_rate_determinant_code in ('6','5','M','E','F') and
1852 		 p_locality_pay_area between '02' and '88' and
1853 		 (p_to_locality_adj is not null or to_number(p_to_locality_adj) <> 0) and
1854 		 (p_to_basic_pay is not null or to_number(p_to_basic_pay) <> 0)
1855 		 ) then
1856 		 if (
1857 				 l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
1858 			 l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
1859 				) then
1860 			GHR_GHRWS52L.CPDF_Parameter_Check;
1861 				hr_utility.set_message(8301,'GHR_37868_ALL_PROCEDURE_FAIL');
1862 			hr_utility.raise_error;
1863 			 end if;
1864 	 end if;
1865 	 -- FWFA Changes
1866    ELSIF ( p_effective_date < to_date('01/05/2005', 'dd/mm/yyyy') ) THEN
1867 		if (
1868 		   p_to_pay_plan in ('GS','GM','GG','GH') and
1869 			   p_pay_rate_determinant_code in ('6','5','M','E','F') and
1870 		   p_locality_pay_area NOT IN ('ZY','ZZ') and
1871 			  (p_to_locality_adj is not null or to_number(p_to_locality_adj) <> 0) and
1872 			  (p_to_basic_pay is not null or to_number(p_to_basic_pay) <> 0)
1873 				) then
1874 
1875 			  if (
1876 					l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
1877 					l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
1878 					 ) then
1879 					 GHR_GHRWS52L.CPDF_Parameter_Check;
1880 				 hr_utility.set_message(8301,'GHR_38930_ALL_PROCEDURE_FAIL');
1881 			 hr_utility.raise_error;
1882 			  end if;
1883 		end if;
1884 	-- Begin Bug# 4999292 and 4917098
1885 	/*ELSE
1886 		if	(p_to_pay_plan in ('GS','GM','GG','GH') and
1887 			 p_pay_rate_determinant_code in ('6','5','E','F')
1888 			) then
1889 
1890 			  if to_number(p_to_locality_adj) <= 0 then
1891 				GHR_GHRWS52L.CPDF_Parameter_Check;
1892 				hr_utility.set_message(8301,'GHR_38981_ALL_PROCEDURE_FAIL');
1893 				hr_utility.raise_error;
1894 			  end if;
1895 		end if;*/
1896 	-- End Bug# 4999292 and 4917098
1897 		-- FWFA Changes
1898    ELSIF ( p_effective_date < to_date('01/10/2006', 'dd/mm/yyyy') ) THEN
1899         l_pay_table := SUBSTR(ghr_pay_calc.get_user_table_name(p_special_pay_table_id),1,4);
1900         if	(p_to_pay_plan in ('GS','GM','GG','GH') and
1901              p_pay_rate_determinant_code in ('6','5','E','F') and
1902              l_pay_table <> '0491'
1903             ) then
1904 
1905               if to_number(p_to_locality_adj) <= 0 then
1906                 GHR_GHRWS52L.CPDF_Parameter_Check;
1907                 hr_utility.set_message(8301,'GHR_38981_ALL_PROCEDURE_FAIL');
1908                 hr_utility.raise_error;
1909               end if;
1910         end if;
1911 
1912    END IF; -- less or greater then 09-JAN-05 check
1913 END IF;
1914 -------------------------------------------------------------------------------
1915 
1916 -- 652.15.2
1917        /* If pay plan = GS, GM, GG, GH, FO, or FP,
1918           And PRD = 6, 5, or M,
1919           And locality pay area is not 99,
1920           Then the locality adjustment amount may not be greater
1921           than the highest percentage on Table 25 for the area,
1922           valid as of the effective date.
1923 
1924           Default:  Insert asterisks in locality adjustment.
1925 
1926           Basis for Edit:  5 U.S.C. 5304
1927          'p_as_of_date' has been determined to be effective date. */
1928 -------------------------------------------------------------------------------
1929 --- Modified by    Date          Comments
1930 -------------------------------------------------------------------------------
1931 --- Madhuri       01-MAR-05      Change the condition 'And locality pay area is 02 through 88'
1932 ---			  	To:'And locality pay area is other than ZY or ZZ' as of 09-JAN-05
1933 --  utokachi      10/21/05       Validate for actions after 01-MAY-2005
1934 --  Raju		  31/1/06		 Commented the code effective from 01-May-2005
1935 -------------------------------------------------------------------------------
1936 IF ( p_effective_date < to_date('09/01/2005', 'dd/mm/yyyy') ) THEN
1937 	if (
1938 	p_to_pay_plan in ('GS','GM','GG','GH','FO','FP') and
1939 	p_pay_rate_determinant_code in ('6','5','M') and
1940         p_locality_pay_area between '02' and '88' and
1941       (p_to_locality_adj is not null or to_number(p_to_locality_adj) <> 0) and
1942 	(p_to_basic_pay is not null or to_number(p_to_basic_pay) <> 0)
1943      ) then
1944 	if (
1945           l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
1946           l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
1947 	   ) then
1948          GHR_GHRWS52L.CPDF_Parameter_Check;
1949          hr_utility.set_message(8301,'GHR_37748_ALL_PROCEDURE_FAIL');
1950 	   hr_utility.raise_error;
1951      end if;
1952   end if;
1953  -- FWFA Changes
1954 ELSIF ( p_effective_date < to_date('01/05/2005', 'dd/mm/yyyy') ) THEN
1955 if (
1956 	p_to_pay_plan in ('GS','GM','GG','GH','FO','FP') and
1957 	p_pay_rate_determinant_code in ('6','5','M') and
1958 	p_locality_pay_area NOT IN ('ZY','ZZ') and
1959       (p_to_locality_adj is not null or to_number(p_to_locality_adj) <> 0) and
1960 	(p_to_basic_pay is not null or to_number(p_to_basic_pay) <> 0)
1961      ) then
1962 	if (
1963           l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
1964           l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
1965 	   ) then
1966          GHR_GHRWS52L.CPDF_Parameter_Check;
1967          hr_utility.set_message(8301,'GHR_38931_ALL_PROCEDURE_FAIL');
1968 	   hr_utility.raise_error;
1969      end if;
1970   end if;
1971   -- Begin Bug# 4999292
1972   /*ELSIF ( p_effective_date >= to_date('01/05/2005', 'dd/mm/yyyy') ) THEN
1973   if (
1974 	p_to_pay_plan in ('GS','GM','GG','GH') and
1975 	p_pay_rate_determinant_code in ('6','5') ) then
1976 	if (to_number(p_to_locality_adj) <= 0 ) then
1977          GHR_GHRWS52L.CPDF_Parameter_Check;
1978          hr_utility.set_message(8301,'GHR_38982_ALL_PROCEDURE_FAIL');
1979 	   hr_utility.raise_error;
1980      end if;
1981   end if;*/
1982   -- End Bug# 4999292
1983   -- FWFA Changes
1984 END IF;
1985 -------------------------------------------------------------------------------
1986 -- 652.20.3
1987 -- Update   Date   	    By                    Comments
1988 -- 21/2    20-Feb-2003     Madhuri  		Adding HS to other than list
1989 --         30-OCT-2003     Ashley               Commented second condition
1990 -------------------------------------------------------------------------------
1991 --- Modified by    Date          Comments
1992 -------------------------------------------------------------------------------
1993 --- Madhuri       01-MAR-05      Change the condition "If Locality Pay Area is 99"
1994 ---				 To: If locality pay area is ZZ as of 09-JAN-05
1995 --  utokachi      10/24/05       Validate for actions after 01-MAY-2005
1996 --  Raju		  26-Jun-06      Validate for actions after 01-Jan-2006
1997 --                                and added pay plan condition affective frm 01-Apr-06
1998 --  arbasu        26-Oct-06      Added PRD condition for GHR_38932_ALL_PROCEDURE_FAIL
1999 -------------------------------------------------------------------------------
2000 IF p_effective_date < fnd_date.canonical_to_date('1998/09/01') then
2001       if (p_locality_pay_area = '99' and
2002          (p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0)) then
2003          GHR_GHRWS52L.CPDF_Parameter_Check;
2004 	    hr_utility.set_message(8301,'GHR_37733_ALL_PROCEDURE_FAIL');
2005 	    hr_utility.raise_error;
2006       end if;
2007 ELSE -- meaning bet 01-SEP-1998 to 01-JAN-2005
2008    IF ( p_effective_date < to_date('09/01/2005', 'dd/mm/yyyy') ) THEN
2009      --  If locality pay area is 99, And agency is other than AM, GY, HS, IB, or ST
2010      --  Then locality adjustment must be spaces or asterisks.
2011        if  p_locality_pay_area = '99' and
2012            p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0
2013        then
2014 	    hr_utility.set_message(8301,'GHR_37896_ALL_PROCEDURE_FAIL');
2015 	    hr_utility.raise_error;
2016        end if;
2017   --FWFA Changes
2018    ELSIF  p_effective_date < to_date('2005/05/01','YYYY/MM/DD') THEN
2019 	--  If locality pay area is 99, And agency is other than AM, GY, HS, IB, or ST
2020 	--  Then locality adjustment must be spaces or asterisks.
2021 	  if  p_locality_pay_area = 'ZZ' and
2022 	      p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0 and
2023           p_pay_rate_determinant_code  NOT IN ('6','E','F')
2024  	  then
2025 	      hr_utility.set_message(8301,'GHR_38932_ALL_PROCEDURE_FAIL');
2026 	      hr_utility.raise_error;
2027 	  end if;
2028    ELSIF p_effective_date < to_date('2006/01/01','YYYY/MM/DD') THEN --Modified for Bug# 5073313
2029 	  if  p_locality_pay_area = 'ZZ' and p_pay_rate_determinant_code  NOT in ('6','5','E','F')
2030 	      AND p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0
2031  	  then
2032 	      hr_utility.set_message(8301,'GHR_38978_ALL_PROCEDURE_FAIL');
2033 	      hr_utility.raise_error;
2034 	  end if;
2035    -- Begin Bug# 5073313
2036    elsif p_effective_date < fnd_date.canonical_to_date('2006/04/01') then
2037 	  if substr(p_agency_subelement,1,2) not in ('HS') and p_locality_pay_area = 'ZZ' and
2038             p_pay_rate_determinant_code  NOT in ('6','5','E','F')
2039 	      AND p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0
2040  	  then
2041 	      hr_utility.set_message(8301,'GHR_37065_ALL_PROCEDURE_FAIL');
2042           hr_utility.set_message_token('PAY_PLAN','5, 6, E, or F');
2043 	      hr_utility.raise_error;
2044 	  end if;
2045    else
2046        if substr(p_agency_subelement,1,2) not in ('HS') and p_locality_pay_area = 'ZZ' and
2047             p_pay_rate_determinant_code  NOT in ('6','5','E','F')and
2048             p_to_pay_plan in ('GM','GS')
2049 	      AND p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0
2050  	  then
2051 	      hr_utility.set_message(8301,'GHR_37065_ALL_PROCEDURE_FAIL');
2052           hr_utility.set_message_token('PAY_PLAN','5, 6, E, or F, and pay plan is GM or GS');
2053 	      hr_utility.raise_error;
2054 	  end if;
2055    -- End Bug# 5073313
2056    END IF;
2057    -- FWFA Changes
2058 END IF;
2059 -------------------------------------------------------------------------------
2060 
2061 --Commented as per EOY 2003 cpdf changes by Ashley
2062 -- 652.21.3
2063 -- Update   Date   	    By                    Comments
2064 -- 21/2    20-Feb-2003     Madhuri  		Adding HS to the list
2065    --     If locality pay area is 99,
2066    --       And agency is AM, GY, HS, IB, or ST
2067    --       And either:
2068    --            The first two positions of duty station are other
2069    --            than CA or MX,
2070    --            Or pay plan is FO or FP,
2071    --       Then locality adjustment must be spaces or asterisks.
2072 
2073   /* if p_effective_date >= fnd_date.canonical_to_date('1998/09/01') then
2074       if  p_locality_pay_area = '99' and
2075           substr(p_agency_subelement,1,2) in ('AM','GY','HS','IB','ST') and
2076           (
2077            substr(p_duty_station_code,1,2) not in ('CA','MX') or
2078            p_to_pay_plan in ('FO','FP')
2079           ) and
2080           (p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0) then
2081 	    hr_utility.set_message(8301,'GHR_37897_ALL_PROCEDURE_FAIL');
2082 	    hr_utility.raise_error;
2083       end if;
2084    end if;*/
2085 
2086 
2087 -- 652.30.3
2088    -- Update     Date        By        Effective Date   Comment
2089    --   9        04/05/99    vravikan                   All pay plans starting with W but not 'WM'
2090    -- 20/2      20-Feb-2003  Madhuri    		Deleting pay plans EH and EI.
2091    --  UPD 41(Bug 4567571)   Raju	   08-Nov-2005		Adds pay plan ES and FE
2092    --  Raju    	  08-Nov-2005	 UPD 42(Bug 4567571) Delete PRD U and V as of 01-May-2005
2093 
2094 
2095 IF ( p_effective_date < to_date('01/05/2005', 'dd/mm/yyyy') ) THEN
2096   if (
2097 	(
2098 	 p_to_pay_plan in ('EX','ZZ','ES','FE') or
2099 	 substr(p_to_pay_plan,1,1) in ('B','X') or
2100 	 (substr(p_to_pay_plan,1,1) in ('W') and p_to_pay_plan not in ('WM') )
2101 	) and
2102 	 p_pay_rate_determinant_code not in ('A','B','E','F','S','U','V') and
2103 	 (p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0)
2104      ) then
2105        GHR_GHRWS52L.CPDF_Parameter_Check;
2106 	    hr_utility.set_message(8301,'GHR_37734_ALL_PROCEDURE_FAIL');
2107 		hr_utility.set_message_token('PRD_LIST','A, B, E, F, S, U, or V');
2108 	    hr_utility.raise_error;
2109    end if;
2110 ELSIF ( p_effective_date >= to_date('01/05/2005', 'dd/mm/yyyy') ) THEN
2111 	if (
2112 	     ( p_to_pay_plan in ('EX','ZZ','ES','FE') or
2113 	      substr(p_to_pay_plan,1,1) in ('B','X') or
2114 	      (substr(p_to_pay_plan,1,1) in ('W') and p_to_pay_plan not in ('WM') )
2115 	     ) and
2116 	     p_pay_rate_determinant_code not in ('A','B','E','F','S') and
2117 	     (p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0)
2118        ) then
2119        GHR_GHRWS52L.CPDF_Parameter_Check;
2120 	    hr_utility.set_message(8301,'GHR_37734_ALL_PROCEDURE_FAIL');
2121 		hr_utility.set_message_token('PRD_LIST','A, B, E, F, or S');
2122 	    hr_utility.raise_error;
2123    end if;
2124 END IF;
2125 
2126 -- 652.35.3
2127 -- upd49  19-Jan-07	  Raju       From 01-Apr-2004	    Bug#5619873 Terminate the Edit
2128  IF p_effective_date < to_date('01/04/2004', 'dd/mm/yyyy') THEN
2129     if (
2130     p_pay_rate_determinant_code = 'C' and
2131     (p_to_locality_adj is not null and to_number(p_to_locality_adj) <> 0)
2132      ) then
2133        GHR_GHRWS52L.CPDF_Parameter_Check;
2134         hr_utility.set_message(8301,'GHR_37735_ALL_PROCEDURE_FAIL');
2135         hr_utility.raise_error;
2136     end if;
2137  END IF;
2138 -- 652.45.1
2139 --            12/8/00   vravikan    From the Start        Remove GH and GM
2140 --            19/03/04  Madhuri     Raise edit error only if the NOAC is not 817
2141 --
2142 -- Modified EDIT for Student Loan Repayment
2143 -- The to Basic Pay will be NULL for 817 action, so this edit will be fired
2144 -- Checking for NOAC 817 before firing edit
2145 -------------------------------------------------------------------------------
2146 --- Modified by    Date          Comments
2147 -------------------------------------------------------------------------------
2148 --- Madhuri       01-MAR-05      Change the condition 'And locality pay area is 02 through 88'
2149 ---			  	To:'And locality pay area is other than ZY or ZZ' as of 09-JAN-05
2150 --  Raju    	  08-Nov-2005	 UPD 42(Bug 4567571) Delete PRD U and V as of 01-May-2005
2151 --  amrchakr      28-sep-2006   Change the edit no. from 652.45.1 to 652.45.3
2152 --                              And remove the lacality pay area 'ZY' effective 01-jul-2006
2153 --  Raju          24-Jan-2007   Change the edit no. from 652.45.3 to 652.45.1 eff from 01-Sep-2006
2154 -------------------------------------------------------------------------------
2155 IF ( p_effective_date < to_date('09/01/2005', 'dd/mm/yyyy') ) THEN
2156    if (	p_retained_pay_plan in ('GS','GG') and
2157 	    p_pay_rate_determinant_code in ('A','B','E','F','U','V') and
2158 	    p_locality_pay_area between '02' and '88' and
2159         (p_to_locality_adj is null) ) and
2160         ( p_first_noac_lookup_code <> '817' )
2161      then
2162         GHR_GHRWS52L.CPDF_Parameter_Check;
2163 	    hr_utility.set_message(8301,'GHR_37736_ALL_PROCEDURE_FAIL');
2164 	    hr_utility.raise_error;
2165    end if;
2166 
2167 ELSIF ( p_effective_date < to_date('01/05/2005', 'dd/mm/yyyy') ) THEN
2168     if (p_retained_pay_plan in ('GS','GG') and
2169         p_pay_rate_determinant_code in ('A','B','E','F','U','V') and
2170         p_locality_pay_area NOT IN ('ZY','ZZ') and
2171         (p_to_locality_adj is null)) and
2172         ( p_first_noac_lookup_code <> '817' )
2173      then
2174         GHR_GHRWS52L.CPDF_Parameter_Check;
2175         hr_utility.set_message(8301,'GHR_38933_ALL_PROCEDURE_FAIL');
2176         hr_utility.set_message_token('PRD_LIST','A, B, E, F, U, or V');
2177         hr_utility.raise_error;
2178     end if;
2179 
2180 ELSIF ( p_effective_date >= to_date('01/05/2005', 'dd/mm/yyyy') ) AND
2181       ( p_effective_date < to_date('01/07/2006', 'dd/mm/yyyy') )  THEN
2182    if (	p_retained_pay_plan in ('GS','GG') and
2183 		p_pay_rate_determinant_code in ('A','B','E','F') and
2184 		p_locality_pay_area NOT IN ('ZY','ZZ') and
2185        (p_to_locality_adj is null))
2186       and ( p_first_noac_lookup_code <> '817' ) then
2187        GHR_GHRWS52L.CPDF_Parameter_Check;
2188        hr_utility.set_message(8301,'GHR_38933_ALL_PROCEDURE_FAIL');
2189 	   hr_utility.set_message_token('PRD_LIST','A, B, E, or F');
2190        hr_utility.raise_error;
2191    end if;
2192 
2193 ELSIF ( p_effective_date >= to_date('01/07/2006', 'dd/mm/yyyy') ) THEN
2194    if (	p_retained_pay_plan in ('GS','GG') and
2195 		p_pay_rate_determinant_code in ('A','B','E','F') and
2196 		p_locality_pay_area NOT IN ('ZZ') and
2197        (p_to_locality_adj is null)) and
2198       ( p_first_noac_lookup_code <> '817' )
2199      then
2200        GHR_GHRWS52L.CPDF_Parameter_Check;
2201        if ( p_effective_date < to_date('01/09/2006', 'dd/mm/yyyy') ) THEN
2202            hr_utility.set_message(8301,'GHR_37696_ALL_PROCEDURE_FAIL');
2203            hr_utility.raise_error;
2204        else
2205             hr_utility.set_message(8301,'GHR_37434_ALL_PROCEDURE_FAIL');
2206             hr_utility.raise_error;
2207        end if;
2208    end if;
2209 
2210 END IF;
2211 -------------------------------------------------------------------------------
2212 
2213 -- 652.60.1
2214 /*  'p_as_of_date' has been determined to be effective date. */
2215 -- NAME           EFFECTIVE      COMMENTS
2216 -- Madhuri        21-JAN-2004    End Dating this edit as on 10-JAN-04
2217 --				 For SES Pay Calculations
2218 -- Madhuri        19-MAY-2004    Removing the pay plans ES, FE from the list
2219 --
2220 -- end dating the edit as on 10-JAN-2004
2221 --
2222 -------------------------------------------------------------------------------
2223 --- Modified by    Date          Comments
2224 -------------------------------------------------------------------------------
2225 --- Madhuri       01-MAR-05      Change the condition 'And locality pay area is 02 through 88'
2226 ---			  	To:'And locality pay area is other than ZY or ZZ' as of 09-JAN-05
2227 --- NOT MODIFYING THIS EDIT as THE EDIT IS END DATED AS OF 11 JAN 04
2228 -------------------------------------------------------------------------------
2229   if ( p_effective_date < to_date('2004/01/11', 'yyyy/mm/dd') and
2230 	p_to_pay_plan in ('ST','AL','CA','SL') and
2231 	p_locality_pay_area between '02' and '88' and
2232       (p_to_locality_adj is not null or to_number(p_to_locality_adj) <> 0) and
2233 	(p_to_basic_pay is not null or to_number(p_to_basic_pay) <> 0)
2234      ) then
2235 	if (
2236 	    l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
2237 	    l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
2238 	   ) then
2239        GHR_GHRWS52L.CPDF_Parameter_Check;
2240 	    hr_utility.set_message(8301,'GHR_37737_ALL_PROCEDURE_FAIL');
2241 	    hr_utility.raise_error;
2242      end if;
2243    end if;
2244 -------------------------------------------------------------------------------
2245 
2246 -- 652.60.2
2247 /*  'p_as_of_date' has been detemined to be effective date.  */
2248 -- Madhuri        21-JAN-2004    End Dating this edit as on 10-JAN-04
2249 --				 For SES Pay Calculations
2250 -- Madhuri        19-MAY-2004    Removing the pay plans ES, FE from the list
2251 --
2252 -- end dating the edit as on 10-JAN-2004
2253 -------------------------------------------------------------------------------
2254 --- Modified by    Date          Comments
2255 -------------------------------------------------------------------------------
2256 --- Madhuri       01-MAR-05      Change the condition 'And locality pay area is 02 through 88'
2257 ---			  	To:'And locality pay area is other than ZY or ZZ' as of 09-JAN-05
2258 --- NOT MODIFYING THIS EDIT as THE EDIT IS END DATED AS OF 11 JAN 04
2259 -------------------------------------------------------------------------------
2260   if (p_effective_date < to_date('2004/01/11', 'yyyy/mm/dd') and
2261 	p_to_pay_plan in ('ST','AL','CA','SL') and
2262         p_locality_pay_area between '02' and '88' and
2263       (p_to_locality_adj is not null or to_number(p_to_locality_adj) <> 0) and
2264 	(p_to_basic_pay is not null or to_number(p_to_basic_pay) <> 0)
2265       )
2266       then
2267 	if (
2268 	     l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
2269 	     l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
2270 	   ) then
2271        GHR_GHRWS52L.CPDF_Parameter_Check;
2272 	    hr_utility.set_message(8301,'GHR_37749_ALL_PROCEDURE_FAIL');
2273 	    hr_utility.raise_error;
2274      end if;
2275   end if;
2276 -------------------------------------------------------------------------------
2277 -- 652.75.1
2278   --  'p_as_of_date' has been determined to be effective date.
2279 /*
2280   --
2281   --   Commented the edit for bug 557188 on 7-aug-98
2282   --
2283 	if (
2284 	p_to_pay_plan not in ('GS','GM') and
2285 	p_pay_rate_determinant_code in ('A','B','E','F','U','V') and
2286 	p_retained_pay_plan not in ('GS', 'GM') and
2287 	p_locality_pay_area between '02' and '88' and
2288       (p_to_locality_adj is not null or to_number(p_to_locality_adj) <> 0) and
2289 	(p_to_basic_pay is not null or to_number(p_to_basic_pay) <> 0)
2290        )
2291        then
2292 	if (
2293            l_lpa_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2) and
2294            l_leo_pct < round((to_number(p_to_locality_adj)/to_number(p_to_basic_pay)*100),2)
2295 	   ) then
2296        GHR_GHRWS52L.CPDF_Parameter_Check;
2297 	    hr_utility.set_message(8301,'GHR_37738_ALL_PROCEDURE_FAIL');
2298 	    hr_utility.raise_error;
2299      end if;
2300   end if;
2301 */
2302 
2303 -- 652.80.1
2304 -------------------------------------------------------------------------------
2305 --- Modified by    Date          Comments
2306 -------------------------------------------------------------------------------
2307 --- Madhuri       01-MAR-05     FROM: If the Locality pay area is 98,And pay rate determinant is 0, 3, 7, J, or K,
2308 ---			              Then the amount of the locality adjustment, as a percentage of basic pay, must fall within the range of the highest and lowest percentages on Table 25 for locality pay area 98, or be spaces or asterisks.
2309 ---				TO: If the locality pay area is ZY, And pay rate determinant is 0, 3, 7, J, or K,
2310 ---				    Then the amount of the locality adjustment, as a percentage of basic pay, must fall within the range of the highest and lowest percentages on Table 25 for locality pay area ZY, or be spaces or asterisks.
2311 --  Raju    	  08-Nov-2005	 UPD 42(Bug 4567571) Delete PRD 3,J and K as of 01-May-2005
2312 --  amrchakr      29-sep-2006    End dated the edit fron 01-jul-2006
2313 -------------------------------------------------------------------------------
2314 IF ( p_effective_date < to_date('09/01/2005', 'dd/mm/yyyy') ) THEN
2315   if (
2316 	p_locality_pay_area = '98' and
2317 	p_pay_rate_determinant_code in ('0','3','7','J','K') and
2318         p_to_basic_pay is not null
2319      ) then
2320 	if (
2321 	   round(((nvl(to_number(p_to_locality_adj),0)/to_number(p_to_basic_pay))*100),2)
2322            not between l_lpa_pct and l_leo_pct
2323 	   ) then
2324        GHR_GHRWS52L.CPDF_Parameter_Check;
2325 	    	hr_utility.set_message(8301,'GHR_37759_ALL_PROCEDURE_FAIL');
2326 	    	hr_utility.raise_error;
2327 	end if;
2328   end if;
2329 ELSIF ( p_effective_date < to_date('01/05/2005', 'dd/mm/yyyy') ) THEN
2330   if (
2331 	p_locality_pay_area = 'ZY' and
2332 	p_pay_rate_determinant_code in ('0','3','7','J','K') and
2333         p_to_basic_pay is not null
2334      ) then
2335 	if (
2336 	   round(((nvl(to_number(p_to_locality_adj),0)/to_number(p_to_basic_pay))*100),2)
2337            not between l_lpa_pct and l_leo_pct
2338 	   ) then
2339        GHR_GHRWS52L.CPDF_Parameter_Check;
2340 	    	hr_utility.set_message(8301,'GHR_38934_ALL_PROCEDURE_FAIL');
2341 			hr_utility.set_message_token('PRD_LIST','0, 3, 7, J, or K');
2342 	    	hr_utility.raise_error;
2343 	end if;
2344   end if;
2345 
2346 ELSIF ( p_effective_date >= to_date('01/05/2005', 'dd/mm/yyyy') )
2347       AND
2348       ( p_effective_date < to_date('01/07/2006', 'dd/mm/yyyy') )
2349       THEN
2350   if (
2351 	p_locality_pay_area = 'ZY' and
2352 	p_pay_rate_determinant_code in ('0','7') and
2353         p_to_basic_pay is not null
2354      ) then
2355 	if (
2356 	   round(((nvl(to_number(p_to_locality_adj),0)/to_number(p_to_basic_pay))*100),2)
2357            not between l_lpa_pct and l_leo_pct
2358 	   ) then
2359        GHR_GHRWS52L.CPDF_Parameter_Check;
2360 	    	hr_utility.set_message(8301,'GHR_38934_ALL_PROCEDURE_FAIL');
2361 			hr_utility.set_message_token('PRD_LIST','0, or 7');
2362 	    	hr_utility.raise_error;
2363 	end if;
2364   end if;
2365 END IF;
2366 -------------------------------------------------------------------------------
2367 /*
2368 -- 652.95.2
2369   if  ((p_to_pay_plan in ('GS','GM','GG','GH','FO','FP','FE','ES','ST','AL','CA','SL') and
2370 	p_locality_pay_area <> '99' and
2371 	p_pay_rate_determinant_code not in ('A','B','C','E','F','U','V') and
2372       p_effective_date >= fnd_date.canonical_to_date('1994/01/01')) and
2373       (
2374        substr(p_first_noac_lookup_code,1,1) <> '3' and
2375        substr(p_first_noac_lookup_code,1,1) <> '4'
2376        )
2377       and
2378 	(p_to_locality_adj is null)
2379 	) then
2380        GHR_GHRWS52L.CPDF_Parameter_Check;
2381 	    	hr_utility.set_message(8301,'GHR_37739_ALL_PROCEDURE_FAIL');
2382 	    	hr_utility.raise_error;
2383   end if;
2384 */
2385 end chk_locality_adj;
2386 /* Name:
2387 -- PRIOR LOCALITY ADJUSTMENT
2388 */
2389 procedure chk_prior_locality_adj
2390   (p_to_pay_plan					in	varchar2
2391   ,p_to_basic_pay                         in    varchar2
2392   ,p_prior_pay_plan                       in    varchar2
2393   ,p_pay_rate_determinant_code		in	varchar2
2394   ,p_retained_pay_plan				in	varchar2
2395   ,p_prior_pay_rate_det_code			in	varchar2
2396   ,p_locality_pay_area				in	varchar2
2397   ,p_prior_locality_pay_area			in	varchar2
2398   ,p_prior_basic_pay                      in    varchar2
2399   ,p_to_locality_adj				in	varchar2
2400   ,p_prior_locality_adj				in	varchar2
2401   ,p_prior_loc_adj_effective_date         in    date
2402   ,p_first_noac_lookup_code			in	varchar2
2403   ,p_as_of_date                         	in    date
2404   ,p_agency_subelement                    in    varchar2
2405   ,p_prior_duty_station                   in    varchar2
2406   ,p_effective_date                       in    date
2407   ) is
2408 
2409   l_lpa_pct		                 ghr_locality_pay_areas_f.adjustment_percentage%type;
2410   l_leo_pct		                 ghr_locality_pay_areas_f.leo_adjustment_percentage%type;
2411   l_lpa_effective_start_date       pay_user_rows_f.effective_start_date%type;
2412   l_lpa_effective_end_date         pay_user_rows_f.effective_end_date%type;
2413 
2414   CURSOR c1 is
2415          SELECT effective_start_date,         effective_end_date,
2416                 NVL(adjustment_percentage,0), NVL(leo_adjustment_percentage,0)
2417 	   FROM   ghr_locality_pay_areas_f
2418 	   WHERE  locality_pay_area_code = p_prior_locality_pay_area
2419            AND  p_prior_loc_adj_effective_date BETWEEN effective_start_date and effective_end_date;
2420 
2421 begin
2422   open c1;
2423   fetch c1 into l_lpa_effective_start_date, l_lpa_effective_end_date,
2424                 l_lpa_pct, l_leo_pct;
2425   close c1;
2426 --
2427 -- 27-jul-98
2428 -- The edits where the locality adj as a percentage of prior basic pay was being compared
2429 -- to the lpa_pct has been modified to include leo_pct.
2430 -- bug #703978
2431 --
2432 
2433 /*653.08.2  If prior pay plan is GS, GM, GG, GH, FO, FP, FE,
2434           ES, ST, AL, CA, or SL,
2435           Then prior locality adjustment, as a percentage of
2436           prior basic pay, must not be greater than the highest
2437           percentage on Table 25 for the prior locality pay area.
2438 
2439           Default:  Insert asterisks in prior locality
2440                     adjustment.
2441 
2442           Basis for Edit:  5 U.S.C. 5304 */
2443 /*
2444   --
2445   --   Commented the edit for bug 557188 on 7-aug-98
2446   --
2447   if (
2448 	nvl(p_prior_pay_plan,hr_api.g_varchar2) in ('GS','GM','GG','GH','FO','FP','FE','ES','ST','AL','CA','SL')
2449      ) then
2450 
2451 	if (p_prior_basic_pay is not null or to_number(p_prior_basic_pay) <> 0) then
2452          if (
2453              l_lpa_pct  < round((nvl(to_number(p_prior_locality_adj),0)/to_number(p_prior_basic_pay))*100,2) and
2454              l_leo_pct  < round((nvl(to_number(p_prior_locality_adj),0)/to_number(p_prior_basic_pay))*100,2)
2455 		) then
2456        GHR_GHRWS52L.CPDF_Parameter_Check;
2457 	    hr_utility.set_message(8301,'GHR_37741_ALL_PROCEDURE_FAIL');
2458 	    hr_utility.raise_error;
2459 		end if;
2460 	end if;
2461   end if;
2462 */
2463 
2464 -- Dec. 2001 Patch Removed the NOAC check
2465 /*653.15.2  If prior pay plan = GS, GM, GG, GH, FO, or FP,
2466           And prior PRD = 0, 3, 7, J, or K,
2467           And prior locality pay area is not 99,
2468           Then the amount of the prior locality adjustment, as a
2469           percentage of prior basic pay, must match any
2470           percentage for the locality pay area on Table 25, valid
2471           as of the effective date or be spaces or asterisks.
2472 
2473           Default:  Insert asterisks in prior locality
2474                     adjustment.
2475 
2476           Basis for Edit:  5 U.S.C. 5304 */
2477 -------------------------------------------------------------------------------
2478 --- Modified by    Date          Comments
2479 -------------------------------------------------------------------------------
2480 --- Madhuri       01-MAR-05     FROM:'And prior locality pay area is 02 through 88'
2481 ---				To: 'And prior locality pay area is other than ZY or ZZ' as of 09-Jan-05
2482 --  Raju    	  08-Nov-2005	 UPD 42(Bug 4567571) Delete prior PRD 3,J and K as of 01-May-2005
2483 --  amrchakr      05-Oct-2006   Removed prior locality pay area 'ZY' effective from 01-jul-2006
2484 -------------------------------------------------------------------------------
2485 IF ( p_effective_date < to_date('09/01/2005', 'dd/mm/yyyy') ) THEN
2486     if (
2487 	nvl(p_prior_pay_plan,hr_api.g_varchar2) in ('GS','GM','GG','GH','FO','FP') and
2488 	nvl(p_prior_pay_rate_det_code,hr_api.g_varchar2) in ('0','3','7','J','K') and
2489         nvl(p_locality_pay_area,hr_api.g_varchar2)  between '02' and '88' and
2490         (p_prior_locality_adj is not null or to_number(p_prior_locality_adj) <> 0) and
2491         (p_prior_basic_pay is not null or p_prior_basic_pay <> 0)
2492        ) then
2493      	 if (
2494 	    l_lpa_pct < round((to_number(p_prior_locality_adj)/to_number(p_prior_basic_pay)*100),2) and
2495  	    l_leo_pct < round((to_number(p_prior_locality_adj)/to_number(p_prior_basic_pay)*100),2)
2496 	    ) then
2497             GHR_GHRWS52L.CPDF_Parameter_Check;
2498 	    hr_utility.set_message(8301,'GHR_37742_ALL_PROCEDURE_FAIL');
2499 	    hr_utility.raise_error;
2500      end if;
2501   end if;
2502 ELSIF ( p_effective_date < to_date('01/05/2005', 'dd/mm/yyyy') ) THEN
2503 	if (
2504 	nvl(p_prior_pay_plan,hr_api.g_varchar2) in ('GS','GM','GG','GH','FO','FP') and
2505 	nvl(p_prior_pay_rate_det_code,hr_api.g_varchar2) in ('0','3','7','J','K') and
2506         nvl(p_locality_pay_area,hr_api.g_varchar2)  NOT IN ('ZY','ZZ') and
2507         (p_prior_locality_adj is not null or to_number(p_prior_locality_adj) <> 0) and
2508         (p_prior_basic_pay is not null or p_prior_basic_pay <> 0)
2509      ) then
2510      	 if (
2511 		 l_lpa_pct < round((to_number(p_prior_locality_adj)/to_number(p_prior_basic_pay)*100),2) and
2512  		 l_leo_pct < round((to_number(p_prior_locality_adj)/to_number(p_prior_basic_pay)*100),2)
2513 	   	) then
2514        GHR_GHRWS52L.CPDF_Parameter_Check;
2515 	    hr_utility.set_message(8301,'GHR_38935_ALL_PROCEDURE_FAIL'); -- NEW MESG TOKEN REQD
2516 		hr_utility.set_message_token('PRD_LIST','0, 3, 7, J, or K');
2517 	    hr_utility.raise_error;
2518      end if;
2519   end if;
2520 
2521 ELSIF ( p_effective_date >= to_date('01/05/2005', 'dd/mm/yyyy')
2522         AND
2523 	p_effective_date < to_date('01/07/2006', 'dd/mm/yyyy')
2524       ) THEN
2525 	if (
2526 	nvl(p_prior_pay_plan,hr_api.g_varchar2) in ('GS','GM','GG','GH','FO','FP') and
2527 	nvl(p_prior_pay_rate_det_code,hr_api.g_varchar2) in ('0','7') and
2528         nvl(p_locality_pay_area,hr_api.g_varchar2)  NOT IN ('ZY','ZZ') and
2529         (p_prior_locality_adj is not null or to_number(p_prior_locality_adj) <> 0) and
2530         (p_prior_basic_pay is not null or p_prior_basic_pay <> 0)
2531      ) then
2532      	 if (
2533 		 l_lpa_pct < round((to_number(p_prior_locality_adj)/to_number(p_prior_basic_pay)*100),2) and
2534  		 l_leo_pct < round((to_number(p_prior_locality_adj)/to_number(p_prior_basic_pay)*100),2)
2535 	   	) then
2536        GHR_GHRWS52L.CPDF_Parameter_Check;
2537 	    hr_utility.set_message(8301,'GHR_38935_ALL_PROCEDURE_FAIL');
2538 		hr_utility.set_message_token('PRD_LIST','0, or 7');
2539 	    hr_utility.raise_error;
2540      end if;
2541   end if;
2542 
2543 ELSIF ( p_effective_date >= to_date('01/07/2006', 'dd/mm/yyyy') ) THEN
2544 	if (
2545 	nvl(p_prior_pay_plan,hr_api.g_varchar2) in ('GS','GM','GG','GH','FO','FP') and
2546 	nvl(p_prior_pay_rate_det_code,hr_api.g_varchar2) in ('0','7') and
2547         nvl(p_locality_pay_area,hr_api.g_varchar2)  NOT IN ('ZZ') and
2548         (p_prior_locality_adj is not null or to_number(p_prior_locality_adj) <> 0) and
2549         (p_prior_basic_pay is not null or p_prior_basic_pay <> 0)
2550      ) then
2551      	 if (
2552 		 l_lpa_pct < round((to_number(p_prior_locality_adj)/to_number(p_prior_basic_pay)*100),2) and
2553  		 l_leo_pct < round((to_number(p_prior_locality_adj)/to_number(p_prior_basic_pay)*100),2)
2554 	   	) then
2555        GHR_GHRWS52L.CPDF_Parameter_Check;
2556 	    hr_utility.set_message(8301,'GHR_37697_ALL_PROCEDURE_FAIL');
2557 	    hr_utility.raise_error;
2558      end if;
2559   end if;
2560 
2561 END IF;
2562 -------------------------------------------------------------------------------
2563 
2564 /*653.16.2  If prior pay plan is FO, FP, GG, GH, GM, or GS,
2565           And prior pay rate determinant is 5, 6, or M,
2566           And prior locality pay area is 02 through 88,
2567           Then the prior locality adjustment may not be spaces or
2568           an amount greater than the highest percentage for the
2569           locality pay area on Table 25
2570 */
2571 -------------------------------------------------------------------------------
2572 --- Modified by    Date          Comments
2573 -------------------------------------------------------------------------------
2574 --- Madhuri       01-MAR-05      Change the condition 'And locality pay area is 02 through 88'
2575 ---			  	To:'And locality pay area is other than ZY or ZZ' as of 09-JAN-05
2576 --- Narasimha Rao 21-SEP-05      Modified as a part of FWFA Changes. Restricted
2577 ---                              the edit to actions processed before 01-MAY-2005.
2578 ---                              For actions processed on or after 01-MAY-2005,
2579 ---                               this edit will be skipped.
2580 --  utokachi      10/21/05       Validate for actions after 01-MAY-2005
2581 --  Raju		  10/26/05		 Commented for Bug# 4699444
2582 -------------------------------------------------------------------------------
2583 /*
2584     IF  p_effective_date >= to_date('2000/10/01', 'yyyy/mm/dd')  THEN
2585 
2586         -- check for 09-JAN-05 starts here
2587         IF ( p_effective_date < to_date('09/01/2005', 'dd/mm/yyyy') ) THEN
2588 
2589 			if ( nvl(p_prior_pay_plan,hr_api.g_varchar2) in ('GS','GM','GG','GH','FO','FP') and
2590 				nvl(p_prior_pay_rate_det_code,hr_api.g_varchar2) in ('5','6','M') and
2591 				 nvl(p_locality_pay_area,hr_api.g_varchar2) between '02' and '88' and
2592 				(p_prior_locality_adj is not null or to_number(p_prior_locality_adj) <> 0) and
2593 				(p_prior_basic_pay is not null or p_prior_basic_pay <> 0)
2594 				) then
2595 
2596 				if (
2597 					l_lpa_pct < round((to_number(p_prior_locality_adj)/to_number(p_prior_basic_pay)*100),2) and
2598 					l_leo_pct < round((to_number(p_prior_locality_adj)/to_number(p_prior_basic_pay)*100),2)
2599 					) then
2600 						 GHR_GHRWS52L.CPDF_Parameter_Check;
2601 					 hr_utility.set_message(8301,'GHR_37680_ALL_PROCEDURE_FAIL');
2602 					 hr_utility.raise_error;
2603 				end if;
2604 			end if;
2605 		-- FWFA Changes Bug#4444609
2606         ELSIF p_effective_date < to_date('2005/05/01','yyyy/mm/dd') THEN
2607 
2608 			if ( nvl(p_prior_pay_plan,hr_api.g_varchar2) in ('GS','GM','GG','GH','FO','FP') and
2609 				nvl(p_prior_pay_rate_det_code,hr_api.g_varchar2) in ('5','6','M') and
2610 				nvl(p_locality_pay_area,hr_api.g_varchar2) NOT IN ('ZY','ZZ') and
2611 				(p_prior_locality_adj is not null or to_number(p_prior_locality_adj) <> 0) and
2612 				(p_prior_basic_pay is not null or p_prior_basic_pay <> 0)
2613 				) then
2614 				if (
2615 					l_lpa_pct < round((to_number(p_prior_locality_adj)/to_number(p_prior_basic_pay)*100),2) and
2616 					l_leo_pct < round((to_number(p_prior_locality_adj)/to_number(p_prior_basic_pay)*100),2)
2617 					) then
2618 					GHR_GHRWS52L.CPDF_Parameter_Check;
2619 					hr_utility.set_message(8301,'GHR_38936_ALL_PROCEDURE_FAIL');
2620 					hr_utility.raise_error;
2621 				end if;
2622 			end if;
2623 		ELSE
2624 			if ( nvl(p_prior_pay_plan,hr_api.g_varchar2) in ('GS','GM','GG','GH') and
2625 				nvl(p_prior_pay_rate_det_code,hr_api.g_varchar2) in ('5','6')
2626 				) then
2627 				if to_number(p_prior_locality_adj) <= 0 then
2628 					GHR_GHRWS52L.CPDF_Parameter_Check;
2629 					hr_utility.set_message(8301,'GHR_38979_ALL_PROCEDURE_FAIL');
2630 					hr_utility.raise_error;
2631 				end if;
2632 			end if;
2633         END IF; -- check for 09-JAN-05 ends here
2634 
2635     END IF; -- only if eff date is greater than 01-OCT-2000
2636 	-- FWFA Changes
2637 	*/
2638 -------------------------------------------------------------------------------
2639 /* p_prior_locality_pay_area has been activated. */
2640 
2641 -- 653.30.2
2642 -- Update   Date   	    By                    Comments
2643 -- 21/2    20-Feb-2003     Madhuri  		Adding HS to other than list
2644 --         30-OCT-2003     Ashley               Commented the second condition(Agency subelement cond.)
2645 -------------------------------------------------------------------------------
2646 --- Modified by    Date          Comments
2647 -------------------------------------------------------------------------------
2648 --- Madhuri       01-MAR-05      Change the condition 'If prior locality pay area is 99'
2649 ---			  	To:'If prior locality pay area is ZZ' as of 09-JAN-05
2650 --upd47  26-Jun-06	Raju	   From 01-Apr-2006		    Added prior pay plan condition
2651 -------------------------------------------------------------------------------
2652 IF p_effective_date < fnd_date.canonical_to_date('1998/09/01') THEN
2653      if (p_prior_locality_pay_area = '99' and
2654         (p_prior_locality_adj is not null and to_number(p_prior_locality_adj) <> 0)) then
2655          GHR_GHRWS52L.CPDF_Parameter_Check;
2656 	   hr_utility.set_message(8301,'GHR_37743_ALL_PROCEDURE_FAIL');
2657 	   hr_utility.raise_error;
2658       end if;
2659 ELSE
2660   -- between 01-SEP-98 to 09-JAN-05
2661   IF ( p_effective_date < to_date('09/01/2005', 'dd/mm/yyyy') ) THEN
2662 	   --  If prior locality pay area is 99,
2663 	   --  And agency is other than AM, GY, HS, IB, or ST
2664 	   --  Then prior locality adjustment must be spaces or asterisks.
2665 	   if  p_prior_locality_pay_area = '99' and
2666 	       p_prior_locality_adj is not null and
2667 	       to_number(p_prior_locality_adj) <> 0
2668 	   then
2669 	        GHR_GHRWS52L.CPDF_Parameter_Check;
2670 	        hr_utility.set_message(8301,'GHR_37898_ALL_PROCEDURE_FAIL');
2671 		hr_utility.raise_error;
2672 	   end if;
2673   -- FWFA Changes
2674   ELSIF p_effective_date < to_date('2005/05/01','YYYY/MM/DD') THEN
2675 	   --  If prior locality pay area is 99,
2676 	   --  And agency is other than AM, GY, HS, IB, or ST
2677 	   --  Then prior locality adjustment must be spaces or asterisks.
2678 	   if  p_prior_locality_pay_area = 'ZZ' and
2679 	       p_prior_locality_adj is not null and
2680 	       to_number(p_prior_locality_adj) <> 0
2681 	   then
2682 	        GHR_GHRWS52L.CPDF_Parameter_Check;
2683 	        hr_utility.set_message(8301,'GHR_38937_ALL_PROCEDURE_FAIL');
2684 		hr_utility.raise_error;
2685 	   end if;
2686   ELSif p_effective_date < fnd_date.canonical_to_date('2006/04/01') then
2687 	   if  p_prior_locality_pay_area = 'ZZ' and
2688 	       p_prior_pay_rate_det_code not in ('5','6','E','F') and
2689 	       p_prior_locality_adj is not null and
2690 	       to_number(p_prior_locality_adj) <> 0
2691 		then
2692 	        GHR_GHRWS52L.CPDF_Parameter_Check;
2693 	        hr_utility.set_message(8301,'GHR_38980_ALL_PROCEDURE_FAIL');
2694 			hr_utility.raise_error;
2695 	   end if;
2696   ELSE
2697         if substr(p_agency_subelement,1,2) <> 'HS' and
2698 		   p_prior_locality_pay_area = 'ZZ' and
2699 	       p_prior_pay_rate_det_code not in ('5','6','E','F') and
2700            p_prior_pay_plan in ('GM','GS') and
2701 	       p_prior_locality_adj is not null and
2702 	       to_number(p_prior_locality_adj) <> 0
2703 		then
2704 	        GHR_GHRWS52L.CPDF_Parameter_Check;
2705 	        hr_utility.set_message(8301,'GHR_37162_ALL_PROCEDURE_FAIL');
2706 			hr_utility.raise_error;
2707 	   end if;
2708   END IF;
2709   -- FWFA Changes
2710 END IF;
2711 -------------------------------------------------------------------------------
2712 --Commented as per EOY 2003 cpdf changes by Ashley
2713 -- 653.31.2
2714 -- Update   Date   	    By                    Comments
2715 -- 21/2    20-Feb-2003     Madhuri  		Adding HS to the list
2716 
2717    -- If prior locality pay area is 99,
2718    --       And agency is AM, GY, HS, IB, or ST,
2719    --       And either:
2720    --            The first two positions of prior duty station are other
2721    --            than CA or MX,
2722    --            Or prior pay plan is FO or FP,
2723    --       Then prior locality adjustment must be spaces or asterisks.
2724 
2725 /*   if p_effective_date >= fnd_date.canonical_to_date('1998/09/01') then
2726       if  p_prior_locality_pay_area = '99' and
2727           substr(p_agency_subelement,1,2) in ('AM','GY','HS','IB','ST') and
2728           (
2729            substr(p_prior_duty_station,1,2) not in ('CA','MX') or
2730            p_prior_pay_plan in ('FO','FP')
2731           ) and
2732           (p_prior_locality_adj is not null and to_number(p_prior_locality_adj) <> 0) then
2733 	    hr_utility.set_message(8301,'GHR_37899_ALL_PROCEDURE_FAIL');
2734 	    hr_utility.raise_error;
2735       end if;
2736    end if;
2737    */
2738 
2739 -- 653.40.2
2740    -- Update     Date        By        Effective Date   Comment
2741    --   9        04/05/99    vravikan                   All pay plans starting with W but not 'WM'
2742    --            10/21/05    utokachi   Validate for actions before to 01-MAY-2005
2743    --      	     08-Nov-05	 Raju       UPD 42(Bug 4567571) Delete Prior PRD U and V as of 01-May-2005
2744    --      	     14-Nov-05	 Raju       UPD 45(Bug 4567571) Terminate the Edit effective 01-Sep-2005
2745    --      	     20-Dec-05	 Raju       Bug# 4879781 Terminate the Edit effective 01-May-2005
2746 -- Begin Fix for Bug#4879781
2747 --IF p_effective_date < to_date('2005/09/01','YYYY/MM/DD') THEN
2748 -- End Fix for Bug#4879781
2749    --FWFA Changes
2750    IF p_effective_date < to_date('2005/05/01','YYYY/MM/DD') THEN
2751 	  if (
2752 		(substr(p_prior_pay_plan,1,1) in ('B','X') or
2753 		 (substr(p_prior_pay_plan,1,1) in ('W') and p_prior_pay_plan not in ('WM') ) or
2754 		 p_prior_pay_plan in ('EH','EI','EX','ZZ')) and
2755 		 p_prior_pay_rate_det_code not in ('A','B','E','F','S','U','V') and
2756 		(p_prior_locality_adj is not null and to_number(p_prior_locality_adj) <> 0)
2757 		 ) then
2758 		   GHR_GHRWS52L.CPDF_Parameter_Check;
2759 			hr_utility.set_message(8301,'GHR_37744_ALL_PROCEDURE_FAIL');
2760 			hr_utility.set_message_token('PRD_LIST','A, B, E, F, S, U, or V');
2761 			hr_utility.raise_error;
2762 	  end if;
2763 -- Begin Fix for Bug#4879781
2764   /*ELSIF p_effective_date >= to_date('2005/05/01','YYYY/MM/DD') THEN
2765 	  if (
2766 		(substr(p_prior_pay_plan,1,1) in ('B','X') or
2767 		 (substr(p_prior_pay_plan,1,1) in ('W') and p_prior_pay_plan not in ('WM') ) or
2768 		 p_prior_pay_plan in ('EH','EI','EX','ZZ')) and
2769 		 p_prior_pay_rate_det_code not in ('A','B','E','F','S') and
2770 		(p_prior_locality_adj is not null and to_number(p_prior_locality_adj) <> 0)
2771 		 ) then
2772 		   GHR_GHRWS52L.CPDF_Parameter_Check;
2773 			hr_utility.set_message(8301,'GHR_37744_ALL_PROCEDURE_FAIL');
2774 			hr_utility.set_message_token('PRD_LIST','A, B, E, F, or S');
2775 			hr_utility.raise_error;
2776 	  end if;
2777   END IF;*/
2778    --FWFA Changes
2779  -- End Fix for Bug#4879781
2780 end if;
2781 
2782 
2783 -- 653.45.2
2784   if (
2785 	p_prior_pay_rate_det_code = 'C' and
2786 	(p_prior_locality_adj is not null and to_number(p_prior_locality_adj) <> 0)
2787 
2788      ) then
2789        GHR_GHRWS52L.CPDF_Parameter_Check;
2790 	    hr_utility.set_message(8301,'GHR_37745_ALL_PROCEDURE_FAIL');
2791 	    hr_utility.raise_error;
2792   end if;
2793 
2794 hr_utility.set_location('Leaving CPDF 7 ',1);
2795 end chk_prior_locality_adj;
2796 end GHR_CPDF_CHECK7;