DBA Data[Home] [Help]

APPS.AR_REVENUE_ADJUSTMENT_PVT dependencies on AR_RAAPI_UTIL

Line 479: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

475: FROM mtl_item_categories mic
476: ,ra_customer_trx_lines l
477: WHERE l.line_type = 'LINE'
478: AND l.autorule_complete_flag IS NULL
479: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
480: AND l.customer_trx_line_id =
481: NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,l.customer_trx_line_id)
482: AND NVL(l.inventory_item_id,0) =
483: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

Line 481: NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,l.customer_trx_line_id)

477: WHERE l.line_type = 'LINE'
478: AND l.autorule_complete_flag IS NULL
479: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
480: AND l.customer_trx_line_id =
481: NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,l.customer_trx_line_id)
482: AND NVL(l.inventory_item_id,0) =
483: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
484: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
485: AND l.inventory_item_id = mic.inventory_item_id(+)

Line 483: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

479: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
480: AND l.customer_trx_line_id =
481: NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,l.customer_trx_line_id)
482: AND NVL(l.inventory_item_id,0) =
483: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
484: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
485: AND l.inventory_item_id = mic.inventory_item_id(+)
486: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
487: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

Line 484: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

480: AND l.customer_trx_line_id =
481: NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,l.customer_trx_line_id)
482: AND NVL(l.inventory_item_id,0) =
483: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
484: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
485: AND l.inventory_item_id = mic.inventory_item_id(+)
486: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
487: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
488: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

Line 486: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

482: AND NVL(l.inventory_item_id,0) =
483: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
484: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
485: AND l.inventory_item_id = mic.inventory_item_id(+)
486: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
487: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
488: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
489: AND ((AR_RAAPI_UTIL.g_from_salesrep_id IS NULL AND
490: AR_RAAPI_UTIL.g_from_salesgroup_id IS NULL)

Line 487: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

483: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
484: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
485: AND l.inventory_item_id = mic.inventory_item_id(+)
486: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
487: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
488: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
489: AND ((AR_RAAPI_UTIL.g_from_salesrep_id IS NULL AND
490: AR_RAAPI_UTIL.g_from_salesgroup_id IS NULL)
491: OR EXISTS

Line 488: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

484: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
485: AND l.inventory_item_id = mic.inventory_item_id(+)
486: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
487: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
488: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
489: AND ((AR_RAAPI_UTIL.g_from_salesrep_id IS NULL AND
490: AR_RAAPI_UTIL.g_from_salesgroup_id IS NULL)
491: OR EXISTS
492: (SELECT 'X'

Line 489: AND ((AR_RAAPI_UTIL.g_from_salesrep_id IS NULL AND

485: AND l.inventory_item_id = mic.inventory_item_id(+)
486: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
487: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
488: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
489: AND ((AR_RAAPI_UTIL.g_from_salesrep_id IS NULL AND
490: AR_RAAPI_UTIL.g_from_salesgroup_id IS NULL)
491: OR EXISTS
492: (SELECT 'X'
493: FROM ra_cust_trx_line_salesreps ls

Line 490: AR_RAAPI_UTIL.g_from_salesgroup_id IS NULL)

486: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
487: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
488: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
489: AND ((AR_RAAPI_UTIL.g_from_salesrep_id IS NULL AND
490: AR_RAAPI_UTIL.g_from_salesgroup_id IS NULL)
491: OR EXISTS
492: (SELECT 'X'
493: FROM ra_cust_trx_line_salesreps ls
494: WHERE ls.customer_trx_line_id = l.customer_trx_line_id

Line 496: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,ls.salesrep_id)

492: (SELECT 'X'
493: FROM ra_cust_trx_line_salesreps ls
494: WHERE ls.customer_trx_line_id = l.customer_trx_line_id
495: AND ls.salesrep_id =
496: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,ls.salesrep_id)
497: AND NVL(ls.revenue_salesgroup_id, -9999) =
498: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,
499: NVL(ls.revenue_salesgroup_id, -9999))
500: GROUP BY ls.salesrep_id

Line 498: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,

494: WHERE ls.customer_trx_line_id = l.customer_trx_line_id
495: AND ls.salesrep_id =
496: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,ls.salesrep_id)
497: AND NVL(ls.revenue_salesgroup_id, -9999) =
498: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,
499: NVL(ls.revenue_salesgroup_id, -9999))
500: GROUP BY ls.salesrep_id
501: HAVING SUM(NVL(ls.revenue_percent_split,0)) <> 0));
502:

Line 513: AR_RAAPI_UTIL.Constant_System_Values;

509:
510: /*Bug 6731185 JVARKEY Making sure GL date has no timestamp*/
511: l_rev_adj_rec.gl_date := trunc(p_rev_adj_rec.gl_date);
512:
513: AR_RAAPI_UTIL.Constant_System_Values;
514: AR_RAAPI_UTIL.Initialize_Globals;
515: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
516: ,p_rev_adj_rec => l_rev_adj_rec
517: ,p_validation_level => p_validation_level

Line 514: AR_RAAPI_UTIL.Initialize_Globals;

510: /*Bug 6731185 JVARKEY Making sure GL date has no timestamp*/
511: l_rev_adj_rec.gl_date := trunc(p_rev_adj_rec.gl_date);
512:
513: AR_RAAPI_UTIL.Constant_System_Values;
514: AR_RAAPI_UTIL.Initialize_Globals;
515: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
516: ,p_rev_adj_rec => l_rev_adj_rec
517: ,p_validation_level => p_validation_level
518: ,x_return_status => x_return_status

Line 515: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE

511: l_rev_adj_rec.gl_date := trunc(p_rev_adj_rec.gl_date);
512:
513: AR_RAAPI_UTIL.Constant_System_Values;
514: AR_RAAPI_UTIL.Initialize_Globals;
515: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
516: ,p_rev_adj_rec => l_rev_adj_rec
517: ,p_validation_level => p_validation_level
518: ,x_return_status => x_return_status
519: ,x_msg_count => x_msg_count

Line 525: AR_RAAPI_UTIL.Validate_Amount

521: IF x_return_status = FND_API.G_RET_STS_SUCCESS
522: THEN
523: l_total_adjusted := 0;
524:
525: AR_RAAPI_UTIL.Validate_Amount
526: (p_init_msg_list => FND_API.G_FALSE
527: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
528: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
529: ,p_amount_mode => p_rev_adj_rec.amount_mode

Line 527: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id

523: l_total_adjusted := 0;
524:
525: AR_RAAPI_UTIL.Validate_Amount
526: (p_init_msg_list => FND_API.G_FALSE
527: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
528: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
529: ,p_amount_mode => p_rev_adj_rec.amount_mode
530: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
531: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

Line 530: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id

526: (p_init_msg_list => FND_API.G_FALSE
527: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
528: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
529: ,p_amount_mode => p_rev_adj_rec.amount_mode
530: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
531: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
532: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
533: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
534: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

Line 531: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

527: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
528: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
529: ,p_amount_mode => p_rev_adj_rec.amount_mode
530: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
531: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
532: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
533: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
534: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
535: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

Line 532: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id

528: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
529: ,p_amount_mode => p_rev_adj_rec.amount_mode
530: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
531: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
532: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
533: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
534: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
535: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
536: ,p_revenue_amount_in => p_rev_adj_rec.amount

Line 534: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

530: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
531: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
532: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
533: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
534: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
535: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
536: ,p_revenue_amount_in => p_rev_adj_rec.amount
537: ,p_revenue_percent => p_rev_adj_rec.percent
538: ,p_revenue_amount_out => l_revenue_amount

Line 535: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

531: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
532: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
533: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
534: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
535: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
536: ,p_revenue_amount_in => p_rev_adj_rec.amount
537: ,p_revenue_percent => p_rev_adj_rec.percent
538: ,p_revenue_amount_out => l_revenue_amount
539: ,p_adjustable_amount_out => l_adj_inv_total

Line 552: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed

548: l_rev_adj_rec.amount := l_revenue_amount;
549: l_line_count := 0;
550:
551: /* Bug 2146970 - validate the GL date passed in */
552: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed
553: (p_gl_date => l_rev_adj_rec.gl_date);
554:
555: IF PG_DEBUG in ('Y','C')
556: THEN

Line 652: l_line_adjustable := AR_RAAPI_UTIL.Adjustable_Revenue

648: l_line_id := c1.customer_trx_line_id;
649:
650: /* 6223281 - fetch the maximum amount allowable for the adjustment
651: based on the given parameters */
652: l_line_adjustable := AR_RAAPI_UTIL.Adjustable_Revenue
653: (p_customer_trx_line_id => l_line_id
654: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
655: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
656: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

Line 655: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id

651: based on the given parameters */
652: l_line_adjustable := AR_RAAPI_UTIL.Adjustable_Revenue
653: (p_customer_trx_line_id => l_line_id
654: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
655: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
656: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
657: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
658: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
659: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

Line 656: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

652: l_line_adjustable := AR_RAAPI_UTIL.Adjustable_Revenue
653: (p_customer_trx_line_id => l_line_id
654: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
655: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
656: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
657: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
658: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
659: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
660: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

Line 657: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id

653: (p_customer_trx_line_id => l_line_id
654: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
655: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
656: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
657: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
658: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
659: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
660: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
661: ,p_revenue_adjustment_id => NULL -- intentionally null

Line 659: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

655: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
656: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
657: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
658: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
659: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
660: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
661: ,p_revenue_adjustment_id => NULL -- intentionally null
662: ,p_line_count_out => x_line_count_out
663: ,p_acctd_amount_out => x_acctd_amount_out);

Line 660: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

656: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
657: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
658: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
659: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
660: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
661: ,p_revenue_adjustment_id => NULL -- intentionally null
662: ,p_line_count_out => x_line_count_out
663: ,p_acctd_amount_out => x_acctd_amount_out);
664:

Line 668: l_line_adjustable / l_adj_inv_total,AR_RAAPI_UTIL.g_trx_precision);

664:
665: IF l_line_adjustable <> 0
666: THEN
667: l_revenue_amount_prorata := ROUND(l_revenue_amount *
668: l_line_adjustable / l_adj_inv_total,AR_RAAPI_UTIL.g_trx_precision);
669:
670: /* Check for salesreps for use later */
671: SELECT count(*)
672: INTO l_sr_count

Line 676: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;

672: INTO l_sr_count
673: FROM ra_cust_trx_line_salesreps
674: WHERE customer_trx_line_id = l_line_id
675: AND NVL(revenue_percent_split,0) <> 0
676: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
677:
678: IF c1.accounting_rule_id IS NOT NULL
679: THEN
680: /* 6325023 - previous logic differentiated between

Line 744: ,AR_RAAPI_UTIL.g_customer_trx_id

740: l_revenue_amount_prorata);
741: END IF;
742:
743: no_rule_debit_credit_no_sr(c1.customer_trx_line_id
744: ,AR_RAAPI_UTIL.g_customer_trx_id
745: ,AR_RAAPI_UTIL.g_from_salesrep_id
746: ,l_revenue_amount_prorata
747: ,l_gl_date_valid -- bug 2146970
748: ,NULL

Line 745: ,AR_RAAPI_UTIL.g_from_salesrep_id

741: END IF;
742:
743: no_rule_debit_credit_no_sr(c1.customer_trx_line_id
744: ,AR_RAAPI_UTIL.g_customer_trx_id
745: ,AR_RAAPI_UTIL.g_from_salesrep_id
746: ,l_revenue_amount_prorata
747: ,l_gl_date_valid -- bug 2146970
748: ,NULL
749: ,c1.inventory_item_id

Line 772: ,AR_RAAPI_UTIL.g_customer_trx_id

768:
769: ELSE
770: /* Original SR-based logic */
771: no_rule_debit_credit (c1.customer_trx_line_id
772: ,AR_RAAPI_UTIL.g_customer_trx_id
773: ,AR_RAAPI_UTIL.g_from_salesrep_id
774: ,l_revenue_amount_prorata
775: ,l_gl_date_valid -- bug 2146970
776: ,NULL

Line 773: ,AR_RAAPI_UTIL.g_from_salesrep_id

769: ELSE
770: /* Original SR-based logic */
771: no_rule_debit_credit (c1.customer_trx_line_id
772: ,AR_RAAPI_UTIL.g_customer_trx_id
773: ,AR_RAAPI_UTIL.g_from_salesrep_id
774: ,l_revenue_amount_prorata
775: ,l_gl_date_valid -- bug 2146970
776: ,NULL
777: ,c1.inventory_item_id

Line 788: IF AR_RAAPI_UTIL.g_customer_trx_id is NOT NULL THEN

784:
785: END LOOP; -- c_line loop
786:
787: IF l_xla_call_req_flag THEN
788: IF AR_RAAPI_UTIL.g_customer_trx_id is NOT NULL THEN
789: l_xla_event.xla_from_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;
790: l_xla_event.xla_to_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;
791: l_xla_event.xla_req_id := NULL;
792: l_xla_event.xla_dist_id := NULL;

Line 789: l_xla_event.xla_from_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;

785: END LOOP; -- c_line loop
786:
787: IF l_xla_call_req_flag THEN
788: IF AR_RAAPI_UTIL.g_customer_trx_id is NOT NULL THEN
789: l_xla_event.xla_from_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;
790: l_xla_event.xla_to_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;
791: l_xla_event.xla_req_id := NULL;
792: l_xla_event.xla_dist_id := NULL;
793: l_xla_event.xla_doc_table := 'CT';

Line 790: l_xla_event.xla_to_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;

786:
787: IF l_xla_call_req_flag THEN
788: IF AR_RAAPI_UTIL.g_customer_trx_id is NOT NULL THEN
789: l_xla_event.xla_from_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;
790: l_xla_event.xla_to_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;
791: l_xla_event.xla_req_id := NULL;
792: l_xla_event.xla_dist_id := NULL;
793: l_xla_event.xla_doc_table := 'CT';
794: l_xla_event.xla_doc_event := NULL;

Line 972: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

968: ,mtl_item_categories mic
969: ,ra_customer_trx_lines l
970: WHERE s.customer_trx_line_id = l.customer_trx_line_id
971: AND l.line_type = 'LINE'
972: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
973: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
974: l.customer_trx_line_id)
975: AND NVL(l.inventory_item_id,0) =
976: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

Line 973: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,

969: ,ra_customer_trx_lines l
970: WHERE s.customer_trx_line_id = l.customer_trx_line_id
971: AND l.line_type = 'LINE'
972: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
973: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
974: l.customer_trx_line_id)
975: AND NVL(l.inventory_item_id,0) =
976: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
977: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

Line 976: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

972: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
973: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
974: l.customer_trx_line_id)
975: AND NVL(l.inventory_item_id,0) =
976: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
977: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
978: AND l.inventory_item_id = mic.inventory_item_id(+)
979: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
980: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

Line 977: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

973: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
974: l.customer_trx_line_id)
975: AND NVL(l.inventory_item_id,0) =
976: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
977: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
978: AND l.inventory_item_id = mic.inventory_item_id(+)
979: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
980: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
981: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

Line 979: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

975: AND NVL(l.inventory_item_id,0) =
976: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
977: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
978: AND l.inventory_item_id = mic.inventory_item_id(+)
979: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
980: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
981: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
982: AND EXISTS
983: (SELECT s1.salesrep_id

Line 980: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

976: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
977: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
978: AND l.inventory_item_id = mic.inventory_item_id(+)
979: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
980: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
981: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
982: AND EXISTS
983: (SELECT s1.salesrep_id
984: FROM ra_cust_trx_line_salesreps s1

Line 981: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

977: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
978: AND l.inventory_item_id = mic.inventory_item_id(+)
979: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
980: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
981: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
982: AND EXISTS
983: (SELECT s1.salesrep_id
984: FROM ra_cust_trx_line_salesreps s1
985: WHERE s1.customer_trx_line_id = l.customer_trx_line_id

Line 987: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s1.salesrep_id)

983: (SELECT s1.salesrep_id
984: FROM ra_cust_trx_line_salesreps s1
985: WHERE s1.customer_trx_line_id = l.customer_trx_line_id
986: AND s1.salesrep_id =
987: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s1.salesrep_id)
988: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)) =
989: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)))
990: GROUP BY s1.salesrep_id
991: HAVING DECODE(p_rev_adj_rec.sales_credit_type,'N',

Line 989: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)))

