1 PACKAGE BODY PAY_PGL_PKG as
2 /* $Header: pypgl01t.pkb 115.4 2003/09/01 00:13:22 tvankayl ship $ */
3 --
4 procedure get_cost_allocation(p_business_group_id NUMBER
5 ,p_cost_allocation_id_flex_num IN OUT NOCOPY NUMBER
6 ) is
7 cursor c is
8 select cost_allocation_structure
9 from per_business_groups
10 where business_group_id + 0 = p_business_group_id;
11 begin
12 hr_utility.set_location('pay_pgl_pkg.get_cost_allocation',1);
13 open c;
14 fetch c into p_cost_allocation_id_flex_num;
15 close c;
16 end get_cost_allocation;
17 --
18 --
19 procedure get_pay_post_query(p_gl_set_of_books_id NUMBER
20 ,p_effective_end_date DATE
21 ,p_end_of_time DATE
22 ,p_period_type VARCHAR2
23 ,p_displayed_set_of_books IN OUT NOCOPY VARCHAR2
24 ,p_displayed_eff_end_date IN OUT NOCOPY DATE
25 ,p_chart_of_accounts_id IN OUT NOCOPY NUMBER
26 ,p_display_period_type IN OUT NOCOPY VARCHAR2) is
27 cursor c is
28 select name
29 , chart_of_accounts_id
30 from gl_sets_of_books
31 where set_of_books_id = p_gl_set_of_books_id;
32 cursor c_period_type is
33 select display_period_type
34 from per_time_period_types_vl
35 where period_type = p_period_type;
36 sob_rec c%rowtype;
37 --
38 begin
39 /* Get the Set of Books Name and Chart of Accounts ID*/
40 hr_utility.set_location('pay_pgl_pkg.get_pay_post_query',1);
41 open c;
42 fetch c into sob_rec;
43 close c;
44 p_displayed_set_of_books := sob_rec.name;
45 p_chart_of_accounts_id := sob_rec.chart_of_accounts_id;
46 --
47 /* Set the Effective End Date */
48 if p_effective_end_date = p_end_of_time then
49 p_displayed_eff_end_date := '';
50 else p_displayed_eff_end_date := p_effective_end_date;
51 end if;
52 --
53 open c_period_type;
54 fetch c_period_type into p_display_period_type;
55 close c_period_type;
56 --
57 end get_pay_post_query;
58 --
59 --
60 procedure get_prf_post_query(p_gl_account_segment VARCHAR2
61 ,p_displayed_gl_segment IN OUT NOCOPY VARCHAR2
62 ,p_gl_flex_num NUMBER
63 ,p_payroll_cost_segment VARCHAR2
64 ,p_displayed_cost_segment IN OUT NOCOPY VARCHAR2
65 ,p_cost_flex_num NUMBER) is
66 --
67 cursor c(l_flex_code VARCHAR2
68 ,l_flex_num NUMBER
69 ,l_column_name VARCHAR2) is
70 select segment_name
71 from fnd_id_flex_segments
72 where id_flex_code = l_flex_code
73 and id_flex_num = l_flex_num
74 and enabled_flag = 'Y'
75 and application_column_name = l_column_name;
76 begin
77 hr_utility.set_location('pay_pgl_pkg.get_prf_post_query',1);
78 open c('GL#',p_gl_flex_num,p_gl_account_segment);
79 fetch c into p_displayed_gl_segment;
80 close c;
81 --
82 hr_utility.set_location('pay_pgl_pkg.get_prf_post_query',2);
83 open c('COST',p_cost_flex_num,p_payroll_cost_segment);
84 fetch c into p_displayed_cost_segment;
85 close c;
86 end;
87 --
88 --
89 procedure prf_checks(p_rowid VARCHAR2
90 ,p_payroll_id NUMBER
91 ,p_gl_set_of_books_id NUMBER
92 ,p_gl_account_segment VARCHAR2 ) is
93 l_exists VARCHAR2(1);
94 --
95 cursor c1 is
96 select ''
97 from pay_payroll_gl_flex_maps
98 where payroll_id = p_payroll_id
99 and gl_set_of_books_id = p_gl_set_of_books_id
100 and gl_account_segment = p_gl_account_segment
101 and ( p_rowid is null or
102 (p_rowid is not null
103 and chartorowid(p_rowid) <> rowid));
104 --
105 begin
106 hr_utility.set_location('pay_pgl_pkg.prf_checks',1);
107 open c1;
108 fetch c1 into l_exists;
109 if c1%found then
110 close c1;
111 hr_utility.set_message(801,'PAY_6962_DEF_GLMAP_DUP_GLSEG');
112 hr_utility.raise_error;
113 end if;
114 close c1;
115 end prf_checks;
116 --
117 function future_payroll_rows(p_payroll_id NUMBER
118 ,p_session_date DATE) return BOOLEAN is
119 cursor c is
120 select ''
121 from pay_payrolls_f
122 where payroll_id = p_payroll_id
123 and effective_start_date > p_session_date;
124 pay_rec c%rowtype;
125 --
126 begin
127 hr_utility.set_location('pay_pgl_pkg.future_payroll_rows',1);
128 open c;
129 fetch c into pay_rec;
130 if c%found then
131 close c;
132 return(TRUE);
133 end if;
134 close c;
135 return(FALSE);
136 end future_payroll_rows;
137 --
138 END PAY_PGL_PKG;