[Home] [Help]
PACKAGE BODY: APPS.JL_ZZ_AP_EXT_AWT_UTIL
Source
1 PACKAGE BODY JL_ZZ_AP_EXT_AWT_UTIL AS
2 /*$Header: jlzzpwub.pls 120.3 2006/08/03 06:33:27 dbetanco ship $ */
3
4 pg_file_name VARCHAR2(100) := NULL ;
5 pg_path_name VARCHAR2(100) := NULL ;
6 pg_fp utl_file.file_type ;
7 pg_debug_flag CHAR(1) := 'N' ;
8 pg_user_name VARCHAR2(100) := NULL;
9 pg_user_id NUMBER := NULL;
10 l_line varchar2(1999) ;
11 pg_debug_level NUMBER ;
12
13 /* ---------------------------------------------------------------------*
14 |Public Procedure |
15 | debug Write the text message in log file |
16 | if the debug is set "Yes". |
17 | Description This procedure will generate the standard debug |
18 | information in to the log file.User can open the |
19 | log file <user name.log> at specified location. |
20 | |
21 | Requires |
22 | p_line The line of debug messages that will be writen |
23 | in the log file. |
24 | Exception Raised |
25 | |
26 | Known Bugs |
27 | |
28 | Notes |
29 | |
30 | History |
31 | |
32 *-----------------------------------------------------------------------*/
33 PROCEDURE debug(
34 p_line IN VARCHAR2
35 ) IS
36
37 p_module_name VARCHAR2(50);
38 g_log_statement_level NUMBER;
39 g_current_runtime_level number;
40 g_level_event CONSTANT NUMBER := FND_LOG.LEVEL_EVENT;
41 g_level_exception CONSTANT NUMBER := FND_LOG.LEVEL_EXCEPTION;
42 g_level_unexpected CONSTANT NUMBER := FND_LOG.LEVEL_UNEXPECTED;
43
44 BEGIN
45 p_module_name := 'JL:Extended Withholding';
46 g_log_statement_level := FND_LOG.LEVEL_STATEMENT;
47 pg_debug_level :=FND_LOG.LEVEL_PROCEDURE;
48 g_current_runtime_level:= FND_LOG.G_CURRENT_RUNTIME_LEVEL;
49
50 /*
51 IF ( pg_debug_level >= g_current_runtime_level) THEN
52 IF lengthb(p_line) > 1999 THEN
53 l_line := substrb(p_line,1,1999) ;
54 ELSE
55 l_line := p_line ;
56 END IF;
57
58 fnd_log.string(
59 LOG_LEVEL => pg_debug_level,
60 MODULE => p_module_name,
61 MESSAGE => l_line);
62 END IF;
63 */
64
65
66 IF ( g_log_statement_level >= g_current_runtime_level) THEN
67 IF lengthb(p_line) > 1999 THEN
68 l_line := substrb(p_line,1,1999) ;
69 ELSE
70 l_line := p_line ;
71 END IF;
72
73 fnd_log.string(
74 LOG_LEVEL => g_log_statement_level,
75 MODULE => p_module_name,
76 MESSAGE => l_line);
77 END IF;
78
79 EXCEPTION
80 WHEN others THEN
81 IF (g_level_unexpected >= g_current_runtime_level ) THEN
82 fnd_log.string(
83 LOG_LEVEL => FND_LOG.LEVEL_UNEXPECTED,
84 MODULE => p_module_name,
85 MESSAGE => 'Unexpected Error When Logging Debug Messages.');
86 END IF;
87
88
89 END debug;
90
91
92 /**************************************************************************
93 * *
94 * Name : Print_Tax_Names *
95 * Purpose : This procedure shows all the elements of the PL/SQL table *
96 * (just for debug purposes) *
97 * *
98 **************************************************************************/
99
100 PROCEDURE Print_Tax_Names (P_Tab_Payment_Wh IN JL_ZZ_AP_WITHHOLDING_PKG.Tab_Withholding)
101 IS
102 tab JL_ZZ_AP_WITHHOLDING_PKG.Tab_Withholding := P_Tab_Payment_Wh;
103 pos Number;
104
105
106 BEGIN
107 IF tab.count > 0 THEN
108 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' ');
109 JL_ZZ_AP_EXT_AWT_UTIL.Debug('*** Data From a Tab Withholding ***');
110
111 FOR pos IN 1 .. tab.COUNT LOOP
112 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' POSITION = ' || to_char(pos));
113 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Invoice ID: ' || to_char(tab(pos).invoice_id));
114 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Distr.Line: ' || to_char(tab(pos).invoice_distribution_id));
115 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' AWT Type Code: ' || tab(pos).awt_type_code);
116 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Jurisdiction: ' || tab(pos).jurisdiction_type);
117 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Tax ID: ' || to_char(tab(pos).tax_id));
118 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Tax Name: ' || tab(pos).tax_name);
119 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Tax Code Comb. ID: ' || to_char(tab(pos).tax_code_combination_id));
120 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' AWT Period Type: ' || tab(pos).awt_period_type);
121 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Tax Rate ID: ' || to_char(tab(pos).rate_id));
122 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Line Amount: ' || to_char(tab(pos).line_amount));
123 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Taxable Base Amount: ' || to_char(tab(pos).taxable_base_amount));
124 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Revised Base Amount: ' || to_char(tab(pos).revised_tax_base_amount));
125 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Withheld Amount: ' || to_char(tab(pos).withheld_amount));
126 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Prorated Amount: ' || to_char(tab(pos).prorated_amount));
127 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Invoice_Pay_Id : ' || to_char(tab(pos).invoice_payment_id));
128 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Payment_Num : ' || to_char(tab(pos).payment_num));
129 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Applicable Flag: ' || tab(pos).applicable_flag);
130 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Exemption Amount: ' || to_char(tab(pos).exemption_amount));
131 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' ');
132 END LOOP;
133 JL_ZZ_AP_EXT_AWT_UTIL.Debug('*** END Tab Withholding ***');
134 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' ');
135 END IF;
136 END Print_Tax_Names;
137
138 /**************************************************************************
139 * *
140 * Name : Print_tab_all_wh *
141 * Purpose : This procedure shows all the elements of the PL/SQL table *
142 * (just for debug purposes) *
143 * *
144 **************************************************************************/
145
146 PROCEDURE Print_tab_all_wh (P_tab_all_wh IN JL_ZZ_AP_WITHHOLDING_PKG.Tab_All_Withholding)
147 IS
148 tab JL_ZZ_AP_WITHHOLDING_PKG.Tab_All_Withholding := P_tab_all_wh;
149 pos Number;
150
151
152 BEGIN
153 IF tab.count > 0 THEN
154 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' ');
155 JL_ZZ_AP_EXT_AWT_UTIL.Debug('* Data From a Tab ALL Withholding * ');
156
157 FOR pos IN 1 .. tab.COUNT LOOP
158 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' POSITION = ' || to_char(pos));
159 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Invoice ID: ' || to_char(tab(pos).invoice_id));
160 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Distr.Line: ' || to_char(tab(pos).invoice_distribution_id));
161 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' AWT Type Code: ' || tab(pos).awt_type_code);
162 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Jurisdiction: ' || tab(pos).jurisdiction_type);
163 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Prorated Amount: ' || to_char(tab(pos).prorated_amount));
164 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' ');
165 END LOOP;
166
167 JL_ZZ_AP_EXT_AWT_UTIL.Debug('* END Tab ALL Withholding * ');
168 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' ');
169
170 END IF;
171
172 END Print_tab_all_wh;
173
174 /**************************************************************************
175 * *
176 * Name : Print_tab_amounts *
177 * Purpose : This procedure shows all the elements of the PL/SQL table *
178 * (just for debug purposes) *
179 * *
180 **************************************************************************/
181
182 PROCEDURE Print_tab_amounts (P_tab_Amounts IN JL_AR_AP_WITHHOLDING_PKG.Tab_Amounts)
183
184 IS
185 tab JL_AR_AP_WITHHOLDING_PKG.Tab_Amounts := P_tab_Amounts;
186 pos Number;
187
188
189 BEGIN
190 IF tab.count > 0 THEN
191 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' ');
192 JL_ZZ_AP_EXT_AWT_UTIL.Debug('** Data From a Tab Amounts **');
193
194 FOR pos IN 1 .. tab.COUNT LOOP
195 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' POSITION = ' || to_char(pos));
196 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Invoice ID: ' || to_char(tab(pos).invoice_id));
197 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Distr.Line: ' || to_char(tab(pos).invoice_distribution_id));
198 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Amount: ' || to_char(tab(pos).amount));
199 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Tax_inclusive_amount: '|| to_char(tab(pos).tax_inclusive_amount));
200 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Payment_amount: ' || to_char(tab(pos).payment_amount));
201 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Taxable_base_amount: ' || to_char(tab(pos).taxable_base_amount));
202 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Prorated_tax_incl_amt: ' || to_char(tab(pos).prorated_tax_incl_amt));
203 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Invoice_payment_id: ' || to_char(tab(pos).invoice_payment_id));
204 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' Invoice_payment_num: ' || to_char(tab(pos).invoice_payment_num));
205 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' ');
206 END LOOP;
207
208 JL_ZZ_AP_EXT_AWT_UTIL.Debug('** END Tab Amounts **');
209 JL_ZZ_AP_EXT_AWT_UTIL.Debug(' ');
210
211 END IF;
212
213 END Print_tab_amounts;
214
215 PROCEDURE initialize IS
216 BEGIN
217
218
219 pg_file_name := NULL ;
220 pg_path_name := NULL ;
221 pg_debug_flag := 'N' ;
222 pg_user_name := NULL;
223
224
225 FND_PROFILE.GET('EXT_AWT_DEBUG_FLAG',pg_debug_flag) ;
226 FND_PROFILE.GET('EXT_AWT_DEBUG_FILE_LOCATION',pg_path_name);
227
228
229 IF pg_user_name is NULL THEN
230
231 FND_PROFILE.GET('USERNAME', pg_user_name);
232
233 IF pg_user_name IS NULL THEN
234 pg_user_name := 'DEFAULT';
235 END IF;
236
237 END IF;
238
239 IF pg_debug_flag ='Y' THEN
240
241 pg_path_name := pg_path_name ;
242
243 pg_file_name := pg_user_name ||'.log' ;
244 pg_fp := utl_file.fopen(pg_path_name, pg_file_name, 'W') ;
245
246 -- Header File
247 Debug('*========================================================*');
248 Debug(' ');
249 Debug(' JL EXTENDED WIHTHHOLDING DEBUG FILE');
250 Debug(' ');
251 Debug('Profiles used to generate the output file: ');
252 Debug('1. Extended Withholding: Debug Flag');
253 Debug('2. Extended Withholding: Debug File Directory');
254 Debug(' ');
255 Debug('File shows: ');
256 Debug('1. Pleace from the procedure/function is called by the symbol (==> Procedure Name)');
257 Debug('2. Procedure/Function Parameters');
258 Debug('3. Cursors fetched values');
259 Debug('4. PLSQL Tables there are three tables: ');
260 Debug(' 4.1. Tab Withholding ');
261 Debug(' 4.2. Tab ALL Withholding ');
262 Debug(' 4.3. Tab Amounts ');
263 Debug('5. Sequence Steps');
264 Debug('*========================================================*');
265 Debug(' ');
266
267 END IF;
268
269 EXCEPTION
270
271 WHEN utl_file.invalid_path THEN
272 FND_MESSAGE.SET_NAME('JL','JL_ZZ_AP_AWT_LOG_INVALID_PATH');
273 FND_MESSAGE.SET_TOKEN('PATH_NAME',pg_path_name );
274 app_exception.raise_exception ;
275
276 WHEN others THEN
277 null;
278
279 END;
280
281
282 /*------------------ Package Constructor --------------------------------*/
283
284 BEGIN
285
286 initialize;
287
288 END JL_ZZ_AP_EXT_AWT_UTIL ;