985: WHERE s1.customer_trx_line_id = l.customer_trx_line_id
986: AND s1.salesrep_id =
987: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s1.salesrep_id)
988: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)) =
989: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)))
990: GROUP BY s1.salesrep_id
991: HAVING DECODE(p_rev_adj_rec.sales_credit_type,'N',
992: SUM(NVL(s1.non_revenue_percent_split,0)),
993: SUM(NVL(s1.revenue_percent_split,0))) <> 0);

Line 1003: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

999: ,ra_customer_trx_lines l
1000: WHERE d.customer_trx_line_id = l.customer_trx_line_id
1001: AND d.account_class = 'REV'
1002: AND l.line_type = 'LINE'
1003: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1004: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1005: l.customer_trx_line_id)
1006: AND NVL(l.inventory_item_id,0) =
1007: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

Line 1004: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,

1000: WHERE d.customer_trx_line_id = l.customer_trx_line_id
1001: AND d.account_class = 'REV'
1002: AND l.line_type = 'LINE'
1003: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1004: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1005: l.customer_trx_line_id)
1006: AND NVL(l.inventory_item_id,0) =
1007: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1008: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

Line 1007: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

1003: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1004: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1005: l.customer_trx_line_id)
1006: AND NVL(l.inventory_item_id,0) =
1007: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1008: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1009: AND l.inventory_item_id = mic.inventory_item_id(+)
1010: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1011: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

Line 1008: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

1004: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1005: l.customer_trx_line_id)
1006: AND NVL(l.inventory_item_id,0) =
1007: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1008: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1009: AND l.inventory_item_id = mic.inventory_item_id(+)
1010: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1011: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1012: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

Line 1010: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

1006: AND NVL(l.inventory_item_id,0) =
1007: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1008: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1009: AND l.inventory_item_id = mic.inventory_item_id(+)
1010: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1011: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1012: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1013: AND EXISTS
1014: (SELECT s.salesrep_id

Line 1011: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

1007: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1008: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1009: AND l.inventory_item_id = mic.inventory_item_id(+)
1010: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1011: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1012: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1013: AND EXISTS
1014: (SELECT s.salesrep_id
1015: FROM ra_cust_trx_line_salesreps s

Line 1012: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

1008: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1009: AND l.inventory_item_id = mic.inventory_item_id(+)
1010: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1011: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1012: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1013: AND EXISTS
1014: (SELECT s.salesrep_id
1015: FROM ra_cust_trx_line_salesreps s
1016: WHERE s.customer_trx_line_id = l.customer_trx_line_id

Line 1018: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)

1014: (SELECT s.salesrep_id
1015: FROM ra_cust_trx_line_salesreps s
1016: WHERE s.customer_trx_line_id = l.customer_trx_line_id
1017: AND s.salesrep_id =
1018: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1019: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1020: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))
1021: GROUP BY s.salesrep_id
1022: HAVING DECODE(p_rev_adj_rec.sales_credit_type,'N',

Line 1020: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))

1016: WHERE s.customer_trx_line_id = l.customer_trx_line_id
1017: AND s.salesrep_id =
1018: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1019: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1020: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))
1021: GROUP BY s.salesrep_id
1022: HAVING DECODE(p_rev_adj_rec.sales_credit_type,'N',
1023: SUM(NVL(s.non_revenue_percent_split,0)),
1024: SUM(NVL(s.revenue_percent_split,0))) <> 0);

Line 1032: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,

1028: FROM ra_customer_trx_lines l
1029: ,mtl_item_categories mic
1030: ,ra_cust_trx_line_salesreps s
1031: WHERE l.customer_trx_line_id = s.customer_trx_line_id
1032: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1033: l.customer_trx_line_id)
1034: AND NVL(l.inventory_item_id,0) =
1035: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1036: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

Line 1035: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

1031: WHERE l.customer_trx_line_id = s.customer_trx_line_id
1032: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1033: l.customer_trx_line_id)
1034: AND NVL(l.inventory_item_id,0) =
1035: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1036: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1037: AND l.inventory_item_id = mic.inventory_item_id(+)
1038: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1039: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

Line 1036: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

1032: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1033: l.customer_trx_line_id)
1034: AND NVL(l.inventory_item_id,0) =
1035: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1036: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1037: AND l.inventory_item_id = mic.inventory_item_id(+)
1038: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1039: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1040: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

Line 1038: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

1034: AND NVL(l.inventory_item_id,0) =
1035: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1036: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1037: AND l.inventory_item_id = mic.inventory_item_id(+)
1038: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1039: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1040: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1041: AND NVL(s.non_revenue_percent_split,0) <> 0
1042: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

Line 1039: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

1035: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1036: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1037: AND l.inventory_item_id = mic.inventory_item_id(+)
1038: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1039: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1040: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1041: AND NVL(s.non_revenue_percent_split,0) <> 0
1042: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1043: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)

Line 1040: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

1036: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1037: AND l.inventory_item_id = mic.inventory_item_id(+)
1038: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1039: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1040: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1041: AND NVL(s.non_revenue_percent_split,0) <> 0
1042: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1043: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1044: AND NVL(s.non_revenue_salesgroup_id,-9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999));

Line 1042: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1038: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1039: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1040: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1041: AND NVL(s.non_revenue_percent_split,0) <> 0
1042: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1043: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1044: AND NVL(s.non_revenue_salesgroup_id,-9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999));
1045:
1046: CURSOR c_nonrev_line_count IS

Line 1043: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)

1039: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1040: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1041: AND NVL(s.non_revenue_percent_split,0) <> 0
1042: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1043: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1044: AND NVL(s.non_revenue_salesgroup_id,-9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999));
1045:
1046: CURSOR c_nonrev_line_count IS
1047: SELECT COUNT(*)

Line 1044: AND NVL(s.non_revenue_salesgroup_id,-9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999));

1040: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1041: AND NVL(s.non_revenue_percent_split,0) <> 0
1042: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1043: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1044: AND NVL(s.non_revenue_salesgroup_id,-9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999));
1045:
1046: CURSOR c_nonrev_line_count IS
1047: SELECT COUNT(*)
1048: FROM mtl_item_categories mic

Line 1050: WHERE l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,

1046: CURSOR c_nonrev_line_count IS
1047: SELECT COUNT(*)
1048: FROM mtl_item_categories mic
1049: ,ra_customer_trx_lines l
1050: WHERE l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1051: l.customer_trx_line_id)
1052: AND NVL(l.inventory_item_id,0) =
1053: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1054: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

Line 1053: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

1049: ,ra_customer_trx_lines l
1050: WHERE l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1051: l.customer_trx_line_id)
1052: AND NVL(l.inventory_item_id,0) =
1053: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1054: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1055: AND l.inventory_item_id = mic.inventory_item_id(+)
1056: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1057: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

Line 1054: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

1050: WHERE l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1051: l.customer_trx_line_id)
1052: AND NVL(l.inventory_item_id,0) =
1053: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1054: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1055: AND l.inventory_item_id = mic.inventory_item_id(+)
1056: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1057: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1058: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

Line 1056: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

1052: AND NVL(l.inventory_item_id,0) =
1053: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1054: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1055: AND l.inventory_item_id = mic.inventory_item_id(+)
1056: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1057: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1058: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1059: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1060: AND EXISTS

Line 1057: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

1053: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1054: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1055: AND l.inventory_item_id = mic.inventory_item_id(+)
1056: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1057: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1058: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1059: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1060: AND EXISTS
1061: (SELECT s.salesrep_id

Line 1058: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

1054: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1055: AND l.inventory_item_id = mic.inventory_item_id(+)
1056: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1057: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1058: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1059: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1060: AND EXISTS
1061: (SELECT s.salesrep_id
1062: FROM ra_cust_trx_line_salesreps s

Line 1059: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1055: AND l.inventory_item_id = mic.inventory_item_id(+)
1056: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1057: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1058: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1059: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1060: AND EXISTS
1061: (SELECT s.salesrep_id
1062: FROM ra_cust_trx_line_salesreps s
1063: WHERE s.customer_trx_line_id = l.customer_trx_line_id

Line 1066: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)

1062: FROM ra_cust_trx_line_salesreps s
1063: WHERE s.customer_trx_line_id = l.customer_trx_line_id
1064: AND NVL(s.non_revenue_percent_split,0) <> 0
1065: AND s.salesrep_id =
1066: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1067: AND NVL(s.non_revenue_salesgroup_id,-9999) =
1068: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999))
1069: GROUP BY s.customer_trx_line_id
1070: HAVING SUM(NVL(s.non_revenue_percent_split,0)) <> 0);

Line 1068: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999))

1064: AND NVL(s.non_revenue_percent_split,0) <> 0
1065: AND s.salesrep_id =
1066: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1067: AND NVL(s.non_revenue_salesgroup_id,-9999) =
1068: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999))
1069: GROUP BY s.customer_trx_line_id
1070: HAVING SUM(NVL(s.non_revenue_percent_split,0)) <> 0);
1071:
1072: CURSOR c_line IS

Line 1084: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1080: ,l.line_number
1081: FROM ra_cust_trx_line_salesreps s
1082: ,mtl_item_categories mic
1083: ,ra_customer_trx_lines l
1084: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1085: AND l.customer_trx_line_id = s.customer_trx_line_id
1086: AND l.customer_trx_line_id =
1087: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
1088: AND NVL(l.inventory_item_id,0) =

Line 1087: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)

1083: ,ra_customer_trx_lines l
1084: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1085: AND l.customer_trx_line_id = s.customer_trx_line_id
1086: AND l.customer_trx_line_id =
1087: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
1088: AND NVL(l.inventory_item_id,0) =
1089: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1090: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1091: AND l.inventory_item_id = mic.inventory_item_id(+)

Line 1089: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

1085: AND l.customer_trx_line_id = s.customer_trx_line_id
1086: AND l.customer_trx_line_id =
1087: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
1088: AND NVL(l.inventory_item_id,0) =
1089: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1090: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1091: AND l.inventory_item_id = mic.inventory_item_id(+)
1092: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1093: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

Line 1090: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

1086: AND l.customer_trx_line_id =
1087: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
1088: AND NVL(l.inventory_item_id,0) =
1089: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1090: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1091: AND l.inventory_item_id = mic.inventory_item_id(+)
1092: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1093: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1094: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

Line 1092: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

1088: AND NVL(l.inventory_item_id,0) =
1089: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1090: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1091: AND l.inventory_item_id = mic.inventory_item_id(+)
1092: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1093: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1094: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1095: AND l.line_type = 'LINE'
1096: AND EXISTS

Line 1093: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

1089: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1090: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1091: AND l.inventory_item_id = mic.inventory_item_id(+)
1092: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1093: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1094: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1095: AND l.line_type = 'LINE'
1096: AND EXISTS
1097: (SELECT s1.salesrep_id

Line 1094: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

1090: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1091: AND l.inventory_item_id = mic.inventory_item_id(+)
1092: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1093: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1094: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1095: AND l.line_type = 'LINE'
1096: AND EXISTS
1097: (SELECT s1.salesrep_id
1098: FROM ra_cust_trx_line_salesreps s1

Line 1101: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s1.salesrep_id)

1097: (SELECT s1.salesrep_id
1098: FROM ra_cust_trx_line_salesreps s1
1099: WHERE s1.customer_trx_line_id = l.customer_trx_line_id
1100: AND s1.salesrep_id =
1101: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s1.salesrep_id)
1102: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)) =
1103: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)))
1104: GROUP BY s1.salesrep_id
1105: HAVING DECODE(p_rev_adj_rec.sales_credit_type,'N',

Line 1103: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)))

1099: WHERE s1.customer_trx_line_id = l.customer_trx_line_id
1100: AND s1.salesrep_id =
1101: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s1.salesrep_id)
1102: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)) =
1103: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)))
1104: GROUP BY s1.salesrep_id
1105: HAVING DECODE(p_rev_adj_rec.sales_credit_type,'N',
1106: SUM(NVL(s1.non_revenue_percent_split,0)),
1107: SUM(NVL(s1.revenue_percent_split,0))) <> 0)

Line 1123: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1119: SELECT NVL(SUM(revenue_amount_split),0)
1120: FROM ra_cust_trx_line_salesreps
1121: WHERE customer_trx_line_id = l_cust_trx_line_id
1122: and NVL(revenue_percent_split,0) <> 0
1123: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1124: and salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)
1125: and NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));
1126:
1127: -- Bug 3431815: Credit Memos included

Line 1124: and salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)

1120: FROM ra_cust_trx_line_salesreps
1121: WHERE customer_trx_line_id = l_cust_trx_line_id
1122: and NVL(revenue_percent_split,0) <> 0
1123: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1124: and salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)
1125: and NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));
1126:
1127: -- Bug 3431815: Credit Memos included
1128: -- Bug 3536944: cursor split into separate queries for invoice and CMs

Line 1125: and NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));

1121: WHERE customer_trx_line_id = l_cust_trx_line_id
1122: and NVL(revenue_percent_split,0) <> 0
1123: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1124: and salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)
1125: and NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));
1126:
1127: -- Bug 3431815: Credit Memos included
1128: -- Bug 3536944: cursor split into separate queries for invoice and CMs
1129: -- Bug 3676923: cater for null amounts and removed check on autorule

