2: /* $Header: hxtgenai.pkb 120.3.12010000.2 2008/08/05 09:47:31 ubhat ship $ */
3:
4: -------------------------------------------------------------------------------
5:
6: g_debug boolean := hr_utility.debug_enabled;
7: PROCEDURE AAI_VALIDATIONS
8: (p_assignment_id NUMBER
9: ,p_earning_policy NUMBER
10: ,p_rotation_plan NUMBER
210: And assignment_id = p_assignment_id;
211:
212: BEGIN
213:
214: g_debug :=hr_utility.debug_enabled;
215: if g_debug then
216: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',10);
217: end if;
218:
212: BEGIN
213:
214: g_debug :=hr_utility.debug_enabled;
215: if g_debug then
216: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',10);
217: end if;
218:
219: /* Get the assignment business group id */
220: OPEN c_asg_bus_grp_id;
221: FETCH c_asg_bus_grp_id into asg_bus_grp_id;
222: CLOSE c_asg_bus_grp_id;
223:
224: if g_debug then
225: hr_utility.trace('asg_bus_grp_id :'||asg_bus_grp_id);
226: end if;
227:
228: /* IF AUTOGEN_HOURS_YN is 'Y', then ROTATION_PLAN_NAME is required */
229: IF p_autogen_hours_yn = 'Y' and p_rotation_plan IS NULL THEN
228: /* IF AUTOGEN_HOURS_YN is 'Y', then ROTATION_PLAN_NAME is required */
229: IF p_autogen_hours_yn = 'Y' and p_rotation_plan IS NULL THEN
230: --
231: if g_debug then
232: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',20);
233: end if;
234: -- FND_MESSAGE.SET_NAME('HXT','HXT_39496_ROT_PLAN_REQD');
235: -- FND_MESSAGE.ERROR;
236: hr_utility.set_message(809, 'HXT_39496_ROT_PLAN_REQD');
232: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',20);
233: end if;
234: -- FND_MESSAGE.SET_NAME('HXT','HXT_39496_ROT_PLAN_REQD');
235: -- FND_MESSAGE.ERROR;
236: hr_utility.set_message(809, 'HXT_39496_ROT_PLAN_REQD');
237: hr_utility.raise_error;
238: --
239: END IF;
240:
233: end if;
234: -- FND_MESSAGE.SET_NAME('HXT','HXT_39496_ROT_PLAN_REQD');
235: -- FND_MESSAGE.ERROR;
236: hr_utility.set_message(809, 'HXT_39496_ROT_PLAN_REQD');
237: hr_utility.raise_error;
238: --
239: END IF;
240:
241: /* Check for rotation plan */
240:
241: /* Check for rotation plan */
242: IF p_rotation_plan is NOT NULL THEN
243: if g_debug then
244: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',25);
245: end if;
246: OPEN chk_rot_plan;
247: FETCH chk_rot_plan INTO l_rtp_compatible;
248: CLOSE chk_rot_plan;
248: CLOSE chk_rot_plan;
249: IF l_rtp_compatible IS NULL THEN
250: --
251: if g_debug then
252: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',30);
253: end if;
254: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_ROT_PLAN_ERR');
255: -- FND_MESSAGE.ERROR;
256: hr_utility.set_message(809, 'HXT_xxxxx_ROT_PLAN_ERR');
252: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',30);
253: end if;
254: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_ROT_PLAN_ERR');
255: -- FND_MESSAGE.ERROR;
256: hr_utility.set_message(809, 'HXT_xxxxx_ROT_PLAN_ERR');
257: hr_utility.raise_error;
258: --
259: END IF;
260: END IF;
253: end if;
254: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_ROT_PLAN_ERR');
255: -- FND_MESSAGE.ERROR;
256: hr_utility.set_message(809, 'HXT_xxxxx_ROT_PLAN_ERR');
257: hr_utility.raise_error;
258: --
259: END IF;
260: END IF;
261:
260: END IF;
261:
262: /* Check whether Earning policy and Assignment are compatible */
263: if g_debug then
264: hr_utility.trace('p_assignment_id is :'|| p_assignment_id);
265: hr_utility.trace('p_earning_policy is :'|| p_earning_policy);
266: end if;
267: OPEN chk_earning_policy;
268: FETCH chk_earning_policy into l_egp_compatible;
261:
262: /* Check whether Earning policy and Assignment are compatible */
263: if g_debug then
264: hr_utility.trace('p_assignment_id is :'|| p_assignment_id);
265: hr_utility.trace('p_earning_policy is :'|| p_earning_policy);
266: end if;
267: OPEN chk_earning_policy;
268: FETCH chk_earning_policy into l_egp_compatible;
269: CLOSE chk_earning_policy;
269: CLOSE chk_earning_policy;
270: IF l_egp_compatible IS NULL THEN
271: --
272: if g_debug then
273: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',40);
274: end if;
275: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_EARN_POL_ERR');
276: -- FND_MESSAGE.ERROR;
277: hr_utility.set_message(809,'HXT_xxxxx_EARN_POL_ERR');
273: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',40);
274: end if;
275: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_EARN_POL_ERR');
276: -- FND_MESSAGE.ERROR;
277: hr_utility.set_message(809,'HXT_xxxxx_EARN_POL_ERR');
278: hr_utility.raise_error;
279: --
280: END IF;
281:
274: end if;
275: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_EARN_POL_ERR');
276: -- FND_MESSAGE.ERROR;
277: hr_utility.set_message(809,'HXT_xxxxx_EARN_POL_ERR');
278: hr_utility.raise_error;
279: --
280: END IF;
281:
282: /* Check whether Shift Differential Policy and Assignment are compatible */
281:
282: /* Check whether Shift Differential Policy and Assignment are compatible */
283: IF p_shift_differential_policy is NOT NULL THEN
284: if g_debug then
285: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',45);
286: end if;
287: OPEN chk_shift_diff_policy;
288: FETCH chk_shift_diff_policy into l_sdp_compatible;
289: CLOSE chk_shift_diff_policy;
289: CLOSE chk_shift_diff_policy;
290: IF l_sdp_compatible IS NULL THEN
291: --
292: if g_debug then
293: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',50);
294: end if;
295: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_SDP_ERR');
296: -- FND_MESSAGE.ERROR;
297: hr_utility.set_message(809,'HXT_xxxxx_SDP_ERR');
293: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',50);
294: end if;
295: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_SDP_ERR');
296: -- FND_MESSAGE.ERROR;
297: hr_utility.set_message(809,'HXT_xxxxx_SDP_ERR');
298: hr_utility.raise_error;
299: --
300: END IF;
301: END IF;
294: end if;
295: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_SDP_ERR');
296: -- FND_MESSAGE.ERROR;
297: hr_utility.set_message(809,'HXT_xxxxx_SDP_ERR');
298: hr_utility.raise_error;
299: --
300: END IF;
301: END IF;
302:
302:
303: /* Check whether Hour Deduction Policy and Assignment are compatible */
304: IF p_hour_deduction_policy is NOT NULL THEN
305: if g_debug then
306: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',55);
307: end if;
308: OPEN chk_hour_deduct_policy;
309: FETCH chk_hour_deduct_policy into l_hdp_compatible;
310: CLOSE chk_hour_deduct_policy;
310: CLOSE chk_hour_deduct_policy;
311: IF l_hdp_compatible IS NULL THEN
312: --
313: if g_debug then
314: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',60);
315: end if;
316: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_HDP_ERR');
317: -- FND_MESSAGE.ERROR;
318: hr_utility.set_message(809,'HXT_xxxxx_HDP_ERR');
314: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',60);
315: end if;
316: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_HDP_ERR');
317: -- FND_MESSAGE.ERROR;
318: hr_utility.set_message(809,'HXT_xxxxx_HDP_ERR');
319: hr_utility.raise_error;
320: --
321: END IF;
322: END IF;
315: end if;
316: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_HDP_ERR');
317: -- FND_MESSAGE.ERROR;
318: hr_utility.set_message(809,'HXT_xxxxx_HDP_ERR');
319: hr_utility.raise_error;
320: --
321: END IF;
322: END IF;
323:
408: FROM sys.dual;
409: l_id NUMBER(15);
410:
411: BEGIN
412: g_debug :=hr_utility.debug_enabled;
413: if g_debug then
414: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',10);
415: end if;
416:
410:
411: BEGIN
412: g_debug :=hr_utility.debug_enabled;
413: if g_debug then
414: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',10);
415: end if;
416:
417: /* First, make sure AAI row doesn't already exist for this assignment */
418: OPEN dup_aai;
418: OPEN dup_aai;
419: FETCH dup_aai into l_duplicate_row;
420: IF dup_aai%FOUND THEN
421: if g_debug then
422: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',20);
423: end if;
424: -- FND_MESSAGE.SET_NAME('HXT','HXT_39481_INFO_EXST_FOR_ASSIGN');
425: -- FND_MESSAGE.Error;
426: hr_utility.set_message(809,'HXT_39481_INFO_EXST_FOR_ASSIGN');
422: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',20);
423: end if;
424: -- FND_MESSAGE.SET_NAME('HXT','HXT_39481_INFO_EXST_FOR_ASSIGN');
425: -- FND_MESSAGE.Error;
426: hr_utility.set_message(809,'HXT_39481_INFO_EXST_FOR_ASSIGN');
427: hr_utility.raise_error;
428: CLOSE dup_aai;
429: END IF;
430: CLOSE dup_aai;
423: end if;
424: -- FND_MESSAGE.SET_NAME('HXT','HXT_39481_INFO_EXST_FOR_ASSIGN');
425: -- FND_MESSAGE.Error;
426: hr_utility.set_message(809,'HXT_39481_INFO_EXST_FOR_ASSIGN');
427: hr_utility.raise_error;
428: CLOSE dup_aai;
429: END IF;
430: CLOSE dup_aai;
431:
429: END IF;
430: CLOSE dup_aai;
431:
432: if g_debug then
433: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',30);
434: end if;
435: HXT_GEN_AAI.AAI_VALIDATIONS
436: (p_assignment_id => p_assignment_id
437: ,p_earning_policy => p_earning_policy
441: ,p_autogen_hours_yn => p_autogen_hours_yn
442: ,p_effective_start_date => p_effective_start_date
443: );
444: if g_debug then
445: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',40);
446: end if;
447:
448: /* Create unique ID for AAI row */
449: IF (p_id is null) THEN
447:
448: /* Create unique ID for AAI row */
449: IF (p_id is null) THEN
450: if g_debug then
451: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',50);
452: end if;
453: OPEN create_unique_id;
454: FETCH create_unique_id into l_id;
455: if g_debug then
452: end if;
453: OPEN create_unique_id;
454: FETCH create_unique_id into l_id;
455: if g_debug then
456: hr_utility.trace('l_id is :'|| l_id);
457: end if;
458: IF create_unique_id%NOTFOUND THEN
459: if g_debug then
460: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',60);
456: hr_utility.trace('l_id is :'|| l_id);
457: end if;
458: IF create_unique_id%NOTFOUND THEN
459: if g_debug then
460: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',60);
461: end if;
462: -- fnd_message.set_name('HXT', 'HXT_39124_ROW_IN_DUAL_NF');
463: -- fnd_message.error;
464: hr_utility.set_message(809,'HXT_39124_ROW_IN_DUAL_NF');
460: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',60);
461: end if;
462: -- fnd_message.set_name('HXT', 'HXT_39124_ROW_IN_DUAL_NF');
463: -- fnd_message.error;
464: hr_utility.set_message(809,'HXT_39124_ROW_IN_DUAL_NF');
465: hr_utility.raise_error;
466: END IF;
467: CLOSE create_unique_id;
468: END IF;
461: end if;
462: -- fnd_message.set_name('HXT', 'HXT_39124_ROW_IN_DUAL_NF');
463: -- fnd_message.error;
464: hr_utility.set_message(809,'HXT_39124_ROW_IN_DUAL_NF');
465: hr_utility.raise_error;
466: END IF;
467: CLOSE create_unique_id;
468: END IF;
469:
467: CLOSE create_unique_id;
468: END IF;
469:
470: if g_debug then
471: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',70);
472: end if;
473:
474: INSERT into HXT_ADD_ASSIGN_INFO_F
475: (id
563: ,p_attribute29
564: ,p_attribute30);
565:
566: if g_debug then
567: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',80);
568: end if;
569:
570: END Create_Otlr_Add_Assign_Info ;
571:
671: p_rowid_eot VARCHAR2(30);
672: l_count NUMBER;
673:
674: BEGIN
675: g_debug :=hr_utility.debug_enabled;
676: if g_debug then
677: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',10);
678: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',20);
679: end if;
673:
674: BEGIN
675: g_debug :=hr_utility.debug_enabled;
676: if g_debug then
677: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',10);
678: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',20);
679: end if;
680: HXT_GEN_AAI.AAI_VALIDATIONS
681: (p_assignment_id => p_assignment_id
674: BEGIN
675: g_debug :=hr_utility.debug_enabled;
676: if g_debug then
677: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',10);
678: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',20);
679: end if;
680: HXT_GEN_AAI.AAI_VALIDATIONS
681: (p_assignment_id => p_assignment_id
682: ,p_earning_policy => p_earning_policy
686: ,p_autogen_hours_yn => p_autogen_hours_yn
687: ,p_effective_start_date => p_effective_start_date
688: );
689: if g_debug then
690: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',30);
691: end if;
692:
693: OPEN c2;
694: FETCH c2 into p_rowid,l_effective_start_date,l_effective_end_date;
699: CLOSE c_delete_rec_eot;
700:
701: IF p_rowid is NOT NULL THEN
702: if g_debug then
703: hr_utility.trace('effective_start_date is :'|| l_effective_start_date);
704: hr_utility.trace('effective_end_date is :'|| l_effective_end_date);
705: hr_utility.trace('Rowid is :'|| p_rowid);
706: end if;
707: IF p_datetrack_mode = 'CORRECTION' THEN
700:
701: IF p_rowid is NOT NULL THEN
702: if g_debug then
703: hr_utility.trace('effective_start_date is :'|| l_effective_start_date);
704: hr_utility.trace('effective_end_date is :'|| l_effective_end_date);
705: hr_utility.trace('Rowid is :'|| p_rowid);
706: end if;
707: IF p_datetrack_mode = 'CORRECTION' THEN
708: if g_debug then
701: IF p_rowid is NOT NULL THEN
702: if g_debug then
703: hr_utility.trace('effective_start_date is :'|| l_effective_start_date);
704: hr_utility.trace('effective_end_date is :'|| l_effective_end_date);
705: hr_utility.trace('Rowid is :'|| p_rowid);
706: end if;
707: IF p_datetrack_mode = 'CORRECTION' THEN
708: if g_debug then
709: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',40);
705: hr_utility.trace('Rowid is :'|| p_rowid);
706: end if;
707: IF p_datetrack_mode = 'CORRECTION' THEN
708: if g_debug then
709: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',40);
710: end if;
711:
712: UPDATE HXT_ADD_ASSIGN_INFO_F
713: SET--effective_start_date = p_effective_start_date
760: /* end date the existing record and then create a new record if an
761: existing record found */
762:
763: if g_debug then
764: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',50);
765: end if;
766:
767: /*UPDATE hxt_add_assign_info_f
768: SET effective_end_date = p_effective_date - 1
773: WHERE assignment_id = p_assignment_id;
774:
775: IF (l_count >1) AND (p_effective_date < p_effective_start_date) THEN
776: if g_debug then
777: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',60);
778: end if;
779: DELETE from hxt_add_assign_info_f
780: WHERE rowid = p_rowid_eot;
781:
779: DELETE from hxt_add_assign_info_f
780: WHERE rowid = p_rowid_eot;
781:
782: if g_debug then
783: hr_utility.trace('p_effective_date is :'||p_effective_date);
784: end if;
785:
786: UPDATE hxt_add_assign_info_f aai
787: SET aai.effective_end_date = p_effective_date - 1
794: WHERE rowid = p_rowid;
795: END IF;
796:
797: if g_debug then
798: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',70);
799: hr_utility.trace('p_id is :'||p_id);
800: end if;
801:
802: INSERT into HXT_ADD_ASSIGN_INFO_F
795: END IF;
796:
797: if g_debug then
798: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',70);
799: hr_utility.trace('p_id is :'||p_id);
800: end if;
801:
802: INSERT into HXT_ADD_ASSIGN_INFO_F
803: (id
892: ,p_attribute29
893: ,p_attribute30);
894:
895: if g_debug then
896: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',80);
897: end if;
898:
899: ELSE
900: /* INVALID datetrack_mode */
897: end if;
898:
899: ELSE
900: /* INVALID datetrack_mode */
901: hr_utility.set_message(809,'HXT_xxxxx_INVALID_DTMODE');
902: hr_utility.raise_error;
903: END IF;
904:
905: if g_debug then
898:
899: ELSE
900: /* INVALID datetrack_mode */
901: hr_utility.set_message(809,'HXT_xxxxx_INVALID_DTMODE');
902: hr_utility.raise_error;
903: END IF;
904:
905: if g_debug then
906: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',90);
902: hr_utility.raise_error;
903: END IF;
904:
905: if g_debug then
906: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',90);
907: end if;
908: END IF;
909:
910: END Update_Otlr_Add_Assign_Info ;
910: END Update_Otlr_Add_Assign_Info ;
911:
912: -------------------------------------------------------------------------------
913: --begin
914: --hr_utility.trace_on(null,'mhanda');
915:
916: END HXT_GEN_AAI;