DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_ADVANCE_PAY_ELE_PKG

Source


1 PACKAGE BODY PAY_ADVANCE_PAY_ELE_PKG as
2 /* $Header: pyadvele.pkb 115.0 2003/11/13 16:29 susivasu noship $ */
3 --
4 g_leg_code pay_legislation_rules.legislation_code%TYPE := null;
5 g_subpriority number := null;
6 --
7 function get_subpriority(p_leg_code      in varchar2,
8                          p_creator_type  in varchar2,
9                          p_subpriority   in number)
10         return pay_element_entries_f.subpriority%TYPE is
11 --
12   cursor csr_subpriority is
13   select to_number(plr.rule_mode)
14     from pay_legislation_rules plr
15    where upper(plr.legislation_code) = upper(p_leg_code)
16      and upper(plr.rule_type) = 'ADV_EE_SUBPRIORITY';
17 --
18   l_subpriority  pay_element_entries_f.subpriority%TYPE;
19 --
20 begin
21 --
22   if (p_creator_type not in ('AE','AD')) then
23      --
24      -- If the entry is other than the advanced or deducted entry then
25      -- return the passed subpriority value.
26      --
27      l_subpriority := p_subpriority;
28      --
29   elsif upper(g_leg_code) = upper(p_leg_code) then
30      --
31      -- If the legislation code exists then use the chached value.
32      --
33      l_subpriority := g_subpriority;
34      --
35   else
36      --
37      -- Derive the value and then caches the derieved value.
38      --
39      open csr_subpriority;
40      fetch csr_subpriority into l_subpriority;
41      --
42      if (csr_subpriority%found) then
43         --
44         g_subpriority := l_subpriority;
45         g_leg_code := p_leg_code;
46         --
47      else
48         l_subpriority := p_subpriority;
49      end if;
50      --
51      close csr_subpriority;
52      --
53   end if;
54   --
55   return l_subpriority;
56 --
57 end get_subpriority;
58 --
59 End PAY_ADVANCE_PAY_ELE_PKG;