Line 1136: AND d.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1132: CURSOR c_line_revenue_total IS
1133: SELECT NVL(SUM(d.amount),0)
1134: FROM ra_cust_trx_line_gl_dist d
1135: WHERE d.customer_trx_line_id = l_cust_trx_line_id
1136: AND d.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1137: AND d.account_set_flag = 'N'
1138: AND d.account_class = 'REV';
1139:
1140: CURSOR c_cm_line_revenue_total IS

Line 1147: AND l.previous_customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1143: ra_customer_trx_lines l
1144: WHERE d.customer_trx_line_id = l.customer_trx_line_id
1145: AND d.customer_trx_id = l.customer_trx_id
1146: AND l.previous_customer_trx_line_id = l_cust_trx_line_id
1147: AND l.previous_customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1148: AND d.account_set_flag = 'N'
1149: AND d.account_class = 'REV';
1150:
1151: CURSOR c_line_nonrev_total IS

Line 1155: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)

1151: CURSOR c_line_nonrev_total IS
1152: SELECT SUM(NVL(s.non_revenue_amount_split,0))
1153: FROM ra_cust_trx_line_salesreps s
1154: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1155: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1156: and NVL(s.non_revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id, -9999));
1157:
1158: CURSOR get_salesrep_lines_old is
1159: SELECT SUM(NVL(s.revenue_amount_split,0)) revenue_amount_split,

Line 1156: and NVL(s.non_revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id, -9999));

1152: SELECT SUM(NVL(s.non_revenue_amount_split,0))
1153: FROM ra_cust_trx_line_salesreps s
1154: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1155: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1156: and NVL(s.non_revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id, -9999));
1157:
1158: CURSOR get_salesrep_lines_old is
1159: SELECT SUM(NVL(s.revenue_amount_split,0)) revenue_amount_split,
1160: SUM(NVL(s.revenue_percent_split,0)) revenue_percent_split,

Line 1166: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)

1162: SUM(NVL(s.non_revenue_percent_split,0)) nonrev_percent_split
1163: FROM ra_cust_trx_line_salesreps s,
1164: ra_customer_trx_lines l
1165: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1166: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1167: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1168: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))
1169: AND l.line_type = 'LINE'
1170: AND l.customer_trx_line_id = s.customer_trx_line_id

Line 1168: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))

1164: ra_customer_trx_lines l
1165: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1166: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1167: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1168: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))
1169: AND l.line_type = 'LINE'
1170: AND l.customer_trx_line_id = s.customer_trx_line_id
1171: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
1172:

Line 1171: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;

1167: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1168: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))
1169: AND l.line_type = 'LINE'
1170: AND l.customer_trx_line_id = s.customer_trx_line_id
1171: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
1172:
1173: CURSOR get_salesrep_lines_new is
1174: SELECT NVL(SUM(s.revenue_amount_split),0),
1175: NVL(SUM(s.revenue_percent_split),0),

Line 1181: AND s.salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id

1177: NVL(SUM(s.non_revenue_percent_split),0)
1178: FROM ra_cust_trx_line_salesreps s,
1179: ra_customer_trx_lines l
1180: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1181: AND s.salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id
1182: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1183: NVL(AR_RAAPI_UTIL.g_to_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))
1184: AND l.line_type = 'LINE'
1185: AND l.customer_trx_line_id = s.customer_trx_line_id

Line 1183: NVL(AR_RAAPI_UTIL.g_to_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))

1179: ra_customer_trx_lines l
1180: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1181: AND s.salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id
1182: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1183: NVL(AR_RAAPI_UTIL.g_to_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))
1184: AND l.line_type = 'LINE'
1185: AND l.customer_trx_line_id = s.customer_trx_line_id
1186: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
1187:

Line 1186: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;

1182: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1183: NVL(AR_RAAPI_UTIL.g_to_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))
1184: AND l.line_type = 'LINE'
1185: AND l.customer_trx_line_id = s.customer_trx_line_id
1186: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
1187:
1188: CURSOR c_get_from_salesreps IS
1189: SELECT s.salesrep_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', s.non_revenue_salesgroup_id, s.revenue_salesgroup_id) salesgroup_id,
1190: SUM(s.revenue_amount_split) revenue_amount_split,

Line 1196: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)

1192: SUM(s.non_revenue_amount_split) nonrev_amount_split,
1193: SUM(s.non_revenue_percent_split) nonrev_percent_split
1194: FROM ra_cust_trx_line_salesreps s
1195: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1196: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1197: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1198: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))
1199: AND NVL(s.revenue_adjustment_id,-99) <> x_adjustment_id -- bug 2543675
1200: GROUP BY s.salesrep_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', s.non_revenue_salesgroup_id,s.revenue_salesgroup_id);

Line 1198: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))

1194: FROM ra_cust_trx_line_salesreps s
1195: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1196: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1197: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1198: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))
1199: AND NVL(s.revenue_adjustment_id,-99) <> x_adjustment_id -- bug 2543675
1200: GROUP BY s.salesrep_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', s.non_revenue_salesgroup_id,s.revenue_salesgroup_id);
1201:
1202: CURSOR c_new_salesrep_name IS

Line 1205: WHERE salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id;

1201:
1202: CURSOR c_new_salesrep_name IS
1203: SELECT name
1204: FROM ra_salesreps
1205: WHERE salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id;
1206:
1207: BEGIN
1208: IF PG_DEBUG in ('Y', 'C') THEN
1209: arp_util.debug('AR_Revenue_Adjustment_PVT.Transfer_Sales_Credits()+');

Line 1240: AR_RAAPI_UTIL.Constant_System_Values;

1236: l_rev_adj_rec.gl_date := trunc(p_rev_adj_rec.gl_date);
1237:
1238: l_rev_adj_rec.adjustment_type := 'SA';
1239:
1240: AR_RAAPI_UTIL.Constant_System_Values;
1241: AR_RAAPI_UTIL.Initialize_Globals;
1242: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
1243: ,p_rev_adj_rec => l_rev_adj_rec
1244: ,p_validation_level => p_validation_level

Line 1241: AR_RAAPI_UTIL.Initialize_Globals;

1237:
1238: l_rev_adj_rec.adjustment_type := 'SA';
1239:
1240: AR_RAAPI_UTIL.Constant_System_Values;
1241: AR_RAAPI_UTIL.Initialize_Globals;
1242: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
1243: ,p_rev_adj_rec => l_rev_adj_rec
1244: ,p_validation_level => p_validation_level
1245: ,x_return_status => x_return_status

Line 1242: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE

1238: l_rev_adj_rec.adjustment_type := 'SA';
1239:
1240: AR_RAAPI_UTIL.Constant_System_Values;
1241: AR_RAAPI_UTIL.Initialize_Globals;
1242: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
1243: ,p_rev_adj_rec => l_rev_adj_rec
1244: ,p_validation_level => p_validation_level
1245: ,x_return_status => x_return_status
1246: ,x_msg_count => x_msg_count

Line 1289: AR_RAAPI_UTIL.Validate_Amount

1285: -- Determine revenue amount to be transferred
1286: --
1287: IF p_rev_adj_rec.sales_credit_type IN ('R','B')
1288: THEN
1289: AR_RAAPI_UTIL.Validate_Amount
1290: (p_init_msg_list => FND_API.G_FALSE
1291: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
1292: ,p_adjustment_type => 'SA'
1293: ,p_amount_mode => p_rev_adj_rec.amount_mode

Line 1291: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id

1287: IF p_rev_adj_rec.sales_credit_type IN ('R','B')
1288: THEN
1289: AR_RAAPI_UTIL.Validate_Amount
1290: (p_init_msg_list => FND_API.G_FALSE
1291: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
1292: ,p_adjustment_type => 'SA'
1293: ,p_amount_mode => p_rev_adj_rec.amount_mode
1294: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
1295: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

Line 1294: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id

1290: (p_init_msg_list => FND_API.G_FALSE
1291: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
1292: ,p_adjustment_type => 'SA'
1293: ,p_amount_mode => p_rev_adj_rec.amount_mode
1294: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
1295: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
1296: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
1297: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
1298: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

Line 1295: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

1291: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
1292: ,p_adjustment_type => 'SA'
1293: ,p_amount_mode => p_rev_adj_rec.amount_mode
1294: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
1295: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
1296: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
1297: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
1298: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
1299: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

Line 1296: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id

1292: ,p_adjustment_type => 'SA'
1293: ,p_amount_mode => p_rev_adj_rec.amount_mode
1294: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
1295: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
1296: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
1297: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
1298: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
1299: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
1300: ,p_revenue_amount_in => p_rev_adj_rec.amount

Line 1298: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

1294: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
1295: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
1296: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
1297: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
1298: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
1299: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
1300: ,p_revenue_amount_in => p_rev_adj_rec.amount
1301: ,p_revenue_percent => p_rev_adj_rec.percent
1302: ,p_revenue_amount_out => l_revenue_amount

Line 1299: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

1295: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
1296: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
1297: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
1298: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
1299: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
1300: ,p_revenue_amount_in => p_rev_adj_rec.amount
1301: ,p_revenue_percent => p_rev_adj_rec.percent
1302: ,p_revenue_amount_out => l_revenue_amount
1303: ,p_adjustable_amount_out => l_adj_trx_total

Line 1317: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed

1313: RAISE FND_API.G_EXC_ERROR;
1314: END IF;
1315: l_rev_adj_rec.amount := l_revenue_amount;
1316: /* Bug 2146970 - validate the GL date passed in */
1317: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed
1318: (p_gl_date => l_rev_adj_rec.gl_date);
1319: IF l_gl_date_valid IS NULL
1320: THEN
1321: FND_MESSAGE.set_name('AR','AR_VAL_GL_DATE');

Line 1351: / 100, AR_RAAPI_UTIL.g_trx_precision);

1347: END IF;
1348: ELSIF p_rev_adj_rec.amount_mode = 'P'
1349: THEN
1350: l_nonrev_amount := ROUND(l_trx_total * p_rev_adj_rec.percent
1351: / 100, AR_RAAPI_UTIL.g_trx_precision);
1352: ELSE
1353: l_nonrev_amount := l_nonrev_trx_total;
1354: END IF;
1355:

Line 1438: / l_adj_trx_total , AR_RAAPI_UTIL.g_trx_precision);

1434: ELSE
1435: l_line_adjustable := 0;
1436: END IF;
1437: l_line_amount := ROUND(l_revenue_amount * l_line_adjustable
1438: / l_adj_trx_total , AR_RAAPI_UTIL.g_trx_precision);
1439: IF l_line_amount <> 0
1440: THEN
1441: l_line_count := l_line_count + 1;
1442: l_total_adjusted := l_total_adjusted + l_line_amount;

Line 1456: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate

1452: /* Bug 4675438: MOAC/SSA */
1453: ARPCURR.functional_amount(
1454: amount => l_line_amount
1455: , currency_code => arp_global.functional_currency
1456: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate
1457: , precision => NULL
1458: , min_acc_unit => NULL );
1459: l_line_percent := ROUND(l_line_amount / c1.amount * 100, 4);
1460: END IF;

Line 1468: / l_nonrev_trx_total, AR_RAAPI_UTIL.g_trx_precision);

1464: OPEN c_line_nonrev_total;
1465: FETCH c_line_nonrev_total INTO l_line_nonrev_total;
1466: CLOSE c_line_nonrev_total;
1467: l_line_nonrev_amount := ROUND(l_nonrev_amount * l_line_nonrev_total
1468: / l_nonrev_trx_total, AR_RAAPI_UTIL.g_trx_precision);
1469: IF l_line_nonrev_amount <> 0
1470: THEN
1471: l_nonrev_line_count := l_nonrev_line_count + 1;
1472: l_total_nonrev_adjusted := l_total_nonrev_adjusted +

Line 1551: / l_revenue_percent_split, AR_RAAPI_UTIL.g_trx_precision);

1547: p_rev_adj_rec.sales_credit_type IN ('R','B') AND
1548: l_revenue_percent_split <> 0
1549: THEN
1550: l_amount_prorata := ROUND(l_line_amount * srrec.revenue_percent_split
1551: / l_revenue_percent_split, AR_RAAPI_UTIL.g_trx_precision);
1552: IF l_amount_prorata <> 0
1553: THEN
1554: l_no_of_salesreps := l_no_of_salesreps + 1;
1555: END IF;

Line 1562: AR_RAAPI_UTIL.g_trx_precision);

1558: l_line_nonrev_amount <> 0 AND l_nonrev_percent_split <> 0
1559: THEN
1560: l_nonrev_amount_prorata := ROUND(l_line_nonrev_amount *
1561: srrec.nonrev_percent_split / l_nonrev_percent_split,
1562: AR_RAAPI_UTIL.g_trx_precision);
1563: IF l_nonrev_amount_prorata <> 0
1564: THEN
1565: l_nr_no_of_salesreps := l_nr_no_of_salesreps + 1;
1566: END IF;

Line 1576: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,

1572: IF l_line_amount <> 0 AND
1573: p_rev_adj_rec.sales_credit_type IN ('R','B') AND
1574: l_revenue_percent_split <> 0
1575: THEN
1576: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
1577: AR_RAAPI_UTIL.g_to_salesrep_id,
1578: AR_RAAPI_UTIL.g_to_salesgroup_id,
1579: l_cust_trx_line_id,
1580: l_line_amount,

Line 1577: AR_RAAPI_UTIL.g_to_salesrep_id,

1573: p_rev_adj_rec.sales_credit_type IN ('R','B') AND
1574: l_revenue_percent_split <> 0
1575: THEN
1576: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
1577: AR_RAAPI_UTIL.g_to_salesrep_id,
1578: AR_RAAPI_UTIL.g_to_salesgroup_id,
1579: l_cust_trx_line_id,
1580: l_line_amount,
1581: l_line_percent,

Line 1578: AR_RAAPI_UTIL.g_to_salesgroup_id,

1574: l_revenue_percent_split <> 0
1575: THEN
1576: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
1577: AR_RAAPI_UTIL.g_to_salesrep_id,
1578: AR_RAAPI_UTIL.g_to_salesgroup_id,
1579: l_cust_trx_line_id,
1580: l_line_amount,
1581: l_line_percent,
1582: 'R',

Line 1594: ,AR_RAAPI_UTIL.g_customer_trx_id

