84: -- ar_cogs_rev_itf table. So, we are overloading the description
85: -- column temporariliy to store the code_combination_id and here
86: -- we will update it with the corresponding description.
87:
88: fnd_file.put_line(fnd_file.log, 'populate_description');
89:
90: FOR rec IN getdesc LOOP
91:
92: l_dummy := fnd_flex_keyval.validate_ccid(
95: rec.chart_of_accounts_id,
96: rec.code_combination_id);
97: l_description := fnd_flex_keyval.concatenated_descriptions;
98:
99: fnd_file.put_line(fnd_file.log, 'CC ID: ' || rec.code_combination_id);
100: fnd_file.put_line(fnd_file.log, 'Description: ' || l_description);
101:
102: UPDATE ar_cogs_rev_itf
103: SET cogs_acct_description = l_description
96: rec.code_combination_id);
97: l_description := fnd_flex_keyval.concatenated_descriptions;
98:
99: fnd_file.put_line(fnd_file.log, 'CC ID: ' || rec.code_combination_id);
100: fnd_file.put_line(fnd_file.log, 'Description: ' || l_description);
101:
102: UPDATE ar_cogs_rev_itf
103: SET cogs_acct_description = l_description
104: WHERE cogs_acct_description = rec.code_combination_id;
136: -- This routine populate the interface table so the detail RXi report
137: -- can publish the report based on the data in the interface table.
138:
139: IF pg_debug in ('Y', 'C') THEN
140: fnd_file.put_line(fnd_file.log, 'ARRX_COGS_REP_INNER.POPULATE_ROWS()+');
141: END IF;
142:
143: fnd_file.put_line(fnd_file.log, 'request id: ' || p_request_id);
144: fnd_file.put_line(fnd_file.log, 'user id : ' || p_user_id);
139: IF pg_debug in ('Y', 'C') THEN
140: fnd_file.put_line(fnd_file.log, 'ARRX_COGS_REP_INNER.POPULATE_ROWS()+');
141: END IF;
142:
143: fnd_file.put_line(fnd_file.log, 'request id: ' || p_request_id);
144: fnd_file.put_line(fnd_file.log, 'user id : ' || p_user_id);
145: fnd_file.put_line(fnd_file.log, 'low gl date: ' || p_gl_date_low);
146: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
147: fnd_file.put_line(fnd_file.log, 'low sales order: ' || p_sales_order_low);
140: fnd_file.put_line(fnd_file.log, 'ARRX_COGS_REP_INNER.POPULATE_ROWS()+');
141: END IF;
142:
143: fnd_file.put_line(fnd_file.log, 'request id: ' || p_request_id);
144: fnd_file.put_line(fnd_file.log, 'user id : ' || p_user_id);
145: fnd_file.put_line(fnd_file.log, 'low gl date: ' || p_gl_date_low);
146: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
147: fnd_file.put_line(fnd_file.log, 'low sales order: ' || p_sales_order_low);
148: fnd_file.put_line(fnd_file.log, 'high sales order: ' || p_sales_order_high);
141: END IF;
142:
143: fnd_file.put_line(fnd_file.log, 'request id: ' || p_request_id);
144: fnd_file.put_line(fnd_file.log, 'user id : ' || p_user_id);
145: fnd_file.put_line(fnd_file.log, 'low gl date: ' || p_gl_date_low);
146: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
147: fnd_file.put_line(fnd_file.log, 'low sales order: ' || p_sales_order_low);
148: fnd_file.put_line(fnd_file.log, 'high sales order: ' || p_sales_order_high);
149: fnd_file.put_line(fnd_file.log, 'posted lines only: ' ||
142:
143: fnd_file.put_line(fnd_file.log, 'request id: ' || p_request_id);
144: fnd_file.put_line(fnd_file.log, 'user id : ' || p_user_id);
145: fnd_file.put_line(fnd_file.log, 'low gl date: ' || p_gl_date_low);
146: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
147: fnd_file.put_line(fnd_file.log, 'low sales order: ' || p_sales_order_low);
148: fnd_file.put_line(fnd_file.log, 'high sales order: ' || p_sales_order_high);
149: fnd_file.put_line(fnd_file.log, 'posted lines only: ' ||
150: p_posted_lines_only);
143: fnd_file.put_line(fnd_file.log, 'request id: ' || p_request_id);
144: fnd_file.put_line(fnd_file.log, 'user id : ' || p_user_id);
145: fnd_file.put_line(fnd_file.log, 'low gl date: ' || p_gl_date_low);
146: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
147: fnd_file.put_line(fnd_file.log, 'low sales order: ' || p_sales_order_low);
148: fnd_file.put_line(fnd_file.log, 'high sales order: ' || p_sales_order_high);
149: fnd_file.put_line(fnd_file.log, 'posted lines only: ' ||
150: p_posted_lines_only);
151: fnd_file.put_line(fnd_file.log, 'unmatched items only: ' ||
144: fnd_file.put_line(fnd_file.log, 'user id : ' || p_user_id);
145: fnd_file.put_line(fnd_file.log, 'low gl date: ' || p_gl_date_low);
146: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
147: fnd_file.put_line(fnd_file.log, 'low sales order: ' || p_sales_order_low);
148: fnd_file.put_line(fnd_file.log, 'high sales order: ' || p_sales_order_high);
149: fnd_file.put_line(fnd_file.log, 'posted lines only: ' ||
150: p_posted_lines_only);
151: fnd_file.put_line(fnd_file.log, 'unmatched items only: ' ||
152: p_posted_lines_only);
145: fnd_file.put_line(fnd_file.log, 'low gl date: ' || p_gl_date_low);
146: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
147: fnd_file.put_line(fnd_file.log, 'low sales order: ' || p_sales_order_low);
148: fnd_file.put_line(fnd_file.log, 'high sales order: ' || p_sales_order_high);
149: fnd_file.put_line(fnd_file.log, 'posted lines only: ' ||
150: p_posted_lines_only);
151: fnd_file.put_line(fnd_file.log, 'unmatched items only: ' ||
152: p_posted_lines_only);
153:
147: fnd_file.put_line(fnd_file.log, 'low sales order: ' || p_sales_order_low);
148: fnd_file.put_line(fnd_file.log, 'high sales order: ' || p_sales_order_high);
149: fnd_file.put_line(fnd_file.log, 'posted lines only: ' ||
150: p_posted_lines_only);
151: fnd_file.put_line(fnd_file.log, 'unmatched items only: ' ||
152: p_posted_lines_only);
153:
154: -- In order to round the amount columns we must figure how many places
155: -- we must round. That is being determined here by looking at the
169: l_posting_control_id := -3;
170: l_gl_batch_id := -1;
171: END IF;
172:
173: fnd_file.put_line(fnd_file.log, 'table being populated with selected rows');
174:
175: -- the commented columns are populated later for better readability.
176:
177: INSERT INTO ar_cogs_rev_itf
310: lines.sales_order_line,
311: lines.interface_line_attribute6,
312: lines.line_number;
313:
314: fnd_file.put_line(fnd_file.log, 'table populated with selected rows');
315:
316: --
317: -- just for better readability I am computing the percentages
318: -- and actual adjustment needed separately here. the formula for
341: cogs_adjustment = 0
342: WHERE cogs_amount_orig = 0
343: AND order_amount_orig = 0;
344:
345: fnd_file.put_line(fnd_file.log, 'update done');
346:
347: -- respond to the user preference set in the program parameter.
348: -- this too could have been done in the main SQL, but
349: -- preferred to do this here for better readability and maintainablity.
352:
353: DELETE FROM ar_cogs_rev_itf
354: WHERE rev_percent_period = cogs_percent_period;
355:
356: fnd_file.put_line(fnd_file.log, 'deleting matched items');
357:
358: END IF;
359:
360: -- Bug # 3840430
359:
360: -- Bug # 3840430
361: populate_description;
362:
363: fnd_file.put_line(fnd_file.log, 'description populated');
364:
365: IF pg_debug in ('Y', 'C') THEN
366: fnd_file.put_line(fnd_file.log, 'ARRX_COGS_REP_INNER.POPULATE_ROWS()-');
367: END IF;
362:
363: fnd_file.put_line(fnd_file.log, 'description populated');
364:
365: IF pg_debug in ('Y', 'C') THEN
366: fnd_file.put_line(fnd_file.log, 'ARRX_COGS_REP_INNER.POPULATE_ROWS()-');
367: END IF;
368:
369: EXCEPTION
370: WHEN NO_DATA_FOUND THEN
420:
421: -- This routine populate the interface table so the summary RXi report
422: -- can publish the report based on the data in the interface table.
423:
424: fnd_file.put_line(fnd_file.log, 'ARRX_C_COGS_REP_INNER.POPULATE_SUMMARY()+');
425:
426: IF pg_debug in ('Y', 'C') THEN
427: fnd_file.put_line(fnd_file.log, 'POPULATE_SUMMARY()+');
428: END IF;
423:
424: fnd_file.put_line(fnd_file.log, 'ARRX_C_COGS_REP_INNER.POPULATE_SUMMARY()+');
425:
426: IF pg_debug in ('Y', 'C') THEN
427: fnd_file.put_line(fnd_file.log, 'POPULATE_SUMMARY()+');
428: END IF;
429:
430: fnd_file.put_line(fnd_file.log, 'request id: ' || p_request_id);
431: fnd_file.put_line(fnd_file.log, 'user id : ' || p_user_id);
426: IF pg_debug in ('Y', 'C') THEN
427: fnd_file.put_line(fnd_file.log, 'POPULATE_SUMMARY()+');
428: END IF;
429:
430: fnd_file.put_line(fnd_file.log, 'request id: ' || p_request_id);
431: fnd_file.put_line(fnd_file.log, 'user id : ' || p_user_id);
432: fnd_file.put_line(fnd_file.log, 'low gl date: ' || p_gl_date_low);
433: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
434: fnd_file.put_line(fnd_file.log, 'chart of account id : ' ||
427: fnd_file.put_line(fnd_file.log, 'POPULATE_SUMMARY()+');
428: END IF;
429:
430: fnd_file.put_line(fnd_file.log, 'request id: ' || p_request_id);
431: fnd_file.put_line(fnd_file.log, 'user id : ' || p_user_id);
432: fnd_file.put_line(fnd_file.log, 'low gl date: ' || p_gl_date_low);
433: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
434: fnd_file.put_line(fnd_file.log, 'chart of account id : ' ||
435: p_chart_of_accounts_id);
428: END IF;
429:
430: fnd_file.put_line(fnd_file.log, 'request id: ' || p_request_id);
431: fnd_file.put_line(fnd_file.log, 'user id : ' || p_user_id);
432: fnd_file.put_line(fnd_file.log, 'low gl date: ' || p_gl_date_low);
433: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
434: fnd_file.put_line(fnd_file.log, 'chart of account id : ' ||
435: p_chart_of_accounts_id);
436: fnd_file.put_line(fnd_file.log, 'low gl account: ' || p_gl_account_low);
429:
430: fnd_file.put_line(fnd_file.log, 'request id: ' || p_request_id);
431: fnd_file.put_line(fnd_file.log, 'user id : ' || p_user_id);
432: fnd_file.put_line(fnd_file.log, 'low gl date: ' || p_gl_date_low);
433: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
434: fnd_file.put_line(fnd_file.log, 'chart of account id : ' ||
435: p_chart_of_accounts_id);
436: fnd_file.put_line(fnd_file.log, 'low gl account: ' || p_gl_account_low);
437: fnd_file.put_line(fnd_file.log, 'high gl account: ' || p_gl_account_high);
430: fnd_file.put_line(fnd_file.log, 'request id: ' || p_request_id);
431: fnd_file.put_line(fnd_file.log, 'user id : ' || p_user_id);
432: fnd_file.put_line(fnd_file.log, 'low gl date: ' || p_gl_date_low);
433: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
434: fnd_file.put_line(fnd_file.log, 'chart of account id : ' ||
435: p_chart_of_accounts_id);
436: fnd_file.put_line(fnd_file.log, 'low gl account: ' || p_gl_account_low);
437: fnd_file.put_line(fnd_file.log, 'high gl account: ' || p_gl_account_high);
438: fnd_file.put_line(fnd_file.log, 'posted lines only: ' ||
432: fnd_file.put_line(fnd_file.log, 'low gl date: ' || p_gl_date_low);
433: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
434: fnd_file.put_line(fnd_file.log, 'chart of account id : ' ||
435: p_chart_of_accounts_id);
436: fnd_file.put_line(fnd_file.log, 'low gl account: ' || p_gl_account_low);
437: fnd_file.put_line(fnd_file.log, 'high gl account: ' || p_gl_account_high);
438: fnd_file.put_line(fnd_file.log, 'posted lines only: ' ||
439: p_posted_lines_only);
440:
433: fnd_file.put_line(fnd_file.log, 'high gl date: ' || p_gl_date_high);
434: fnd_file.put_line(fnd_file.log, 'chart of account id : ' ||
435: p_chart_of_accounts_id);
436: fnd_file.put_line(fnd_file.log, 'low gl account: ' || p_gl_account_low);
437: fnd_file.put_line(fnd_file.log, 'high gl account: ' || p_gl_account_high);
438: fnd_file.put_line(fnd_file.log, 'posted lines only: ' ||
439: p_posted_lines_only);
440:
441: -- In order to round the amount columns we must figure how many places
434: fnd_file.put_line(fnd_file.log, 'chart of account id : ' ||
435: p_chart_of_accounts_id);
436: fnd_file.put_line(fnd_file.log, 'low gl account: ' || p_gl_account_low);
437: fnd_file.put_line(fnd_file.log, 'high gl account: ' || p_gl_account_high);
438: fnd_file.put_line(fnd_file.log, 'posted lines only: ' ||
439: p_posted_lines_only);
440:
441: -- In order to round the amount columns we must figure how many places
442: -- we must round. That is being determined here by looking at the
449: -- let the populate_rows do the work as far as fetching the detail rows
450: -- are concerned. Once that is done we can sum it up at the cogs account
451: -- level.
452:
453: fnd_file.put_line(fnd_file.log, 'calling populate_rows');
454:
455: populate_rows
456: (
457: p_gl_date_low => p_gl_date_low,
465: x_retcode => x_retcode,
466: x_errbuf => x_errbuf
467: );
468:
469: fnd_file.put_line(fnd_file.log, 'returned from populate_rows');
470:
471: OPEN summary_rows;
472: FETCH summary_rows BULK COLLECT INTO
473: l_gl_acct_tbl,
474: l_gl_acct_desc_tbl,
475: l_cogs_adjustment_tbl;
476: CLOSE summary_rows;
477:
478: fnd_file.put_line(fnd_file.log, 'clearing detail rows from the table');
479:
480: -- remove the details rows and then populate summary rows.
481: DELETE FROM ar_cogs_rev_itf;
482:
479:
480: -- remove the details rows and then populate summary rows.
481: DELETE FROM ar_cogs_rev_itf;
482:
483: fnd_file.put_line(fnd_file.log, 'summary rows count: ' ||
484: l_gl_acct_tbl.COUNT);
485:
486: FORALL i IN 1..l_gl_acct_tbl.COUNT
487: INSERT INTO ar_cogs_rev_itf
510: l_gl_acct_desc_tbl(i),
511: l_cogs_adjustment_tbl(i)
512: );
513:
514: fnd_file.put_line(fnd_file.log, 'table populated with summary rows');
515:
516: IF ((p_gl_account_low IS NOT NULL) OR (p_gl_account_low IS NOT NULL)) THEN
517:
518: fnd_file.put_line(fnd_file.log, 'keep only the rows within acct range');
514: fnd_file.put_line(fnd_file.log, 'table populated with summary rows');
515:
516: IF ((p_gl_account_low IS NOT NULL) OR (p_gl_account_low IS NOT NULL)) THEN
517:
518: fnd_file.put_line(fnd_file.log, 'keep only the rows within acct range');
519:
520: DELETE FROM ar_cogs_rev_itf
521: WHERE COGS_GL_ACCOUNT
522: NOT BETWEEN p_gl_account_low AND p_gl_account_high;
523:
524: END IF;
525:
526: IF pg_debug in ('Y', 'C') THEN
527: fnd_file.put_line(fnd_file.log, 'ARRX_COGS_REP_INNER.POPULATE_SUMMARY()-');
528: END IF;
529:
530: EXCEPTION
531: WHEN NO_DATA_FOUND THEN