27: return 'TRUE';
28: /*
29: -- Commented the grade code to return everything as valid for the time being
30: if p_position_id is null and p_job_id is null then
31: hr_utility.set_location('All grades valid',10);
32: return 'TRUE';
33: else
34: open c1;
35: fetch c1 into l_check;
33: else
34: open c1;
35: fetch c1 into l_check;
36: if c1%notfound then
37: hr_utility.set_location('invalid grade:'||p_grade_id||' for pos:'||p_position_id||' and job:'||p_job_id,20);
38: return 'FALSE';
39: else
40: hr_utility.set_location('valid grade:'||p_grade_id||' for pos:'||p_position_id||' and job:'||p_job_id,30);
41: return 'TRUE';
36: if c1%notfound then
37: hr_utility.set_location('invalid grade:'||p_grade_id||' for pos:'||p_position_id||' and job:'||p_job_id,20);
38: return 'FALSE';
39: else
40: hr_utility.set_location('valid grade:'||p_grade_id||' for pos:'||p_position_id||' and job:'||p_job_id,30);
41: return 'TRUE';
42: end if;
43: end if;
44: */
113: fetch c1 into l_budget_unit1_id,l_budget_unit2_id,l_budget_unit3_id;
114: close c1;
115: exception
116: when others then
117: hr_utility.set_message(8302,'PQH_INVALID_WKD_PASSED');
118: hr_utility.raise_error;
119: end;
120: p_unit1_desc := get_unit_desc(l_budget_unit1_id);
121: if l_budget_unit2_id is not null then
114: close c1;
115: exception
116: when others then
117: hr_utility.set_message(8302,'PQH_INVALID_WKD_PASSED');
118: hr_utility.raise_error;
119: end;
120: p_unit1_desc := get_unit_desc(l_budget_unit1_id);
121: if l_budget_unit2_id is not null then
122: p_unit2_desc := get_unit_desc(l_budget_unit2_id);
128: else
129: p_unit3_desc := null;
130: end if;
131: else
132: hr_utility.set_message(8302,'PQH_INVALID_WKD_PASSED');
133: hr_utility.raise_error;
134: end if;
135: exception
136: when others then
129: p_unit3_desc := null;
130: end if;
131: else
132: hr_utility.set_message(8302,'PQH_INVALID_WKD_PASSED');
133: hr_utility.raise_error;
134: end if;
135: exception
136: when others then
137: p_unit1_desc := null;
136: when others then
137: p_unit1_desc := null;
138: p_unit2_desc := null;
139: p_unit3_desc := null;
140: hr_utility.set_message(8302,'PQH_INVALID_WKD_PASSED');
141: hr_utility.raise_error;
142: end get_all_unit_desc;
143: */
144:
137: p_unit1_desc := null;
138: p_unit2_desc := null;
139: p_unit3_desc := null;
140: hr_utility.set_message(8302,'PQH_INVALID_WKD_PASSED');
141: hr_utility.raise_error;
142: end get_all_unit_desc;
143: */
144:
145: function get_org_hier(p_org_structure_version_id in number) return varchar2 is
167: close c1;
168: return l_system_type_cd;
169: exception
170: when others then
171: hr_utility.set_message(8302,'PQH_INVALID_UNIT_ENTERED');
172: hr_utility.raise_error;
173: end get_unit_type;
174:
175: function get_unit_desc(p_unit_id in number) return varchar2 is
168: return l_system_type_cd;
169: exception
170: when others then
171: hr_utility.set_message(8302,'PQH_INVALID_UNIT_ENTERED');
172: hr_utility.raise_error;
173: end get_unit_type;
174:
175: function get_unit_desc(p_unit_id in number) return varchar2 is
176: l_unit_name per_shared_types_vl.shared_type_name%type;
194: close c1;
195: return l_shared_type_name;
196: exception
197: when others then
198: hr_utility.set_message(8302,'PQH_INVALID_UNIT_ENTERED');
199: hr_utility.raise_error;
200: end get_unit_desc;
201: */
202: function get_parent_value(p_worksheet_detail_id in number,
195: return l_shared_type_name;
196: exception
197: when others then
198: hr_utility.set_message(8302,'PQH_INVALID_UNIT_ENTERED');
199: hr_utility.raise_error;
200: end get_unit_desc;
201: */
202: function get_parent_value(p_worksheet_detail_id in number,
203: p_worksheet_propagate_code in varchar2) return varchar2 is
218: l_worksheet_id number;
219: l_code varchar2(3);
220: l_proc varchar2(100) := g_package||'get_parent_value' ;
221: begin
222: hr_utility.set_location('entering '||l_proc,10);
223: if p_worksheet_detail_id is not null then
224: begin
225: open c1(p_worksheet_detail_id);
226: fetch c1 into l_parent_worksheet_detail_id,l_worksheet_id;
226: fetch c1 into l_parent_worksheet_detail_id,l_worksheet_id;
227: close c1;
228: exception
229: when others then
230: hr_utility.set_message(8302,'PQH_INVALID_WKD_PASSED');
231: hr_utility.raise_error;
232: end;
233: if l_parent_worksheet_detail_id is null then
234: hr_utility.set_location('parent null '||l_proc,20);
227: close c1;
228: exception
229: when others then
230: hr_utility.set_message(8302,'PQH_INVALID_WKD_PASSED');
231: hr_utility.raise_error;
232: end;
233: if l_parent_worksheet_detail_id is null then
234: hr_utility.set_location('parent null '||l_proc,20);
235: begin
230: hr_utility.set_message(8302,'PQH_INVALID_WKD_PASSED');
231: hr_utility.raise_error;
232: end;
233: if l_parent_worksheet_detail_id is null then
234: hr_utility.set_location('parent null '||l_proc,20);
235: begin
236: open c3(l_worksheet_id);
237: fetch c3 into l_code;
238: close c3;
237: fetch c3 into l_code;
238: close c3;
239: exception
240: when others then
241: hr_utility.set_message(8302,'PQH_INVALID_WKS_PASSED');
242: hr_utility.raise_error;
243: end;
244: return l_code;
245: else
238: close c3;
239: exception
240: when others then
241: hr_utility.set_message(8302,'PQH_INVALID_WKS_PASSED');
242: hr_utility.raise_error;
243: end;
244: return l_code;
245: else
246: hr_utility.set_location('parent not null '||l_parent_worksheet_detail_id||l_proc,30);
242: hr_utility.raise_error;
243: end;
244: return l_code;
245: else
246: hr_utility.set_location('parent not null '||l_parent_worksheet_detail_id||l_proc,30);
247: begin
248: open c2(l_parent_worksheet_detail_id);
249: fetch c2 into l_code,l_worksheet_detail_id;
250: close c2;
249: fetch c2 into l_code,l_worksheet_detail_id;
250: close c2;
251: exception
252: when others then
253: hr_utility.set_message(8302,'PQH_INVALID_WKD_PASSED');
254: hr_utility.raise_error;
255: end;
256: if l_code = 'PC' then
257: l_code := get_parent_value(l_worksheet_detail_id,p_worksheet_propagate_code);
250: close c2;
251: exception
252: when others then
253: hr_utility.set_message(8302,'PQH_INVALID_WKD_PASSED');
254: hr_utility.raise_error;
255: end;
256: if l_code = 'PC' then
257: l_code := get_parent_value(l_worksheet_detail_id,p_worksheet_propagate_code);
258: end if;
255: end;
256: if l_code = 'PC' then
257: l_code := get_parent_value(l_worksheet_detail_id,p_worksheet_propagate_code);
258: end if;
259: hr_utility.set_location('l_code is '||l_code||l_proc,40);
260: return l_code;
261: end if;
262: else
263: l_code := p_worksheet_propagate_code;
260: return l_code;
261: end if;
262: else
263: l_code := p_worksheet_propagate_code;
264: hr_utility.set_location('l_code is '||l_code||l_proc,50);
265: return l_code;
266: end if;
267: end;
268: function get_value(p_worksheet_detail_id in number,
272: l_meaning varchar2(80);
273: l_meaning1 varchar2(80);
274: l_proc varchar2(100) := g_package||'get_value' ;
275: begin
276: hr_utility.set_location('entering '||code||l_proc,10);
277: if code = 'PC' then
278: l_code := get_parent_value(p_worksheet_detail_id,p_worksheet_propagate_code);
279: l_meaning := hr_general.decode_lookup('PQH_WORKSHEET_PROPAGATE_METHOD','PC');
280: l_meaning1 := hr_general.decode_lookup('PQH_WORKSHEET_PROPAGATE_METHOD',l_code);
281: l_meaning := l_meaning||'('||l_meaning1||')' ;
282: elsif code in ('RV','RP','UE') then
283: l_meaning := hr_general.decode_lookup('PQH_WORKSHEET_PROPAGATE_METHOD',code);
284: else
285: hr_utility.set_message(8302,'PQH_INVALID_PROPAGATION_METHOD');
286: hr_utility.raise_error;
287: end if;
288: hr_utility.set_location('exiting with meaning'||l_meaning||l_proc,50);
289: return l_meaning;
282: elsif code in ('RV','RP','UE') then
283: l_meaning := hr_general.decode_lookup('PQH_WORKSHEET_PROPAGATE_METHOD',code);
284: else
285: hr_utility.set_message(8302,'PQH_INVALID_PROPAGATION_METHOD');
286: hr_utility.raise_error;
287: end if;
288: hr_utility.set_location('exiting with meaning'||l_meaning||l_proc,50);
289: return l_meaning;
290: end get_value;
284: else
285: hr_utility.set_message(8302,'PQH_INVALID_PROPAGATION_METHOD');
286: hr_utility.raise_error;
287: end if;
288: hr_utility.set_location('exiting with meaning'||l_meaning||l_proc,50);
289: return l_meaning;
290: end get_value;
291: function lookup_desc(p_lookup_type in varchar2,
292: p_lookup_code in varchar2) return varchar2 is
318: fetch c0 into l_worksheet_id,l_change_mode ;
319: close c0;
320: exception
321: when others then
322: hr_utility.set_message(8302,'PQH_INVALID_WKD_PASSED');
323: hr_utility.raise_error;
324: end;
325: if l_change_mode = 'PC' then
326: open c1;
319: close c0;
320: exception
321: when others then
322: hr_utility.set_message(8302,'PQH_INVALID_WKD_PASSED');
323: hr_utility.raise_error;
324: end;
325: if l_change_mode = 'PC' then
326: open c1;
327: fetch c1 into l_wks_change_mode;
486: l_count number(15) ;
487: BEGIN
488: if p_worksheet_budget_set_id is not null then
489: if p_dflt_budget_set_id is null then
490: hr_utility.set_message(8302,'PQH_WKS_MIG_INV_SET');
491: hr_utility.raise_error;
492: else
493: select count(*) into l_count from pqh_worksheet_bdgt_elmnts
494: where worksheet_budget_set_id = p_worksheet_budget_set_id ;
487: BEGIN
488: if p_worksheet_budget_set_id is not null then
489: if p_dflt_budget_set_id is null then
490: hr_utility.set_message(8302,'PQH_WKS_MIG_INV_SET');
491: hr_utility.raise_error;
492: else
493: select count(*) into l_count from pqh_worksheet_bdgt_elmnts
494: where worksheet_budget_set_id = p_worksheet_budget_set_id ;
495: if l_count = 0 then
539: l_object_version_number number;
540: BEGIN
541: if p_budget_set_id is not null then
542: if p_dflt_budget_set_id is null then
543: hr_utility.set_message(8302,'PQH_WKS_MIG_INV_SET');
544: hr_utility.raise_error;
545: else
546: select count(*) into l_count from pqh_budget_elements
547: where budget_set_id = p_budget_set_id ;
540: BEGIN
541: if p_budget_set_id is not null then
542: if p_dflt_budget_set_id is null then
543: hr_utility.set_message(8302,'PQH_WKS_MIG_INV_SET');
544: hr_utility.raise_error;
545: else
546: select count(*) into l_count from pqh_budget_elements
547: where budget_set_id = p_budget_set_id ;
548: if l_count = 0 then
599: l_transaction_name varchar2(200);
600: l_apply_error_mesg varchar2(200);
601: l_apply_error_num varchar2(30);
602: begin
603: hr_utility.set_location('entering '||l_proc,10);
604: for i in c1 loop
605: hr_utility.set_location('inside loop '||l_proc,11);
606: begin
607: open c2(i.user_id);
601: l_apply_error_num varchar2(30);
602: begin
603: hr_utility.set_location('entering '||l_proc,10);
604: for i in c1 loop
605: hr_utility.set_location('inside loop '||l_proc,11);
606: begin
607: open c2(i.user_id);
608: fetch c2 into l_user_name;
609: close c2;
608: fetch c2 into l_user_name;
609: close c2;
610: exception
611: when others then
612: hr_utility.set_location('user name fetch raised error '||l_proc,20);
613: raise;
614: end;
615: hr_utility.set_location('user name is '||l_user_name||l_proc,30);
616: hr_utility.set_location('calling process user action'||l_proc,40);
611: when others then
612: hr_utility.set_location('user name fetch raised error '||l_proc,20);
613: raise;
614: end;
615: hr_utility.set_location('user name is '||l_user_name||l_proc,30);
616: hr_utility.set_location('calling process user action'||l_proc,40);
617: begin
618: l_transaction_name := get_transaction_name(p_worksheet_detail_id => i.worksheet_detail_id);
619: pqh_wf.process_user_action(p_transaction_category_id => p_transaction_category_id,
612: hr_utility.set_location('user name fetch raised error '||l_proc,20);
613: raise;
614: end;
615: hr_utility.set_location('user name is '||l_user_name||l_proc,30);
616: hr_utility.set_location('calling process user action'||l_proc,40);
617: begin
618: l_transaction_name := get_transaction_name(p_worksheet_detail_id => i.worksheet_detail_id);
619: pqh_wf.process_user_action(p_transaction_category_id => p_transaction_category_id,
620: p_transaction_id => i.worksheet_detail_id,
628: p_apply_error_mesg => l_apply_error_mesg,
629: p_apply_error_num => l_apply_error_num);
630: exception
631: when others then
632: hr_utility.set_location('process user action raised error'||l_proc,50);
633: raise;
634: end;
635: hr_utility.set_location('going to update status'||l_proc,60);
636: l_object_version_number := i.object_version_number;
631: when others then
632: hr_utility.set_location('process user action raised error'||l_proc,50);
633: raise;
634: end;
635: hr_utility.set_location('going to update status'||l_proc,60);
636: l_object_version_number := i.object_version_number;
637: pqh_budget.update_worksheet_detail(
638: p_worksheet_detail_id => i.worksheet_detail_id,
639: p_effective_date => trunc(sysdate),
639: p_effective_date => trunc(sysdate),
640: p_object_version_number => l_object_version_number,
641: p_status => 'DELEGATED'
642: );
643: hr_utility.set_location('updated status'||l_proc,60);
644: end loop;
645: hr_utility.set_location('leaving '||l_proc,1000);
646: end delegating_org;
647: procedure wks_date_validation( p_worksheet_mode in varchar2,
641: p_status => 'DELEGATED'
642: );
643: hr_utility.set_location('updated status'||l_proc,60);
644: end loop;
645: hr_utility.set_location('leaving '||l_proc,1000);
646: end delegating_org;
647: procedure wks_date_validation( p_worksheet_mode in varchar2,
648: p_budget_id in number,
649: p_budget_version_id in number default null,
667: l_ver_chk varchar2(15);
668: l_version_number number;
669: l_proc varchar2(61) := g_package ||'wks_date_validation' ;
670: begin
671: hr_utility.set_location('entering '||l_proc,10);
672: -- mode N is edit and make new version
673: -- mode S is start from scratch
674: -- mode O is copy and edit version
675: if p_worksheet_mode not in ('N','S','O') then
672: -- mode N is edit and make new version
673: -- mode S is start from scratch
674: -- mode O is copy and edit version
675: if p_worksheet_mode not in ('N','S','O') then
676: hr_utility.set_message(8302,'PQH_INVALID_WORKSHEET_MODE');
677: hr_utility.raise_error;
678: elsif p_budget_id is null then
679: hr_utility.set_message(8302,'PQH_INVALID_BUDGET');
680: hr_utility.raise_error;
673: -- mode S is start from scratch
674: -- mode O is copy and edit version
675: if p_worksheet_mode not in ('N','S','O') then
676: hr_utility.set_message(8302,'PQH_INVALID_WORKSHEET_MODE');
677: hr_utility.raise_error;
678: elsif p_budget_id is null then
679: hr_utility.set_message(8302,'PQH_INVALID_BUDGET');
680: hr_utility.raise_error;
681: elsif p_worksheet_mode in ('O','N') and p_budget_version_id is null then
675: if p_worksheet_mode not in ('N','S','O') then
676: hr_utility.set_message(8302,'PQH_INVALID_WORKSHEET_MODE');
677: hr_utility.raise_error;
678: elsif p_budget_id is null then
679: hr_utility.set_message(8302,'PQH_INVALID_BUDGET');
680: hr_utility.raise_error;
681: elsif p_worksheet_mode in ('O','N') and p_budget_version_id is null then
682: hr_utility.set_message(8302,'PQH_INVALID_BUDGET_VERSION');
683: hr_utility.raise_error;
676: hr_utility.set_message(8302,'PQH_INVALID_WORKSHEET_MODE');
677: hr_utility.raise_error;
678: elsif p_budget_id is null then
679: hr_utility.set_message(8302,'PQH_INVALID_BUDGET');
680: hr_utility.raise_error;
681: elsif p_worksheet_mode in ('O','N') and p_budget_version_id is null then
682: hr_utility.set_message(8302,'PQH_INVALID_BUDGET_VERSION');
683: hr_utility.raise_error;
684: elsif p_wks_start_date is null then
678: elsif p_budget_id is null then
679: hr_utility.set_message(8302,'PQH_INVALID_BUDGET');
680: hr_utility.raise_error;
681: elsif p_worksheet_mode in ('O','N') and p_budget_version_id is null then
682: hr_utility.set_message(8302,'PQH_INVALID_BUDGET_VERSION');
683: hr_utility.raise_error;
684: elsif p_wks_start_date is null then
685: hr_utility.set_message(8302,'PQH_START_DT_NULL');
686: hr_utility.raise_error;
679: hr_utility.set_message(8302,'PQH_INVALID_BUDGET');
680: hr_utility.raise_error;
681: elsif p_worksheet_mode in ('O','N') and p_budget_version_id is null then
682: hr_utility.set_message(8302,'PQH_INVALID_BUDGET_VERSION');
683: hr_utility.raise_error;
684: elsif p_wks_start_date is null then
685: hr_utility.set_message(8302,'PQH_START_DT_NULL');
686: hr_utility.raise_error;
687: elsif p_wks_end_date is null then
681: elsif p_worksheet_mode in ('O','N') and p_budget_version_id is null then
682: hr_utility.set_message(8302,'PQH_INVALID_BUDGET_VERSION');
683: hr_utility.raise_error;
684: elsif p_wks_start_date is null then
685: hr_utility.set_message(8302,'PQH_START_DT_NULL');
686: hr_utility.raise_error;
687: elsif p_wks_end_date is null then
688: hr_utility.set_message(8302,'PQH_END_DT_NULL');
689: hr_utility.raise_error;
682: hr_utility.set_message(8302,'PQH_INVALID_BUDGET_VERSION');
683: hr_utility.raise_error;
684: elsif p_wks_start_date is null then
685: hr_utility.set_message(8302,'PQH_START_DT_NULL');
686: hr_utility.raise_error;
687: elsif p_wks_end_date is null then
688: hr_utility.set_message(8302,'PQH_END_DT_NULL');
689: hr_utility.raise_error;
690: elsif p_wks_start_date > p_wks_end_date then
684: elsif p_wks_start_date is null then
685: hr_utility.set_message(8302,'PQH_START_DT_NULL');
686: hr_utility.raise_error;
687: elsif p_wks_end_date is null then
688: hr_utility.set_message(8302,'PQH_END_DT_NULL');
689: hr_utility.raise_error;
690: elsif p_wks_start_date > p_wks_end_date then
691: hr_utility.set_message(8302,'PQH_INVALID_END_DT');
692: hr_utility.set_message_token('STARTDATE',fnd_date.date_to_chardate(p_wks_start_date));
685: hr_utility.set_message(8302,'PQH_START_DT_NULL');
686: hr_utility.raise_error;
687: elsif p_wks_end_date is null then
688: hr_utility.set_message(8302,'PQH_END_DT_NULL');
689: hr_utility.raise_error;
690: elsif p_wks_start_date > p_wks_end_date then
691: hr_utility.set_message(8302,'PQH_INVALID_END_DT');
692: hr_utility.set_message_token('STARTDATE',fnd_date.date_to_chardate(p_wks_start_date));
693: hr_utility.set_message_token('ENDDATE',fnd_date.date_to_chardate(p_wks_end_date));
687: elsif p_wks_end_date is null then
688: hr_utility.set_message(8302,'PQH_END_DT_NULL');
689: hr_utility.raise_error;
690: elsif p_wks_start_date > p_wks_end_date then
691: hr_utility.set_message(8302,'PQH_INVALID_END_DT');
692: hr_utility.set_message_token('STARTDATE',fnd_date.date_to_chardate(p_wks_start_date));
693: hr_utility.set_message_token('ENDDATE',fnd_date.date_to_chardate(p_wks_end_date));
694: hr_utility.raise_error;
695: end if;
688: hr_utility.set_message(8302,'PQH_END_DT_NULL');
689: hr_utility.raise_error;
690: elsif p_wks_start_date > p_wks_end_date then
691: hr_utility.set_message(8302,'PQH_INVALID_END_DT');
692: hr_utility.set_message_token('STARTDATE',fnd_date.date_to_chardate(p_wks_start_date));
693: hr_utility.set_message_token('ENDDATE',fnd_date.date_to_chardate(p_wks_end_date));
694: hr_utility.raise_error;
695: end if;
696: if p_budget_version_id is not null then
689: hr_utility.raise_error;
690: elsif p_wks_start_date > p_wks_end_date then
691: hr_utility.set_message(8302,'PQH_INVALID_END_DT');
692: hr_utility.set_message_token('STARTDATE',fnd_date.date_to_chardate(p_wks_start_date));
693: hr_utility.set_message_token('ENDDATE',fnd_date.date_to_chardate(p_wks_end_date));
694: hr_utility.raise_error;
695: end if;
696: if p_budget_version_id is not null then
697: open c1;
690: elsif p_wks_start_date > p_wks_end_date then
691: hr_utility.set_message(8302,'PQH_INVALID_END_DT');
692: hr_utility.set_message_token('STARTDATE',fnd_date.date_to_chardate(p_wks_start_date));
693: hr_utility.set_message_token('ENDDATE',fnd_date.date_to_chardate(p_wks_end_date));
694: hr_utility.raise_error;
695: end if;
696: if p_budget_version_id is not null then
697: open c1;
698: fetch c1 into l_ver_chk;
697: open c1;
698: fetch c1 into l_ver_chk;
699: if c1%notfound then
700: close c1;
701: hr_utility.set_message(8302,'PQH_INVALID_BUDGET_VER');
702: hr_utility.raise_error;
703: end if;
704: close c1;
705: end if;
698: fetch c1 into l_ver_chk;
699: if c1%notfound then
700: close c1;
701: hr_utility.set_message(8302,'PQH_INVALID_BUDGET_VER');
702: hr_utility.raise_error;
703: end if;
704: close c1;
705: end if;
706: hr_utility.set_location('wks_mode is '||p_worksheet_mode||l_proc,20);
702: hr_utility.raise_error;
703: end if;
704: close c1;
705: end if;
706: hr_utility.set_location('wks_mode is '||p_worksheet_mode||l_proc,20);
707: if p_worksheet_mode in ('S','N') then
708: -- in the case of start from scratch, worksheet dates should be greater than all the existing
709: -- version dates as it is going to make a new version in all cases, if the dates
710: -- are not highest in that case status is returned as error
712: -- gaps are also ok
713: open c0;
714: fetch c0 into l_max_version;
715: close c0;
716: hr_utility.set_location('max_version is '||l_max_version||l_proc,30);
717: open c2;
718: fetch c2 into l_max_end_date;
719: if c2%notfound then
720: hr_utility.set_location('max_end_date notfound '||l_proc,40);
716: hr_utility.set_location('max_version is '||l_max_version||l_proc,30);
717: open c2;
718: fetch c2 into l_max_end_date;
719: if c2%notfound then
720: hr_utility.set_location('max_end_date notfound '||l_proc,40);
721: if p_worksheet_mode ='S' then
722: -- no dates in the budget version as it is a initial case so
723: p_status := 'SUCCESS' ;
724: else
725: -- mode is correction but no records
726: p_status := 'ERROR' ;
727: end if;
728: else
729: hr_utility.set_location('max_end_date is '||l_max_end_date||l_proc,50);
730: if l_max_end_date is not null then
731: if p_wks_start_date = l_max_end_date + 1 then
732: -- start date is valid as it is not overlapping and nor giving any gap.
733: p_wks_ll_date := l_max_end_date+1 ;
746: p_status := 'SUCCESS' ;
747: end if;
748: end if;
749: close c2;
750: hr_utility.set_location('end of validation with status'||p_status||l_proc,60);
751: else
752: open c3;
753: fetch c3 into l_version_number;
754: close c3;
758: p_date_to => p_wks_end_date,
759: p_bgv_ll_date => p_wks_ll_date,
760: p_bgv_ul_date => p_wks_ul_date,
761: p_status => p_status ) ;
762: hr_utility.set_location('end of validation with status'||p_status||l_proc,170);
763: end if;
764: exception when others then
765: p_wks_ll_date := null;
766: p_wks_ul_date := null;
792: l_budget_unit3_value number;
793: l_lck_success boolean := FALSE;
794: l_status varchar2(30) ;
795: begin
796: hr_utility.set_location('entering bootom_up for wkd'||p_worksheet_detail_id,05);
797: for i in c1 loop
798: hr_utility.set_location('inside the loop for wkd'||i.worksheet_detail_id,10);
799: begin
800: hr_utility.set_location('going to lock'||i.worksheet_detail_id,20);
794: l_status varchar2(30) ;
795: begin
796: hr_utility.set_location('entering bootom_up for wkd'||p_worksheet_detail_id,05);
797: for i in c1 loop
798: hr_utility.set_location('inside the loop for wkd'||i.worksheet_detail_id,10);
799: begin
800: hr_utility.set_location('going to lock'||i.worksheet_detail_id,20);
801: pqh_wdt_shd.lck(p_worksheet_detail_id => i.worksheet_detail_id,
802: p_object_version_number => i.object_version_number );
796: hr_utility.set_location('entering bootom_up for wkd'||p_worksheet_detail_id,05);
797: for i in c1 loop
798: hr_utility.set_location('inside the loop for wkd'||i.worksheet_detail_id,10);
799: begin
800: hr_utility.set_location('going to lock'||i.worksheet_detail_id,20);
801: pqh_wdt_shd.lck(p_worksheet_detail_id => i.worksheet_detail_id,
802: p_object_version_number => i.object_version_number );
803: l_lck_success := TRUE;
804: hr_utility.set_location('lock success',30);
800: hr_utility.set_location('going to lock'||i.worksheet_detail_id,20);
801: pqh_wdt_shd.lck(p_worksheet_detail_id => i.worksheet_detail_id,
802: p_object_version_number => i.object_version_number );
803: l_lck_success := TRUE;
804: hr_utility.set_location('lock success',30);
805: exception
806: when others then
807: hr_utility.set_location('lock failed',40);
808: l_lck_success := FALSE;
803: l_lck_success := TRUE;
804: hr_utility.set_location('lock success',30);
805: exception
806: when others then
807: hr_utility.set_location('lock failed',40);
808: l_lck_success := FALSE;
809: if p_status <> 'LOCK' then
810: p_status := 'LOCK';
811: end if;
810: p_status := 'LOCK';
811: end if;
812: end;
813: if l_lck_success then
814: hr_utility.set_location('going for propagation',50);
815: l_object_version_number := i.object_version_number;
816: l_budget_unit1_value := i.budget_unit1_value;
817: l_budget_unit2_value := i.budget_unit2_value;
818: l_budget_unit3_value := i.budget_unit3_value;
815: l_object_version_number := i.object_version_number;
816: l_budget_unit1_value := i.budget_unit1_value;
817: l_budget_unit2_value := i.budget_unit2_value;
818: l_budget_unit3_value := i.budget_unit3_value;
819: hr_utility.set_location('calling propagate bottom_up',60);
820: begin
821: propagate_bottom_up(p_worksheet_detail_id => i.worksheet_detail_id,
822: p_budget_unit1_value => l_budget_unit1_value,
823: p_budget_unit2_value => l_budget_unit2_value,
840: p_old_unit1_value => l_budget_unit1_value,
841: p_old_unit2_value => l_budget_unit2_value,
842: p_old_unit3_value => l_budget_unit3_value);
843: end if;
844: hr_utility.set_location('end of the loop for wkd'||i.worksheet_detail_id,120);
845: end loop;
846: hr_utility.set_location('exiting propagate_bottom_up for wkd'||p_worksheet_detail_id,130);
847: exception when others then
848: p_budget_unit1_value := init_budget_unit1_value;
842: p_old_unit3_value => l_budget_unit3_value);
843: end if;
844: hr_utility.set_location('end of the loop for wkd'||i.worksheet_detail_id,120);
845: end loop;
846: hr_utility.set_location('exiting propagate_bottom_up for wkd'||p_worksheet_detail_id,130);
847: exception when others then
848: p_budget_unit1_value := init_budget_unit1_value;
849: p_budget_unit2_value := init_budget_unit2_value;
850: p_budget_unit3_value := init_budget_unit3_value;
876: l_rows_inserted number := 0;
877: l_object_version_number number := 1;
878: l_proc varchar2(100) := g_package||'populate_bud_grades' ;
879: begin
880: hr_utility.set_location('entering '||l_proc,10);
881: open c0;
882: fetch c0 into l_budget_start_date,l_budget_end_date,l_valid_grade_flag,l_budgeted_entity_cd;
883: close c0;
884: hr_utility.set_location('budget_start_date is'||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,11);
880: hr_utility.set_location('entering '||l_proc,10);
881: open c0;
882: fetch c0 into l_budget_start_date,l_budget_end_date,l_valid_grade_flag,l_budgeted_entity_cd;
883: close c0;
884: hr_utility.set_location('budget_start_date is'||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,11);
885: hr_utility.set_location('budget_end_date is'||to_char(l_budget_end_date,'DD/MM/RRRR')||l_proc,12);
886: for i in c1 loop
887: l_rows_inserted := l_rows_inserted + 1;
888: pqh_budget_details_api.create_budget_detail(
881: open c0;
882: fetch c0 into l_budget_start_date,l_budget_end_date,l_valid_grade_flag,l_budgeted_entity_cd;
883: close c0;
884: hr_utility.set_location('budget_start_date is'||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,11);
885: hr_utility.set_location('budget_end_date is'||to_char(l_budget_end_date,'DD/MM/RRRR')||l_proc,12);
886: for i in c1 loop
887: l_rows_inserted := l_rows_inserted + 1;
888: pqh_budget_details_api.create_budget_detail(
889: p_validate => FALSE
909: );
910: pqh_budget.insert_grd_is_bud(i.grade_id);
911: end loop;
912: p_rows_inserted := l_rows_inserted;
913: hr_utility.set_location('exiting '||l_proc,1000);
914: exception when others then
915: p_rows_inserted := null;
916: raise;
917: end populate_bud_grades;
935: l_rows_inserted number := 0;
936: l_object_version_number number := 1;
937: l_proc varchar2(100) := g_package||'populate_bud_jobs' ;
938: begin
939: hr_utility.set_location('entering '||l_proc,10);
940: open c0;
941: fetch c0 into l_budget_start_date,l_budget_end_date;
942: close c0;
943: hr_utility.set_location('budget_start_date is'||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,11);
939: hr_utility.set_location('entering '||l_proc,10);
940: open c0;
941: fetch c0 into l_budget_start_date,l_budget_end_date;
942: close c0;
943: hr_utility.set_location('budget_start_date is'||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,11);
944: hr_utility.set_location('budget_end_date is'||to_char(l_budget_end_date,'DD/MM/RRRR')||l_proc,12);
945: for i in c1 loop
946: l_rows_inserted := l_rows_inserted + 1;
947: pqh_budget_details_api.create_budget_detail(
940: open c0;
941: fetch c0 into l_budget_start_date,l_budget_end_date;
942: close c0;
943: hr_utility.set_location('budget_start_date is'||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,11);
944: hr_utility.set_location('budget_end_date is'||to_char(l_budget_end_date,'DD/MM/RRRR')||l_proc,12);
945: for i in c1 loop
946: l_rows_inserted := l_rows_inserted + 1;
947: pqh_budget_details_api.create_budget_detail(
948: p_validate => FALSE
968: );
969: pqh_budget.insert_job_is_bud(i.job_id);
970: end loop;
971: p_rows_inserted := l_rows_inserted;
972: hr_utility.set_location('exiting '||l_proc,1000);
973: exception when others then
974: p_rows_inserted := null;
975: raise;
976: end populate_bud_jobs;
1013: l_rows_inserted number := 0;
1014: l_object_version_number number := 1;
1015: l_proc varchar2(100) := g_package||'populate_budget_positions' ;
1016: begin
1017: hr_utility.set_location('entering '||l_proc,10);
1018: hr_utility.set_location('business_group_id is '||p_business_group_id||l_proc,11);
1019: hr_utility.set_location('org_hier is '||p_org_hier_ver||l_proc,13);
1020: hr_utility.set_location('start organization is '||p_start_organization_id||l_proc,15);
1021: open c0;
1014: l_object_version_number number := 1;
1015: l_proc varchar2(100) := g_package||'populate_budget_positions' ;
1016: begin
1017: hr_utility.set_location('entering '||l_proc,10);
1018: hr_utility.set_location('business_group_id is '||p_business_group_id||l_proc,11);
1019: hr_utility.set_location('org_hier is '||p_org_hier_ver||l_proc,13);
1020: hr_utility.set_location('start organization is '||p_start_organization_id||l_proc,15);
1021: open c0;
1022: fetch c0 into l_budget_start_date, l_budget_end_date;
1015: l_proc varchar2(100) := g_package||'populate_budget_positions' ;
1016: begin
1017: hr_utility.set_location('entering '||l_proc,10);
1018: hr_utility.set_location('business_group_id is '||p_business_group_id||l_proc,11);
1019: hr_utility.set_location('org_hier is '||p_org_hier_ver||l_proc,13);
1020: hr_utility.set_location('start organization is '||p_start_organization_id||l_proc,15);
1021: open c0;
1022: fetch c0 into l_budget_start_date, l_budget_end_date;
1023: close c0;
1016: begin
1017: hr_utility.set_location('entering '||l_proc,10);
1018: hr_utility.set_location('business_group_id is '||p_business_group_id||l_proc,11);
1019: hr_utility.set_location('org_hier is '||p_org_hier_ver||l_proc,13);
1020: hr_utility.set_location('start organization is '||p_start_organization_id||l_proc,15);
1021: open c0;
1022: fetch c0 into l_budget_start_date, l_budget_end_date;
1023: close c0;
1024: if p_org_hier_ver is null then
1021: open c0;
1022: fetch c0 into l_budget_start_date, l_budget_end_date;
1023: close c0;
1024: if p_org_hier_ver is null then
1025: hr_utility.set_location('Business group cursor selected '||l_proc,20);
1026: for i in c1 loop
1027: l_rows_inserted := l_rows_inserted + 1;
1028: pqh_budget_details_api.create_budget_detail(
1029: p_validate => FALSE
1047: ,p_budget_unit3_value_type_cd => ''
1048: ,p_object_version_number => l_object_version_number
1049: );
1050: pqh_budget.insert_pos_is_bud(i.position_id);
1051: hr_utility.set_location('position inserted '||i.position_id||l_proc,40);
1052: end loop;
1053: else
1054: hr_utility.set_location('Org hierarchy cursor selected '||l_proc,45);
1055: for i in c2 loop
1050: pqh_budget.insert_pos_is_bud(i.position_id);
1051: hr_utility.set_location('position inserted '||i.position_id||l_proc,40);
1052: end loop;
1053: else
1054: hr_utility.set_location('Org hierarchy cursor selected '||l_proc,45);
1055: for i in c2 loop
1056: l_rows_inserted := l_rows_inserted + 1;
1057: pqh_budget_details_api.create_budget_detail(
1058: p_validate => FALSE
1076: ,p_budget_unit3_value_type_cd => ''
1077: ,p_object_version_number => l_object_version_number
1078: );
1079: pqh_budget.insert_pos_is_bud(i.position_id);
1080: hr_utility.set_location('position inserted '||i.position_id||l_proc,50);
1081: end loop;
1082: end if;
1083: p_rows_inserted := l_rows_inserted;
1084: hr_utility.set_location('exiting '||l_proc,90);
1080: hr_utility.set_location('position inserted '||i.position_id||l_proc,50);
1081: end loop;
1082: end if;
1083: p_rows_inserted := l_rows_inserted;
1084: hr_utility.set_location('exiting '||l_proc,90);
1085: exception when others then
1086: p_rows_inserted := null;
1087: raise;
1088: end populate_bud_positions;
1139: l_object_version_number number := 1;
1140: l_rows_inserted number := 0;
1141: l_proc varchar2(100) := g_package||'populate_bud_orgs' ;
1142: begin
1143: hr_utility.set_location('entering '||l_proc,10);
1144: open c0;
1145: fetch c0 into l_budget_start_date,l_budget_end_date;
1146: close c0;
1147: hr_utility.set_location('budget_start_date is'||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,11);
1143: hr_utility.set_location('entering '||l_proc,10);
1144: open c0;
1145: fetch c0 into l_budget_start_date,l_budget_end_date;
1146: close c0;
1147: hr_utility.set_location('budget_start_date is'||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,11);
1148: hr_utility.set_location('budget_end_date is'||to_char(l_budget_end_date,'DD/MM/RRRR')||l_proc,12);
1149: if p_org_hier_ver is null then
1150: hr_utility.set_location('bg is used '||l_proc,20);
1151: for i in c1 loop
1144: open c0;
1145: fetch c0 into l_budget_start_date,l_budget_end_date;
1146: close c0;
1147: hr_utility.set_location('budget_start_date is'||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,11);
1148: hr_utility.set_location('budget_end_date is'||to_char(l_budget_end_date,'DD/MM/RRRR')||l_proc,12);
1149: if p_org_hier_ver is null then
1150: hr_utility.set_location('bg is used '||l_proc,20);
1151: for i in c1 loop
1152: hr_utility.set_location('in loop for '||i.organization_id||l_proc,25);
1146: close c0;
1147: hr_utility.set_location('budget_start_date is'||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,11);
1148: hr_utility.set_location('budget_end_date is'||to_char(l_budget_end_date,'DD/MM/RRRR')||l_proc,12);
1149: if p_org_hier_ver is null then
1150: hr_utility.set_location('bg is used '||l_proc,20);
1151: for i in c1 loop
1152: hr_utility.set_location('in loop for '||i.organization_id||l_proc,25);
1153: l_rows_inserted := l_rows_inserted + 1;
1154: pqh_budget_details_api.create_budget_detail(
1148: hr_utility.set_location('budget_end_date is'||to_char(l_budget_end_date,'DD/MM/RRRR')||l_proc,12);
1149: if p_org_hier_ver is null then
1150: hr_utility.set_location('bg is used '||l_proc,20);
1151: for i in c1 loop
1152: hr_utility.set_location('in loop for '||i.organization_id||l_proc,25);
1153: l_rows_inserted := l_rows_inserted + 1;
1154: pqh_budget_details_api.create_budget_detail(
1155: p_validate => FALSE
1156: ,p_budget_detail_id => l_budget_detail_id
1172: ,p_budget_unit3_available => ''
1173: ,p_budget_unit3_value_type_cd => ''
1174: ,p_object_version_number => l_object_version_number
1175: );
1176: hr_utility.set_location('inserting '||i.organization_id||l_proc,30);
1177: pqh_budget.insert_org_is_bud(i.organization_id);
1178: end loop;
1179: else
1180: hr_utility.set_location('oh is used '||l_proc,40);
1176: hr_utility.set_location('inserting '||i.organization_id||l_proc,30);
1177: pqh_budget.insert_org_is_bud(i.organization_id);
1178: end loop;
1179: else
1180: hr_utility.set_location('oh is used '||l_proc,40);
1181: for i in c2 loop
1182: l_rows_inserted := l_rows_inserted + 1;
1183: pqh_budget_details_api.create_budget_detail(
1184: p_validate => FALSE
1201: ,p_budget_unit3_available => ''
1202: ,p_budget_unit3_value_type_cd => ''
1203: ,p_object_version_number => l_object_version_number
1204: );
1205: hr_utility.set_location('inserting '||i.organization_id||l_proc,50);
1206: pqh_budget.insert_org_is_bud(i.organization_id);
1207: end loop;
1208: end if;
1209: p_rows_inserted := l_rows_inserted;
1206: pqh_budget.insert_org_is_bud(i.organization_id);
1207: end loop;
1208: end if;
1209: p_rows_inserted := l_rows_inserted;
1210: hr_utility.set_location('entering '||l_proc,60);
1211: exception when others then
1212: p_rows_inserted := null;
1213: raise;
1214: end populate_bud_organizations;
1278: and end_date > l_period_start_date
1279: order by end_date desc;
1280: l_proc varchar2(100) := g_package||'insert_default_period' ;
1281: begin
1282: hr_utility.set_location('entering '||l_proc,10);
1283: hr_utility.set_location('unit1_value '||p_worksheet_unit1_value||l_proc,11);
1284: hr_utility.set_location('unit2_value '||p_worksheet_unit2_value||l_proc,12);
1285: hr_utility.set_location('unit3_value '||p_worksheet_unit3_value||l_proc,13);
1286: l_budget_id := get_wkd_budget(p_worksheet_detail_id);
1279: order by end_date desc;
1280: l_proc varchar2(100) := g_package||'insert_default_period' ;
1281: begin
1282: hr_utility.set_location('entering '||l_proc,10);
1283: hr_utility.set_location('unit1_value '||p_worksheet_unit1_value||l_proc,11);
1284: hr_utility.set_location('unit2_value '||p_worksheet_unit2_value||l_proc,12);
1285: hr_utility.set_location('unit3_value '||p_worksheet_unit3_value||l_proc,13);
1286: l_budget_id := get_wkd_budget(p_worksheet_detail_id);
1287: hr_utility.set_location('budget id is '||l_budget_id||l_proc,20);
1280: l_proc varchar2(100) := g_package||'insert_default_period' ;
1281: begin
1282: hr_utility.set_location('entering '||l_proc,10);
1283: hr_utility.set_location('unit1_value '||p_worksheet_unit1_value||l_proc,11);
1284: hr_utility.set_location('unit2_value '||p_worksheet_unit2_value||l_proc,12);
1285: hr_utility.set_location('unit3_value '||p_worksheet_unit3_value||l_proc,13);
1286: l_budget_id := get_wkd_budget(p_worksheet_detail_id);
1287: hr_utility.set_location('budget id is '||l_budget_id||l_proc,20);
1288: select period_set_name,budget_start_date,budget_end_date
1281: begin
1282: hr_utility.set_location('entering '||l_proc,10);
1283: hr_utility.set_location('unit1_value '||p_worksheet_unit1_value||l_proc,11);
1284: hr_utility.set_location('unit2_value '||p_worksheet_unit2_value||l_proc,12);
1285: hr_utility.set_location('unit3_value '||p_worksheet_unit3_value||l_proc,13);
1286: l_budget_id := get_wkd_budget(p_worksheet_detail_id);
1287: hr_utility.set_location('budget id is '||l_budget_id||l_proc,20);
1288: select period_set_name,budget_start_date,budget_end_date
1289: into l_calendar,l_budget_start_date,l_budget_end_date
1283: hr_utility.set_location('unit1_value '||p_worksheet_unit1_value||l_proc,11);
1284: hr_utility.set_location('unit2_value '||p_worksheet_unit2_value||l_proc,12);
1285: hr_utility.set_location('unit3_value '||p_worksheet_unit3_value||l_proc,13);
1286: l_budget_id := get_wkd_budget(p_worksheet_detail_id);
1287: hr_utility.set_location('budget id is '||l_budget_id||l_proc,20);
1288: select period_set_name,budget_start_date,budget_end_date
1289: into l_calendar,l_budget_start_date,l_budget_end_date
1290: from pqh_budgets
1291: where budget_id = l_budget_id;
1288: select period_set_name,budget_start_date,budget_end_date
1289: into l_calendar,l_budget_start_date,l_budget_end_date
1290: from pqh_budgets
1291: where budget_id = l_budget_id;
1292: hr_utility.set_location('calendar id is '||l_calendar||l_proc,30);
1293: hr_utility.set_location('budget start date is '||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,40);
1294: hr_utility.set_location('budget_end date id is '||to_char(l_budget_end_date,'DD/MM/RRRR')||l_proc,50);
1295: open c1;
1296: fetch c1 into l_start_time_period_id,l_period_start_date;
1289: into l_calendar,l_budget_start_date,l_budget_end_date
1290: from pqh_budgets
1291: where budget_id = l_budget_id;
1292: hr_utility.set_location('calendar id is '||l_calendar||l_proc,30);
1293: hr_utility.set_location('budget start date is '||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,40);
1294: hr_utility.set_location('budget_end date id is '||to_char(l_budget_end_date,'DD/MM/RRRR')||l_proc,50);
1295: open c1;
1296: fetch c1 into l_start_time_period_id,l_period_start_date;
1297: hr_utility.set_location('period_start date id is '||to_char(l_period_start_date,'DD/MM/RRRR')||l_proc,60);
1290: from pqh_budgets
1291: where budget_id = l_budget_id;
1292: hr_utility.set_location('calendar id is '||l_calendar||l_proc,30);
1293: hr_utility.set_location('budget start date is '||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,40);
1294: hr_utility.set_location('budget_end date id is '||to_char(l_budget_end_date,'DD/MM/RRRR')||l_proc,50);
1295: open c1;
1296: fetch c1 into l_start_time_period_id,l_period_start_date;
1297: hr_utility.set_location('period_start date id is '||to_char(l_period_start_date,'DD/MM/RRRR')||l_proc,60);
1298: if c1%found then
1293: hr_utility.set_location('budget start date is '||to_char(l_budget_start_date,'DD/MM/RRRR')||l_proc,40);
1294: hr_utility.set_location('budget_end date id is '||to_char(l_budget_end_date,'DD/MM/RRRR')||l_proc,50);
1295: open c1;
1296: fetch c1 into l_start_time_period_id,l_period_start_date;
1297: hr_utility.set_location('period_start date id is '||to_char(l_period_start_date,'DD/MM/RRRR')||l_proc,60);
1298: if c1%found then
1299: open c2;
1300: fetch c2 into l_end_time_period_id,l_period_end_date;
1301: hr_utility.set_location('period_end date id is '||to_char(l_period_end_date,'DD/MM/RRRR')||l_proc,70);
1297: hr_utility.set_location('period_start date id is '||to_char(l_period_start_date,'DD/MM/RRRR')||l_proc,60);
1298: if c1%found then
1299: open c2;
1300: fetch c2 into l_end_time_period_id,l_period_end_date;
1301: hr_utility.set_location('period_end date id is '||to_char(l_period_end_date,'DD/MM/RRRR')||l_proc,70);
1302: close c2;
1303: end if;
1304: close c1;
1305: if l_end_time_period_id is null then
1302: close c2;
1303: end if;
1304: close c1;
1305: if l_end_time_period_id is null then
1306: hr_utility.set_location('no period lies during budget life'||l_proc,80);
1307: pqh_budget.update_worksheet_detail(
1308: p_worksheet_detail_id => p_worksheet_detail_id,
1309: p_object_version_number => p_wkd_ovn,
1310: p_effective_date => trunc(sysdate),
1310: p_effective_date => trunc(sysdate),
1311: p_budget_unit1_available => p_worksheet_unit1_value,
1312: p_budget_unit2_available => p_worksheet_unit1_value,
1313: p_budget_unit3_available => p_worksheet_unit1_value);
1314: hr_utility.set_location('ovn of wkd after is'||p_wkd_ovn||l_proc,90);
1315: else
1316: hr_utility.set_location('inserting worksheet period '||l_proc,100);
1317: pqh_worksheet_periods_api.create_worksheet_period
1318: (
1312: p_budget_unit2_available => p_worksheet_unit1_value,
1313: p_budget_unit3_available => p_worksheet_unit1_value);
1314: hr_utility.set_location('ovn of wkd after is'||p_wkd_ovn||l_proc,90);
1315: else
1316: hr_utility.set_location('inserting worksheet period '||l_proc,100);
1317: pqh_worksheet_periods_api.create_worksheet_period
1318: (
1319: p_worksheet_period_id => p_worksheet_period_id
1320: ,p_end_time_period_id => l_end_time_period_id
1335: ,p_budget_unit3_available => p_worksheet_unit3_value
1336: ,p_effective_date => trunc(sysdate)
1337: );
1338: end if;
1339: hr_utility.set_location('exiting '||l_proc,1000);
1340: exception when others then
1341: p_wkd_ovn := l_wkd_ovn;
1342: p_worksheet_period_id := null;
1343: p_wpr_ovn := null;
1352: l_wkd_ovn number;
1353: l_wks_ovn number;
1354: l_proc varchar2(61) := g_package||'apply_wks' ;
1355: BEGIN
1356: hr_utility.set_location('entering '||l_proc,10);
1357: approve_wks(p_transaction_id => p_transaction_id,
1358: p_transaction_category_id => p_transaction_category_id,
1359: p_wkd_ovn => l_wkd_ovn,
1360: p_wks_ovn => l_wks_ovn);
1357: approve_wks(p_transaction_id => p_transaction_id,
1358: p_transaction_category_id => p_transaction_category_id,
1359: p_wkd_ovn => l_wkd_ovn,
1360: p_wks_ovn => l_wks_ovn);
1361: hr_utility.set_location(l_proc||'wks_ovn is '||l_wks_ovn,20);
1362: hr_utility.set_location(l_proc||'wkd_ovn is '||l_wkd_ovn,30);
1363: pqh_budget.complete_workflow(p_worksheet_detail_id => p_transaction_id,
1364: p_transaction_category_id => p_transaction_category_id,
1365: p_result_status => 'SUBMITTED',
1358: p_transaction_category_id => p_transaction_category_id,
1359: p_wkd_ovn => l_wkd_ovn,
1360: p_wks_ovn => l_wks_ovn);
1361: hr_utility.set_location(l_proc||'wks_ovn is '||l_wks_ovn,20);
1362: hr_utility.set_location(l_proc||'wkd_ovn is '||l_wkd_ovn,30);
1363: pqh_budget.complete_workflow(p_worksheet_detail_id => p_transaction_id,
1364: p_transaction_category_id => p_transaction_category_id,
1365: p_result_status => 'SUBMITTED',
1366: p_wkd_object_version_number => p_wkd_ovn,
1364: p_transaction_category_id => p_transaction_category_id,
1365: p_result_status => 'SUBMITTED',
1366: p_wkd_object_version_number => p_wkd_ovn,
1367: p_wks_object_version_number => p_wks_ovn);
1368: hr_utility.set_location(l_proc||'wks_ovn is '||l_wks_ovn,40);
1369: hr_utility.set_location(l_proc||'wkd_ovn is '||l_wkd_ovn,50);
1370: exception when others then
1371: p_wkd_ovn := null;
1372: p_wks_ovn := null;
1365: p_result_status => 'SUBMITTED',
1366: p_wkd_object_version_number => p_wkd_ovn,
1367: p_wks_object_version_number => p_wks_ovn);
1368: hr_utility.set_location(l_proc||'wks_ovn is '||l_wks_ovn,40);
1369: hr_utility.set_location(l_proc||'wkd_ovn is '||l_wkd_ovn,50);
1370: exception when others then
1371: p_wkd_ovn := null;
1372: p_wks_ovn := null;
1373: raise;
1381: l_status varchar2(30);
1382: l_working_users varchar2(2000);
1383: l_proc varchar2(61) := g_package||'pending_wks' ;
1384: BEGIN
1385: hr_utility.set_location('entering'||l_proc,10);
1386: pqh_budget.complete_workflow(p_worksheet_detail_id => p_transaction_id,
1387: p_transaction_category_id => p_transaction_category_id,
1388: p_result_status => 'PENDING',
1389: p_wkd_object_version_number => p_wkd_ovn,
1387: p_transaction_category_id => p_transaction_category_id,
1388: p_result_status => 'PENDING',
1389: p_wkd_object_version_number => p_wkd_ovn,
1390: p_wks_object_version_number => p_wks_ovn);
1391: hr_utility.set_location(l_proc||'wks_ovn is '||p_wks_ovn,40);
1392: hr_utility.set_location(l_proc||'wkd_ovn is '||p_wkd_ovn,50);
1393: exception when others then
1394: p_wkd_ovn := null;
1395: p_wks_ovn := null;
1388: p_result_status => 'PENDING',
1389: p_wkd_object_version_number => p_wkd_ovn,
1390: p_wks_object_version_number => p_wks_ovn);
1391: hr_utility.set_location(l_proc||'wks_ovn is '||p_wks_ovn,40);
1392: hr_utility.set_location(l_proc||'wkd_ovn is '||p_wkd_ovn,50);
1393: exception when others then
1394: p_wkd_ovn := null;
1395: p_wks_ovn := null;
1396: raise;
1404: l_status varchar2(30);
1405: l_working_users varchar2(2000);
1406: l_proc varchar2(61) := g_package||'approve_wks' ;
1407: BEGIN
1408: hr_utility.set_location('entering'||l_proc,10);
1409: pqh_budget.lock_all_children(p_worksheet_detail_id => p_transaction_id,
1410: p_transaction_category_id => p_transaction_category_id,
1411: p_status => l_status,
1412: p_working_users => l_working_users);
1409: pqh_budget.lock_all_children(p_worksheet_detail_id => p_transaction_id,
1410: p_transaction_category_id => p_transaction_category_id,
1411: p_status => l_status,
1412: p_working_users => l_working_users);
1413: hr_utility.set_location('child locked'||l_proc,20);
1414: if nvl(l_status,'Y') ='Y' then
1415: -- close notifications and change status
1416: hr_utility.set_location('changing status'||l_proc,30);
1417: pqh_budget.complete_workflow(p_worksheet_detail_id => p_transaction_id,
1412: p_working_users => l_working_users);
1413: hr_utility.set_location('child locked'||l_proc,20);
1414: if nvl(l_status,'Y') ='Y' then
1415: -- close notifications and change status
1416: hr_utility.set_location('changing status'||l_proc,30);
1417: pqh_budget.complete_workflow(p_worksheet_detail_id => p_transaction_id,
1418: p_transaction_category_id => p_transaction_category_id,
1419: p_result_status => 'APPROVED',
1420: p_wkd_object_version_number => p_wkd_ovn,
1418: p_transaction_category_id => p_transaction_category_id,
1419: p_result_status => 'APPROVED',
1420: p_wkd_object_version_number => p_wkd_ovn,
1421: p_wks_object_version_number => p_wks_ovn);
1422: hr_utility.set_location('status changed'||l_proc,40);
1423: else
1424: hr_utility.set_message(8302,'PQH_WKS_CHILD_WORKING');
1425: hr_utility.set_message_token('USERS',l_working_users);
1426: hr_utility.raise_error;
1420: p_wkd_object_version_number => p_wkd_ovn,
1421: p_wks_object_version_number => p_wks_ovn);
1422: hr_utility.set_location('status changed'||l_proc,40);
1423: else
1424: hr_utility.set_message(8302,'PQH_WKS_CHILD_WORKING');
1425: hr_utility.set_message_token('USERS',l_working_users);
1426: hr_utility.raise_error;
1427: end if;
1428: hr_utility.set_location('wks out nocopy ovn is'||p_wks_ovn||l_proc,90);
1421: p_wks_object_version_number => p_wks_ovn);
1422: hr_utility.set_location('status changed'||l_proc,40);
1423: else
1424: hr_utility.set_message(8302,'PQH_WKS_CHILD_WORKING');
1425: hr_utility.set_message_token('USERS',l_working_users);
1426: hr_utility.raise_error;
1427: end if;
1428: hr_utility.set_location('wks out nocopy ovn is'||p_wks_ovn||l_proc,90);
1429: hr_utility.set_location('wkd out nocopy ovn is'||p_wkd_ovn||l_proc,100);
1422: hr_utility.set_location('status changed'||l_proc,40);
1423: else
1424: hr_utility.set_message(8302,'PQH_WKS_CHILD_WORKING');
1425: hr_utility.set_message_token('USERS',l_working_users);
1426: hr_utility.raise_error;
1427: end if;
1428: hr_utility.set_location('wks out nocopy ovn is'||p_wks_ovn||l_proc,90);
1429: hr_utility.set_location('wkd out nocopy ovn is'||p_wkd_ovn||l_proc,100);
1430: exception when others then
1424: hr_utility.set_message(8302,'PQH_WKS_CHILD_WORKING');
1425: hr_utility.set_message_token('USERS',l_working_users);
1426: hr_utility.raise_error;
1427: end if;
1428: hr_utility.set_location('wks out nocopy ovn is'||p_wks_ovn||l_proc,90);
1429: hr_utility.set_location('wkd out nocopy ovn is'||p_wkd_ovn||l_proc,100);
1430: exception when others then
1431: p_wkd_ovn := null;
1432: p_wks_ovn := null;
1425: hr_utility.set_message_token('USERS',l_working_users);
1426: hr_utility.raise_error;
1427: end if;
1428: hr_utility.set_location('wks out nocopy ovn is'||p_wks_ovn||l_proc,90);
1429: hr_utility.set_location('wkd out nocopy ovn is'||p_wkd_ovn||l_proc,100);
1430: exception when others then
1431: p_wkd_ovn := null;
1432: p_wks_ovn := null;
1433: raise;
1441: l_status varchar2(30);
1442: l_working_users varchar2(2000);
1443: l_proc varchar2(61) := g_package||'reject_wks' ;
1444: BEGIN
1445: hr_utility.set_location('entering'||l_proc,10);
1446: -- if the current user is the initiator of the txn then mark the status
1447: -- as reject else status remains the same and notification will be sent to initiator.
1448: l_user := pqh_wf.get_requestor(p_transaction_category_id => p_transaction_category_id,
1449: p_transaction_id => p_transaction_id);
1446: -- if the current user is the initiator of the txn then mark the status
1447: -- as reject else status remains the same and notification will be sent to initiator.
1448: l_user := pqh_wf.get_requestor(p_transaction_category_id => p_transaction_category_id,
1449: p_transaction_id => p_transaction_id);
1450: hr_utility.set_location('requestor is'||l_user||l_proc,20);
1451: -- change the status of the delegated rows to reject
1452: -- and all open notifications to be killed
1453: -- depending upon the initator of the delegated row
1454: if l_user is null or l_user = fnd_profile.value('USERNAME') then
1451: -- change the status of the delegated rows to reject
1452: -- and all open notifications to be killed
1453: -- depending upon the initator of the delegated row
1454: if l_user is null or l_user = fnd_profile.value('USERNAME') then
1455: hr_utility.set_location('going for lock'||l_proc,30);
1456: pqh_budget.lock_all_children(p_worksheet_detail_id => p_transaction_id,
1457: p_transaction_category_id => p_transaction_category_id,
1458: p_status => l_status,
1459: p_working_users => l_working_users);
1456: pqh_budget.lock_all_children(p_worksheet_detail_id => p_transaction_id,
1457: p_transaction_category_id => p_transaction_category_id,
1458: p_status => l_status,
1459: p_working_users => l_working_users);
1460: hr_utility.set_location('locked'||l_proc,40);
1461: if nvl(l_status,'Y') ='Y' then
1462: -- notifications are to be closed and change status
1463: hr_utility.set_location('changing status'||l_proc,50);
1464: pqh_budget.complete_workflow(p_worksheet_detail_id => p_transaction_id,
1459: p_working_users => l_working_users);
1460: hr_utility.set_location('locked'||l_proc,40);
1461: if nvl(l_status,'Y') ='Y' then
1462: -- notifications are to be closed and change status
1463: hr_utility.set_location('changing status'||l_proc,50);
1464: pqh_budget.complete_workflow(p_worksheet_detail_id => p_transaction_id,
1465: p_transaction_category_id => p_transaction_category_id,
1466: p_result_status => 'REJECT',
1467: p_wkd_object_version_number => p_wkd_ovn,
1465: p_transaction_category_id => p_transaction_category_id,
1466: p_result_status => 'REJECT',
1467: p_wkd_object_version_number => p_wkd_ovn,
1468: p_wks_object_version_number => p_wks_ovn);
1469: hr_utility.set_location('status changed'||l_proc,60);
1470: else
1471: hr_utility.set_message(8302,'PQH_WKS_CHILD_WORKING');
1472: hr_utility.set_message_token('USERS',l_working_users);
1473: hr_utility.raise_error;
1467: p_wkd_object_version_number => p_wkd_ovn,
1468: p_wks_object_version_number => p_wks_ovn);
1469: hr_utility.set_location('status changed'||l_proc,60);
1470: else
1471: hr_utility.set_message(8302,'PQH_WKS_CHILD_WORKING');
1472: hr_utility.set_message_token('USERS',l_working_users);
1473: hr_utility.raise_error;
1474: end if;
1475: else
1468: p_wks_object_version_number => p_wks_ovn);
1469: hr_utility.set_location('status changed'||l_proc,60);
1470: else
1471: hr_utility.set_message(8302,'PQH_WKS_CHILD_WORKING');
1472: hr_utility.set_message_token('USERS',l_working_users);
1473: hr_utility.raise_error;
1474: end if;
1475: else
1476: hr_utility.set_location('changing status'||l_proc,70);
1469: hr_utility.set_location('status changed'||l_proc,60);
1470: else
1471: hr_utility.set_message(8302,'PQH_WKS_CHILD_WORKING');
1472: hr_utility.set_message_token('USERS',l_working_users);
1473: hr_utility.raise_error;
1474: end if;
1475: else
1476: hr_utility.set_location('changing status'||l_proc,70);
1477: pqh_budget.complete_workflow(p_worksheet_detail_id => p_transaction_id,
1472: hr_utility.set_message_token('USERS',l_working_users);
1473: hr_utility.raise_error;
1474: end if;
1475: else
1476: hr_utility.set_location('changing status'||l_proc,70);
1477: pqh_budget.complete_workflow(p_worksheet_detail_id => p_transaction_id,
1478: p_transaction_category_id => p_transaction_category_id,
1479: p_result_status => 'PENDING',
1480: p_wkd_object_version_number => p_wkd_ovn,
1478: p_transaction_category_id => p_transaction_category_id,
1479: p_result_status => 'PENDING',
1480: p_wkd_object_version_number => p_wkd_ovn,
1481: p_wks_object_version_number => p_wks_ovn);
1482: hr_utility.set_location('status changed'||l_proc,80);
1483: end if;
1484: hr_utility.set_location('wks out nocopy ovn is'||p_wks_ovn||l_proc,90);
1485: hr_utility.set_location('wkd out nocopy ovn is'||p_wkd_ovn||l_proc,100);
1486: exception when others then
1480: p_wkd_object_version_number => p_wkd_ovn,
1481: p_wks_object_version_number => p_wks_ovn);
1482: hr_utility.set_location('status changed'||l_proc,80);
1483: end if;
1484: hr_utility.set_location('wks out nocopy ovn is'||p_wks_ovn||l_proc,90);
1485: hr_utility.set_location('wkd out nocopy ovn is'||p_wkd_ovn||l_proc,100);
1486: exception when others then
1487: p_wkd_ovn := null;
1488: p_wks_ovn := null;
1481: p_wks_object_version_number => p_wks_ovn);
1482: hr_utility.set_location('status changed'||l_proc,80);
1483: end if;
1484: hr_utility.set_location('wks out nocopy ovn is'||p_wks_ovn||l_proc,90);
1485: hr_utility.set_location('wkd out nocopy ovn is'||p_wkd_ovn||l_proc,100);
1486: exception when others then
1487: p_wkd_ovn := null;
1488: p_wks_ovn := null;
1489: raise;