DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_PENS_AND_AVCS_FUNCTION

Source


1 PACKAGE BODY pqp_pens_and_avcs_function AS
2 -- $Header: pqgbpafn.pkb 115.4 2003/06/24 15:59:27 bsamuel noship $
3 -----------------------------------------------------------------------------
4 -- FUNCTION pqp_check_pension_cap
5 -----------------------------------------------------------------------------
6 FUNCTION  pqp_check_pension_cap(    p_salary_cap          IN      NUMBER
7                                    ,p_salary_prp_cap      IN      NUMBER
8                                    ,p_total_contribution  IN OUT NOCOPY  NUMBER
9                                    ,p_superannuable_ptd   IN      NUMBER
10                                    ,p_superannuation_tot  IN      NUMBER
11                                    ,p_total_pens_cont     IN      NUMBER)
12 RETURN CHAR IS
13 
14   l_final_contribution    number := 0;
15   l_adj_contribution      number := 0;
16   l_ref_cont              number := 0;
17   l_actual_cont           number := 0;
18   l_mesg                  varchar2(200);
19 
20   -- nocopy changes
21   l_total_contrib_nc      number;
22 
23 BEGIN
24 
25  l_total_contrib_nc  := p_total_contribution;
26 
27   p_total_contribution := ROUND(p_total_contribution,2);
28 
29   -- Added to fix bug 2273146
30 
31   IF p_superannuable_ptd <= 0 THEN
32 
33      p_total_contribution := 0;
34      l_mesg               := 'insufficient pay to make contributions';
35      RETURN l_mesg;
36 
37   END IF; -- End if of salary check ...
38   -- End Bug 2273146
39 
40   -- Test the percentage cap
41   -- Bug fix 3000682
42   -- Check percentage and annual cap limit independently
43 
44   l_ref_cont    := ROUND(((p_superannuable_ptd * p_salary_prp_cap)/100),2);
45   l_actual_cont := p_total_contribution + p_superannuation_tot;
46 
47   IF l_ref_cont < l_actual_cont THEN
48 
49      l_adj_contribution   := l_actual_cont - l_ref_cont;
50 
51      IF l_adj_contribution < p_total_contribution THEN
52 
53         l_final_contribution := p_total_contribution - l_adj_contribution;
54 
55      ELSE
56 
57         l_final_contribution := 0;
58 
59      END IF; -- End if of adj cont < total cont check...
60      l_mesg := 'contribution amount exceeds percentage capping limit.';
61 
62   ELSE
63      l_final_contribution := p_total_contribution;
64      l_mesg               := 'SUCCESS';
65 
66   END IF; -- End if of percentage cap check ...
67 
68   p_total_contribution := l_final_contribution;
69 
70   -- Test the total amount cap
71 
72   l_ref_cont    := ROUND(((p_salary_cap * p_salary_prp_cap)/100),2);
73   l_actual_cont := p_total_contribution + p_total_pens_cont;
74 
75   IF l_ref_cont < l_actual_cont THEN
76 
77      l_adj_contribution   := l_actual_cont - l_ref_cont;
78 
79      IF l_adj_contribution < p_total_contribution THEN
80 
81         l_final_contribution := p_total_contribution - l_adj_contribution;
82 
83      ELSE
84 
85         l_final_contribution := 0;
86 
87      END IF; -- End if of adj cont < total cont check...
88 
89      IF l_mesg <> 'SUCCESS' THEN
90         l_mesg := 'contribution amount exceeds percentage capping limit '
91                  ||
92                   'and total amount capping limit';
93      ELSE
94         l_mesg := 'contribution amount exceeds total amount capping limit';
95      END IF; -- End if of mesg <> success check ...
96 
97   ELSE
98 
99       l_final_contribution := p_total_contribution;
100 
101   END IF; -- End if of annual cap check...
102 
103   p_total_contribution := l_final_contribution;
104   RETURN(l_mesg);
105 
106 -- Added by tmehra for nocopy changes Feb'03
107 
108 EXCEPTION
109     WHEN OTHERS THEN
110        p_total_contribution := l_total_contrib_nc;
111        raise;
112 
113 
114 END pqp_check_pension_cap;
115 
116 -----------------------------------------------------------------------------
117 -- FUNCTION pqp_check_net_pay
118 -----------------------------------------------------------------------------
119 FUNCTION  pqp_check_net_pay(p_total_contribution  IN OUT NOCOPY  NUMBER
120                            ,p_net_pay_ptd         IN      NUMBER
121                            )
122 RETURN CHAR IS
123 
124   l_mesg                  varchar2(80);
125 
126   -- nocopy changes
127   l_total_contrib_nc      number;
128 
129 BEGIN
130 
131 
132   -- nocopy changes
133   l_total_contrib_nc := p_total_contribution;
134 
135   p_total_contribution  := ROUND(p_total_contribution,2);
136 
137   -- Added for bug fix 2273146
138 
139   IF p_net_pay_ptd <= 0 THEN
140 
141      p_total_contribution := 0;
142      l_mesg               := 'insufficient net pay to make contributions';
143      RETURN l_mesg;
144 
145   END IF; -- end if of total contribution is negative check ...
146 
147   -- End bug fix 2273146
148 
149   IF p_total_contribution > p_net_pay_ptd THEN
150 
151      p_total_contribution := p_net_pay_ptd;
152      l_mesg               := 'contribution amount exceeds net pay amount';
153 
154   ELSE
155 
156      l_mesg               := 'SUCCESS';
157 
158   END IF; -- End if of net pay check...
159 
160   RETURN(l_mesg);
161 -- Added by tmehra for nocopy changes Feb'03
162 
163 EXCEPTION
164     WHEN OTHERS THEN
165        p_total_contribution := l_total_contrib_nc;
166        raise;
167 
168 
169 END pqp_check_net_pay;
170 
171 -----------------------------------------------------------------------------
172 
173 END pqp_pens_and_avcs_function;