1590: -- Bug 1930302 : Added warehouse_id as 16th parameter.
1591:
1592: ARP_AUTO_ACCOUNTING.do_autoaccounting('G'
1593: ,'REV'
1594: ,AR_RAAPI_UTIL.g_customer_trx_id
1595: ,l_cust_trx_line_id
1596: ,NULL
1597: ,NULL
1598: ,l_rev_adj_rec.gl_date

Line 1603: ,AR_RAAPI_UTIL.g_cust_trx_type_id

1599: ,NULL
1600: ,l_line_amount
1601: ,NULL
1602: ,NULL
1603: ,AR_RAAPI_UTIL.g_cust_trx_type_id
1604: ,AR_RAAPI_UTIL.g_to_salesrep_id
1605: ,c1.inventory_item_id
1606: ,c1.memo_line_id
1607: ,c1.warehouse_id

Line 1604: ,AR_RAAPI_UTIL.g_to_salesrep_id

1600: ,l_line_amount
1601: ,NULL
1602: ,NULL
1603: ,AR_RAAPI_UTIL.g_cust_trx_type_id
1604: ,AR_RAAPI_UTIL.g_to_salesrep_id
1605: ,c1.inventory_item_id
1606: ,c1.memo_line_id
1607: ,c1.warehouse_id
1608: ,l_credit_ccid

Line 1638: / l_revenue_percent_split, AR_RAAPI_UTIL.g_trx_precision);

1634: l_revenue_percent_split <> 0
1635: THEN
1636: /* Bug 6932079 - Added the NVL for c2.revenue_percent_split */
1637: l_amount_prorata := ROUND(l_line_amount * NVL(c2.revenue_percent_split, 0)
1638: / l_revenue_percent_split, AR_RAAPI_UTIL.g_trx_precision);
1639: /* Bug 2143925 - get the pro rata amount in SOB currency */
1640: /* Bug 4675438: MOAC/SSA */
1641: l_amount_prorata_acctd :=
1642: ARPCURR.functional_amount(

Line 1645: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate

1641: l_amount_prorata_acctd :=
1642: ARPCURR.functional_amount(
1643: amount => l_amount_prorata
1644: , currency_code => arp_global.functional_currency
1645: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate
1646: , precision => NULL
1647: , min_acc_unit => NULL );
1648: l_percent_prorata :=
1649: ROUND((l_amount_prorata / c1.amount) * 100,4);

Line 1687: insert_sales_credit(AR_RAAPI_UTIL.g_customer_trx_id,

1683: END IF;
1684: ELSE
1685: l_last_salesrep_flag := 'N'; -- Bug 2477881
1686: END IF;
1687: insert_sales_credit(AR_RAAPI_UTIL.g_customer_trx_id,
1688: c2.salesrep_id,
1689: c2.salesgroup_id,
1690: l_cust_trx_line_id,
1691: l_amount_prorata * -1,

Line 1705: ,AR_RAAPI_UTIL.g_customer_trx_id

1701:
1702: ARP_AUTO_ACCOUNTING.do_autoaccounting
1703: ('G'
1704: ,'REV'
1705: ,AR_RAAPI_UTIL.g_customer_trx_id
1706: ,l_cust_trx_line_id
1707: ,NULL
1708: ,NULL
1709: ,l_rev_adj_rec.gl_date

Line 1714: ,AR_RAAPI_UTIL.g_cust_trx_type_id

1710: ,NULL
1711: ,l_amount_prorata
1712: ,NULL
1713: ,NULL
1714: ,AR_RAAPI_UTIL.g_cust_trx_type_id
1715: ,c2.salesrep_id
1716: ,c1.inventory_item_id
1717: ,c1.memo_line_id
1718: ,c1.warehouse_id

Line 1743: ,AR_RAAPI_UTIL.g_customer_trx_id

1739: IF c1.accounting_rule_id IS NOT NULL
1740: THEN
1741: transfer_salesrep_revenue
1742: (c1.customer_trx_line_id
1743: ,AR_RAAPI_UTIL.g_customer_trx_id
1744: ,l_debit_sales_credit_id
1745: ,l_amount_prorata * -1
1746: ,l_amount_prorata_acctd * -1 -- Bug 2143925
1747: ,l_rev_adj_rec.gl_date

Line 1756: ,AR_RAAPI_UTIL.g_customer_trx_id

1752: ,x_adjustment_id);
1753: /* Bug 2543675 - insert 1 credit for every debit */
1754: transfer_salesrep_revenue
1755: (c1.customer_trx_line_id
1756: ,AR_RAAPI_UTIL.g_customer_trx_id
1757: ,l_credit_sales_credit_id
1758: ,l_amount_prorata
1759: ,l_amount_prorata_acctd
1760: ,l_rev_adj_rec.gl_date

Line 1776: AR_RAAPI_UTIL.g_customer_trx_id,

1772: l_rev_adj_rec.gl_date,
1773: 'REV',
1774: l_amount_prorata * -1,
1775: l_debit_sales_credit_id,
1776: AR_RAAPI_UTIL.g_customer_trx_id,
1777: x_adjustment_id);
1778: /* Bug 2543675 - insert 1 credit for every debit */
1779: insert_distribution(l_cust_trx_line_id,
1780: l_credit_ccid,

Line 1788: AR_RAAPI_UTIL.g_customer_trx_id,

1784: l_rev_adj_rec.gl_date,
1785: 'REV',
1786: l_amount_prorata,
1787: l_credit_sales_credit_id,
1788: AR_RAAPI_UTIL.g_customer_trx_id,
1789: x_adjustment_id);
1790:
1791: END IF;
1792: END IF;

Line 1800: AR_RAAPI_UTIL.g_trx_precision);

1796: l_line_nonrev_amount <> 0 AND l_nonrev_percent_split <> 0
1797: THEN
1798: l_nonrev_amount_prorata := ROUND(l_line_nonrev_amount *
1799: c2.nonrev_percent_split / l_nonrev_percent_split,
1800: AR_RAAPI_UTIL.g_trx_precision);
1801: l_nonrev_percent_prorata :=
1802: ROUND((l_nonrev_amount_prorata / c1.amount) * 100,4);
1803:
1804: IF l_nonrev_percent_prorata <> 0

Line 1823: insert_sales_credit(AR_RAAPI_UTIL.g_customer_trx_id,

1819: l_nonrev_percent_prorata := l_nonrev_percent_prorata +
1820: l_line_nonrev_percent - l_nr_line_pct_adjusted;
1821: END IF;
1822: END IF;
1823: insert_sales_credit(AR_RAAPI_UTIL.g_customer_trx_id,
1824: c2.salesrep_id,
1825: c2.salesgroup_id,
1826: l_cust_trx_line_id,
1827: l_nonrev_amount_prorata * -1,

Line 1847: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,

1843:
1844: IF p_rev_adj_rec.sales_credit_type in ('N','B') AND
1845: l_line_nonrev_amount <> 0 AND l_nonrev_percent_split <> 0
1846: THEN
1847: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
1848: AR_RAAPI_UTIL.g_to_salesrep_id,
1849: AR_RAAPI_UTIL.g_to_salesgroup_id,
1850: l_cust_trx_line_id,
1851: l_line_nonrev_amount,

Line 1848: AR_RAAPI_UTIL.g_to_salesrep_id,

1844: IF p_rev_adj_rec.sales_credit_type in ('N','B') AND
1845: l_line_nonrev_amount <> 0 AND l_nonrev_percent_split <> 0
1846: THEN
1847: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
1848: AR_RAAPI_UTIL.g_to_salesrep_id,
1849: AR_RAAPI_UTIL.g_to_salesgroup_id,
1850: l_cust_trx_line_id,
1851: l_line_nonrev_amount,
1852: l_line_nonrev_percent,

Line 1849: AR_RAAPI_UTIL.g_to_salesgroup_id,

1845: l_line_nonrev_amount <> 0 AND l_nonrev_percent_split <> 0
1846: THEN
1847: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
1848: AR_RAAPI_UTIL.g_to_salesrep_id,
1849: AR_RAAPI_UTIL.g_to_salesgroup_id,
1850: l_cust_trx_line_id,
1851: l_line_nonrev_amount,
1852: l_line_nonrev_percent,
1853: 'N',

Line 1887: AR_RAAPI_UTIL.g_trx_currency||' '||l_adj_trx_total);

1883: ELSE
1884: FND_MESSAGE.SET_NAME
1885: (application => 'AR', name => 'AR_RA_AMT_EXCEEDS_AVAIL_REV');
1886: FND_MESSAGE.set_token('TOT_AVAIL_REV',
1887: AR_RAAPI_UTIL.g_trx_currency||' '||l_adj_trx_total);
1888: END IF;
1889: FND_MSG_PUB.Add;
1890: RAISE FND_API.G_EXC_ERROR;
1891: WHEN invalid_zero THEN

Line 2065: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

2061: ,mtl_item_categories mic
2062: ,ra_customer_trx_lines l
2063: WHERE s.customer_trx_line_id = l.customer_trx_line_id
2064: AND l.line_type = 'LINE'
2065: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2066: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2067: l.customer_trx_line_id)
2068: AND NVL(l.inventory_item_id,0) =
2069: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

Line 2066: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,

2062: ,ra_customer_trx_lines l
2063: WHERE s.customer_trx_line_id = l.customer_trx_line_id
2064: AND l.line_type = 'LINE'
2065: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2066: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2067: l.customer_trx_line_id)
2068: AND NVL(l.inventory_item_id,0) =
2069: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2070: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

Line 2069: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

2065: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2066: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2067: l.customer_trx_line_id)
2068: AND NVL(l.inventory_item_id,0) =
2069: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2070: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2071: AND l.inventory_item_id = mic.inventory_item_id(+)
2072: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2073: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

Line 2070: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

2066: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2067: l.customer_trx_line_id)
2068: AND NVL(l.inventory_item_id,0) =
2069: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2070: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2071: AND l.inventory_item_id = mic.inventory_item_id(+)
2072: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2073: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2074: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;

Line 2072: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

2068: AND NVL(l.inventory_item_id,0) =
2069: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2070: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2071: AND l.inventory_item_id = mic.inventory_item_id(+)
2072: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2073: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2074: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
2075:
2076: CURSOR c_line_count IS

Line 2073: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

2069: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2070: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2071: AND l.inventory_item_id = mic.inventory_item_id(+)
2072: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2073: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2074: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
2075:
2076: CURSOR c_line_count IS
2077: SELECT COUNT(*)

Line 2074: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;

2070: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2071: AND l.inventory_item_id = mic.inventory_item_id(+)
2072: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2073: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2074: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
2075:
2076: CURSOR c_line_count IS
2077: SELECT COUNT(*)
2078: FROM mtl_item_categories mic

Line 2080: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

2076: CURSOR c_line_count IS
2077: SELECT COUNT(*)
2078: FROM mtl_item_categories mic
2079: ,ra_customer_trx_lines l
2080: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2081: AND l.line_type = 'LINE'
2082: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2083: l.customer_trx_line_id)
2084: AND NVL(l.inventory_item_id,0) =

Line 2082: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,

2078: FROM mtl_item_categories mic
2079: ,ra_customer_trx_lines l
2080: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2081: AND l.line_type = 'LINE'
2082: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2083: l.customer_trx_line_id)
2084: AND NVL(l.inventory_item_id,0) =
2085: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2086: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

Line 2085: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

2081: AND l.line_type = 'LINE'
2082: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2083: l.customer_trx_line_id)
2084: AND NVL(l.inventory_item_id,0) =
2085: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2086: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2087: AND l.inventory_item_id = mic.inventory_item_id(+)
2088: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2089: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

Line 2086: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

2082: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2083: l.customer_trx_line_id)
2084: AND NVL(l.inventory_item_id,0) =
2085: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2086: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2087: AND l.inventory_item_id = mic.inventory_item_id(+)
2088: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2089: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2090: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;

Line 2088: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

2084: AND NVL(l.inventory_item_id,0) =
2085: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2086: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2087: AND l.inventory_item_id = mic.inventory_item_id(+)
2088: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2089: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2090: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
2091:
2092: CURSOR c_line IS

Line 2089: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

2085: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2086: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2087: AND l.inventory_item_id = mic.inventory_item_id(+)
2088: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2089: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2090: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
2091:
2092: CURSOR c_line IS
2093: SELECT l.customer_trx_line_id

Line 2090: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;

2086: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2087: AND l.inventory_item_id = mic.inventory_item_id(+)
2088: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2089: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2090: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
2091:
2092: CURSOR c_line IS
2093: SELECT l.customer_trx_line_id
2094: ,l.line_number

Line 2099: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

2095: ,SUM(NVL(s.revenue_amount_split,0)) amount
2096: FROM mtl_item_categories mic
2097: ,ra_cust_trx_line_salesreps s
2098: ,ra_customer_trx_lines l
2099: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2100: AND l.customer_trx_line_id = s.customer_trx_line_id
2101: AND l.customer_trx_line_id =
2102: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
2103: AND NVL(l.inventory_item_id,0) =

Line 2102: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)

2098: ,ra_customer_trx_lines l
2099: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2100: AND l.customer_trx_line_id = s.customer_trx_line_id
2101: AND l.customer_trx_line_id =
2102: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
2103: AND NVL(l.inventory_item_id,0) =
2104: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2105: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2106: AND l.inventory_item_id = mic.inventory_item_id(+)

Line 2104: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

2100: AND l.customer_trx_line_id = s.customer_trx_line_id
2101: AND l.customer_trx_line_id =
2102: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
2103: AND NVL(l.inventory_item_id,0) =
2104: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2105: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2106: AND l.inventory_item_id = mic.inventory_item_id(+)
2107: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2108: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

Line 2105: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

2101: AND l.customer_trx_line_id =
2102: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
2103: AND NVL(l.inventory_item_id,0) =
2104: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2105: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2106: AND l.inventory_item_id = mic.inventory_item_id(+)
2107: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2108: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2109: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

Line 2107: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

2103: AND NVL(l.inventory_item_id,0) =
2104: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2105: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2106: AND l.inventory_item_id = mic.inventory_item_id(+)
2107: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2108: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2109: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
2110: AND l.line_type = 'LINE'
2111: GROUP BY l.customer_trx_line_id

Line 2108: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

2104: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2105: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2106: AND l.inventory_item_id = mic.inventory_item_id(+)
2107: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2108: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2109: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
2110: AND l.line_type = 'LINE'
2111: GROUP BY l.customer_trx_line_id
2112: ,l.line_number;

Line 2109: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

2105: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2106: AND l.inventory_item_id = mic.inventory_item_id(+)
2107: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2108: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2109: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
2110: AND l.line_type = 'LINE'
2111: GROUP BY l.customer_trx_line_id
2112: ,l.line_number;
2113:

Line 2122: AND s.salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id

