DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_CONSOLIDATION_SETS_PKG

Source


1 PACKAGE BODY PAY_CONSOLIDATION_SETS_PKG as
2 /* $Header: pycss01t.pkb 115.1 99/07/17 05:55:49 porting ship  $ */
3 --
4 procedure get_next_sequence(p_consolidation_set_id in out number) is
5 --
6 cursor c1 is select pay_consolidation_sets_s.nextval
7 	     from sys.dual;
8 --
9 begin
10   --
11   -- Retrieve the next sequence number for consolidation_set_id
12   --
13   if (p_consolidation_set_id is null) then
14      open c1;
15      fetch c1 into p_consolidation_set_id;
16      if (C1%NOTFOUND) then
17         hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
18         hr_utility.set_message_token('PROCEDURE','get_next_sequence');
19      end if;
20      close c1;
21   end if;
22   --
23   hr_utility.set_location('PER_JOBS_PKG.get_next_sequence', 1);
24   --
25 end get_next_sequence;
26 --
27 PROCEDURE check_unique_name(p_consolidation_set_name    in varchar2,
28 			    p_business_group_id         in number,
29 			    p_rowid                     in varchar2) is
30 --
31 cursor csr_name is select null
32 		   from pay_consolidation_sets cs
33 		   WHERE  UPPER(CS.CONSOLIDATION_SET_NAME) =
34 			     UPPER(P_CONSOLIDATION_SET_NAME)
35 	           AND    CS.business_group_id + 0 =
36 		       	     P_BUSINESS_GROUP_ID
37 		   AND    (P_ROWID IS NULL
38 		   OR     (P_ROWID IS NOT NULL AND
39 			     P_ROWID <> rowidtochar(CS.ROWID)));
40 g_dummy_number number;
41 consolidation_exists boolean := FALSE;
42 --
43 -- Check the consolidation name is unique
44 --
45 begin
46   --
47   open csr_name;
48   fetch csr_name into g_dummy_number;
49   consolidation_exists := csr_name%FOUND;
50   close csr_name;
51   if consolidation_exists then
52     hr_utility.set_message (801,'HR_6395_SETUP_SET_EXISTS');
53     hr_utility.raise_error;
54   end if;
55 --
56 end check_unique_name;
57 --
58 procedure check_delete(p_business_group_id    in number,
59 		       p_consolidation_set_id in number) is
60 --
61 cursor csr_pay is select null
62                   FROM PAY_PAYROLLS_F PAY
63                   WHERE PAY.business_group_id + 0  = P_BUSINESS_GROUP_ID
64                   AND PAY.CONSOLIDATION_SET_ID = P_CONSOLIDATION_SET_ID;
65 --
66 cursor csr_payact is select null
67                      FROM PAY_PAYROLL_ACTIONS PAC
68                      WHERE PAC.business_group_id + 0  = P_BUSINESS_GROUP_ID
69                      AND PAC.CONSOLIDATION_SET_ID = P_CONSOLIDATION_SET_ID;
70 --
71 g_dummy_number number;
72 payroll_exists boolean := FALSE;
73 pay_action_exists boolean := FALSE;
74 --
75 -- Check the consolidation set is not the default set for a payroll
76 -- or is associated with at least one payroll action
77 --
78 begin
79   --
80   open csr_pay;
81   fetch csr_pay into g_dummy_number;
82   payroll_exists := csr_pay%FOUND;
83   close csr_pay;
84   --
85   if payroll_exists then
86     hr_utility.set_message (801,'HR_6396_SETUP_SET_FOR_PAYROLL');
87     hr_utility.raise_error;
88   end if;
89   --
90   open csr_payact;
91   fetch csr_payact into g_dummy_number;
92   pay_action_exists := csr_payact%FOUND;
93   close csr_payact;
94   --
95   if pay_action_exists then
96     hr_utility.set_message (801,'HR_6397_SETUP_SET_ACTION_EXIST');
97     hr_utility.raise_error;
98   end if;
99   --
100 end check_delete;
101 --
102 END PAY_CONSOLIDATION_SETS_PKG;