DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_AU_SUPER_FF

Source


1 PACKAGE BODY pay_au_super_ff AS
2 /* $Header: pyaufmsp.pkb 120.1 2005/07/27 21:22:53 hnainani noship $ */
3 
4 /*
5  +==========================================================================================
6  |              Copyright (c) 1999 Oracle Corporation Ltd
7  |                           All rights reserved.
8  +==========================================================================================
9  Change List
10  ----------
11  DATE        Name            Vers     Bug No    Description
12  -----------+---------------+--------+--------+-----------------------+
13  01-Dec-1999 makelly         115.0             Created for AU
14  05-Dec-2000 rbsinha         115.1             Added a cursor to fetch
15                                                balance name for the
16                                                balance id . This has
17                                                been done to raise a
18                                                context sensitive message.
19  04-Dec-2002 Ragovind        115.2             Added NOCOPY for function get_bals.
20  09-Aug-2004 abhkumar        115.4    2610141  Added tax_unit_id parameter in function get_bals for LE changes.
21  12-Aug-2004 abhkumar        115.5    2610141  Modfied code to set the appropriate token for the message
22  08-SEP-2004 abhkumar        115.6    2610141  Added a new parameter to function get_bals
23  28-JUL-2005 hnainani        115.7    4519080  Changed Get_Value function to add parameter get_rb_routes
24  -----------+---------------+--------+--------+-----------------------+
25 */
26 
27 
28 /*
29 **------------------------------ Formula Fuctions ---------------------------------
30 **  Package containing addition processing required by superannuation
31 **  formula in AU localisaton
32 */
33 
34 
35 /*
36 **  get_bals - get the balances for a user specified balance
37 */
38 
39 
40 function  get_bals
41   (
42       p_ass_act_id  in     number     /* context - assignment_action_id */
43      ,p_tax_unit_id in     number     /* context - tax_unit_id */ --2610141
44      ,p_bal_id      in     number     /* Balance id of user Balance     */
45      ,p_use_tax_flag IN    VARCHAR2 --2610141
46      ,p_bal_run     in out NOCOPY number     /* Run balance                    */
47      ,p_bal_mtd     in out NOCOPY number     /* Month to date balance          */
48      ,p_bal_qtd     in out NOCOPY number     /* Quarter to date balance        */
49   )
50   return number is
51 
52 l_bal_dim_id           number;
53 l_bal_name             VARCHAR2(80);
54 l_run_dim_name         VARCHAR2(20);
55 l_qtd_dim_name         VARCHAR2(20);
56 l_mtd_dim_name         VARCHAR2(20);
57 
58 cursor c_get_def_bal_id (v_bal_dim   varchar2) is
59 select pdb.defined_balance_id
60   from pay_balance_dimensions pbd,
61        pay_defined_balances   pdb
62  where pbd.dimension_name = v_bal_dim
63    and pdb.balance_type_id   = p_bal_id
64    and pdb.balance_dimension_id = pbd.balance_dimension_id;
65 
66 cursor c_get_balance_name is
67 select pbt.balance_name
68 from   pay_balance_types pbt
69 where  pbt.balance_type_id = p_bal_id;
70 
71 
72 begin
73 
74   IF p_use_tax_flag = 'N' THEN
75 	l_run_dim_name := '_ASG_RUN';
76 	l_qtd_dim_name := '_ASG_QTD';
77 	l_mtd_dim_name := '_ASG_MTD';
78   ELSE
79 	l_run_dim_name := '_ASG_LE_RUN';
80 	l_qtd_dim_name := '_ASG_LE_QTD';
81 	l_mtd_dim_name := '_ASG_LE_MTD';
82   END IF ;
83 
84 
85   open c_get_def_bal_id (l_run_dim_name); --2610141
86   fetch c_get_def_bal_id into l_bal_dim_id;
87   if c_get_def_bal_id%notfound then
88     open c_get_balance_name;
89     fetch c_get_balance_name into l_bal_name;
90     close c_get_balance_name;
91     hr_utility.set_message(801,'HR_AU_BAL_DIM_NOT_DEFINED');
92     hr_utility.set_message_token('DIMENSION',l_run_dim_name); --2610141
93     hr_utility.set_message_token('BALANCE_NAME',l_bal_name);
94     return(-1);
95   end if;
96   close c_get_def_bal_id;
97 
98 /* 4519080 - IF changing the parameters for the get_value function ,please make sure to retain the parameter
99        p_get_rb_route. Since this function is called from a formula function , latest balances do not always
100        work as expected */
101 
102 
103   IF p_use_tax_flag = 'Y' THEN
104   p_bal_run:=  pay_balance_pkg.get_value(p_defined_balance_id   => l_bal_dim_id
105                          ,p_assignment_action_id => p_ass_act_id
106                          ,p_tax_unit_id          => p_tax_unit_id
107                          ,p_jurisdiction_code    => null
108                          ,p_source_id            => null
109                          ,p_source_text          => null
110                          ,p_tax_group            => null
111                          ,p_date_earned          => null
112                          ,p_get_rr_route         => null
113                          ,p_get_rb_route         => 'TRUE'
114                          ,p_source_text2         => null
115                         ,p_source_number        => null
116                          );
117 
118 ELSE
119   p_bal_run:=  pay_balance_pkg.get_value(p_defined_balance_id   => l_bal_dim_id
120                          ,p_assignment_action_id => p_ass_act_id
121                          ,p_tax_unit_id          => null
122                          ,p_jurisdiction_code    => null
123                          ,p_source_id            => null
124                          ,p_source_text          => null
125                          ,p_tax_group            => null
126                          ,p_date_earned          => null
127                          ,p_get_rr_route         => null
128                          ,p_get_rb_route         => 'TRUE'
129                          ,p_source_text2         => null
130                         ,p_source_number        => null
131                          );
132 
133 
134 
135   END IF;
136 
137   open c_get_def_bal_id (l_mtd_dim_name); --2610141
138   fetch c_get_def_bal_id into l_bal_dim_id;
139   if c_get_def_bal_id%notfound then
140     open c_get_balance_name;
141     fetch c_get_balance_name into l_bal_name;
142     close c_get_balance_name;
143     hr_utility.set_message(801,'HR_AU_BAL_DIM_NOT_DEFINED');
144     hr_utility.set_message_token('DIMENSION',l_mtd_dim_name); --2610141
145     hr_utility.set_message_token('BALANCE_NAME',l_bal_name);
146     return(-2);
147   end if;
148   close c_get_def_bal_id;
149 
150   IF p_use_tax_flag = 'Y' THEN
151        p_bal_mtd :=  pay_balance_pkg.get_value(p_defined_balance_id   => l_bal_dim_id
152                          ,p_assignment_action_id => p_ass_act_id
153                          ,p_tax_unit_id          => p_tax_unit_id
154                          ,p_jurisdiction_code    => null
155                          ,p_source_id            => null
156                          ,p_source_text          => null
157                          ,p_tax_group            => null
158                          ,p_date_earned          => null
159                          ,p_get_rr_route         => null
160                          ,p_get_rb_route         => 'TRUE'
161                          ,p_source_text2         => null
162                          ,p_source_number        => null
163                          );
164 
165   ELSE
166       p_bal_mtd :=    pay_balance_pkg.get_value(p_defined_balance_id   => l_bal_dim_id
167                          ,p_assignment_action_id => p_ass_act_id
168                          ,p_tax_unit_id          => null
169                          ,p_jurisdiction_code    => null
170                          ,p_source_id            => null
171                          ,p_source_text          => null
172                          ,p_tax_group            => null
173                          ,p_date_earned          => null
174                          ,p_get_rr_route         => null
175                          ,p_get_rb_route         => 'TRUE'
176                          ,p_source_text2         => null
177                          ,p_source_number        => null
178                          );
179 
180   END IF ;
181 
182   open c_get_def_bal_id (l_qtd_dim_name); --2610141
183   fetch c_get_def_bal_id into l_bal_dim_id;
184   if c_get_def_bal_id%notfound then
185     open c_get_balance_name;
186     fetch c_get_balance_name into l_bal_name;
187     close c_get_balance_name;
188     hr_utility.set_message(801,'HR_AU_BAL_DIM_NOT_DEFINED');
189     hr_utility.set_message_token('DIMENSION',l_qtd_dim_name); --2610141
190     hr_utility.set_message_token('BALANCE_NAME',l_bal_name);
191     return(-3);
192   end if;
193   close c_get_def_bal_id;
194 
195   IF p_use_tax_flag = 'Y' THEN
196     p_bal_qtd :=     pay_balance_pkg.get_value(p_defined_balance_id   => l_bal_dim_id
197                          ,p_assignment_action_id => p_ass_act_id
198                          ,p_tax_unit_id          => p_tax_unit_id
199                          ,p_jurisdiction_code    => null
200                          ,p_source_id            => null
201                          ,p_source_text          => null
202                          ,p_tax_group            => null
203                          ,p_date_earned          => null
204                          ,p_get_rr_route         => null
205                          ,p_get_rb_route         => 'TRUE'
206                          ,p_source_text2         => null
207                          ,p_source_number        => null
208                          );
209 
210   ELSE
211         p_bal_qtd := pay_balance_pkg.get_value(p_defined_balance_id   => l_bal_dim_id
212                          ,p_assignment_action_id => p_ass_act_id
213                          ,p_tax_unit_id          => null
214                          ,p_jurisdiction_code    => null
215                          ,p_source_id            => null
216                          ,p_source_text          => null
217                          ,p_tax_group            => null
218                          ,p_date_earned          => null
219                          ,p_get_rr_route         => null
220                          ,p_get_rb_route         => 'TRUE'
221                          ,p_source_text2         => null
222                          ,p_source_number        => null
223                          );
224 
225   END IF ;
226 
227    hr_utility.trace('p_bal_run '||p_bal_run);
228    hr_utility.trace('p_bal_mtd '||p_bal_mtd);
229    hr_utility.trace('p_bal_qtd '||p_bal_qtd);
230 
231   return(0);
232 
233 exception
234   when others then
235     return(-99);
236 
237 end get_bals;
238 
239 
240 end pay_au_super_ff;