2118: NVL(SUM(s.non_revenue_percent_split),0)
2119: FROM ra_cust_trx_line_salesreps s,
2120: ra_customer_trx_lines l
2121: WHERE s.customer_trx_line_id = l_cust_trx_line_id
2122: AND s.salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id
2123: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
2124: NVL(AR_RAAPI_UTIL.g_to_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))
2125: AND l.line_type = 'LINE'
2126: AND l.customer_trx_line_id = s.customer_trx_line_id

Line 2124: NVL(AR_RAAPI_UTIL.g_to_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))

2120: ra_customer_trx_lines l
2121: WHERE s.customer_trx_line_id = l_cust_trx_line_id
2122: AND s.salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id
2123: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
2124: NVL(AR_RAAPI_UTIL.g_to_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))
2125: AND l.line_type = 'LINE'
2126: AND l.customer_trx_line_id = s.customer_trx_line_id
2127: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
2128:

Line 2127: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;

2123: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
2124: NVL(AR_RAAPI_UTIL.g_to_salesgroup_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)))
2125: AND l.line_type = 'LINE'
2126: AND l.customer_trx_line_id = s.customer_trx_line_id
2127: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
2128:
2129: CURSOR c_new_salesrep_name IS
2130: SELECT name
2131: FROM ra_salesreps

Line 2132: WHERE salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id;

2128:
2129: CURSOR c_new_salesrep_name IS
2130: SELECT name
2131: FROM ra_salesreps
2132: WHERE salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id;
2133:
2134: BEGIN
2135:
2136: IF PG_DEBUG in ('Y', 'C') THEN

Line 2168: AR_RAAPI_UTIL.Constant_System_Values;

2164: l_rev_adj_rec.gl_date := trunc(p_rev_adj_rec.gl_date);
2165:
2166: l_rev_adj_rec.adjustment_type := 'NR';
2167:
2168: AR_RAAPI_UTIL.Constant_System_Values;
2169: AR_RAAPI_UTIL.Initialize_Globals;
2170: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
2171: ,p_rev_adj_rec => l_rev_adj_rec
2172: ,p_validation_level => p_validation_level

Line 2169: AR_RAAPI_UTIL.Initialize_Globals;

2165:
2166: l_rev_adj_rec.adjustment_type := 'NR';
2167:
2168: AR_RAAPI_UTIL.Constant_System_Values;
2169: AR_RAAPI_UTIL.Initialize_Globals;
2170: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
2171: ,p_rev_adj_rec => l_rev_adj_rec
2172: ,p_validation_level => p_validation_level
2173: ,x_return_status => x_return_status

Line 2170: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE

2166: l_rev_adj_rec.adjustment_type := 'NR';
2167:
2168: AR_RAAPI_UTIL.Constant_System_Values;
2169: AR_RAAPI_UTIL.Initialize_Globals;
2170: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
2171: ,p_rev_adj_rec => l_rev_adj_rec
2172: ,p_validation_level => p_validation_level
2173: ,x_return_status => x_return_status
2174: ,x_msg_count => x_msg_count

Line 2213: AR_RAAPI_UTIL.g_trx_precision);

2209: l_amount := p_rev_adj_rec.amount;
2210: ELSIF p_rev_adj_rec.amount_mode = 'P'
2211: THEN
2212: l_amount := ROUND(l_trx_total * p_rev_adj_rec.percent / 100,
2213: AR_RAAPI_UTIL.g_trx_precision);
2214: END IF;
2215: IF l_amount = 0
2216: THEN
2217: RAISE invalid_amount;

Line 2236: / l_trx_total , AR_RAAPI_UTIL.g_trx_precision);

2232: l_line_amount := 0;
2233: l_line_percent := 0;
2234:
2235: l_line_amount := ROUND(l_amount * c1.amount
2236: / l_trx_total , AR_RAAPI_UTIL.g_trx_precision);
2237:
2238: IF l_line_amount <> 0
2239: THEN
2240: l_line_count := l_line_count + 1;

Line 2283: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,

2279: THEN
2280: RAISE invalid_sc_total;
2281: END IF;
2282:
2283: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
2284: AR_RAAPI_UTIL.g_to_salesrep_id,
2285: AR_RAAPI_UTIL.g_to_salesgroup_id,
2286: l_cust_trx_line_id,
2287: l_line_amount,

Line 2284: AR_RAAPI_UTIL.g_to_salesrep_id,

2280: RAISE invalid_sc_total;
2281: END IF;
2282:
2283: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
2284: AR_RAAPI_UTIL.g_to_salesrep_id,
2285: AR_RAAPI_UTIL.g_to_salesgroup_id,
2286: l_cust_trx_line_id,
2287: l_line_amount,
2288: l_line_percent,

Line 2285: AR_RAAPI_UTIL.g_to_salesgroup_id,

2281: END IF;
2282:
2283: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
2284: AR_RAAPI_UTIL.g_to_salesrep_id,
2285: AR_RAAPI_UTIL.g_to_salesgroup_id,
2286: l_cust_trx_line_id,
2287: l_line_amount,
2288: l_line_percent,
2289: 'N',

Line 2314: AR_RAAPI_UTIL.g_trx_currency||' '||'0');

2310: WHEN invalid_amount THEN
2311: FND_MESSAGE.SET_NAME
2312: (application => 'AR', name => 'AR_RA_AMT_EXCEEDS_AVAIL_REV');
2313: FND_MESSAGE.set_token('TOT_AVAIL_REV',
2314: AR_RAAPI_UTIL.g_trx_currency||' '||'0');
2315: FND_MSG_PUB.Add;
2316: RAISE FND_API.G_EXC_ERROR;
2317: WHEN OTHERS then
2318: IF (SQLCODE = -20001)

Line 2541: l_dist_amount := arpcurr.currround(p_revenue_amount / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);

2537: calculate the correct overall revenue amount to be debited */
2538: /* Bug 4675438: MOAC/SSA */
2539: IF l_assignment_total = 0
2540: THEN
2541: l_dist_amount := arpcurr.currround(p_revenue_amount / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);
2542: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2543: l_correct_gl_date_amt := arpcurr.currround(p_line_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2544: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2545: ELSE

Line 2542: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);

2538: /* Bug 4675438: MOAC/SSA */
2539: IF l_assignment_total = 0
2540: THEN
2541: l_dist_amount := arpcurr.currround(p_revenue_amount / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);
2542: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2543: l_correct_gl_date_amt := arpcurr.currround(p_line_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2544: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2545: ELSE
2546: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);

Line 2543: l_correct_gl_date_amt := arpcurr.currround(p_line_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);

2539: IF l_assignment_total = 0
2540: THEN
2541: l_dist_amount := arpcurr.currround(p_revenue_amount / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);
2542: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2543: l_correct_gl_date_amt := arpcurr.currround(p_line_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2544: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2545: ELSE
2546: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2547: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);

Line 2544: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);

2540: THEN
2541: l_dist_amount := arpcurr.currround(p_revenue_amount / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);
2542: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2543: l_correct_gl_date_amt := arpcurr.currround(p_line_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2544: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2545: ELSE
2546: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2547: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2548: l_correct_gl_date_amt := arpcurr.currround(p_line_amount * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);

Line 2546: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);

2542: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2543: l_correct_gl_date_amt := arpcurr.currround(p_line_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2544: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2545: ELSE
2546: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2547: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2548: l_correct_gl_date_amt := arpcurr.currround(p_line_amount * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2549: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2550: END IF;

Line 2547: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);

2543: l_correct_gl_date_amt := arpcurr.currround(p_line_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2544: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2545: ELSE
2546: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2547: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2548: l_correct_gl_date_amt := arpcurr.currround(p_line_amount * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2549: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2550: END IF;
2551:

Line 2548: l_correct_gl_date_amt := arpcurr.currround(p_line_amount * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);

2544: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2545: ELSE
2546: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2547: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2548: l_correct_gl_date_amt := arpcurr.currround(p_line_amount * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2549: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2550: END IF;
2551:
2552: IF l_ext_amount = 0

Line 2549: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);

2545: ELSE
2546: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2547: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2548: l_correct_gl_date_amt := arpcurr.currround(p_line_amount * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2549: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2550: END IF;
2551:
2552: IF l_ext_amount = 0
2553: THEN

Line 2614: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed (p_gl_date => l_gl_date);

2610: l_gl_date := p_gl_date;
2611: END IF;
2612:
2613: /* Bug 2146970 - validate the GL date passed in */
2614: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed (p_gl_date => l_gl_date);
2615: IF l_gl_date_valid IS NULL
2616: THEN
2617: FND_MESSAGE.set_name('AR','AR_RA_NO_OPEN_PERIODS');
2618: FND_MSG_PUB.Add;

Line 3074: ,AR_RAAPI_UTIL.g_cust_trx_type_id

3070: ,NULL
3071: ,NULL --l_dist_amount
3072: ,NULL
3073: ,null
3074: ,AR_RAAPI_UTIL.g_cust_trx_type_id
3075: ,c2.salesrep_id
3076: ,p_inventory_item_id
3077: ,p_memo_line_id
3078: ,l_warehouse_id

Line 3116: ,AR_RAAPI_UTIL.g_cust_trx_type_id

3112: ,NULL
3113: ,NULL --l_dist_tot
3114: ,NULL
3115: ,NULL
3116: ,AR_RAAPI_UTIL.g_cust_trx_type_id
3117: ,c2.salesrep_id
3118: ,p_inventory_item_id
3119: ,p_memo_line_id
3120: ,l_warehouse_id

Line 3156: l_gl_date := AR_RAAPI_UTIL.Deferred_GL_Date

3152: l_assignment_count := l_assignment_count + 1;
3153: -- If revenue is deferred, get the deferred GL date
3154: IF NVL(l_deferred_revenue_flag,'N') = 'Y'
3155: THEN
3156: l_gl_date := AR_RAAPI_UTIL.Deferred_GL_Date
3157: (p_start_date => p_gl_date,
3158: p_period_seq_no => l_assignment_count);
3159:
3160:

Line 3182: / 100 / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);

3178: IF l_assignment_total = 0
3179: THEN
3180: l_dist_amount := arpcurr.currround(
3181: p_revenue_amount * l_salesrep_percent
3182: / 100 / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);
3183: ELSE
3184: l_dist_amount := arpcurr.currround(p_revenue_amount * l_salesrep_percent / 100 * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
3185: END IF;
3186: l_dist_tot := l_dist_tot + l_dist_amount;

Line 3184: l_dist_amount := arpcurr.currround(p_revenue_amount * l_salesrep_percent / 100 * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);

3180: l_dist_amount := arpcurr.currround(
3181: p_revenue_amount * l_salesrep_percent
3182: / 100 / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);
3183: ELSE
3184: l_dist_amount := arpcurr.currround(p_revenue_amount * l_salesrep_percent / 100 * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
3185: END IF;
3186: l_dist_tot := l_dist_tot + l_dist_amount;
3187: IF l_salesrep_count = l_no_of_salesreps AND
3188: l_assignment_count = l_no_of_assignments AND

Line 3224: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate

3220: l_dist_acctd_amount :=
3221: ARPCURR.functional_amount(
3222: amount => l_dist_amount
3223: , currency_code => arp_global.functional_currency
3224: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate
3225: , precision => NULL
3226: , min_acc_unit => NULL );
3227: /* Bug 2146970 - validate the GL date for all lines regardless
3228: of duration */

Line 3229: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed

3225: , precision => NULL
3226: , min_acc_unit => NULL );
3227: /* Bug 2146970 - validate the GL date for all lines regardless
3228: of duration */
3229: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed
3230: (p_gl_date => l_gl_date);
3231: IF l_gl_date_valid IS NULL
3232: THEN
3233: FND_MESSAGE.set_name('AR','AR_RA_NO_OPEN_PERIODS');

Line 3461: l_dist_amount := arpcurr.currround(p_revenue_amount * l_salesrep_percent / 100 , AR_RAAPI_UTIL.g_trx_currency);

3457: l_salesrep_percent := c1.revenue_percent_split;
3458: END IF;
3459:
3460: /* Bug 4675438: MOAC/SSA */
3461: l_dist_amount := arpcurr.currround(p_revenue_amount * l_salesrep_percent / 100 , AR_RAAPI_UTIL.g_trx_currency);
3462: l_dist_tot := l_dist_tot + l_dist_amount;
3463: l_salesrep_count := l_salesrep_count + 1;
3464: IF l_salesrep_count = l_no_of_salesreps AND
3465: l_dist_tot <> p_revenue_amount

Line 3487: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate

3483: l_dist_acctd_amount :=
3484: ARPCURR.functional_amount(
3485: amount => l_dist_amount
3486: , currency_code => arp_global.functional_currency
3487: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate
3488: , precision => NULL
3489: , min_acc_unit => NULL );
3490: --
3491: -- Step 1: Debit earned revenue

Line 3510: ,AR_RAAPI_UTIL.g_cust_trx_type_id

3506: ,NULL
3507: ,l_dist_amount
3508: ,NULL
3509: ,NULL
3510: ,AR_RAAPI_UTIL.g_cust_trx_type_id
3511: ,c1.salesrep_id
3512: ,p_inventory_item_id
3513: ,p_memo_line_id
3514: ,l_warehouse_id

Line 3569: ,AR_RAAPI_UTIL.g_cust_trx_type_id

3565: ,NULL
3566: ,l_dist_tot
3567: ,NULL
3568: ,NULL
3569: ,AR_RAAPI_UTIL.g_cust_trx_type_id
3570: ,c1.salesrep_id
3571: ,p_inventory_item_id
3572: ,p_memo_line_id
3573: ,l_warehouse_id

Line 3734: l_dist_amount := arpcurr.currround(p_revenue_amount ,AR_RAAPI_UTIL.g_trx_currency);

3730: FOR gld in c_dist LOOP
3731:
3732: /* set amounts for adjustment */ /* bug 5644810 added IF condition */
3733: IF gld.code_combination_id IS NULL THEN
3734: l_dist_amount := arpcurr.currround(p_revenue_amount ,AR_RAAPI_UTIL.g_trx_currency);
3735: ELSE
3736: l_dist_amount := arpcurr.currround(p_revenue_amount * gld.percent / 100,
3737: AR_RAAPI_UTIL.g_trx_currency);
3738: END IF;

Line 3737: AR_RAAPI_UTIL.g_trx_currency);

3733: IF gld.code_combination_id IS NULL THEN
3734: l_dist_amount := arpcurr.currround(p_revenue_amount ,AR_RAAPI_UTIL.g_trx_currency);
3735: ELSE
3736: l_dist_amount := arpcurr.currround(p_revenue_amount * gld.percent / 100,
3737: AR_RAAPI_UTIL.g_trx_currency);
3738: END IF;
3739: l_dist_percent := ROUND (((l_dist_amount / gld.extended_amount) * 100), 4);
3740:
3741: l_dist_acctd_amount :=

Line 3745: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate

3741: l_dist_acctd_amount :=
3742: ARPCURR.functional_amount(
3743: amount => l_dist_amount
3744: , currency_code => arp_global.functional_currency
3745: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate
3746: , precision => NULL
3747: , min_acc_unit => NULL );
3748: --
3749: -- Step 1: Debit earned revenue

Line 3767: ,AR_RAAPI_UTIL.g_cust_trx_type_id

3763: ,NULL
3764: ,l_dist_amount
3765: ,NULL
3766: ,NULL
3767: ,AR_RAAPI_UTIL.g_cust_trx_type_id
3768: ,NULL -- srep id
3769: ,p_inventory_item_id
3770: ,p_memo_line_id
3771: ,gld.warehouse_id

Line 3837: ,AR_RAAPI_UTIL.g_cust_trx_type_id

3833: ,NULL
3834: ,l_dist_amount
3835: ,NULL
3836: ,NULL
3837: ,AR_RAAPI_UTIL.g_cust_trx_type_id
3838: ,NULL -- srep_Id
3839: ,p_inventory_item_id
3840: ,p_memo_line_id
3841: ,gld.warehouse_id

Line 3994: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

3990: ,ra_customer_trx_lines l
3991: WHERE d.customer_trx_line_id = l.customer_trx_line_id
3992: AND d.account_class = 'REV'
3993: AND l.line_type = 'LINE'
3994: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
3995: AND d.account_class IN ('REV','UNEARN','UNBILL')
3996: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
3997: l.customer_trx_line_id)
3998: AND NVL(l.inventory_item_id,0) =

Line 3996: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,

3992: AND d.account_class = 'REV'
3993: AND l.line_type = 'LINE'
3994: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
3995: AND d.account_class IN ('REV','UNEARN','UNBILL')
3996: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
3997: l.customer_trx_line_id)
3998: AND NVL(l.inventory_item_id,0) =
3999: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4000: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

Line 3999: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

3995: AND d.account_class IN ('REV','UNEARN','UNBILL')
3996: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
3997: l.customer_trx_line_id)
3998: AND NVL(l.inventory_item_id,0) =
3999: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4000: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4001: AND l.inventory_item_id = mic.inventory_item_id(+)
4002: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4003: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

