DBA Data[Home] [Help]

PACKAGE BODY: APPS.PN_VRA_CLIENT_EXTN

Source


1 PACKAGE BODY pn_vra_client_extn AS
2 /* $Header: PNVRACEB.pls 120.2 2011/05/09 11:31:57 pstawar noship $ */
3 ------------PACKAGE GLOBAL to be used during updates ---------------------------
4  /*
5    -- Package constant g_pkg_name used for package name validation.
6    -- Package constant g_org_id used for organization id validation.
7    -- Package constant g_fun_name used for function name validation.
8    -- Package constant g_func_exists used for function existance validation.
9 
10    */
11    g_pkg_name                    VARCHAR2 (20) := 'Client_Extension';
12    g_org_id             CONSTANT NUMBER := fnd_profile.VALUE ('ORG_ID');
13    g_fun_name           CONSTANT VARCHAR2 (11) := 'PN_PNXVAREN';
14    g_func_exists                 VARCHAR2 (1);
15 
16 -- ========================================================================================
17 --
18 --Name:               calculate_override
19 --Type:                 Procedure
20 --Description:  This procedure can be used to calculate override.
21 --
22 --Called subprograms:  fnd_message.set_name
23 --					   fnd_msg_pub.count_and_get
24 --
25 --
26 -- History:
27 --  12-Nov-2010   vkatta   o Created
28 -- 09-APR-2011   pstawar   Interface Repository Annotation
29 --                          Standards are incorporated.
30 
31   -- Procedure to override variable rent calculations
32    PROCEDURE calculate_override (
33       p_var_rent_id              IN       NUMBER
34     , p_trx_header_id            IN       NUMBER
35     , p_calculated_rent          IN OUT NOCOPY NUMBER
36     , p_prorated_rent            IN OUT NOCOPY NUMBER
37     , p_percent_rent             IN OUT NOCOPY NUMBER
38     , p_ytd_percent_rent         IN OUT NOCOPY NUMBER
39     , p_first_yr_rent            IN OUT NOCOPY NUMBER
40     , x_return_status            OUT NOCOPY VARCHAR2
41     , x_msg_count                OUT NOCOPY NUMBER
42     , x_msg_data                 OUT NOCOPY VARCHAR2
43    )
44    IS
45       l_calculated_rent             NUMBER ;
46       l_prorated_rent               NUMBER ;
47       l_percent_rent                NUMBER ;
48       l_ytd_percent_rent            NUMBER ;
49       l_first_yr_rent               NUMBER ;
50       l_api_name           CONSTANT VARCHAR2 (30) := 'Calculate_Override';
51       l_api_version        CONSTANT NUMBER := 1.0;
52       l_api_name_full      CONSTANT VARCHAR2 (61) :=    g_pkg_name
53                                                      || '.'
54                                                      || l_api_name;
55    BEGIN
56       SAVEPOINT calculate_override;
57       x_return_status                                                              := fnd_api.g_ret_sts_success;
58 
59       IF NVL (mo_global.check_valid_org (g_org_id)
60             , 'N'
61              ) <> 'Y'
62       THEN
63          fnd_message.set_name ('MO'
64                              , 'MO_ORG_INVALID'
65                               );
66          fnd_msg_pub.ADD;
67          RAISE fnd_api.g_exc_error;
68       END IF;
69 
70       --- Verifying whether the VRA from exists or not.
71       IF fnd_function.TEST (function_name                 => g_fun_name)
72       THEN
73          g_func_exists                                                                := 'Y';
74       END IF;
75 
76       IF g_func_exists <> 'Y'
77       THEN
78          fnd_message.set_name ('PN'
79                              , 'PN_FUNCTION_SECURITY'
80                               );
81          fnd_msg_pub.ADD;
82          RAISE fnd_api.g_exc_error;
83       END IF;
84       pnp_debug_pkg.LOG (   l_api_name_full
85                          || ' Before Calculations ----- : ');
86       pnp_debug_pkg.LOG (   l_api_name_full
87                          || ' p_var_rent_id : '
88                          || p_var_rent_id);
89       pnp_debug_pkg.LOG (   l_api_name_full
90                          || ' p_trx_header_id : '
91                          || p_trx_header_id);
92       pnp_debug_pkg.LOG (   l_api_name_full
93                          || ' p_calculated_rent : '
94                          || p_calculated_rent);
95       pnp_debug_pkg.LOG (   l_api_name_full
96                          || ' p_prorated_rent : '
97                          || p_prorated_rent);
98       pnp_debug_pkg.LOG (   l_api_name_full
99                          || ' p_percent_rent : '
100                          || p_percent_rent);
101       pnp_debug_pkg.LOG (   l_api_name_full
102                          || ' p_ytd_percent_rent : '
103                          || p_ytd_percent_rent);
104       pnp_debug_pkg.LOG (   l_api_name_full
105                          || ' p_first_yr_rent : '
106                          || p_first_yr_rent);
107       --
108 
109       -- Incorporate custom code calculations here...
110 
111       --
112       pnp_debug_pkg.LOG (   l_api_name_full
113                          || ' After Calculations ----- : ');
114       pnp_debug_pkg.LOG (   l_api_name_full
115                          || ' p_var_rent_id : '
116                          || p_var_rent_id);
117       pnp_debug_pkg.LOG (   l_api_name_full
118                          || ' p_trx_header_id : '
119                          || p_trx_header_id);
120       pnp_debug_pkg.LOG (   l_api_name_full
121                          || ' p_calculated_rent : '
122                          || p_calculated_rent);
123       pnp_debug_pkg.LOG (   l_api_name_full
124                          || ' p_prorated_rent : '
125                          || p_prorated_rent);
126       pnp_debug_pkg.LOG (   l_api_name_full
127                          || ' p_percent_rent : '
128                          || p_percent_rent);
129       pnp_debug_pkg.LOG (   l_api_name_full
130                          || ' p_ytd_percent_rent : '
131                          || p_ytd_percent_rent);
132       pnp_debug_pkg.LOG (   l_api_name_full
133                          || ' p_first_yr_rent : '
134                          || p_first_yr_rent);
135 
136       fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
137                                , p_count                       => x_msg_count
138                                , p_data                        => x_msg_data
139                                 );
140    EXCEPTION
141       WHEN fnd_api.g_exc_error
142       THEN
143          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
144                                   , p_count                       => x_msg_count
145                                   , p_data                        => x_msg_data
146                                    );
147          x_return_status                                                              := fnd_api.g_ret_sts_error;
148          pnp_debug_pkg.LOG (   l_api_name_full||' : '||'Exception : '
149                                  || SQLERRM
150                                 );
151          pnp_debug_pkg.LOG (   l_api_name_full||' : '||'Return Status : '
152                                  || x_return_status
153                                 );
154          pnp_debug_pkg.LOG (   l_api_name_full||' : '||'No of Error Messages : '
155                                  || x_msg_count
156                                 );
157 
158       WHEN fnd_api.g_exc_unexpected_error
159       THEN
160          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
161                                   , p_count                       => x_msg_count
162                                   , p_data                        => x_msg_data
163                                    );
164          x_return_status                                                              := fnd_api.g_ret_sts_unexp_error;
165          pnp_debug_pkg.LOG (  l_api_name_full||' : '|| 'Unexpected Exception : '
166                                  || SQLERRM
167                                 );
168          pnp_debug_pkg.LOG (   l_api_name_full||' : '||'Return Status : '
169                                  || x_return_status
170                                 );
171          pnp_debug_pkg.LOG (   l_api_name_full||' : '||'No of Error Messages : '
172                                  || x_msg_count
173                                 );
174       WHEN OTHERS
175       THEN
176          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
177                                   , p_count                       => x_msg_count
178                                   , p_data                        => x_msg_data
179                                    );
180          x_return_status                                                              := fnd_api.g_ret_sts_error;
181          pnp_debug_pkg.LOG (   l_api_name_full||' : '||'Others Exception : '
182                                  || SQLERRM
183                                 );
184          pnp_debug_pkg.LOG (   l_api_name_full||' : '||'Return Status : '
185                                  || x_return_status
186                                 );
187          pnp_debug_pkg.LOG (   l_api_name_full||' : '||'No of Error Messages : '
188                                  || x_msg_count
189                                 );
190    END calculate_override;
191 END pn_vra_client_extn;