[Home] [Help]
PACKAGE BODY: APPS.GL_CALCULATE_TAX2_PKG
Source
1 PACKAGE BODY GL_CALCULATE_TAX2_PKG as
2 /* $Header: glujet2b.pls 120.3.12000000.2 2007/07/03 17:09:29 djogg ship $ */
3
4 ---
5 --- PRIVATE VARIABLES
6 ---
7 line_select VARCHAR2(2000); -- Buffer for line select dynamic sql
8 ccid_select VARCHAR2(4500); -- Buffer for flex select dynamic sql
9
10 lines_cursor INTEGER; -- Handles the lines cursor
11 ccid_cursor INTEGER; -- Handles the flex cursor
12
13 --- Variables for next line
14 no_next_record BOOLEAN; -- Indicates there is no next record
15 first_time BOOLEAN; -- Indicates this is the first time through
16 next_line_num NUMBER; -- Number of next line
17 next_eff_date DATE; -- effective date of line
18 next_ent_dr NUMBER; -- line debits
19 next_ent_cr NUMBER; -- line credits
20 next_description VARCHAR2(250); -- line description
21 next_rounding_rule VARCHAR2(1); -- line rounding rule
22 next_incl_tax VARCHAR2(1); -- line includes tax
23 next_tax_type VARCHAR2(1); -- line tax type
24 next_tax_code_id NUMBER; -- line tax code id
25 next_tax_code VARCHAR2(50); -- line tax code
26 next_tax_rate NUMBER; -- line tax rate
27 next_bal_seg_val VARCHAR2(25); -- balancing segment value for line
28 next_tax_ccid NUMBER; -- tax ccid for line
29 next_tax_group NUMBER; -- tax group for line
30 next_tax_bad_acct BOOLEAN; -- indicates whether the account is bad
31 next_tax_bad_csegs VARCHAR2(750); -- provides the bad account
32
33 ---
34 --- PRIVATE FUNCTIONS
35 ---
36
37 --
38 -- Procedure
39 -- build_selects
40 -- Purpose
41 -- Builds the dynamic sql statements needed
42 -- History
43 -- 13-DEC-1996 D. J. Ogg Created
44 -- Arguments
45 -- coa_id Current chart of accounts
46 -- calculation_level Calculation level - journal or line
47 -- Example
48 -- gl_calculate_tax2_pkg.build_selects(1, 'L');
49 -- Notes
50 --
51 PROCEDURE build_selects(coa_id NUMBER,
52 calculation_level VARCHAR2) IS
53
54 flexwherebuf VARCHAR2(1500); -- Holds the flexfield portion of the
55 -- where clause
56 flexselectbuf VARCHAR2(2000); -- Holds the flexfield portion of the
57 -- select clause
58
59 segcount NUMBER; -- Number of segments in flexfield
60 delim VARCHAR2(1); -- Delimiter for flexfield
61 bal_seg_num NUMBER; -- Number of balancing segment
62 bal_seg_appcol VARCHAR2(30); -- Database column holding balancing
63 --segment
64
65 appcol_name VARCHAR2(30); -- Database column holding current
66 -- segment
67 seg_name VARCHAR2(30); -- User name for current segment
68 prompt VARCHAR2(80); -- Prompt for current segment
69 value_set_name VARCHAR2(60); -- Value set for current segment
70
71 BEGIN
72
73 -- Get the balancing segment number
74 IF (NOT fnd_flex_apis.get_qualifier_segnum(
75 appl_id => 101,
76 key_flex_code => 'GL#',
77 structure_number => coa_id,
78 flex_qual_name => 'GL_BALANCING',
79 segment_number => bal_seg_num)) THEN
80 app_exception.raise_exception;
81 END IF;
82
83 -- Get the delimiter
84 delim := fnd_flex_apis.get_segment_delimiter(
85 x_application_id => 101,
86 x_id_flex_code => 'GL#',
87 x_id_flex_num => coa_id);
88
89 -- Get the number of segments
90 SELECT count(*)
91 INTO segcount
92 FROM fnd_id_flex_segments
93 WHERE enabled_flag = 'Y'
94 AND id_flex_num = coa_id
95 AND application_id = 101
96 AND id_flex_code = 'GL#';
97
98 flexwherebuf := '';
99 flexselectbuf := '';
100
101 -- Get the segment information and build the flexfield
102 -- portions of the select statement
103 FOR segnum IN 1..segcount LOOP
104 IF (NOT fnd_flex_apis.get_segment_info(
105 x_application_id => 101,
106 x_id_flex_code => 'GL#',
107 x_id_flex_num => coa_id,
108 x_seg_num => segnum,
109 x_appcol_name => appcol_name,
110 x_seg_name => seg_name,
111 x_prompt => prompt,
112 x_value_set_name => value_set_name)) THEN
113 app_exception.raise_exception;
114 END IF;
115
116 IF (segnum = bal_seg_num) THEN
117 bal_seg_appcol := appcol_name;
118
119 flexselectbuf := flexselectbuf ||
120 'replace(:bal_seg_val, ''' ||
121 delim || ''', ''
122 '') ';
123 flexwherebuf := flexwherebuf ||
124 'AND new_cc.' || appcol_name || '(+) = :bal_seg_val ';
125 ELSE
126 flexselectbuf := flexselectbuf ||
127 'replace(tax_cc.' || appcol_name || ', ''' ||
128 delim || ''', ''
129 '') ';
130 flexwherebuf := flexwherebuf ||
131 'AND new_cc.' || appcol_name || '(+) = tax_cc.' ||
132 appcol_name || ' ';
133 END IF;
134
135 IF (segnum <> segcount) THEN
136 flexselectbuf := flexselectbuf || ' || ''' || delim || ''' || ';
137 END IF;
138 END LOOP;
139
140
141 ---
142 --- Build the line select statement
143 ---
144
145 line_select := 'SELECT jel.je_line_num, jel.effective_date, ' ||
146 'jel.entered_dr, jel.entered_cr, ' ||
147 'jel.tax_rounding_rule_code, jel.description, ' ||
148 'jel.amount_includes_tax_flag, ' ||
149 'jel.tax_type_code, jel.tax_code_id, ' ||
150 'cc.'||bal_seg_appcol||' ' ||
151 'FROM gl_je_lines jel, ' ||
152 'gl_code_combinations cc ' ||
153 'WHERE jel.je_header_id = :header ' ||
154 'AND jel.taxable_line_flag = ''Y'' ' ||
155 'AND cc.code_combination_id = jel.code_combination_id ';
156
157 IF (calculation_level = 'L') THEN
158 line_select := line_select ||
159 'ORDER BY jel.je_line_num ';
160 ELSE
161 line_select := line_select ||
162 'ORDER BY jel.tax_type_code, jel.tax_code_id, ' ||
163 'jel.tax_rounding_rule_code, ' ||
164 'jel.amount_includes_tax_flag, ' ||
165 'cc.' || bal_seg_appcol || ', ' ||
166 'decode(jel.entered_dr, NULL, 1, 0), ' ||
167 'decode(jel.entered_cr, NULL, 1, 0), ' ||
168 'greatest(nvl(jel.entered_dr, 0), ' ||
169 'nvl(jel.entered_cr, 0)), ' ||
170 'jel.je_line_num ';
171 END IF;
172
173
174 ---
175 --- Build the flex select statement
176 ---
177 ccid_select := 'SELECT new_cc.code_combination_id, ' ||
178 flexselectbuf ||
179 'FROM gl_code_combinations tax_cc, ' ||
180 'gl_code_combinations new_cc ' ||
181 'WHERE tax_cc.code_combination_id = :tax_ccid ' ||
182 'AND tax_cc.chart_of_accounts_id = :coa_id ' ||
183 flexwherebuf ||
184 'AND new_cc.template_id(+) IS NULL ' ||
185 'AND new_cc.chart_of_accounts_id(+) = :coa_id ' ||
186 'AND new_cc.enabled_flag(+) = ''Y'' ' ||
187 'AND new_cc.detail_posting_allowed_flag(+) = ''Y'' ' ||
188 'AND trunc(:eff_date) ' ||
189 'between trunc(nvl(new_cc.start_date_active(+),' ||
190 ':eff_date - 1)) ' ||
191 'and trunc(nvl(new_cc.end_date_active(+), ' ||
192 ':eff_date + 1))';
193
194 END build_selects;
195
196
197 --
198 -- Procedure
199 -- get_tax_ccid
200 -- Purpose
201 -- Gets the appropriate ccid to be used for tax
202 -- History
203 -- 13-DEC-1996 D. J. Ogg Created
204 -- Arguments
205 -- coa_id Current chart of accounts
206 -- tax_code Tax code of current line
207 -- non_bal_tax_ccid Tax ccid with the wrong balancing segment value
208 -- bal_seg_val The correct balancing segment value
209 -- journal_effective_date Effective date of journal being taxed
210 -- tax_ccid Tax ccid for the current line
211 -- bad_acct Indicates that the tax account is bad
212 -- bad_csegs Gives the bad account
213 -- Example
214 -- gl_calculate_tax2_pkg.get_tax_ccid(1, 2, '01', '01-JAN-91',
215 -- tax_ccid, bad_acct, bad_csegs);
216 -- Notes
217 --
218 PROCEDURE get_tax_ccid(coa_id NUMBER,
219 tax_code VARCHAR2,
220 non_bal_tax_ccid NUMBER,
221 bal_seg_val VARCHAR2,
222 journal_eff_date DATE,
223 resp_appl_id NUMBER,
224 resp_id NUMBER,
225 user_id NUMBER,
226 tax_ccid IN OUT NOCOPY NUMBER,
227 bad_acct IN OUT NOCOPY BOOLEAN,
228 bad_csegs IN OUT NOCOPY VARCHAR2) IS
229
230 row_count NUMBER; -- Number of rows returned by fetch
231 tax_csegs VARCHAR2(750); -- Holds concatenated segments
232 message VARCHAR2(250);
233 BEGIN
234 dbms_sql.bind_variable(ccid_cursor, ':tax_ccid', non_bal_tax_ccid);
235 dbms_sql.bind_variable(ccid_cursor, ':eff_date', journal_eff_date);
236 dbms_sql.bind_variable(ccid_cursor, ':bal_seg_val', bal_seg_val);
237 dbms_sql.bind_variable(ccid_cursor, ':coa_id', coa_id);
238
239 row_count := dbms_sql.execute_and_fetch(ccid_cursor);
240
241 IF (row_count = 0) THEN
242 fnd_message.set_name('SQLGL', 'GL_CTAX_BAD_TAX_CCID');
243 fnd_message.set_token('TAX_CODE', tax_code);
244 app_exception.raise_exception;
245 END IF;
246
247
248 dbms_sql.column_value(ccid_cursor, 1, tax_ccid);
249 dbms_sql.column_value(ccid_cursor, 2, tax_csegs);
250
251 bad_acct := FALSE;
252 bad_csegs := null;
253 IF (tax_ccid IS NULL) THEN
254 IF (NOT fnd_flex_keyval.validate_segs(
255 operation => 'CREATE_COMBINATION',
256 appl_short_name => 'SQLGL',
257 key_flex_code => 'GL#',
258 structure_number=> coa_id,
259 concat_segments => tax_csegs,
260 vrule => '\nSUMMARY_FLAG\nI\nAPPL=SQLGL;' ||
261 'NAME=GL_CTAX_SUMMARY_ACCOUNT\nN\0' ||
262 'GL_GLOBAL\nDETAIL_POSTING_ALLOWED\nI\n' ||
263 'APPL=SQLGL;' ||
264 'NAME=GL_CTAX_DETAIL_POSTING\nY',
265 validation_date => journal_eff_date,
266 resp_appl_id => resp_appl_id,
267 resp_id => resp_id,
268 user_id => user_id)) THEN
269
270 bad_acct := TRUE;
271 bad_csegs := tax_csegs;
272 tax_ccid := -1;
273 ELSE
274 tax_ccid := fnd_flex_keyval.combination_id;
275 END IF;
276 END IF;
277
278 END get_tax_ccid;
279
280 ---
281 --- PUBLIC FUNCTIONS
282 ---
283
284 PROCEDURE define_cursor(coa_id NUMBER,
285 calculation_level VARCHAR2) IS
286 tax_ccid NUMBER; -- dummy column for define
287 tax_csegs VARCHAR2(750); -- dummy column for define
288 BEGIN
289 build_selects(coa_id => coa_id,
290 calculation_level => calculation_level);
291
292 -- Setup the lines cursor
293 lines_cursor := dbms_sql.open_cursor;
294 dbms_sql.parse(lines_cursor, line_select, dbms_sql.v7);
295 dbms_sql.define_column(lines_cursor, 1, next_line_num);
296 dbms_sql.define_column(lines_cursor, 2, next_eff_date);
297 dbms_sql.define_column(lines_cursor, 3, next_ent_dr);
298 dbms_sql.define_column(lines_cursor, 4, next_ent_cr);
299 dbms_sql.define_column(lines_cursor, 5, next_rounding_rule, 1);
300 dbms_sql.define_column(lines_cursor, 6, next_description, 250);
301 dbms_sql.define_column(lines_cursor, 7, next_incl_tax, 1);
302 dbms_sql.define_column(lines_cursor, 8, next_tax_type, 1);
303 dbms_sql.define_column(lines_cursor, 9, next_tax_code_id);
304 dbms_sql.define_column(lines_cursor, 10, next_bal_seg_val, 25);
305
306 -- Setup the ccid cursor
307 ccid_cursor := dbms_sql.open_cursor;
308 dbms_sql.parse(ccid_cursor, ccid_select, dbms_sql.v7);
309 dbms_sql.define_column(ccid_cursor, 1, tax_ccid);
310 dbms_sql.define_column(ccid_cursor, 2, tax_csegs, 750);
311 END define_cursor;
312
313 PROCEDURE bind_cursor(header_id NUMBER) IS
314 BEGIN
315 dbms_sql.bind_variable(lines_cursor, ':header', header_id);
316 END bind_cursor;
317
318 PROCEDURE execute_cursor IS
319 dummy NUMBER;
320 BEGIN
321 -- Setup everything for the fetch
322 no_next_record := FALSE;
323 first_time := TRUE;
324 dummy := dbms_sql.execute(lines_cursor);
325 END execute_cursor;
326
327 PROCEDURE fetch_cursor(coa_id NUMBER,
328 lgr_id NUMBER,
329 org_id NUMBER,
330 calculation_level VARCHAR2,
331 journal_effective_date DATE,
332 resp_appl_id NUMBER,
333 resp_id NUMBER,
334 user_id NUMBER,
335 no_more_records IN OUT NOCOPY BOOLEAN,
336 last_in_group IN OUT NOCOPY BOOLEAN,
337 bad_acct IN OUT NOCOPY BOOLEAN,
338 bad_csegs IN OUT NOCOPY VARCHAR2,
339 line_num IN OUT NOCOPY NUMBER,
340 eff_date IN OUT NOCOPY DATE,
341 ent_dr IN OUT NOCOPY NUMBER,
342 ent_cr IN OUT NOCOPY NUMBER,
343 rounding_rule IN OUT NOCOPY VARCHAR2,
344 description IN OUT NOCOPY VARCHAR2,
345 incl_tax IN OUT NOCOPY VARCHAR2,
346 tax_code IN OUT NOCOPY VARCHAR2,
347 tax_rate IN OUT NOCOPY NUMBER,
348 tax_ccid IN OUT NOCOPY NUMBER,
349 tax_group IN OUT NOCOPY NUMBER) IS
350
351 row_count NUMBER; -- number of rows fetched
352
353 tax_type VARCHAR2(1); -- tax type of current row;
354 tax_code_id NUMBER; -- tax code id of current row;
355 bal_seg_val VARCHAR2(25); -- balancing segment value of current row
356
357 non_bal_tax_ccid NUMBER; -- tax ccid associated with tax code of
358 -- current row. May not have the correct
359 -- balancing segment value
360 next_non_bal_tax_ccid NUMBER; -- tax ccid associated with tax code of
361 -- next row. May not have the correct
362 -- balancing segment value
363 temp_return_status varchar2(1);
364 err_msg varchar2(2000);
365 BEGIN
366 no_more_records := FALSE;
367 last_in_group := FALSE;
368
369 -- If there are no more records, then exit
370 IF (no_next_record) THEN
371 no_more_records := TRUE;
372 RETURN;
373 END IF;
374
375 -- If this is the first time in, or the calculation
376 -- level is line, then get the current row
377 IF ( (first_time)
378 OR (calculation_level = 'L')
379 ) THEN
380
381 row_count := dbms_sql.fetch_rows(lines_cursor);
382 IF (row_count = 0) THEN
383 no_more_records := TRUE;
384 RETURN;
385 END IF;
386
387 -- Get a journal line
388 dbms_sql.column_value(lines_cursor, 1, line_num);
389 dbms_sql.column_value(lines_cursor, 2, eff_date);
390 dbms_sql.column_value(lines_cursor, 3, ent_dr);
391 dbms_sql.column_value(lines_cursor, 4, ent_cr);
392 dbms_sql.column_value(lines_cursor, 5, rounding_rule);
393 dbms_sql.column_value(lines_cursor, 6, description);
394 dbms_sql.column_value(lines_cursor, 7, incl_tax);
395 dbms_sql.column_value(lines_cursor, 8, tax_type);
396 dbms_sql.column_value(lines_cursor, 9, tax_code_id);
397 dbms_sql.column_value(lines_cursor, 10, bal_seg_val);
398
399 -- Get the base tax rate and ccid
400 zx_gl_tax_options_pkg.get_tax_rate_and_account
401 (1.0, lgr_id, org_id, tax_type, tax_code_id,
402 tax_rate, non_bal_tax_ccid, temp_return_status, err_msg);
403 tax_rate := tax_rate / 100;
407 fnd_message.set_token('PROCEDURE', 'gl_calculate_tax2_pkg.fetch_cursor');
404
405 IF (temp_return_status = 'E') THEN
406 FND_MESSAGE.Set_Name('ZX', err_msg);
408 APP_EXCEPTION.Raise_Exception;
409 ELSIF (temp_return_status = 'U') THEN
410 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
411 fnd_message.set_token('PROCEDURE', 'gl_calculate_tax2_pkg.fetch_cursor');
412 APP_EXCEPTION.Raise_Exception;
413 END IF;
414
415 -- Get the tax code
416 zx_gl_tax_options_pkg.get_tax_rate_code
417 (1.0, tax_type, tax_code_id, tax_code, temp_return_status, err_msg);
418
419 IF (temp_return_status = 'E') THEN
420 FND_MESSAGE.Set_Name('ZX', err_msg);
421 fnd_message.set_token('PROCEDURE', 'gl_calculate_tax2_pkg.fetch_cursor');
422 APP_EXCEPTION.Raise_Exception;
423 ELSIF (temp_return_status = 'U') THEN
424 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
425 fnd_message.set_token('PROCEDURE', 'gl_calculate_tax2_pkg.fetch_cursor');
426 APP_EXCEPTION.Raise_Exception;
427 END IF;
428
429 -- Get the tax group
430 SELECT gl_je_lines_s.nextval
431 INTO tax_group
432 FROM sys.dual;
433
434 -- Get the correct tax ccid
435 get_tax_ccid(coa_id => coa_id,
436 tax_code => tax_code,
437 non_bal_tax_ccid => non_bal_tax_ccid,
438 bal_seg_val => bal_seg_val,
439 journal_eff_date => journal_effective_date,
440 resp_appl_id => resp_appl_id,
441 resp_id => resp_id,
442 user_id => user_id,
443 tax_ccid => tax_ccid,
444 bad_acct => bad_acct,
445 bad_csegs => bad_csegs);
446
447 next_tax_group := tax_group;
448 next_tax_ccid := tax_ccid;
449 next_tax_code := tax_code;
450 next_tax_rate := tax_rate;
451
452 first_time := FALSE;
453
454 -- Otherwise, copy the current row from the next row fields
455 ELSE
456 line_num := next_line_num;
457 eff_date := next_eff_date;
458 ent_dr := next_ent_dr;
459 ent_cr := next_ent_cr;
460 rounding_rule := next_rounding_rule;
461 description := next_description;
462 incl_tax := next_incl_tax;
463 tax_type := next_tax_type;
464 tax_code_id := next_tax_code_id;
465 tax_code := next_tax_code;
466 tax_rate := next_tax_rate;
467 tax_ccid := next_tax_ccid;
468 bad_acct := next_tax_bad_acct;
469 bad_csegs := next_tax_bad_csegs;
470 tax_group := next_tax_group;
471 bal_seg_val := next_bal_seg_val;
472 END IF;
473
474 -- If the calculation level is journal, then
475 -- fetch the next row
476 IF (calculation_level <> 'L') THEN
477 row_count := dbms_sql.fetch_rows(lines_cursor);
478 IF (row_count = 0) THEN
479 no_next_record := TRUE;
480 END IF;
481
482 dbms_sql.column_value(lines_cursor, 1, next_line_num);
483 dbms_sql.column_value(lines_cursor, 2, next_eff_date);
484 dbms_sql.column_value(lines_cursor, 3, next_ent_dr);
485 dbms_sql.column_value(lines_cursor, 4, next_ent_cr);
486 dbms_sql.column_value(lines_cursor, 5, next_rounding_rule);
487 dbms_sql.column_value(lines_cursor, 6, next_description);
488 dbms_sql.column_value(lines_cursor, 7, next_incl_tax);
489 dbms_sql.column_value(lines_cursor, 8, next_tax_type);
490 dbms_sql.column_value(lines_cursor, 9, next_tax_code_id);
491 dbms_sql.column_value(lines_cursor, 10, next_bal_seg_val);
492 END IF;
493
494 -- Determine if the current record is the last one in its
495 -- group
496 IF (calculation_level = 'L') THEN
497 last_in_group := TRUE;
498 ELSIF (no_next_record) THEN
499 last_in_group := TRUE;
500 ELSIF ( (rounding_rule <> next_rounding_rule)
501 OR (incl_tax <> next_incl_tax)
502 OR (tax_type <> next_tax_type)
503 OR (tax_code_id <> next_tax_code_id)
504 OR (bal_seg_val <> next_bal_seg_val)
505 OR ((ent_dr IS NULL) <> (next_ent_dr IS NULL))
506 OR ((ent_cr IS NULL) <> (next_ent_cr IS NULL))
507 ) THEN
508 last_in_group := TRUE;
509 ELSE
510 last_in_group := FALSE;
511 END IF;
512
513 IF ( (calculation_level <> 'L')
514 AND last_in_group
515 AND NOT no_next_record) THEN
516
517 -- Get the base tax rate and ccid
518 zx_gl_tax_options_pkg.get_tax_rate_and_account
519 (1.0, lgr_id, org_id, next_tax_type, next_tax_code_id,
520 next_tax_rate, next_non_bal_tax_ccid, temp_return_status, err_msg);
521 next_tax_rate := next_tax_rate / 100;
522
523 IF (temp_return_status = 'E') THEN
524 FND_MESSAGE.Set_Name('ZX', err_msg);
525 fnd_message.set_token('PROCEDURE', 'gl_calculate_tax2_pkg.fetch_cursor');
526 APP_EXCEPTION.Raise_Exception;
527 ELSIF (temp_return_status = 'U') THEN
528 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
529 fnd_message.set_token('PROCEDURE', 'gl_calculate_tax2_pkg.fetch_cursor');
530 APP_EXCEPTION.Raise_Exception;
531 END IF;
532
533 -- Get the tax code
534 zx_gl_tax_options_pkg.get_tax_rate_code
535 (1.0, next_tax_type, next_tax_code_id, next_tax_code, temp_return_status, err_msg);
536
537 IF (temp_return_status = 'E') THEN
538 FND_MESSAGE.Set_Name('ZX', err_msg);
539 fnd_message.set_token('PROCEDURE', 'gl_calculate_tax2_pkg.fetch_cursor');
540 APP_EXCEPTION.Raise_Exception;
541 ELSIF (temp_return_status = 'U') THEN
542 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
543 fnd_message.set_token('PROCEDURE', 'gl_calculate_tax2_pkg.fetch_cursor');
544 APP_EXCEPTION.Raise_Exception;
545 END IF;
546
547 -- Get a group id for the next set
548 SELECT gl_je_lines_s.nextval
549 INTO next_tax_group
550 FROM sys.dual;
551
552 -- Get the correct tax ccid for the next set
553 get_tax_ccid(coa_id => coa_id,
554 tax_code => next_tax_code,
555 non_bal_tax_ccid => next_non_bal_tax_ccid,
556 bal_seg_val => next_bal_seg_val,
557 journal_eff_date => journal_effective_date,
558 resp_appl_id => resp_appl_id,
559 resp_id => resp_id,
560 user_id => user_id,
561 tax_ccid => next_tax_ccid,
562 bad_acct => next_tax_bad_acct,
563 bad_csegs => next_tax_bad_csegs);
564 END IF;
565
566 END fetch_cursor;
567
568 PROCEDURE close_cursor IS
569 BEGIN
570 dbms_sql.close_cursor(lines_cursor);
571 dbms_sql.close_cursor(ccid_cursor);
572 END close_cursor;
573
574 END GL_CALCULATE_TAX2_PKG;