Line 4000: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

3996: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
3997: l.customer_trx_line_id)
3998: AND NVL(l.inventory_item_id,0) =
3999: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4000: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4001: AND l.inventory_item_id = mic.inventory_item_id(+)
4002: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4003: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4004: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

Line 4002: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

3998: AND NVL(l.inventory_item_id,0) =
3999: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4000: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4001: AND l.inventory_item_id = mic.inventory_item_id(+)
4002: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4003: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4004: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4005: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4006: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,

Line 4003: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

3999: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4000: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4001: AND l.inventory_item_id = mic.inventory_item_id(+)
4002: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4003: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4004: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4005: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4006: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4007: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,

Line 4004: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

4000: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4001: AND l.inventory_item_id = mic.inventory_item_id(+)
4002: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4003: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4004: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4005: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4006: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4007: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4008: NVL(l.accounting_rule_duration,0),0),0),0) <= 1;

Line 4005: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,

4001: AND l.inventory_item_id = mic.inventory_item_id(+)
4002: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4003: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4004: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4005: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4006: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4007: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4008: NVL(l.accounting_rule_duration,0),0),0),0) <= 1;
4009:

Line 4006: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,

4002: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4003: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4004: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4005: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4006: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4007: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4008: NVL(l.accounting_rule_duration,0),0),0),0) <= 1;
4009:
4010: CURSOR c_lines_from IS

Line 4007: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,

4003: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4004: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4005: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4006: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4007: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4008: NVL(l.accounting_rule_duration,0),0),0),0) <= 1;
4009:
4010: CURSOR c_lines_from IS
4011: SELECT l.line_number

Line 4023: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

4019: ,ra_customer_trx_lines l
4020: WHERE d.customer_trx_line_id = l.customer_trx_line_id
4021: AND d.account_class = 'REV'
4022: AND l.line_type = 'LINE'
4023: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4024: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
4025: l.customer_trx_line_id)
4026: AND NVL(l.inventory_item_id,0) =
4027: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

Line 4024: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,

4020: WHERE d.customer_trx_line_id = l.customer_trx_line_id
4021: AND d.account_class = 'REV'
4022: AND l.line_type = 'LINE'
4023: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4024: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
4025: l.customer_trx_line_id)
4026: AND NVL(l.inventory_item_id,0) =
4027: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4028: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

Line 4027: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

4023: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4024: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
4025: l.customer_trx_line_id)
4026: AND NVL(l.inventory_item_id,0) =
4027: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4028: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4029: AND l.inventory_item_id = mic.inventory_item_id(+)
4030: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4031: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

Line 4028: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

4024: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
4025: l.customer_trx_line_id)
4026: AND NVL(l.inventory_item_id,0) =
4027: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4028: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4029: AND l.inventory_item_id = mic.inventory_item_id(+)
4030: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4031: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4032: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

Line 4030: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

4026: AND NVL(l.inventory_item_id,0) =
4027: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4028: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4029: AND l.inventory_item_id = mic.inventory_item_id(+)
4030: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4031: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4032: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4033: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4034: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,

Line 4031: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

4027: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4028: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4029: AND l.inventory_item_id = mic.inventory_item_id(+)
4030: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4031: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4032: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4033: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4034: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4035: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,

Line 4032: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

4028: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4029: AND l.inventory_item_id = mic.inventory_item_id(+)
4030: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4031: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4032: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4033: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4034: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4035: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4036: NVL(l.accounting_rule_duration,0),0),0),0) <= 1

Line 4033: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,

4029: AND l.inventory_item_id = mic.inventory_item_id(+)
4030: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4031: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4032: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4033: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4034: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4035: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4036: NVL(l.accounting_rule_duration,0),0),0),0) <= 1
4037: GROUP BY l.line_number

Line 4034: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,

4030: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4031: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4032: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4033: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4034: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4035: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4036: NVL(l.accounting_rule_duration,0),0),0),0) <= 1
4037: GROUP BY l.line_number
4038: ,l.customer_trx_line_id

Line 4035: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,

4031: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4032: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4033: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4034: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4035: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4036: NVL(l.accounting_rule_duration,0),0),0),0) <= 1
4037: GROUP BY l.line_number
4038: ,l.customer_trx_line_id
4039: ,l.memo_line_id

Line 4047: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

4043: CURSOR c_line_salesrep_amount IS
4044: SELECT SUM(NVL(revenue_amount_split,0))
4045: FROM ra_cust_trx_line_salesreps
4046: WHERE customer_trx_line_id = l_line_id
4047: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4048: AND salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)
4049: AND NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));
4050:
4051: CURSOR c_tax_rate_count IS

Line 4048: AND salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)

4044: SELECT SUM(NVL(revenue_amount_split,0))
4045: FROM ra_cust_trx_line_salesreps
4046: WHERE customer_trx_line_id = l_line_id
4047: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4048: AND salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)
4049: AND NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));
4050:
4051: CURSOR c_tax_rate_count IS
4052: SELECT NVL(COUNT(DISTINCT tax.item_exception_rate_id||

Line 4049: AND NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));

4045: FROM ra_cust_trx_line_salesreps
4046: WHERE customer_trx_line_id = l_line_id
4047: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4048: AND salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)
4049: AND NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));
4050:
4051: CURSOR c_tax_rate_count IS
4052: SELECT NVL(COUNT(DISTINCT tax.item_exception_rate_id||
4053: tax.tax_exemption_id|| tax.vat_tax_id||

Line 4058: WHERE line.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

4054: tax.sales_tax_id|| tax.tax_rate|| tax.tax_precedence),0)
4055: FROM ra_customer_trx_lines line
4056: ,mtl_item_categories mic
4057: ,ra_customer_trx_lines tax
4058: WHERE line.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4059: AND tax.line_type = 'TAX'
4060: AND line.customer_trx_line_id = tax.link_to_cust_trx_line_id
4061: AND line.customer_trx_line_id IN
4062: (NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id, line.customer_trx_line_id),

Line 4062: (NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id, line.customer_trx_line_id),

4058: WHERE line.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4059: AND tax.line_type = 'TAX'
4060: AND line.customer_trx_line_id = tax.link_to_cust_trx_line_id
4061: AND line.customer_trx_line_id IN
4062: (NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id, line.customer_trx_line_id),
4063: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id, line.customer_trx_line_id))
4064: AND NVL(line.inventory_item_id,0) IN
4065: (NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(line.inventory_item_id,0)),
4066: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))

Line 4063: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id, line.customer_trx_line_id))

4059: AND tax.line_type = 'TAX'
4060: AND line.customer_trx_line_id = tax.link_to_cust_trx_line_id
4061: AND line.customer_trx_line_id IN
4062: (NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id, line.customer_trx_line_id),
4063: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id, line.customer_trx_line_id))
4064: AND NVL(line.inventory_item_id,0) IN
4065: (NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(line.inventory_item_id,0)),
4066: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))
4067: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

Line 4065: (NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(line.inventory_item_id,0)),

4061: AND line.customer_trx_line_id IN
4062: (NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id, line.customer_trx_line_id),
4063: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id, line.customer_trx_line_id))
4064: AND NVL(line.inventory_item_id,0) IN
4065: (NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(line.inventory_item_id,0)),
4066: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))
4067: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4068: AND line.inventory_item_id = mic.inventory_item_id(+)
4069: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

Line 4066: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))

4062: (NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id, line.customer_trx_line_id),
4063: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id, line.customer_trx_line_id))
4064: AND NVL(line.inventory_item_id,0) IN
4065: (NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(line.inventory_item_id,0)),
4066: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))
4067: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4068: AND line.inventory_item_id = mic.inventory_item_id(+)
4069: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4070: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR

Line 4067: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

4063: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id, line.customer_trx_line_id))
4064: AND NVL(line.inventory_item_id,0) IN
4065: (NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(line.inventory_item_id,0)),
4066: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))
4067: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4068: AND line.inventory_item_id = mic.inventory_item_id(+)
4069: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4070: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR
4071: NVL(AR_RAAPI_UTIL.g_to_category_id,0) =

Line 4069: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

4065: (NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(line.inventory_item_id,0)),
4066: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))
4067: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4068: AND line.inventory_item_id = mic.inventory_item_id(+)
4069: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4070: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR
4071: NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4072: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id))
4073: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;

Line 4070: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR

4066: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))
4067: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4068: AND line.inventory_item_id = mic.inventory_item_id(+)
4069: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4070: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR
4071: NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4072: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id))
4073: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
4074:

Line 4071: NVL(AR_RAAPI_UTIL.g_to_category_id,0) =

4067: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4068: AND line.inventory_item_id = mic.inventory_item_id(+)
4069: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4070: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR
4071: NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4072: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id))
4073: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
4074:
4075: CURSOR c_lines_to_total IS

Line 4072: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id))

4068: AND line.inventory_item_id = mic.inventory_item_id(+)
4069: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4070: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR
4071: NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4072: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id))
4073: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
4074:
4075: CURSOR c_lines_to_total IS
4076: SELECT NVL(SUM(d.amount),0) amount

Line 4073: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;

4069: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4070: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR
4071: NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4072: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id))
4073: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
4074:
4075: CURSOR c_lines_to_total IS
4076: SELECT NVL(SUM(d.amount),0) amount
4077: FROM ra_cust_trx_line_gl_dist d

Line 4083: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

4079: ,ra_customer_trx_lines l
4080: WHERE d.customer_trx_line_id = l.customer_trx_line_id
4081: AND d.account_class = 'REV'
4082: AND l.line_type = 'LINE'
4083: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4084: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4085: l.customer_trx_line_id)
4086: AND NVL(l.inventory_item_id,0) =
4087: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))

Line 4084: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,

4080: WHERE d.customer_trx_line_id = l.customer_trx_line_id
4081: AND d.account_class = 'REV'
4082: AND l.line_type = 'LINE'
4083: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4084: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4085: l.customer_trx_line_id)
4086: AND NVL(l.inventory_item_id,0) =
4087: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4088: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

Line 4087: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))

4083: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4084: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4085: l.customer_trx_line_id)
4086: AND NVL(l.inventory_item_id,0) =
4087: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4088: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4089: AND l.inventory_item_id = mic.inventory_item_id(+)
4090: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4091: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)

Line 4088: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

4084: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4085: l.customer_trx_line_id)
4086: AND NVL(l.inventory_item_id,0) =
4087: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4088: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4089: AND l.inventory_item_id = mic.inventory_item_id(+)
4090: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4091: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4092: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

Line 4090: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =

4086: AND NVL(l.inventory_item_id,0) =
4087: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4088: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4089: AND l.inventory_item_id = mic.inventory_item_id(+)
4090: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4091: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4092: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4093: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4094: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,

Line 4091: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)

4087: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4088: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4089: AND l.inventory_item_id = mic.inventory_item_id(+)
4090: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4091: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4092: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4093: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4094: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4095: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,

Line 4092: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

4088: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4089: AND l.inventory_item_id = mic.inventory_item_id(+)
4090: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4091: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4092: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4093: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4094: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4095: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4096: NVL(l.accounting_rule_duration,0),2),2),2) > 1;

Line 4093: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,

4089: AND l.inventory_item_id = mic.inventory_item_id(+)
4090: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4091: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4092: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4093: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4094: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4095: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4096: NVL(l.accounting_rule_duration,0),2),2),2) > 1;
4097:

Line 4094: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,

4090: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4091: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4092: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4093: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4094: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4095: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4096: NVL(l.accounting_rule_duration,0),2),2),2) > 1;
4097:
4098: CURSOR c_line_to_count IS

Line 4095: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,

4091: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4092: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4093: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4094: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4095: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4096: NVL(l.accounting_rule_duration,0),2),2),2) > 1;
4097:
4098: CURSOR c_line_to_count IS
4099: SELECT COUNT(*)

Line 4102: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

4098: CURSOR c_line_to_count IS
4099: SELECT COUNT(*)
4100: FROM mtl_item_categories mic
4101: ,ra_customer_trx_lines l
4102: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4103: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4104: l.customer_trx_line_id)
4105: AND NVL(l.inventory_item_id,0) =
4106: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))

Line 4103: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,

4099: SELECT COUNT(*)
4100: FROM mtl_item_categories mic
4101: ,ra_customer_trx_lines l
4102: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4103: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4104: l.customer_trx_line_id)
4105: AND NVL(l.inventory_item_id,0) =
4106: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4107: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

Line 4106: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))

4102: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4103: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4104: l.customer_trx_line_id)
4105: AND NVL(l.inventory_item_id,0) =
4106: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4107: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4108: AND l.inventory_item_id = mic.inventory_item_id(+)
4109: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4110: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)

Line 4107: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

4103: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4104: l.customer_trx_line_id)
4105: AND NVL(l.inventory_item_id,0) =
4106: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4107: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4108: AND l.inventory_item_id = mic.inventory_item_id(+)
4109: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4110: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4111: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

Line 4109: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =

4105: AND NVL(l.inventory_item_id,0) =
4106: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4107: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4108: AND l.inventory_item_id = mic.inventory_item_id(+)
4109: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4110: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4111: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4112: AND l.line_type = 'LINE'
4113: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,

Line 4110: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)

4106: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4107: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4108: AND l.inventory_item_id = mic.inventory_item_id(+)
4109: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4110: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4111: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4112: AND l.line_type = 'LINE'
4113: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4114: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,

Line 4111: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

4107: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4108: AND l.inventory_item_id = mic.inventory_item_id(+)
4109: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4110: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4111: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4112: AND l.line_type = 'LINE'
4113: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4114: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4115: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,

Line 4113: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,

4109: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4110: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4111: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4112: AND l.line_type = 'LINE'
4113: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4114: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4115: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4116: NVL(l.accounting_rule_duration,0),2),2),2) > 1;
4117:

Line 4114: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,

4110: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4111: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4112: AND l.line_type = 'LINE'
4113: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4114: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4115: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4116: NVL(l.accounting_rule_duration,0),2),2),2) > 1;
4117:
4118: CURSOR c_lines_to IS

Line 4115: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,

4111: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4112: AND l.line_type = 'LINE'
4113: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4114: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4115: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4116: NVL(l.accounting_rule_duration,0),2),2),2) > 1;
4117:
4118: CURSOR c_lines_to IS
4119: SELECT l.line_number

Line 4132: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

4128: ,ra_customer_trx_lines l
4129: WHERE d.customer_trx_line_id = l.customer_trx_line_id
4130: AND d.account_class = 'REV'
4131: AND l.line_type = 'LINE'
4132: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4133: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4134: l.customer_trx_line_id)
4135: AND NVL(l.inventory_item_id,0) =
4136: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))

Line 4133: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,

4129: WHERE d.customer_trx_line_id = l.customer_trx_line_id
4130: AND d.account_class = 'REV'
4131: AND l.line_type = 'LINE'
4132: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4133: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4134: l.customer_trx_line_id)
4135: AND NVL(l.inventory_item_id,0) =
4136: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4137: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

Line 4136: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))

4132: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4133: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4134: l.customer_trx_line_id)
4135: AND NVL(l.inventory_item_id,0) =
4136: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4137: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4138: AND l.inventory_item_id = mic.inventory_item_id(+)
4139: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4140: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)

Line 4137: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

4133: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4134: l.customer_trx_line_id)
4135: AND NVL(l.inventory_item_id,0) =
4136: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4137: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4138: AND l.inventory_item_id = mic.inventory_item_id(+)
4139: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4140: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4141: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

Line 4139: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =

4135: AND NVL(l.inventory_item_id,0) =
4136: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4137: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4138: AND l.inventory_item_id = mic.inventory_item_id(+)
4139: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4140: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4141: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4142: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4143: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,

Line 4140: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)

4136: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4137: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4138: AND l.inventory_item_id = mic.inventory_item_id(+)
4139: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4140: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4141: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4142: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4143: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4144: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,

Line 4141: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

4137: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4138: AND l.inventory_item_id = mic.inventory_item_id(+)
4139: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4140: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4141: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4142: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4143: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4144: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4145: NVL(l.accounting_rule_duration,0),2),2),2) > 1

Line 4142: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,

4138: AND l.inventory_item_id = mic.inventory_item_id(+)
4139: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4140: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4141: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4142: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4143: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4144: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4145: NVL(l.accounting_rule_duration,0),2),2),2) > 1
4146: GROUP BY l.line_number

Line 4143: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,

4139: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4140: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4141: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4142: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4143: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4144: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4145: NVL(l.accounting_rule_duration,0),2),2),2) > 1
4146: GROUP BY l.line_number
4147: ,l.customer_trx_line_id

Line 4144: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,

4140: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4141: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4142: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4143: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4144: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4145: NVL(l.accounting_rule_duration,0),2),2),2) > 1
4146: GROUP BY l.line_number
4147: ,l.customer_trx_line_id
4148: ,l.memo_line_id

Line 4191: AR_RAAPI_UTIL.Constant_System_Values;

4187: l_rev_adj_rec.gl_date := trunc(p_rev_adj_rec.gl_date);
4188:
4189: l_rev_adj_rec.adjustment_type := 'LL';
4190:
4191: AR_RAAPI_UTIL.Constant_System_Values;
4192: AR_RAAPI_UTIL.Initialize_Globals;
4193: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
4194: ,p_rev_adj_rec => l_rev_adj_rec
4195: ,p_validation_level => p_validation_level

Line 4192: AR_RAAPI_UTIL.Initialize_Globals;

4188:
4189: l_rev_adj_rec.adjustment_type := 'LL';
4190:
4191: AR_RAAPI_UTIL.Constant_System_Values;
4192: AR_RAAPI_UTIL.Initialize_Globals;
4193: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
4194: ,p_rev_adj_rec => l_rev_adj_rec
4195: ,p_validation_level => p_validation_level
4196: ,x_return_status => x_return_status

Line 4193: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE

4189: l_rev_adj_rec.adjustment_type := 'LL';
4190:
4191: AR_RAAPI_UTIL.Constant_System_Values;
4192: AR_RAAPI_UTIL.Initialize_Globals;
4193: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
4194: ,p_rev_adj_rec => l_rev_adj_rec
4195: ,p_validation_level => p_validation_level
4196: ,x_return_status => x_return_status
4197: ,x_msg_count => x_msg_count

Line 4204: IF NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,-100) =

4200: THEN
4201: RAISE FND_API.G_EXC_ERROR;
4202: END IF;
4203:
4204: IF NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,-100) =
4205: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,-200)
4206: THEN
4207: FND_MESSAGE.SET_NAME (application => 'AR',
4208: name => 'AR_RA_SAME_FROM_AND_TO_LINES');

Line 4205: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,-200)

4201: RAISE FND_API.G_EXC_ERROR;
4202: END IF;
4203:
4204: IF NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,-100) =
4205: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,-200)
4206: THEN
4207: FND_MESSAGE.SET_NAME (application => 'AR',
4208: name => 'AR_RA_SAME_FROM_AND_TO_LINES');
4209: RAISE invalid_same_lines;

Line 4211: IF NVL(AR_RAAPI_UTIL.g_from_category_id,-100) =

4207: FND_MESSAGE.SET_NAME (application => 'AR',
4208: name => 'AR_RA_SAME_FROM_AND_TO_LINES');
4209: RAISE invalid_same_lines;
4210: END IF;
4211: IF NVL(AR_RAAPI_UTIL.g_from_category_id,-100) =
4212: NVL(AR_RAAPI_UTIL.g_to_category_id,-200)
4213: THEN
4214: FND_MESSAGE.SET_NAME (application => 'AR',
4215: name => 'AR_RA_SAME_FROM_AND_TO_CATS');

Line 4212: NVL(AR_RAAPI_UTIL.g_to_category_id,-200)

4208: name => 'AR_RA_SAME_FROM_AND_TO_LINES');
4209: RAISE invalid_same_lines;
4210: END IF;
4211: IF NVL(AR_RAAPI_UTIL.g_from_category_id,-100) =
4212: NVL(AR_RAAPI_UTIL.g_to_category_id,-200)
4213: THEN
4214: FND_MESSAGE.SET_NAME (application => 'AR',
4215: name => 'AR_RA_SAME_FROM_AND_TO_CATS');
4216: RAISE invalid_same_lines;

Line 4218: IF NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,-100) =

4214: FND_MESSAGE.SET_NAME (application => 'AR',
4215: name => 'AR_RA_SAME_FROM_AND_TO_CATS');
4216: RAISE invalid_same_lines;
4217: END IF;
4218: IF NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,-100) =
4219: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,-200)
4220: THEN
4221: FND_MESSAGE.SET_NAME (application => 'AR',
4222: name => 'AR_RA_SAME_FROM_AND_TO_ITEMS');

Line 4219: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,-200)

4215: name => 'AR_RA_SAME_FROM_AND_TO_CATS');
4216: RAISE invalid_same_lines;
4217: END IF;
4218: IF NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,-100) =
4219: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,-200)
4220: THEN
4221: FND_MESSAGE.SET_NAME (application => 'AR',
4222: name => 'AR_RA_SAME_FROM_AND_TO_ITEMS');
4223: RAISE invalid_same_lines;

Line 4239: AR_RAAPI_UTIL.Validate_Amount

4235: OPEN c_lines_from_total;
4236: FETCH c_lines_from_total INTO l_lines_from_total;
4237: CLOSE c_lines_from_total;
4238:
4239: AR_RAAPI_UTIL.Validate_Amount
4240: (p_init_msg_list => FND_API.G_FALSE
4241: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
4242: ,p_adjustment_type => 'LL'
4243: ,p_amount_mode => p_rev_adj_rec.amount_mode

Line 4241: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id

4237: CLOSE c_lines_from_total;
4238:
4239: AR_RAAPI_UTIL.Validate_Amount
4240: (p_init_msg_list => FND_API.G_FALSE
4241: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
4242: ,p_adjustment_type => 'LL'
4243: ,p_amount_mode => p_rev_adj_rec.amount_mode
4244: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
4245: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

Line 4244: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id

4240: (p_init_msg_list => FND_API.G_FALSE
4241: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
4242: ,p_adjustment_type => 'LL'
4243: ,p_amount_mode => p_rev_adj_rec.amount_mode
4244: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
4245: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
4246: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
4247: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
4248: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

Line 4245: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

4241: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
4242: ,p_adjustment_type => 'LL'
4243: ,p_amount_mode => p_rev_adj_rec.amount_mode
4244: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
4245: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
4246: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
4247: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
4248: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
4249: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

Line 4246: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id

4242: ,p_adjustment_type => 'LL'
4243: ,p_amount_mode => p_rev_adj_rec.amount_mode
4244: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
4245: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
4246: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
4247: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
4248: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
4249: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
4250: ,p_revenue_amount_in => p_rev_adj_rec.amount

Line 4248: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

4244: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
4245: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
4246: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
4247: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
4248: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
4249: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
4250: ,p_revenue_amount_in => p_rev_adj_rec.amount
4251: ,p_revenue_percent => p_rev_adj_rec.percent
4252: ,p_revenue_amount_out => l_revenue_amount

Line 4249: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

4245: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
4246: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
4247: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
4248: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
4249: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
4250: ,p_revenue_amount_in => p_rev_adj_rec.amount
4251: ,p_revenue_percent => p_rev_adj_rec.percent
4252: ,p_revenue_amount_out => l_revenue_amount
4253: ,p_adjustable_amount_out => l_adj_inv_total

Line 4276: AR_RAAPI_UTIL.g_from_cust_trx_line_id IS NULL AND

4272: FETCH c_line_to_count INTO l_no_of_lines_to;
4273: CLOSE c_line_to_count;
4274:
4275: IF (l_no_of_lines_from = 0 OR l_no_of_lines_to = 0) AND
4276: AR_RAAPI_UTIL.g_from_cust_trx_line_id IS NULL AND
4277: AR_RAAPI_UTIL.g_to_cust_trx_line_id IS NULL
4278: THEN
4279: RAISE invalid_lines;
4280: END IF;

Line 4277: AR_RAAPI_UTIL.g_to_cust_trx_line_id IS NULL

4273: CLOSE c_line_to_count;
4274:
4275: IF (l_no_of_lines_from = 0 OR l_no_of_lines_to = 0) AND
4276: AR_RAAPI_UTIL.g_from_cust_trx_line_id IS NULL AND
4277: AR_RAAPI_UTIL.g_to_cust_trx_line_id IS NULL
4278: THEN
4279: RAISE invalid_lines;
4280: END IF;
4281:

Line 4308: l_line_adjustable / l_adj_inv_total,AR_RAAPI_UTIL.g_trx_precision);

4304: END IF;
4305: IF l_line_adjustable <> 0
4306: THEN
4307: l_revenue_amount_prorata := ROUND(l_revenue_amount *
4308: l_line_adjustable / l_adj_inv_total,AR_RAAPI_UTIL.g_trx_precision);
4309: l_line_from_count := l_line_from_count + 1;
4310: l_total_adjusted := l_total_adjusted + l_revenue_amount_prorata;
4311:
4312: IF l_line_from_count = l_no_of_lines_from AND

Line 4321: ,AR_RAAPI_UTIL.g_customer_trx_id

4317: END IF;
4318: IF c1.accounting_rule_id IS NOT NULL
4319: THEN
4320: debit_credit (c1.customer_trx_line_id
4321: ,AR_RAAPI_UTIL.g_customer_trx_id
4322: ,AR_RAAPI_UTIL.g_from_salesrep_id
4323: ,l_revenue_amount_prorata
4324: ,l_rev_adj_rec.gl_date
4325: ,arp_global.sysparam.rev_transfer_clear_ccid

Line 4322: ,AR_RAAPI_UTIL.g_from_salesrep_id

4318: IF c1.accounting_rule_id IS NOT NULL
4319: THEN
4320: debit_credit (c1.customer_trx_line_id
4321: ,AR_RAAPI_UTIL.g_customer_trx_id
4322: ,AR_RAAPI_UTIL.g_from_salesrep_id
4323: ,l_revenue_amount_prorata
4324: ,l_rev_adj_rec.gl_date
4325: ,arp_global.sysparam.rev_transfer_clear_ccid
4326: ,c1.inventory_item_id

Line 4331: ,AR_RAAPI_UTIL.g_customer_trx_id

4327: ,c1.memo_line_id
4328: ,x_adjustment_id);
4329: ELSE
4330: no_rule_debit_credit (c1.customer_trx_line_id
4331: ,AR_RAAPI_UTIL.g_customer_trx_id
4332: ,AR_RAAPI_UTIL.g_from_salesrep_id
4333: ,l_revenue_amount_prorata
4334: ,l_rev_adj_rec.gl_date
4335: ,arp_global.sysparam.rev_transfer_clear_ccid

Line 4332: ,AR_RAAPI_UTIL.g_from_salesrep_id

4328: ,x_adjustment_id);
4329: ELSE
4330: no_rule_debit_credit (c1.customer_trx_line_id
4331: ,AR_RAAPI_UTIL.g_customer_trx_id
4332: ,AR_RAAPI_UTIL.g_from_salesrep_id
4333: ,l_revenue_amount_prorata
4334: ,l_rev_adj_rec.gl_date
4335: ,arp_global.sysparam.rev_transfer_clear_ccid
4336: ,c1.inventory_item_id

Line 4351: AR_RAAPI_UTIL.g_trx_precision);

4347: IF l_lines_to_total = 0
4348: THEN
4349: l_revenue_amount_prorata :=
4350: ROUND(l_revenue_amount / l_no_of_lines_to,
4351: AR_RAAPI_UTIL.g_trx_precision);
4352: ELSE
4353: l_revenue_amount_prorata := ROUND(l_revenue_amount * c1.amount /
4354: l_lines_to_total, AR_RAAPI_UTIL.g_trx_precision);
4355: END IF;

Line 4354: l_lines_to_total, AR_RAAPI_UTIL.g_trx_precision);

4350: ROUND(l_revenue_amount / l_no_of_lines_to,
4351: AR_RAAPI_UTIL.g_trx_precision);
4352: ELSE
4353: l_revenue_amount_prorata := ROUND(l_revenue_amount * c1.amount /
4354: l_lines_to_total, AR_RAAPI_UTIL.g_trx_precision);
4355: END IF;
4356: l_line_to_count := l_line_to_count + 1;
4357: l_total_adjusted := l_total_adjusted + l_revenue_amount_prorata;
4358: IF l_line_to_count = l_no_of_lines_to AND

Line 4370: ,AR_RAAPI_UTIL.g_customer_trx_id

4366: THEN
4367: IF NVL(c1.accounting_rule_duration,0) > 1
4368: THEN
4369: cr_target_line_unearned(c1.customer_trx_line_id
4370: ,AR_RAAPI_UTIL.g_customer_trx_id
4371: ,l_revenue_amount_prorata
4372: ,l_rev_adj_rec.gl_date
4373: ,c1.inventory_item_id
4374: ,c1.memo_line_id

Line 4382: ,AR_RAAPI_UTIL.g_customer_trx_id

4378: l_credit_ccid := arp_global.sysparam.rev_transfer_clear_ccid;
4379: END IF;
4380:
4381: debit_credit (c1.customer_trx_line_id
4382: ,AR_RAAPI_UTIL.g_customer_trx_id
4383: ,NULL
4384: ,l_revenue_amount_prorata * -1
4385: ,l_rev_adj_rec.gl_date
4386: ,l_credit_ccid

Line 4392: ,AR_RAAPI_UTIL.g_customer_trx_id

4388: ,c1.memo_line_id
4389: ,x_adjustment_id);
4390: ELSE
4391: no_rule_debit_credit (c1.customer_trx_line_id
4392: ,AR_RAAPI_UTIL.g_customer_trx_id
4393: ,NULL
4394: ,l_revenue_amount_prorata * -1
4395: ,l_rev_adj_rec.gl_date
4396: ,arp_global.sysparam.rev_transfer_clear_ccid

Line 4656: ,AR_RAAPI_UTIL.g_customer_trx_id

4652: ,org_id ) -- Bug 4607673
4653: VALUES
4654: (x_adjustment_id
4655: ,x_adjustment_number
4656: ,AR_RAAPI_UTIL.g_customer_trx_id
4657: ,SYSDATE
4658: ,AR_RAAPI_UTIL.g_from_salesrep_id
4659: ,AR_RAAPI_UTIL.g_to_salesrep_id
4660: ,AR_RAAPI_UTIL.g_from_salesgroup_id

Line 4658: ,AR_RAAPI_UTIL.g_from_salesrep_id

4654: (x_adjustment_id
4655: ,x_adjustment_number
4656: ,AR_RAAPI_UTIL.g_customer_trx_id
4657: ,SYSDATE
4658: ,AR_RAAPI_UTIL.g_from_salesrep_id
4659: ,AR_RAAPI_UTIL.g_to_salesrep_id
4660: ,AR_RAAPI_UTIL.g_from_salesgroup_id
4661: ,AR_RAAPI_UTIL.g_to_salesgroup_id
4662: ,p_rev_adj_rec.adjustment_type

Line 4659: ,AR_RAAPI_UTIL.g_to_salesrep_id

4655: ,x_adjustment_number
4656: ,AR_RAAPI_UTIL.g_customer_trx_id
4657: ,SYSDATE
4658: ,AR_RAAPI_UTIL.g_from_salesrep_id
4659: ,AR_RAAPI_UTIL.g_to_salesrep_id
4660: ,AR_RAAPI_UTIL.g_from_salesgroup_id
4661: ,AR_RAAPI_UTIL.g_to_salesgroup_id
4662: ,p_rev_adj_rec.adjustment_type
4663: ,p_rev_adj_rec.sales_credit_type

Line 4660: ,AR_RAAPI_UTIL.g_from_salesgroup_id

4656: ,AR_RAAPI_UTIL.g_customer_trx_id
4657: ,SYSDATE
4658: ,AR_RAAPI_UTIL.g_from_salesrep_id
4659: ,AR_RAAPI_UTIL.g_to_salesrep_id
4660: ,AR_RAAPI_UTIL.g_from_salesgroup_id
4661: ,AR_RAAPI_UTIL.g_to_salesgroup_id
4662: ,p_rev_adj_rec.adjustment_type
4663: ,p_rev_adj_rec.sales_credit_type
4664: ,p_rev_adj_rec.amount_mode

Line 4661: ,AR_RAAPI_UTIL.g_to_salesgroup_id

4657: ,SYSDATE
4658: ,AR_RAAPI_UTIL.g_from_salesrep_id
4659: ,AR_RAAPI_UTIL.g_to_salesrep_id
4660: ,AR_RAAPI_UTIL.g_from_salesgroup_id
4661: ,AR_RAAPI_UTIL.g_to_salesgroup_id
4662: ,p_rev_adj_rec.adjustment_type
4663: ,p_rev_adj_rec.sales_credit_type
4664: ,p_rev_adj_rec.amount_mode
4665: ,p_rev_adj_rec.amount

Line 4668: ,AR_RAAPI_UTIL.g_from_category_id

4664: ,p_rev_adj_rec.amount_mode
4665: ,p_rev_adj_rec.amount
4666: ,p_rev_adj_rec.percent
4667: ,p_rev_adj_rec.line_selection_mode
4668: ,AR_RAAPI_UTIL.g_from_category_id
4669: ,AR_RAAPI_UTIL.g_to_category_id
4670: ,AR_RAAPI_UTIL.g_from_inventory_item_id
4671: ,AR_RAAPI_UTIL.g_to_inventory_item_id
4672: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id

Line 4669: ,AR_RAAPI_UTIL.g_to_category_id

4665: ,p_rev_adj_rec.amount
4666: ,p_rev_adj_rec.percent
4667: ,p_rev_adj_rec.line_selection_mode
4668: ,AR_RAAPI_UTIL.g_from_category_id
4669: ,AR_RAAPI_UTIL.g_to_category_id
4670: ,AR_RAAPI_UTIL.g_from_inventory_item_id
4671: ,AR_RAAPI_UTIL.g_to_inventory_item_id
4672: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id
4673: ,AR_RAAPI_UTIL.g_to_cust_trx_line_id

Line 4670: ,AR_RAAPI_UTIL.g_from_inventory_item_id

4666: ,p_rev_adj_rec.percent
4667: ,p_rev_adj_rec.line_selection_mode
4668: ,AR_RAAPI_UTIL.g_from_category_id
4669: ,AR_RAAPI_UTIL.g_to_category_id
4670: ,AR_RAAPI_UTIL.g_from_inventory_item_id
4671: ,AR_RAAPI_UTIL.g_to_inventory_item_id
4672: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id
4673: ,AR_RAAPI_UTIL.g_to_cust_trx_line_id
4674: /*Bug 6731185 JVARKEY Making sure GL date has no timestamp*/

Line 4671: ,AR_RAAPI_UTIL.g_to_inventory_item_id

4667: ,p_rev_adj_rec.line_selection_mode
4668: ,AR_RAAPI_UTIL.g_from_category_id
4669: ,AR_RAAPI_UTIL.g_to_category_id
4670: ,AR_RAAPI_UTIL.g_from_inventory_item_id
4671: ,AR_RAAPI_UTIL.g_to_inventory_item_id
4672: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id
4673: ,AR_RAAPI_UTIL.g_to_cust_trx_line_id
4674: /*Bug 6731185 JVARKEY Making sure GL date has no timestamp*/
4675: ,trunc(p_rev_adj_rec.gl_date)

Line 4672: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id

4668: ,AR_RAAPI_UTIL.g_from_category_id
4669: ,AR_RAAPI_UTIL.g_to_category_id
4670: ,AR_RAAPI_UTIL.g_from_inventory_item_id
4671: ,AR_RAAPI_UTIL.g_to_inventory_item_id
4672: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id
4673: ,AR_RAAPI_UTIL.g_to_cust_trx_line_id
4674: /*Bug 6731185 JVARKEY Making sure GL date has no timestamp*/
4675: ,trunc(p_rev_adj_rec.gl_date)
4676: /*,p_rev_adj_rec.gl_date*/

Line 4673: ,AR_RAAPI_UTIL.g_to_cust_trx_line_id

4669: ,AR_RAAPI_UTIL.g_to_category_id
4670: ,AR_RAAPI_UTIL.g_from_inventory_item_id
4671: ,AR_RAAPI_UTIL.g_to_inventory_item_id
4672: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id
4673: ,AR_RAAPI_UTIL.g_to_cust_trx_line_id
4674: /*Bug 6731185 JVARKEY Making sure GL date has no timestamp*/
4675: ,trunc(p_rev_adj_rec.gl_date)
4676: /*,p_rev_adj_rec.gl_date*/
4677: ,p_rev_adj_rec.reason_code

Line 4804: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.revenue_percent_split / 100 , AR_RAAPI_UTIL.g_trx_currency);

4800: CLOSE c_line;
4801:
4802: FOR c1 in c_salesrep LOOP
4803:
4804: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.revenue_percent_split / 100 , AR_RAAPI_UTIL.g_trx_currency);
4805: l_dist_tot := l_dist_tot + l_dist_amount;
4806: l_salesrep_count := l_salesrep_count + 1;
4807: IF l_salesrep_count = l_no_of_salesreps AND
4808: l_dist_tot <> p_revenue_amount

Line 4829: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate

4825: l_dist_acctd_amount :=
4826: ARPCURR.functional_amount(
4827: amount => l_dist_amount
4828: , currency_code => arp_global.functional_currency
4829: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate
4830: , precision => NULL
4831: , min_acc_unit => NULL );
4832: --
4833: -- Initiate auto accounting procedure

Line 4848: ,AR_RAAPI_UTIL.g_cust_trx_type_id

4844: ,NULL
4845: ,l_dist_tot
4846: ,NULL
4847: ,NULL
4848: ,AR_RAAPI_UTIL.g_cust_trx_type_id
4849: ,c1.salesrep_id
4850: ,p_inventory_item_id
4851: ,p_memo_line_id
4852: ,l_warehouse_id

Line 5196: AR_RAAPI_UTIL.g_invoicing_rule_id IS NOT NULL

5192:
5193: /* 6615118 - create model distribution if srep is revenue type
5194: and transaction has rules */
5195: IF p_type = 'R' AND
5196: AR_RAAPI_UTIL.g_invoicing_rule_id IS NOT NULL
5197: THEN
5198: /* fetch these values for autoaccounting */
5199:
5200: IF NVL(g_line_id, -99) = p_cust_trx_line_id

Line 5243: ,AR_RAAPI_UTIL.g_cust_trx_type_id

5239: ,NULL
5240: ,p_amount
5241: ,NULL
5242: ,NULL
5243: ,AR_RAAPI_UTIL.g_cust_trx_type_id
5244: ,p_salesrep_id
5245: ,g_inventory_item_id
5246: ,g_memo_line_id
5247: ,g_warehouse_id

Line 5369: RETURN AR_RAAPI_UTIL.g_category_set_id;

5365:
5366: FUNCTION category_set_id
5367: RETURN VARCHAR2 IS
5368: BEGIN
5369: RETURN AR_RAAPI_UTIL.g_category_set_id;
5370: END category_set_id;
5371:
5372: FUNCTION inv_org_id
5373: RETURN VARCHAR2 IS

Line 5375: RETURN AR_RAAPI_UTIL.g_inv_org_id;

5371:
5372: FUNCTION inv_org_id
5373: RETURN VARCHAR2 IS
5374: BEGIN
5375: RETURN AR_RAAPI_UTIL.g_inv_org_id;
5376: END inv_org_id;
5377:
5378: -----------------------------------------------------------------------
5379: -- API name : Record_Acceptance

Line 5422: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

5418: WHERE l.customer_trx_id = p_customer_trx_id
5419: AND l.accounting_rule_id = r.rule_id(+)
5420: AND NVL(l.inventory_item_id,0) =
5421: NVL(p_inventory_item_id,NVL(l.inventory_item_id,0))
5422: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
5423: AND l.inventory_item_id = mic.inventory_item_id(+)
5424: AND NVL(p_category_id,0) =
5425: DECODE(p_category_id,NULL,0,mic.category_id)
5426: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

Line 5426: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

5422: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
5423: AND l.inventory_item_id = mic.inventory_item_id(+)
5424: AND NVL(p_category_id,0) =
5425: DECODE(p_category_id,NULL,0,mic.category_id)
5426: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
5427: AND l.line_type = 'LINE'
5428: AND NVL(r.deferred_revenue_flag,'N') <> 'Y';
5429:
5430: BEGIN

Line 5434: AR_RAAPI_UTIL.Constant_System_Values;

5430: BEGIN
5431: IF PG_DEBUG in ('Y', 'C') THEN
5432: arp_util.debug('AR_Revenue_Adjustment_PVT.record_acceptance()+');
5433: END IF;
5434: AR_RAAPI_UTIL.Constant_System_Values;
5435: AR_RAAPI_UTIL.Initialize_Globals;
5436: x_first_rev_adj_id := NULL;
5437: x_last_rev_adj_id := NULL;
5438: l_first_adj_num := NULL;

Line 5435: AR_RAAPI_UTIL.Initialize_Globals;

5431: IF PG_DEBUG in ('Y', 'C') THEN
5432: arp_util.debug('AR_Revenue_Adjustment_PVT.record_acceptance()+');
5433: END IF;
5434: AR_RAAPI_UTIL.Constant_System_Values;
5435: AR_RAAPI_UTIL.Initialize_Globals;
5436: x_first_rev_adj_id := NULL;
5437: x_last_rev_adj_id := NULL;
5438: l_first_adj_num := NULL;
5439: l_last_adj_num := NULL;