DBA Data[Home] [Help]

APPS.AR_REVENUE_ADJUSTMENT_PVT dependencies on AR_RAAPI_UTIL

Line 487: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

483: ,ra_customer_trx_lines l
484: ,ra_rules r
485: WHERE l.line_type = 'LINE'
486: AND l.autorule_complete_flag IS NULL
487: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
488: AND l.customer_trx_line_id =
489: NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,l.customer_trx_line_id)
490: AND l.accounting_rule_id = r.rule_id (+)
491: AND NVL(l.inventory_item_id,0) =

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

485: WHERE l.line_type = 'LINE'
486: AND l.autorule_complete_flag IS NULL
487: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
488: AND l.customer_trx_line_id =
489: NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,l.customer_trx_line_id)
490: AND l.accounting_rule_id = r.rule_id (+)
491: AND NVL(l.inventory_item_id,0) =
492: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
493: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

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

488: AND l.customer_trx_line_id =
489: NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,l.customer_trx_line_id)
490: AND l.accounting_rule_id = r.rule_id (+)
491: AND NVL(l.inventory_item_id,0) =
492: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
493: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
494: AND l.inventory_item_id = mic.inventory_item_id(+)
495: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
496: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

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

489: NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,l.customer_trx_line_id)
490: AND l.accounting_rule_id = r.rule_id (+)
491: AND NVL(l.inventory_item_id,0) =
492: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
493: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
494: AND l.inventory_item_id = mic.inventory_item_id(+)
495: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
496: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
497: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

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

491: AND NVL(l.inventory_item_id,0) =
492: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
493: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
494: AND l.inventory_item_id = mic.inventory_item_id(+)
495: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
496: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
497: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
498: AND ((AR_RAAPI_UTIL.g_from_salesrep_id IS NULL AND
499: AR_RAAPI_UTIL.g_from_salesgroup_id IS NULL)

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

492: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
493: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
494: AND l.inventory_item_id = mic.inventory_item_id(+)
495: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
496: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
497: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
498: AND ((AR_RAAPI_UTIL.g_from_salesrep_id IS NULL AND
499: AR_RAAPI_UTIL.g_from_salesgroup_id IS NULL)
500: OR EXISTS

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

493: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
494: AND l.inventory_item_id = mic.inventory_item_id(+)
495: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
496: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
497: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
498: AND ((AR_RAAPI_UTIL.g_from_salesrep_id IS NULL AND
499: AR_RAAPI_UTIL.g_from_salesgroup_id IS NULL)
500: OR EXISTS
501: (SELECT 'X'

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

494: AND l.inventory_item_id = mic.inventory_item_id(+)
495: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
496: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
497: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
498: AND ((AR_RAAPI_UTIL.g_from_salesrep_id IS NULL AND
499: AR_RAAPI_UTIL.g_from_salesgroup_id IS NULL)
500: OR EXISTS
501: (SELECT 'X'
502: FROM ra_cust_trx_line_salesreps ls

Line 499: AR_RAAPI_UTIL.g_from_salesgroup_id IS NULL)

495: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
496: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
497: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
498: AND ((AR_RAAPI_UTIL.g_from_salesrep_id IS NULL AND
499: AR_RAAPI_UTIL.g_from_salesgroup_id IS NULL)
500: OR EXISTS
501: (SELECT 'X'
502: FROM ra_cust_trx_line_salesreps ls
503: WHERE ls.customer_trx_line_id = l.customer_trx_line_id

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

501: (SELECT 'X'
502: FROM ra_cust_trx_line_salesreps ls
503: WHERE ls.customer_trx_line_id = l.customer_trx_line_id
504: AND ls.salesrep_id =
505: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,ls.salesrep_id)
506: AND NVL(ls.revenue_salesgroup_id, -9999) =
507: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,
508: NVL(ls.revenue_salesgroup_id, -9999))
509: GROUP BY ls.salesrep_id

Line 507: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,

503: WHERE ls.customer_trx_line_id = l.customer_trx_line_id
504: AND ls.salesrep_id =
505: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,ls.salesrep_id)
506: AND NVL(ls.revenue_salesgroup_id, -9999) =
507: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,
508: NVL(ls.revenue_salesgroup_id, -9999))
509: GROUP BY ls.salesrep_id
510: HAVING SUM(NVL(ls.revenue_percent_split,0)) <> 0));
511:

Line 524: AR_RAAPI_UTIL.Constant_System_Values;

520:
521: /*Bug 6731185 JVARKEY Making sure GL date has no timestamp*/
522: l_rev_adj_rec.gl_date := trunc(p_rev_adj_rec.gl_date);
523:
524: AR_RAAPI_UTIL.Constant_System_Values;
525: AR_RAAPI_UTIL.Initialize_Globals;
526: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
527: ,p_rev_adj_rec => l_rev_adj_rec
528: ,p_validation_level => p_validation_level

Line 525: AR_RAAPI_UTIL.Initialize_Globals;

521: /*Bug 6731185 JVARKEY Making sure GL date has no timestamp*/
522: l_rev_adj_rec.gl_date := trunc(p_rev_adj_rec.gl_date);
523:
524: AR_RAAPI_UTIL.Constant_System_Values;
525: AR_RAAPI_UTIL.Initialize_Globals;
526: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
527: ,p_rev_adj_rec => l_rev_adj_rec
528: ,p_validation_level => p_validation_level
529: ,x_return_status => x_return_status

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

522: l_rev_adj_rec.gl_date := trunc(p_rev_adj_rec.gl_date);
523:
524: AR_RAAPI_UTIL.Constant_System_Values;
525: AR_RAAPI_UTIL.Initialize_Globals;
526: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
527: ,p_rev_adj_rec => l_rev_adj_rec
528: ,p_validation_level => p_validation_level
529: ,x_return_status => x_return_status
530: ,x_msg_count => x_msg_count

Line 536: AR_RAAPI_UTIL.Validate_Amount

532: IF x_return_status = FND_API.G_RET_STS_SUCCESS
533: THEN
534: l_total_adjusted := 0;
535:
536: AR_RAAPI_UTIL.Validate_Amount
537: (p_init_msg_list => FND_API.G_FALSE
538: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
539: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
540: ,p_amount_mode => p_rev_adj_rec.amount_mode

Line 538: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id

534: l_total_adjusted := 0;
535:
536: AR_RAAPI_UTIL.Validate_Amount
537: (p_init_msg_list => FND_API.G_FALSE
538: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
539: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
540: ,p_amount_mode => p_rev_adj_rec.amount_mode
541: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
542: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

Line 541: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id

537: (p_init_msg_list => FND_API.G_FALSE
538: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
539: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
540: ,p_amount_mode => p_rev_adj_rec.amount_mode
541: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
542: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
543: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
544: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
545: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

Line 542: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

538: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
539: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
540: ,p_amount_mode => p_rev_adj_rec.amount_mode
541: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
542: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
543: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
544: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
545: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
546: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

Line 543: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id

539: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
540: ,p_amount_mode => p_rev_adj_rec.amount_mode
541: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
542: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
543: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
544: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
545: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
546: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
547: ,p_revenue_amount_in => p_rev_adj_rec.amount

Line 545: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

541: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
542: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
543: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
544: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
545: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
546: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
547: ,p_revenue_amount_in => p_rev_adj_rec.amount
548: ,p_revenue_percent => p_rev_adj_rec.percent
549: ,p_revenue_amount_out => l_revenue_amount

Line 546: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

542: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
543: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
544: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
545: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
546: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
547: ,p_revenue_amount_in => p_rev_adj_rec.amount
548: ,p_revenue_percent => p_rev_adj_rec.percent
549: ,p_revenue_amount_out => l_revenue_amount
550: ,p_adjustable_amount_out => l_adj_inv_total

Line 563: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed

559: l_rev_adj_rec.amount := l_revenue_amount;
560: l_line_count := 0;
561:
562: /* Bug 2146970 - validate the GL date passed in */
563: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed
564: (p_gl_date => l_rev_adj_rec.gl_date);
565:
566: IF PG_DEBUG in ('Y','C')
567: THEN

Line 659: l_line_adjustable := AR_RAAPI_UTIL.Adjustable_Revenue

655: l_line_id := c1.customer_trx_line_id;
656:
657: /* 6223281 - fetch the maximum amount allowable for the adjustment
658: based on the given parameters */
659: l_line_adjustable := AR_RAAPI_UTIL.Adjustable_Revenue
660: (p_customer_trx_line_id => l_line_id
661: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
662: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
663: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

Line 662: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id

658: based on the given parameters */
659: l_line_adjustable := AR_RAAPI_UTIL.Adjustable_Revenue
660: (p_customer_trx_line_id => l_line_id
661: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
662: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
663: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
664: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
665: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
666: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

Line 663: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

659: l_line_adjustable := AR_RAAPI_UTIL.Adjustable_Revenue
660: (p_customer_trx_line_id => l_line_id
661: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
662: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
663: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
664: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
665: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
666: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
667: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

Line 664: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id

660: (p_customer_trx_line_id => l_line_id
661: ,p_adjustment_type => p_rev_adj_rec.adjustment_type
662: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
663: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
664: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
665: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
666: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
667: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
668: ,p_revenue_adjustment_id => NULL -- intentionally null

Line 666: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

662: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
663: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
664: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
665: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
666: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
667: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
668: ,p_revenue_adjustment_id => NULL -- intentionally null
669: ,p_line_count_out => x_line_count_out
670: ,p_acctd_amount_out => x_acctd_amount_out);

Line 667: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

663: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
664: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
665: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
666: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
667: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
668: ,p_revenue_adjustment_id => NULL -- intentionally null
669: ,p_line_count_out => x_line_count_out
670: ,p_acctd_amount_out => x_acctd_amount_out);
671:

Line 687: IF NOT AR_RAAPI_UTIL.unearned_zero_lines(

683: THEN
684:
685: /* 7454302 - check for dists, continue only if there are none
686: Returns TRUE if there are zero lines with no REV */
687: IF NOT AR_RAAPI_UTIL.unearned_zero_lines(
688: p_customer_trx_id => c1.customer_trx_id,
689: p_customer_trx_line_id => c1.customer_trx_line_id,
690: p_check_line_amt => 'Y',
691: p_adjustment_type => l_rev_adj_rec.adjustment_type)

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

724: THEN
725: l_revenue_amount_prorata := 0;
726: ELSE
727: l_revenue_amount_prorata := ROUND(l_revenue_amount *
728: l_line_adjustable / l_adj_inv_total,AR_RAAPI_UTIL.g_trx_precision);
729: END IF;
730:
731: /* Check for salesreps for use later */
732: SELECT count(*)

Line 737: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;

733: INTO l_sr_count
734: FROM ra_cust_trx_line_salesreps
735: WHERE customer_trx_line_id = l_line_id
736: AND NVL(revenue_percent_split,0) <> 0
737: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
738:
739: IF c1.accounting_rule_id IS NOT NULL
740: THEN
741: /* 6325023 - previous logic differentiated between

Line 818: ,AR_RAAPI_UTIL.g_customer_trx_id

814: l_revenue_amount_prorata);
815: END IF;
816:
817: no_rule_debit_credit_no_sr(c1.customer_trx_line_id
818: ,AR_RAAPI_UTIL.g_customer_trx_id
819: ,AR_RAAPI_UTIL.g_from_salesrep_id
820: ,l_revenue_amount_prorata
821: ,l_gl_date_valid -- bug 2146970
822: ,NULL

Line 819: ,AR_RAAPI_UTIL.g_from_salesrep_id

815: END IF;
816:
817: no_rule_debit_credit_no_sr(c1.customer_trx_line_id
818: ,AR_RAAPI_UTIL.g_customer_trx_id
819: ,AR_RAAPI_UTIL.g_from_salesrep_id
820: ,l_revenue_amount_prorata
821: ,l_gl_date_valid -- bug 2146970
822: ,NULL
823: ,c1.inventory_item_id

Line 847: ,AR_RAAPI_UTIL.g_customer_trx_id

843:
844: ELSE
845: /* Original SR-based logic */
846: no_rule_debit_credit (c1.customer_trx_line_id
847: ,AR_RAAPI_UTIL.g_customer_trx_id
848: ,AR_RAAPI_UTIL.g_from_salesrep_id
849: ,l_revenue_amount_prorata
850: ,l_gl_date_valid -- bug 2146970
851: ,NULL

Line 848: ,AR_RAAPI_UTIL.g_from_salesrep_id

844: ELSE
845: /* Original SR-based logic */
846: no_rule_debit_credit (c1.customer_trx_line_id
847: ,AR_RAAPI_UTIL.g_customer_trx_id
848: ,AR_RAAPI_UTIL.g_from_salesrep_id
849: ,l_revenue_amount_prorata
850: ,l_gl_date_valid -- bug 2146970
851: ,NULL
852: ,c1.inventory_item_id

Line 864: IF AR_RAAPI_UTIL.g_customer_trx_id is NOT NULL THEN

860: NULL;
861: END LOOP; -- c_line loop
862:
863: IF l_xla_call_req_flag THEN
864: IF AR_RAAPI_UTIL.g_customer_trx_id is NOT NULL THEN
865: l_xla_event.xla_from_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;
866: l_xla_event.xla_to_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;
867: l_xla_event.xla_req_id := NULL;
868: l_xla_event.xla_dist_id := NULL;

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

861: END LOOP; -- c_line loop
862:
863: IF l_xla_call_req_flag THEN
864: IF AR_RAAPI_UTIL.g_customer_trx_id is NOT NULL THEN
865: l_xla_event.xla_from_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;
866: l_xla_event.xla_to_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;
867: l_xla_event.xla_req_id := NULL;
868: l_xla_event.xla_dist_id := NULL;
869: l_xla_event.xla_doc_table := 'CT';

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

862:
863: IF l_xla_call_req_flag THEN
864: IF AR_RAAPI_UTIL.g_customer_trx_id is NOT NULL THEN
865: l_xla_event.xla_from_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;
866: l_xla_event.xla_to_doc_id := AR_RAAPI_UTIL.g_customer_trx_id;
867: l_xla_event.xla_req_id := NULL;
868: l_xla_event.xla_dist_id := NULL;
869: l_xla_event.xla_doc_table := 'CT';
870: l_xla_event.xla_doc_event := NULL;

Line 885: NVL(AR_RAAPI_UTIL.g_called_from,'XXX') <> 'SWEEPER' )

881: be rounded are stored in a global temporary table
882: and that table is used by the rounding code to
883: determine the lines targeted for rounding. */
884: IF (l_override_flag = 'Y' AND
885: NVL(AR_RAAPI_UTIL.g_called_from,'XXX') <> 'SWEEPER' )
886: THEN
887: /* This call will round each adjustment that has be
888: previously recorded in ar_rev_line_adj_gt */
889: IF (arp_rounding.correct_rev_adj_by_line = 0)

Line 1049: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1045: ,mtl_item_categories mic
1046: ,ra_customer_trx_lines l
1047: WHERE s.customer_trx_line_id = l.customer_trx_line_id
1048: AND l.line_type = 'LINE'
1049: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1050: AND 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))

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

1046: ,ra_customer_trx_lines l
1047: WHERE s.customer_trx_line_id = l.customer_trx_line_id
1048: AND l.line_type = 'LINE'
1049: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1050: AND 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: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1050: AND 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: AND 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 EXISTS
1060: (SELECT s1.salesrep_id

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 EXISTS
1060: (SELECT s1.salesrep_id
1061: FROM ra_cust_trx_line_salesreps s1

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 EXISTS
1060: (SELECT s1.salesrep_id
1061: FROM ra_cust_trx_line_salesreps s1
1062: WHERE s1.customer_trx_line_id = l.customer_trx_line_id

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

1060: (SELECT s1.salesrep_id
1061: FROM ra_cust_trx_line_salesreps s1
1062: WHERE s1.customer_trx_line_id = l.customer_trx_line_id
1063: AND s1.salesrep_id =
1064: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s1.salesrep_id)
1065: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)) =
1066: 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)))
1067: GROUP BY s1.salesrep_id
1068: HAVING DECODE(p_rev_adj_rec.sales_credit_type,'N',

Line 1066: 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)))

1062: WHERE s1.customer_trx_line_id = l.customer_trx_line_id
1063: AND s1.salesrep_id =
1064: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s1.salesrep_id)
1065: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)) =
1066: 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)))
1067: GROUP BY s1.salesrep_id
1068: HAVING DECODE(p_rev_adj_rec.sales_credit_type,'N',
1069: SUM(NVL(s1.non_revenue_percent_split,0)),
1070: SUM(NVL(s1.revenue_percent_split,0))) <> 0);

Line 1080: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1076: ,ra_customer_trx_lines l
1077: WHERE d.customer_trx_line_id = l.customer_trx_line_id
1078: AND d.account_class = 'REV'
1079: AND l.line_type = 'LINE'
1080: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1081: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1082: l.customer_trx_line_id)
1083: AND NVL(l.inventory_item_id,0) =
1084: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

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

1077: WHERE d.customer_trx_line_id = l.customer_trx_line_id
1078: AND d.account_class = 'REV'
1079: AND l.line_type = 'LINE'
1080: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1081: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1082: l.customer_trx_line_id)
1083: AND NVL(l.inventory_item_id,0) =
1084: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1085: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

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

1080: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1081: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1082: l.customer_trx_line_id)
1083: AND NVL(l.inventory_item_id,0) =
1084: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1085: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1086: AND l.inventory_item_id = mic.inventory_item_id(+)
1087: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1088: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

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

1081: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1082: l.customer_trx_line_id)
1083: AND NVL(l.inventory_item_id,0) =
1084: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1085: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1086: AND l.inventory_item_id = mic.inventory_item_id(+)
1087: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1088: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1089: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

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

1083: AND NVL(l.inventory_item_id,0) =
1084: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1085: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1086: AND l.inventory_item_id = mic.inventory_item_id(+)
1087: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1088: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1089: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1090: AND EXISTS
1091: (SELECT s.salesrep_id

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

1084: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1085: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1086: AND l.inventory_item_id = mic.inventory_item_id(+)
1087: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1088: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1089: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1090: AND EXISTS
1091: (SELECT s.salesrep_id
1092: FROM ra_cust_trx_line_salesreps s

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

1085: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1086: AND l.inventory_item_id = mic.inventory_item_id(+)
1087: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1088: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1089: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1090: AND EXISTS
1091: (SELECT s.salesrep_id
1092: FROM ra_cust_trx_line_salesreps s
1093: WHERE s.customer_trx_line_id = l.customer_trx_line_id

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

1091: (SELECT s.salesrep_id
1092: FROM ra_cust_trx_line_salesreps s
1093: WHERE s.customer_trx_line_id = l.customer_trx_line_id
1094: AND s.salesrep_id =
1095: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1096: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1097: 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)))
1098: GROUP BY s.salesrep_id
1099: HAVING DECODE(p_rev_adj_rec.sales_credit_type,'N',

Line 1097: 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)))

1093: WHERE s.customer_trx_line_id = l.customer_trx_line_id
1094: AND s.salesrep_id =
1095: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1096: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1097: 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)))
1098: GROUP BY s.salesrep_id
1099: HAVING DECODE(p_rev_adj_rec.sales_credit_type,'N',
1100: SUM(NVL(s.non_revenue_percent_split,0)),
1101: SUM(NVL(s.revenue_percent_split,0))) <> 0);

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

1105: FROM ra_customer_trx_lines l
1106: ,mtl_item_categories mic
1107: ,ra_cust_trx_line_salesreps s
1108: WHERE l.customer_trx_line_id = s.customer_trx_line_id
1109: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1110: l.customer_trx_line_id)
1111: AND NVL(l.inventory_item_id,0) =
1112: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1113: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

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

1108: WHERE l.customer_trx_line_id = s.customer_trx_line_id
1109: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1110: l.customer_trx_line_id)
1111: AND NVL(l.inventory_item_id,0) =
1112: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1113: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1114: AND l.inventory_item_id = mic.inventory_item_id(+)
1115: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1116: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

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

1109: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1110: l.customer_trx_line_id)
1111: AND NVL(l.inventory_item_id,0) =
1112: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1113: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1114: AND l.inventory_item_id = mic.inventory_item_id(+)
1115: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1116: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1117: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

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

1111: AND NVL(l.inventory_item_id,0) =
1112: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1113: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1114: AND l.inventory_item_id = mic.inventory_item_id(+)
1115: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1116: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1117: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1118: AND NVL(s.non_revenue_percent_split,0) <> 0
1119: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

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

1112: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1113: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1114: AND l.inventory_item_id = mic.inventory_item_id(+)
1115: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1116: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1117: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1118: AND NVL(s.non_revenue_percent_split,0) <> 0
1119: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1120: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)

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

1113: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1114: AND l.inventory_item_id = mic.inventory_item_id(+)
1115: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1116: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1117: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1118: AND NVL(s.non_revenue_percent_split,0) <> 0
1119: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1120: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1121: AND NVL(s.non_revenue_salesgroup_id,-9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999));

Line 1119: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1115: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1116: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1117: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1118: AND NVL(s.non_revenue_percent_split,0) <> 0
1119: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1120: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1121: AND NVL(s.non_revenue_salesgroup_id,-9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999));
1122:
1123: CURSOR c_nonrev_line_count IS

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

1116: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1117: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1118: AND NVL(s.non_revenue_percent_split,0) <> 0
1119: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1120: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1121: AND NVL(s.non_revenue_salesgroup_id,-9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999));
1122:
1123: CURSOR c_nonrev_line_count IS
1124: SELECT COUNT(*)

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

1117: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1118: AND NVL(s.non_revenue_percent_split,0) <> 0
1119: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1120: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1121: AND NVL(s.non_revenue_salesgroup_id,-9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999));
1122:
1123: CURSOR c_nonrev_line_count IS
1124: SELECT COUNT(*)
1125: FROM mtl_item_categories mic

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

1123: CURSOR c_nonrev_line_count IS
1124: SELECT COUNT(*)
1125: FROM mtl_item_categories mic
1126: ,ra_customer_trx_lines l
1127: WHERE l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1128: l.customer_trx_line_id)
1129: AND NVL(l.inventory_item_id,0) =
1130: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1131: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

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

1126: ,ra_customer_trx_lines l
1127: WHERE l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1128: l.customer_trx_line_id)
1129: AND NVL(l.inventory_item_id,0) =
1130: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1131: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1132: AND l.inventory_item_id = mic.inventory_item_id(+)
1133: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1134: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

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

1127: WHERE l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
1128: l.customer_trx_line_id)
1129: AND NVL(l.inventory_item_id,0) =
1130: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1131: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1132: AND l.inventory_item_id = mic.inventory_item_id(+)
1133: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1134: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1135: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

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

1129: AND NVL(l.inventory_item_id,0) =
1130: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1131: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1132: AND l.inventory_item_id = mic.inventory_item_id(+)
1133: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1134: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1135: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1136: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1137: AND EXISTS

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

1130: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1131: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1132: AND l.inventory_item_id = mic.inventory_item_id(+)
1133: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1134: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1135: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1136: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1137: AND EXISTS
1138: (SELECT 'nonrev salesrep' -- 9799882 -> was s.salesrep_id

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

1131: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1132: AND l.inventory_item_id = mic.inventory_item_id(+)
1133: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1134: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1135: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1136: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1137: AND EXISTS
1138: (SELECT 'nonrev salesrep' -- 9799882 -> was s.salesrep_id
1139: FROM ra_cust_trx_line_salesreps s

Line 1136: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1132: AND l.inventory_item_id = mic.inventory_item_id(+)
1133: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1134: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1135: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1136: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1137: AND EXISTS
1138: (SELECT 'nonrev salesrep' -- 9799882 -> was s.salesrep_id
1139: FROM ra_cust_trx_line_salesreps s
1140: WHERE s.customer_trx_line_id = l.customer_trx_line_id

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

1139: FROM ra_cust_trx_line_salesreps s
1140: WHERE s.customer_trx_line_id = l.customer_trx_line_id
1141: AND NVL(s.non_revenue_percent_split,0) <> 0
1142: AND s.salesrep_id =
1143: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1144: AND NVL(s.non_revenue_salesgroup_id,-9999) =
1145: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999))
1146: GROUP BY s.customer_trx_line_id
1147: HAVING SUM(NVL(s.non_revenue_percent_split,0)) <> 0);

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

1141: AND NVL(s.non_revenue_percent_split,0) <> 0
1142: AND s.salesrep_id =
1143: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1144: AND NVL(s.non_revenue_salesgroup_id,-9999) =
1145: NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id,-9999))
1146: GROUP BY s.customer_trx_line_id
1147: HAVING SUM(NVL(s.non_revenue_percent_split,0)) <> 0);
1148:
1149: CURSOR c_line IS

Line 1161: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1157: ,l.line_number
1158: FROM ra_cust_trx_line_salesreps s
1159: ,mtl_item_categories mic
1160: ,ra_customer_trx_lines l
1161: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1162: AND l.customer_trx_line_id = s.customer_trx_line_id
1163: AND l.customer_trx_line_id =
1164: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
1165: AND NVL(l.inventory_item_id,0) =

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

1160: ,ra_customer_trx_lines l
1161: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1162: AND l.customer_trx_line_id = s.customer_trx_line_id
1163: AND l.customer_trx_line_id =
1164: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
1165: AND NVL(l.inventory_item_id,0) =
1166: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1167: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1168: AND l.inventory_item_id = mic.inventory_item_id(+)

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

1162: AND l.customer_trx_line_id = s.customer_trx_line_id
1163: AND l.customer_trx_line_id =
1164: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
1165: AND NVL(l.inventory_item_id,0) =
1166: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1167: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1168: AND l.inventory_item_id = mic.inventory_item_id(+)
1169: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1170: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

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

1163: AND l.customer_trx_line_id =
1164: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
1165: AND NVL(l.inventory_item_id,0) =
1166: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1167: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1168: AND l.inventory_item_id = mic.inventory_item_id(+)
1169: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1170: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1171: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

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

1165: AND NVL(l.inventory_item_id,0) =
1166: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1167: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1168: AND l.inventory_item_id = mic.inventory_item_id(+)
1169: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1170: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1171: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1172: AND l.line_type = 'LINE'
1173: AND EXISTS

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

1166: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
1167: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1168: AND l.inventory_item_id = mic.inventory_item_id(+)
1169: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1170: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1171: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1172: AND l.line_type = 'LINE'
1173: AND EXISTS
1174: (SELECT s1.salesrep_id

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

1167: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
1168: AND l.inventory_item_id = mic.inventory_item_id(+)
1169: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
1170: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
1171: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
1172: AND l.line_type = 'LINE'
1173: AND EXISTS
1174: (SELECT s1.salesrep_id
1175: FROM ra_cust_trx_line_salesreps s1

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

1174: (SELECT s1.salesrep_id
1175: FROM ra_cust_trx_line_salesreps s1
1176: WHERE s1.customer_trx_line_id = l.customer_trx_line_id
1177: AND s1.salesrep_id =
1178: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s1.salesrep_id)
1179: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)) =
1180: 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)))
1181: GROUP BY s1.salesrep_id
1182: HAVING DECODE(p_rev_adj_rec.sales_credit_type,'N',

Line 1180: 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)))

1176: WHERE s1.customer_trx_line_id = l.customer_trx_line_id
1177: AND s1.salesrep_id =
1178: NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s1.salesrep_id)
1179: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s1.non_revenue_salesgroup_id, -9999), NVL(s1.revenue_salesgroup_id, -9999)) =
1180: 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)))
1181: GROUP BY s1.salesrep_id
1182: HAVING DECODE(p_rev_adj_rec.sales_credit_type,'N',
1183: SUM(NVL(s1.non_revenue_percent_split,0)),
1184: SUM(NVL(s1.revenue_percent_split,0))) <> 0)

Line 1200: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1196: SELECT NVL(SUM(revenue_amount_split),0)
1197: FROM ra_cust_trx_line_salesreps
1198: WHERE customer_trx_line_id = l_cust_trx_line_id
1199: and NVL(revenue_percent_split,0) <> 0
1200: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1201: and salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)
1202: and NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));
1203:
1204: -- Bug 3431815: Credit Memos included

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

1197: FROM ra_cust_trx_line_salesreps
1198: WHERE customer_trx_line_id = l_cust_trx_line_id
1199: and NVL(revenue_percent_split,0) <> 0
1200: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1201: and salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)
1202: and NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));
1203:
1204: -- Bug 3431815: Credit Memos included
1205: -- Bug 3536944: cursor split into separate queries for invoice and CMs

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

1198: WHERE customer_trx_line_id = l_cust_trx_line_id
1199: and NVL(revenue_percent_split,0) <> 0
1200: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1201: and salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)
1202: and NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));
1203:
1204: -- Bug 3431815: Credit Memos included
1205: -- Bug 3536944: cursor split into separate queries for invoice and CMs
1206: -- Bug 3676923: cater for null amounts and removed check on autorule

Line 1213: AND d.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1209: CURSOR c_line_revenue_total IS
1210: SELECT NVL(SUM(d.amount),0)
1211: FROM ra_cust_trx_line_gl_dist d
1212: WHERE d.customer_trx_line_id = l_cust_trx_line_id
1213: AND d.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1214: AND d.account_set_flag = 'N'
1215: AND d.account_class = 'REV';
1216:
1217: CURSOR c_cm_line_revenue_total IS

Line 1224: AND l.previous_customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

1220: ra_customer_trx_lines l
1221: WHERE d.customer_trx_line_id = l.customer_trx_line_id
1222: AND d.customer_trx_id = l.customer_trx_id
1223: AND l.previous_customer_trx_line_id = l_cust_trx_line_id
1224: AND l.previous_customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
1225: AND d.account_set_flag = 'N'
1226: AND d.account_class = 'REV';
1227:
1228: CURSOR c_line_nonrev_total IS

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

1228: CURSOR c_line_nonrev_total IS
1229: SELECT SUM(NVL(s.non_revenue_amount_split,0))
1230: FROM ra_cust_trx_line_salesreps s
1231: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1232: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1233: and NVL(s.non_revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id, -9999));
1234:
1235: CURSOR get_salesrep_lines_old is
1236: SELECT SUM(NVL(s.revenue_amount_split,0)) revenue_amount_split,

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

1229: SELECT SUM(NVL(s.non_revenue_amount_split,0))
1230: FROM ra_cust_trx_line_salesreps s
1231: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1232: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1233: and NVL(s.non_revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(s.non_revenue_salesgroup_id, -9999));
1234:
1235: CURSOR get_salesrep_lines_old is
1236: SELECT SUM(NVL(s.revenue_amount_split,0)) revenue_amount_split,
1237: SUM(NVL(s.revenue_percent_split,0)) revenue_percent_split,

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

1239: SUM(NVL(s.non_revenue_percent_split,0)) nonrev_percent_split
1240: FROM ra_cust_trx_line_salesreps s,
1241: ra_customer_trx_lines l
1242: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1243: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1244: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1245: 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)))
1246: AND l.line_type = 'LINE'
1247: AND l.customer_trx_line_id = s.customer_trx_line_id

Line 1245: 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)))

1241: ra_customer_trx_lines l
1242: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1243: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1244: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1245: 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)))
1246: AND l.line_type = 'LINE'
1247: AND l.customer_trx_line_id = s.customer_trx_line_id
1248: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
1249:

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

1244: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1245: 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)))
1246: AND l.line_type = 'LINE'
1247: AND l.customer_trx_line_id = s.customer_trx_line_id
1248: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
1249:
1250: CURSOR get_salesrep_lines_new is
1251: SELECT NVL(SUM(s.revenue_amount_split),0),
1252: NVL(SUM(s.revenue_percent_split),0),

Line 1258: AND s.salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id

1254: NVL(SUM(s.non_revenue_percent_split),0)
1255: FROM ra_cust_trx_line_salesreps s,
1256: ra_customer_trx_lines l
1257: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1258: AND s.salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id
1259: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1260: 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)))
1261: AND l.line_type = 'LINE'
1262: AND l.customer_trx_line_id = s.customer_trx_line_id

Line 1260: 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)))

1256: ra_customer_trx_lines l
1257: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1258: AND s.salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id
1259: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1260: 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)))
1261: AND l.line_type = 'LINE'
1262: AND l.customer_trx_line_id = s.customer_trx_line_id
1263: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
1264:

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

1259: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1260: 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)))
1261: AND l.line_type = 'LINE'
1262: AND l.customer_trx_line_id = s.customer_trx_line_id
1263: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
1264:
1265: CURSOR c_get_from_salesreps IS
1266: SELECT s.salesrep_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', s.non_revenue_salesgroup_id, s.revenue_salesgroup_id) salesgroup_id,
1267: SUM(s.revenue_amount_split) revenue_amount_split,

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

1269: SUM(s.non_revenue_amount_split) nonrev_amount_split,
1270: SUM(s.non_revenue_percent_split) nonrev_percent_split
1271: FROM ra_cust_trx_line_salesreps s
1272: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1273: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1274: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1275: 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)))
1276: AND NVL(s.revenue_adjustment_id,-99) <> x_adjustment_id -- bug 2543675
1277: GROUP BY s.salesrep_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', s.non_revenue_salesgroup_id,s.revenue_salesgroup_id);

Line 1275: 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)))

1271: FROM ra_cust_trx_line_salesreps s
1272: WHERE s.customer_trx_line_id = l_cust_trx_line_id
1273: AND s.salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,s.salesrep_id)
1274: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
1275: 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)))
1276: AND NVL(s.revenue_adjustment_id,-99) <> x_adjustment_id -- bug 2543675
1277: GROUP BY s.salesrep_id, DECODE(p_rev_adj_rec.sales_credit_type,'N', s.non_revenue_salesgroup_id,s.revenue_salesgroup_id);
1278:
1279: CURSOR c_new_salesrep_name IS

Line 1282: WHERE salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id;

1278:
1279: CURSOR c_new_salesrep_name IS
1280: SELECT name
1281: FROM ra_salesreps
1282: WHERE salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id;
1283:
1284: BEGIN
1285: IF PG_DEBUG in ('Y', 'C') THEN
1286: arp_util.debug('AR_Revenue_Adjustment_PVT.Transfer_Sales_Credits()+');

Line 1317: AR_RAAPI_UTIL.Constant_System_Values;

1313: l_rev_adj_rec.gl_date := trunc(p_rev_adj_rec.gl_date);
1314:
1315: l_rev_adj_rec.adjustment_type := 'SA';
1316:
1317: AR_RAAPI_UTIL.Constant_System_Values;
1318: AR_RAAPI_UTIL.Initialize_Globals;
1319: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
1320: ,p_rev_adj_rec => l_rev_adj_rec
1321: ,p_validation_level => p_validation_level

Line 1318: AR_RAAPI_UTIL.Initialize_Globals;

1314:
1315: l_rev_adj_rec.adjustment_type := 'SA';
1316:
1317: AR_RAAPI_UTIL.Constant_System_Values;
1318: AR_RAAPI_UTIL.Initialize_Globals;
1319: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
1320: ,p_rev_adj_rec => l_rev_adj_rec
1321: ,p_validation_level => p_validation_level
1322: ,x_return_status => x_return_status

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

1315: l_rev_adj_rec.adjustment_type := 'SA';
1316:
1317: AR_RAAPI_UTIL.Constant_System_Values;
1318: AR_RAAPI_UTIL.Initialize_Globals;
1319: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
1320: ,p_rev_adj_rec => l_rev_adj_rec
1321: ,p_validation_level => p_validation_level
1322: ,x_return_status => x_return_status
1323: ,x_msg_count => x_msg_count

Line 1366: AR_RAAPI_UTIL.Validate_Amount

1362: -- Determine revenue amount to be transferred
1363: --
1364: IF p_rev_adj_rec.sales_credit_type IN ('R','B')
1365: THEN
1366: AR_RAAPI_UTIL.Validate_Amount
1367: (p_init_msg_list => FND_API.G_FALSE
1368: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
1369: ,p_adjustment_type => 'SA'
1370: ,p_amount_mode => p_rev_adj_rec.amount_mode

Line 1368: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id

1364: IF p_rev_adj_rec.sales_credit_type IN ('R','B')
1365: THEN
1366: AR_RAAPI_UTIL.Validate_Amount
1367: (p_init_msg_list => FND_API.G_FALSE
1368: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
1369: ,p_adjustment_type => 'SA'
1370: ,p_amount_mode => p_rev_adj_rec.amount_mode
1371: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
1372: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

Line 1371: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id

1367: (p_init_msg_list => FND_API.G_FALSE
1368: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
1369: ,p_adjustment_type => 'SA'
1370: ,p_amount_mode => p_rev_adj_rec.amount_mode
1371: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
1372: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
1373: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
1374: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
1375: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

Line 1372: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

1368: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
1369: ,p_adjustment_type => 'SA'
1370: ,p_amount_mode => p_rev_adj_rec.amount_mode
1371: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
1372: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
1373: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
1374: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
1375: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
1376: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

Line 1373: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id

1369: ,p_adjustment_type => 'SA'
1370: ,p_amount_mode => p_rev_adj_rec.amount_mode
1371: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
1372: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
1373: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
1374: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
1375: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
1376: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
1377: ,p_revenue_amount_in => p_rev_adj_rec.amount

Line 1375: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

1371: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
1372: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
1373: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
1374: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
1375: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
1376: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
1377: ,p_revenue_amount_in => p_rev_adj_rec.amount
1378: ,p_revenue_percent => p_rev_adj_rec.percent
1379: ,p_revenue_amount_out => l_revenue_amount

Line 1376: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

1372: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
1373: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
1374: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
1375: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
1376: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
1377: ,p_revenue_amount_in => p_rev_adj_rec.amount
1378: ,p_revenue_percent => p_rev_adj_rec.percent
1379: ,p_revenue_amount_out => l_revenue_amount
1380: ,p_adjustable_amount_out => l_adj_trx_total

Line 1394: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed

1390: RAISE FND_API.G_EXC_ERROR;
1391: END IF;
1392: l_rev_adj_rec.amount := l_revenue_amount;
1393: /* Bug 2146970 - validate the GL date passed in */
1394: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed
1395: (p_gl_date => l_rev_adj_rec.gl_date);
1396: IF l_gl_date_valid IS NULL
1397: THEN
1398: FND_MESSAGE.set_name('AR','AR_VAL_GL_DATE');

Line 1428: / 100, AR_RAAPI_UTIL.g_trx_precision);

1424: END IF;
1425: ELSIF p_rev_adj_rec.amount_mode = 'P'
1426: THEN
1427: l_nonrev_amount := ROUND(l_trx_total * p_rev_adj_rec.percent
1428: / 100, AR_RAAPI_UTIL.g_trx_precision);
1429: ELSE
1430: l_nonrev_amount := l_nonrev_trx_total;
1431: END IF;
1432:

Line 1515: / l_adj_trx_total , AR_RAAPI_UTIL.g_trx_precision);

1511: ELSE
1512: l_line_adjustable := 0;
1513: END IF;
1514: l_line_amount := ROUND(l_revenue_amount * l_line_adjustable
1515: / l_adj_trx_total , AR_RAAPI_UTIL.g_trx_precision);
1516: IF l_line_amount <> 0
1517: THEN
1518: l_line_count := l_line_count + 1;
1519: l_total_adjusted := l_total_adjusted + l_line_amount;

Line 1533: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate

1529: /* Bug 4675438: MOAC/SSA */
1530: ARPCURR.functional_amount(
1531: amount => l_line_amount
1532: , currency_code => arp_global.functional_currency
1533: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate
1534: , precision => NULL
1535: , min_acc_unit => NULL );
1536: l_line_percent := ROUND(l_line_amount / c1.amount * 100, 4);
1537: END IF;

Line 1545: / l_nonrev_trx_total, AR_RAAPI_UTIL.g_trx_precision);

1541: OPEN c_line_nonrev_total;
1542: FETCH c_line_nonrev_total INTO l_line_nonrev_total;
1543: CLOSE c_line_nonrev_total;
1544: l_line_nonrev_amount := ROUND(l_nonrev_amount * l_line_nonrev_total
1545: / l_nonrev_trx_total, AR_RAAPI_UTIL.g_trx_precision);
1546: IF l_line_nonrev_amount <> 0
1547: THEN
1548: l_nonrev_line_count := l_nonrev_line_count + 1;
1549: l_total_nonrev_adjusted := l_total_nonrev_adjusted +

Line 1628: / l_revenue_percent_split, AR_RAAPI_UTIL.g_trx_precision);

1624: p_rev_adj_rec.sales_credit_type IN ('R','B') AND
1625: l_revenue_percent_split <> 0
1626: THEN
1627: l_amount_prorata := ROUND(l_line_amount * srrec.revenue_percent_split
1628: / l_revenue_percent_split, AR_RAAPI_UTIL.g_trx_precision);
1629: IF l_amount_prorata <> 0
1630: THEN
1631: l_no_of_salesreps := l_no_of_salesreps + 1;
1632: END IF;

Line 1639: AR_RAAPI_UTIL.g_trx_precision);

1635: l_line_nonrev_amount <> 0 AND l_nonrev_percent_split <> 0
1636: THEN
1637: l_nonrev_amount_prorata := ROUND(l_line_nonrev_amount *
1638: srrec.nonrev_percent_split / l_nonrev_percent_split,
1639: AR_RAAPI_UTIL.g_trx_precision);
1640: IF l_nonrev_amount_prorata <> 0
1641: THEN
1642: l_nr_no_of_salesreps := l_nr_no_of_salesreps + 1;
1643: END IF;

Line 1653: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,

1649: IF l_line_amount <> 0 AND
1650: p_rev_adj_rec.sales_credit_type IN ('R','B') AND
1651: l_revenue_percent_split <> 0
1652: THEN
1653: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
1654: AR_RAAPI_UTIL.g_to_salesrep_id,
1655: AR_RAAPI_UTIL.g_to_salesgroup_id,
1656: l_cust_trx_line_id,
1657: l_line_amount,

Line 1654: AR_RAAPI_UTIL.g_to_salesrep_id,

1650: p_rev_adj_rec.sales_credit_type IN ('R','B') AND
1651: l_revenue_percent_split <> 0
1652: THEN
1653: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
1654: AR_RAAPI_UTIL.g_to_salesrep_id,
1655: AR_RAAPI_UTIL.g_to_salesgroup_id,
1656: l_cust_trx_line_id,
1657: l_line_amount,
1658: l_line_percent,

Line 1655: AR_RAAPI_UTIL.g_to_salesgroup_id,

1651: l_revenue_percent_split <> 0
1652: THEN
1653: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
1654: AR_RAAPI_UTIL.g_to_salesrep_id,
1655: AR_RAAPI_UTIL.g_to_salesgroup_id,
1656: l_cust_trx_line_id,
1657: l_line_amount,
1658: l_line_percent,
1659: 'R',

Line 1671: ,AR_RAAPI_UTIL.g_customer_trx_id

1667: -- Bug 1930302 : Added warehouse_id as 16th parameter.
1668:
1669: ARP_AUTO_ACCOUNTING.do_autoaccounting('G'
1670: ,'REV'
1671: ,AR_RAAPI_UTIL.g_customer_trx_id
1672: ,l_cust_trx_line_id
1673: ,NULL
1674: ,NULL
1675: ,l_rev_adj_rec.gl_date

Line 1680: ,AR_RAAPI_UTIL.g_cust_trx_type_id

1676: ,NULL
1677: ,l_line_amount
1678: ,NULL
1679: ,NULL
1680: ,AR_RAAPI_UTIL.g_cust_trx_type_id
1681: ,AR_RAAPI_UTIL.g_to_salesrep_id
1682: ,c1.inventory_item_id
1683: ,c1.memo_line_id
1684: ,c1.warehouse_id

Line 1681: ,AR_RAAPI_UTIL.g_to_salesrep_id

1677: ,l_line_amount
1678: ,NULL
1679: ,NULL
1680: ,AR_RAAPI_UTIL.g_cust_trx_type_id
1681: ,AR_RAAPI_UTIL.g_to_salesrep_id
1682: ,c1.inventory_item_id
1683: ,c1.memo_line_id
1684: ,c1.warehouse_id
1685: ,l_credit_ccid

Line 1715: / l_revenue_percent_split, AR_RAAPI_UTIL.g_trx_precision);

1711: l_revenue_percent_split <> 0
1712: THEN
1713: /* Bug 6932079 - Added the NVL for c2.revenue_percent_split */
1714: l_amount_prorata := ROUND(l_line_amount * NVL(c2.revenue_percent_split, 0)
1715: / l_revenue_percent_split, AR_RAAPI_UTIL.g_trx_precision);
1716: /* Bug 2143925 - get the pro rata amount in SOB currency */
1717: /* Bug 4675438: MOAC/SSA */
1718: l_amount_prorata_acctd :=
1719: ARPCURR.functional_amount(

Line 1722: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate

1718: l_amount_prorata_acctd :=
1719: ARPCURR.functional_amount(
1720: amount => l_amount_prorata
1721: , currency_code => arp_global.functional_currency
1722: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate
1723: , precision => NULL
1724: , min_acc_unit => NULL );
1725: l_percent_prorata :=
1726: ROUND((l_amount_prorata / c1.amount) * 100,4);

Line 1764: insert_sales_credit(AR_RAAPI_UTIL.g_customer_trx_id,

1760: END IF;
1761: ELSE
1762: l_last_salesrep_flag := 'N'; -- Bug 2477881
1763: END IF;
1764: insert_sales_credit(AR_RAAPI_UTIL.g_customer_trx_id,
1765: c2.salesrep_id,
1766: c2.salesgroup_id,
1767: l_cust_trx_line_id,
1768: l_amount_prorata * -1,

Line 1782: ,AR_RAAPI_UTIL.g_customer_trx_id

1778:
1779: ARP_AUTO_ACCOUNTING.do_autoaccounting
1780: ('G'
1781: ,'REV'
1782: ,AR_RAAPI_UTIL.g_customer_trx_id
1783: ,l_cust_trx_line_id
1784: ,NULL
1785: ,NULL
1786: ,l_rev_adj_rec.gl_date

Line 1791: ,AR_RAAPI_UTIL.g_cust_trx_type_id

1787: ,NULL
1788: ,l_amount_prorata
1789: ,NULL
1790: ,NULL
1791: ,AR_RAAPI_UTIL.g_cust_trx_type_id
1792: ,c2.salesrep_id
1793: ,c1.inventory_item_id
1794: ,c1.memo_line_id
1795: ,c1.warehouse_id

Line 1820: ,AR_RAAPI_UTIL.g_customer_trx_id

1816: IF c1.accounting_rule_id IS NOT NULL
1817: THEN
1818: transfer_salesrep_revenue
1819: (c1.customer_trx_line_id
1820: ,AR_RAAPI_UTIL.g_customer_trx_id
1821: ,l_debit_sales_credit_id
1822: ,l_amount_prorata * -1
1823: ,l_amount_prorata_acctd * -1 -- Bug 2143925
1824: ,l_rev_adj_rec.gl_date

Line 1833: ,AR_RAAPI_UTIL.g_customer_trx_id

1829: ,x_adjustment_id);
1830: /* Bug 2543675 - insert 1 credit for every debit */
1831: transfer_salesrep_revenue
1832: (c1.customer_trx_line_id
1833: ,AR_RAAPI_UTIL.g_customer_trx_id
1834: ,l_credit_sales_credit_id
1835: ,l_amount_prorata
1836: ,l_amount_prorata_acctd
1837: ,l_rev_adj_rec.gl_date

Line 1853: AR_RAAPI_UTIL.g_customer_trx_id,

1849: l_rev_adj_rec.gl_date,
1850: 'REV',
1851: l_amount_prorata * -1,
1852: l_debit_sales_credit_id,
1853: AR_RAAPI_UTIL.g_customer_trx_id,
1854: x_adjustment_id);
1855: /* Bug 2543675 - insert 1 credit for every debit */
1856: insert_distribution(l_cust_trx_line_id,
1857: l_credit_ccid,

Line 1865: AR_RAAPI_UTIL.g_customer_trx_id,

1861: l_rev_adj_rec.gl_date,
1862: 'REV',
1863: l_amount_prorata,
1864: l_credit_sales_credit_id,
1865: AR_RAAPI_UTIL.g_customer_trx_id,
1866: x_adjustment_id);
1867:
1868: END IF;
1869: END IF;

Line 1877: AR_RAAPI_UTIL.g_trx_precision);

1873: l_line_nonrev_amount <> 0 AND l_nonrev_percent_split <> 0
1874: THEN
1875: l_nonrev_amount_prorata := ROUND(l_line_nonrev_amount *
1876: c2.nonrev_percent_split / l_nonrev_percent_split,
1877: AR_RAAPI_UTIL.g_trx_precision);
1878: l_nonrev_percent_prorata :=
1879: ROUND((l_nonrev_amount_prorata / c1.amount) * 100,4);
1880:
1881: IF l_nonrev_percent_prorata <> 0

Line 1900: insert_sales_credit(AR_RAAPI_UTIL.g_customer_trx_id,

1896: l_nonrev_percent_prorata := l_nonrev_percent_prorata +
1897: l_line_nonrev_percent - l_nr_line_pct_adjusted;
1898: END IF;
1899: END IF;
1900: insert_sales_credit(AR_RAAPI_UTIL.g_customer_trx_id,
1901: c2.salesrep_id,
1902: c2.salesgroup_id,
1903: l_cust_trx_line_id,
1904: l_nonrev_amount_prorata * -1,

Line 1924: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,

1920:
1921: IF p_rev_adj_rec.sales_credit_type in ('N','B') AND
1922: l_line_nonrev_amount <> 0 AND l_nonrev_percent_split <> 0
1923: THEN
1924: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
1925: AR_RAAPI_UTIL.g_to_salesrep_id,
1926: AR_RAAPI_UTIL.g_to_salesgroup_id,
1927: l_cust_trx_line_id,
1928: l_line_nonrev_amount,

Line 1925: AR_RAAPI_UTIL.g_to_salesrep_id,

1921: IF p_rev_adj_rec.sales_credit_type in ('N','B') AND
1922: l_line_nonrev_amount <> 0 AND l_nonrev_percent_split <> 0
1923: THEN
1924: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
1925: AR_RAAPI_UTIL.g_to_salesrep_id,
1926: AR_RAAPI_UTIL.g_to_salesgroup_id,
1927: l_cust_trx_line_id,
1928: l_line_nonrev_amount,
1929: l_line_nonrev_percent,

Line 1926: AR_RAAPI_UTIL.g_to_salesgroup_id,

1922: l_line_nonrev_amount <> 0 AND l_nonrev_percent_split <> 0
1923: THEN
1924: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
1925: AR_RAAPI_UTIL.g_to_salesrep_id,
1926: AR_RAAPI_UTIL.g_to_salesgroup_id,
1927: l_cust_trx_line_id,
1928: l_line_nonrev_amount,
1929: l_line_nonrev_percent,
1930: 'N',

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

1960: ELSE
1961: FND_MESSAGE.SET_NAME
1962: (application => 'AR', name => 'AR_RA_AMT_EXCEEDS_AVAIL_REV');
1963: FND_MESSAGE.set_token('TOT_AVAIL_REV',
1964: AR_RAAPI_UTIL.g_trx_currency||' '||l_adj_trx_total);
1965: END IF;
1966: FND_MSG_PUB.Add;
1967: RAISE FND_API.G_EXC_ERROR;
1968: WHEN invalid_zero THEN

Line 2142: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

2138: ,mtl_item_categories mic
2139: ,ra_customer_trx_lines l
2140: WHERE s.customer_trx_line_id = l.customer_trx_line_id
2141: AND l.line_type = 'LINE'
2142: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2143: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2144: l.customer_trx_line_id)
2145: AND NVL(l.inventory_item_id,0) =
2146: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

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

2139: ,ra_customer_trx_lines l
2140: WHERE s.customer_trx_line_id = l.customer_trx_line_id
2141: AND l.line_type = 'LINE'
2142: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2143: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2144: l.customer_trx_line_id)
2145: AND NVL(l.inventory_item_id,0) =
2146: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2147: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

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

2142: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2143: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2144: l.customer_trx_line_id)
2145: AND NVL(l.inventory_item_id,0) =
2146: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2147: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2148: AND l.inventory_item_id = mic.inventory_item_id(+)
2149: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2150: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

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

2143: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2144: l.customer_trx_line_id)
2145: AND NVL(l.inventory_item_id,0) =
2146: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2147: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2148: AND l.inventory_item_id = mic.inventory_item_id(+)
2149: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2150: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2151: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;

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

2145: AND NVL(l.inventory_item_id,0) =
2146: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2147: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2148: AND l.inventory_item_id = mic.inventory_item_id(+)
2149: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2150: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2151: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
2152:
2153: CURSOR c_line_count IS

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

2146: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2147: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2148: AND l.inventory_item_id = mic.inventory_item_id(+)
2149: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2150: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2151: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
2152:
2153: CURSOR c_line_count IS
2154: SELECT COUNT(*)

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

2147: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2148: AND l.inventory_item_id = mic.inventory_item_id(+)
2149: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2150: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2151: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
2152:
2153: CURSOR c_line_count IS
2154: SELECT COUNT(*)
2155: FROM mtl_item_categories mic

Line 2157: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

2153: CURSOR c_line_count IS
2154: SELECT COUNT(*)
2155: FROM mtl_item_categories mic
2156: ,ra_customer_trx_lines l
2157: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2158: AND l.line_type = 'LINE'
2159: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2160: l.customer_trx_line_id)
2161: AND NVL(l.inventory_item_id,0) =

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

2155: FROM mtl_item_categories mic
2156: ,ra_customer_trx_lines l
2157: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2158: AND l.line_type = 'LINE'
2159: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2160: l.customer_trx_line_id)
2161: AND NVL(l.inventory_item_id,0) =
2162: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2163: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

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

2158: AND l.line_type = 'LINE'
2159: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2160: l.customer_trx_line_id)
2161: AND NVL(l.inventory_item_id,0) =
2162: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2163: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2164: AND l.inventory_item_id = mic.inventory_item_id(+)
2165: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2166: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

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

2159: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
2160: l.customer_trx_line_id)
2161: AND NVL(l.inventory_item_id,0) =
2162: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2163: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2164: AND l.inventory_item_id = mic.inventory_item_id(+)
2165: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2166: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2167: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;

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

2161: AND NVL(l.inventory_item_id,0) =
2162: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2163: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2164: AND l.inventory_item_id = mic.inventory_item_id(+)
2165: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2166: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2167: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
2168:
2169: CURSOR c_line IS

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

2162: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2163: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2164: AND l.inventory_item_id = mic.inventory_item_id(+)
2165: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2166: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2167: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
2168:
2169: CURSOR c_line IS
2170: SELECT l.customer_trx_line_id

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

2163: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2164: AND l.inventory_item_id = mic.inventory_item_id(+)
2165: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2166: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2167: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
2168:
2169: CURSOR c_line IS
2170: SELECT l.customer_trx_line_id
2171: ,l.line_number

Line 2176: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

2172: ,SUM(NVL(s.revenue_amount_split,0)) amount
2173: FROM mtl_item_categories mic
2174: ,ra_cust_trx_line_salesreps s
2175: ,ra_customer_trx_lines l
2176: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2177: AND l.customer_trx_line_id = s.customer_trx_line_id
2178: AND l.customer_trx_line_id =
2179: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
2180: AND NVL(l.inventory_item_id,0) =

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

2175: ,ra_customer_trx_lines l
2176: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
2177: AND l.customer_trx_line_id = s.customer_trx_line_id
2178: AND l.customer_trx_line_id =
2179: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
2180: AND NVL(l.inventory_item_id,0) =
2181: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2182: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2183: AND l.inventory_item_id = mic.inventory_item_id(+)

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

2177: AND l.customer_trx_line_id = s.customer_trx_line_id
2178: AND l.customer_trx_line_id =
2179: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
2180: AND NVL(l.inventory_item_id,0) =
2181: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2182: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2183: AND l.inventory_item_id = mic.inventory_item_id(+)
2184: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2185: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

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

2178: AND l.customer_trx_line_id =
2179: NVL (AR_RAAPI_UTIL.g_from_cust_trx_line_id, l.customer_trx_line_id)
2180: AND NVL(l.inventory_item_id,0) =
2181: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2182: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2183: AND l.inventory_item_id = mic.inventory_item_id(+)
2184: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2185: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2186: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

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

2180: AND NVL(l.inventory_item_id,0) =
2181: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2182: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2183: AND l.inventory_item_id = mic.inventory_item_id(+)
2184: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2185: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2186: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
2187: AND l.line_type = 'LINE'
2188: GROUP BY l.customer_trx_line_id

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

2181: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
2182: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2183: AND l.inventory_item_id = mic.inventory_item_id(+)
2184: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2185: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2186: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
2187: AND l.line_type = 'LINE'
2188: GROUP BY l.customer_trx_line_id
2189: ,l.line_number;

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

2182: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
2183: AND l.inventory_item_id = mic.inventory_item_id(+)
2184: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
2185: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
2186: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
2187: AND l.line_type = 'LINE'
2188: GROUP BY l.customer_trx_line_id
2189: ,l.line_number;
2190:

Line 2199: AND s.salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id

2195: NVL(SUM(s.non_revenue_percent_split),0)
2196: FROM ra_cust_trx_line_salesreps s,
2197: ra_customer_trx_lines l
2198: WHERE s.customer_trx_line_id = l_cust_trx_line_id
2199: AND s.salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id
2200: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
2201: 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)))
2202: AND l.line_type = 'LINE'
2203: AND l.customer_trx_line_id = s.customer_trx_line_id

Line 2201: 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)))

2197: ra_customer_trx_lines l
2198: WHERE s.customer_trx_line_id = l_cust_trx_line_id
2199: AND s.salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id
2200: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
2201: 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)))
2202: AND l.line_type = 'LINE'
2203: AND l.customer_trx_line_id = s.customer_trx_line_id
2204: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
2205:

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

2200: AND DECODE(p_rev_adj_rec.sales_credit_type,'N', NVL(s.non_revenue_salesgroup_id, -9999), NVL(s.revenue_salesgroup_id, -9999)) =
2201: 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)))
2202: AND l.line_type = 'LINE'
2203: AND l.customer_trx_line_id = s.customer_trx_line_id
2204: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id;
2205:
2206: CURSOR c_new_salesrep_name IS
2207: SELECT name
2208: FROM ra_salesreps

Line 2209: WHERE salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id;

2205:
2206: CURSOR c_new_salesrep_name IS
2207: SELECT name
2208: FROM ra_salesreps
2209: WHERE salesrep_id = AR_RAAPI_UTIL.g_to_salesrep_id;
2210:
2211: BEGIN
2212:
2213: IF PG_DEBUG in ('Y', 'C') THEN

Line 2245: AR_RAAPI_UTIL.Constant_System_Values;

2241: l_rev_adj_rec.gl_date := trunc(p_rev_adj_rec.gl_date);
2242:
2243: l_rev_adj_rec.adjustment_type := 'NR';
2244:
2245: AR_RAAPI_UTIL.Constant_System_Values;
2246: AR_RAAPI_UTIL.Initialize_Globals;
2247: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
2248: ,p_rev_adj_rec => l_rev_adj_rec
2249: ,p_validation_level => p_validation_level

Line 2246: AR_RAAPI_UTIL.Initialize_Globals;

2242:
2243: l_rev_adj_rec.adjustment_type := 'NR';
2244:
2245: AR_RAAPI_UTIL.Constant_System_Values;
2246: AR_RAAPI_UTIL.Initialize_Globals;
2247: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
2248: ,p_rev_adj_rec => l_rev_adj_rec
2249: ,p_validation_level => p_validation_level
2250: ,x_return_status => x_return_status

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

2243: l_rev_adj_rec.adjustment_type := 'NR';
2244:
2245: AR_RAAPI_UTIL.Constant_System_Values;
2246: AR_RAAPI_UTIL.Initialize_Globals;
2247: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
2248: ,p_rev_adj_rec => l_rev_adj_rec
2249: ,p_validation_level => p_validation_level
2250: ,x_return_status => x_return_status
2251: ,x_msg_count => x_msg_count

Line 2290: AR_RAAPI_UTIL.g_trx_precision);

2286: l_amount := p_rev_adj_rec.amount;
2287: ELSIF p_rev_adj_rec.amount_mode = 'P'
2288: THEN
2289: l_amount := ROUND(l_trx_total * p_rev_adj_rec.percent / 100,
2290: AR_RAAPI_UTIL.g_trx_precision);
2291: END IF;
2292: IF l_amount = 0
2293: THEN
2294: RAISE invalid_amount;

Line 2313: / l_trx_total , AR_RAAPI_UTIL.g_trx_precision);

2309: l_line_amount := 0;
2310: l_line_percent := 0;
2311:
2312: l_line_amount := ROUND(l_amount * c1.amount
2313: / l_trx_total , AR_RAAPI_UTIL.g_trx_precision);
2314:
2315: IF l_line_amount <> 0
2316: THEN
2317: l_line_count := l_line_count + 1;

Line 2360: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,

2356: THEN
2357: RAISE invalid_sc_total;
2358: END IF;
2359:
2360: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
2361: AR_RAAPI_UTIL.g_to_salesrep_id,
2362: AR_RAAPI_UTIL.g_to_salesgroup_id,
2363: l_cust_trx_line_id,
2364: l_line_amount,

Line 2361: AR_RAAPI_UTIL.g_to_salesrep_id,

2357: RAISE invalid_sc_total;
2358: END IF;
2359:
2360: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
2361: AR_RAAPI_UTIL.g_to_salesrep_id,
2362: AR_RAAPI_UTIL.g_to_salesgroup_id,
2363: l_cust_trx_line_id,
2364: l_line_amount,
2365: l_line_percent,

Line 2362: AR_RAAPI_UTIL.g_to_salesgroup_id,

2358: END IF;
2359:
2360: insert_sales_credit( AR_RAAPI_UTIL.g_customer_trx_id,
2361: AR_RAAPI_UTIL.g_to_salesrep_id,
2362: AR_RAAPI_UTIL.g_to_salesgroup_id,
2363: l_cust_trx_line_id,
2364: l_line_amount,
2365: l_line_percent,
2366: 'N',

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

2387: WHEN invalid_amount THEN
2388: FND_MESSAGE.SET_NAME
2389: (application => 'AR', name => 'AR_RA_AMT_EXCEEDS_AVAIL_REV');
2390: FND_MESSAGE.set_token('TOT_AVAIL_REV',
2391: AR_RAAPI_UTIL.g_trx_currency||' '||'0');
2392: FND_MSG_PUB.Add;
2393: RAISE FND_API.G_EXC_ERROR;
2394: WHEN OTHERS then
2395: IF (SQLCODE = -20001)

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

2614: calculate the correct overall revenue amount to be debited */
2615: /* Bug 4675438: MOAC/SSA */
2616: IF l_assignment_total = 0
2617: THEN
2618: l_dist_amount := arpcurr.currround(p_revenue_amount / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);
2619: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2620: l_correct_gl_date_amt := arpcurr.currround(p_line_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2621: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2622: ELSE

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

2615: /* Bug 4675438: MOAC/SSA */
2616: IF l_assignment_total = 0
2617: THEN
2618: l_dist_amount := arpcurr.currround(p_revenue_amount / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);
2619: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2620: l_correct_gl_date_amt := arpcurr.currround(p_line_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2621: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2622: ELSE
2623: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);

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

2616: IF l_assignment_total = 0
2617: THEN
2618: l_dist_amount := arpcurr.currround(p_revenue_amount / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);
2619: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2620: l_correct_gl_date_amt := arpcurr.currround(p_line_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2621: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2622: ELSE
2623: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2624: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);

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

2617: THEN
2618: l_dist_amount := arpcurr.currround(p_revenue_amount / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);
2619: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2620: l_correct_gl_date_amt := arpcurr.currround(p_line_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2621: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2622: ELSE
2623: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2624: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2625: l_correct_gl_date_amt := arpcurr.currround(p_line_amount * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);

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

2619: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2620: l_correct_gl_date_amt := arpcurr.currround(p_line_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2621: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2622: ELSE
2623: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2624: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2625: l_correct_gl_date_amt := arpcurr.currround(p_line_amount * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2626: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2627: END IF;

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

2620: l_correct_gl_date_amt := arpcurr.currround(p_line_amount / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2621: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2622: ELSE
2623: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2624: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2625: l_correct_gl_date_amt := arpcurr.currround(p_line_amount * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2626: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2627: END IF;
2628:

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

2621: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd / l_no_of_assignments ,AR_RAAPI_UTIL.g_trx_currency);
2622: ELSE
2623: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2624: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2625: l_correct_gl_date_amt := arpcurr.currround(p_line_amount * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2626: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2627: END IF;
2628:
2629: IF l_ext_amount = 0

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

2622: ELSE
2623: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2624: l_dist_acctd_amount := arpcurr.currround(p_revenue_acctd_amount * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
2625: l_correct_gl_date_amt := arpcurr.currround(p_line_amount * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2626: l_correct_gl_date_acctd_amt := arpcurr.currround(p_line_amount_acctd * c1.amount / l_assignment_total ,AR_RAAPI_UTIL.g_trx_currency);
2627: END IF;
2628:
2629: IF l_ext_amount = 0
2630: THEN

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

2687: l_gl_date := p_gl_date;
2688: END IF;
2689:
2690: /* Bug 2146970 - validate the GL date passed in */
2691: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed (p_gl_date => l_gl_date);
2692: IF l_gl_date_valid IS NULL
2693: THEN
2694: FND_MESSAGE.set_name('AR','AR_RA_NO_OPEN_PERIODS');
2695: FND_MSG_PUB.Add;

Line 2937: ,AR_RAAPI_UTIL.g_cust_trx_type_id

2933: ,NULL
2934: ,NULL
2935: ,NULL
2936: ,NULL
2937: ,AR_RAAPI_UTIL.g_cust_trx_type_id
2938: ,rec.salesrep_id
2939: ,rec.inventory_item_id
2940: ,rec.memo_line_id
2941: ,rec.warehouse_id

Line 3259: ,AR_RAAPI_UTIL.g_cust_trx_type_id

3255: ,NULL
3256: ,NULL --l_dist_amount
3257: ,NULL
3258: ,null
3259: ,AR_RAAPI_UTIL.g_cust_trx_type_id
3260: ,c2.salesrep_id
3261: ,p_inventory_item_id
3262: ,p_memo_line_id
3263: ,l_warehouse_id

Line 3301: ,AR_RAAPI_UTIL.g_cust_trx_type_id

3297: ,NULL
3298: ,NULL --l_dist_tot
3299: ,NULL
3300: ,NULL
3301: ,AR_RAAPI_UTIL.g_cust_trx_type_id
3302: ,c2.salesrep_id
3303: ,p_inventory_item_id
3304: ,p_memo_line_id
3305: ,l_warehouse_id

Line 3341: l_gl_date := AR_RAAPI_UTIL.Deferred_GL_Date

3337: l_assignment_count := l_assignment_count + 1;
3338: -- If revenue is deferred, get the deferred GL date
3339: IF NVL(l_deferred_revenue_flag,'N') = 'Y'
3340: THEN
3341: l_gl_date := AR_RAAPI_UTIL.Deferred_GL_Date
3342: (p_start_date => p_gl_date,
3343: p_period_seq_no => l_assignment_count);
3344:
3345:

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

3363: IF l_assignment_total = 0
3364: THEN
3365: l_dist_amount := arpcurr.currround(
3366: p_revenue_amount * l_salesrep_percent
3367: / 100 / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);
3368: ELSE
3369: l_dist_amount := arpcurr.currround(p_revenue_amount * l_salesrep_percent / 100 * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
3370: END IF;
3371: l_dist_tot := l_dist_tot + l_dist_amount;

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

3365: l_dist_amount := arpcurr.currround(
3366: p_revenue_amount * l_salesrep_percent
3367: / 100 / l_no_of_assignments , AR_RAAPI_UTIL.g_trx_currency);
3368: ELSE
3369: l_dist_amount := arpcurr.currround(p_revenue_amount * l_salesrep_percent / 100 * c1.amount / l_assignment_total , AR_RAAPI_UTIL.g_trx_currency);
3370: END IF;
3371: l_dist_tot := l_dist_tot + l_dist_amount;
3372: IF l_salesrep_count = l_no_of_salesreps AND
3373: l_assignment_count = l_no_of_assignments AND

Line 3416: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate

3412: l_dist_acctd_amount :=
3413: ARPCURR.functional_amount(
3414: amount => l_dist_amount
3415: , currency_code => arp_global.functional_currency
3416: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate
3417: , precision => NULL
3418: , min_acc_unit => NULL );
3419: /* Bug 2146970 - validate the GL date for all lines regardless
3420: of duration */

Line 3421: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed

3417: , precision => NULL
3418: , min_acc_unit => NULL );
3419: /* Bug 2146970 - validate the GL date for all lines regardless
3420: of duration */
3421: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed
3422: (p_gl_date => l_gl_date);
3423: IF l_gl_date_valid IS NULL
3424: THEN
3425: FND_MESSAGE.set_name('AR','AR_RA_NO_OPEN_PERIODS');

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

3646: l_salesrep_percent := c1.revenue_percent_split;
3647: END IF;
3648:
3649: /* Bug 4675438: MOAC/SSA */
3650: l_dist_amount := arpcurr.currround(p_revenue_amount * l_salesrep_percent / 100 , AR_RAAPI_UTIL.g_trx_currency);
3651: l_dist_tot := l_dist_tot + l_dist_amount;
3652: l_salesrep_count := l_salesrep_count + 1;
3653: IF l_salesrep_count = l_no_of_salesreps AND
3654: l_dist_tot <> p_revenue_amount

Line 3688: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate

3684: l_dist_acctd_amount :=
3685: ARPCURR.functional_amount(
3686: amount => l_dist_amount
3687: , currency_code => arp_global.functional_currency
3688: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate
3689: , precision => NULL
3690: , min_acc_unit => NULL );
3691: --
3692: -- Step 1: Debit earned revenue

Line 3711: ,AR_RAAPI_UTIL.g_cust_trx_type_id

3707: ,NULL
3708: ,l_dist_amount
3709: ,NULL
3710: ,NULL
3711: ,AR_RAAPI_UTIL.g_cust_trx_type_id
3712: ,c1.salesrep_id
3713: ,p_inventory_item_id
3714: ,p_memo_line_id
3715: ,l_warehouse_id

Line 3770: ,AR_RAAPI_UTIL.g_cust_trx_type_id

3766: ,NULL
3767: ,l_dist_tot
3768: ,NULL
3769: ,NULL
3770: ,AR_RAAPI_UTIL.g_cust_trx_type_id
3771: ,c1.salesrep_id
3772: ,p_inventory_item_id
3773: ,p_memo_line_id
3774: ,l_warehouse_id

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

3932: FOR gld in c_dist LOOP
3933:
3934: /* set amounts for adjustment */ /* bug 5644810 added IF condition */
3935: IF gld.code_combination_id IS NULL THEN
3936: l_dist_amount := arpcurr.currround(p_revenue_amount ,AR_RAAPI_UTIL.g_trx_currency);
3937: ELSE
3938: l_dist_amount := arpcurr.currround(p_revenue_amount * gld.percent / 100,
3939: AR_RAAPI_UTIL.g_trx_currency);
3940: END IF;

Line 3939: AR_RAAPI_UTIL.g_trx_currency);

3935: IF gld.code_combination_id IS NULL THEN
3936: l_dist_amount := arpcurr.currround(p_revenue_amount ,AR_RAAPI_UTIL.g_trx_currency);
3937: ELSE
3938: l_dist_amount := arpcurr.currround(p_revenue_amount * gld.percent / 100,
3939: AR_RAAPI_UTIL.g_trx_currency);
3940: END IF;
3941:
3942: IF gld.extended_amount = 0
3943: THEN

Line 3960: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate

3956: l_dist_acctd_amount :=
3957: ARPCURR.functional_amount(
3958: amount => l_dist_amount
3959: , currency_code => arp_global.functional_currency
3960: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate
3961: , precision => NULL
3962: , min_acc_unit => NULL );
3963: --
3964: -- Step 1: Debit earned revenue

Line 3982: ,AR_RAAPI_UTIL.g_cust_trx_type_id

3978: ,NULL
3979: ,l_dist_amount
3980: ,NULL
3981: ,NULL
3982: ,AR_RAAPI_UTIL.g_cust_trx_type_id
3983: ,NULL -- srep id
3984: ,p_inventory_item_id
3985: ,p_memo_line_id
3986: ,gld.warehouse_id

Line 4052: ,AR_RAAPI_UTIL.g_cust_trx_type_id

4048: ,NULL
4049: ,l_dist_amount
4050: ,NULL
4051: ,NULL
4052: ,AR_RAAPI_UTIL.g_cust_trx_type_id
4053: ,NULL -- srep_Id
4054: ,p_inventory_item_id
4055: ,p_memo_line_id
4056: ,gld.warehouse_id

Line 4210: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

4206: ,ra_customer_trx_lines l
4207: WHERE d.customer_trx_line_id = l.customer_trx_line_id
4208: AND d.account_class = 'REV'
4209: AND l.line_type = 'LINE'
4210: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4211: AND d.account_class IN ('REV','UNEARN','UNBILL')
4212: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
4213: l.customer_trx_line_id)
4214: AND NVL(l.inventory_item_id,0) =

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

4208: AND d.account_class = 'REV'
4209: AND l.line_type = 'LINE'
4210: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4211: AND d.account_class IN ('REV','UNEARN','UNBILL')
4212: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
4213: l.customer_trx_line_id)
4214: AND NVL(l.inventory_item_id,0) =
4215: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4216: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

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

4211: AND d.account_class IN ('REV','UNEARN','UNBILL')
4212: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
4213: l.customer_trx_line_id)
4214: AND NVL(l.inventory_item_id,0) =
4215: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4216: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4217: AND l.inventory_item_id = mic.inventory_item_id(+)
4218: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4219: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

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

4212: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
4213: l.customer_trx_line_id)
4214: AND NVL(l.inventory_item_id,0) =
4215: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4216: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4217: AND l.inventory_item_id = mic.inventory_item_id(+)
4218: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4219: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4220: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

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

4214: AND NVL(l.inventory_item_id,0) =
4215: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4216: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4217: AND l.inventory_item_id = mic.inventory_item_id(+)
4218: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4219: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4220: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4221: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4222: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,

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

4215: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4216: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4217: AND l.inventory_item_id = mic.inventory_item_id(+)
4218: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4219: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4220: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4221: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4222: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4223: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,

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

4216: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4217: AND l.inventory_item_id = mic.inventory_item_id(+)
4218: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4219: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4220: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4221: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4222: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4223: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4224: NVL(l.accounting_rule_duration,0),0),0),0) <= 1;

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

4217: AND l.inventory_item_id = mic.inventory_item_id(+)
4218: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4219: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4220: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4221: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4222: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4223: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4224: NVL(l.accounting_rule_duration,0),0),0),0) <= 1;
4225:

Line 4222: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,

4218: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4219: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4220: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4221: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4222: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4223: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4224: NVL(l.accounting_rule_duration,0),0),0),0) <= 1;
4225:
4226: CURSOR c_lines_from IS

Line 4223: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,

4219: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4220: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4221: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4222: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4223: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4224: NVL(l.accounting_rule_duration,0),0),0),0) <= 1;
4225:
4226: CURSOR c_lines_from IS
4227: SELECT l.line_number

Line 4239: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

4235: ,ra_customer_trx_lines l
4236: WHERE d.customer_trx_line_id = l.customer_trx_line_id
4237: AND d.account_class = 'REV'
4238: AND l.line_type = 'LINE'
4239: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4240: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
4241: l.customer_trx_line_id)
4242: AND NVL(l.inventory_item_id,0) =
4243: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))

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

4236: WHERE d.customer_trx_line_id = l.customer_trx_line_id
4237: AND d.account_class = 'REV'
4238: AND l.line_type = 'LINE'
4239: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4240: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
4241: l.customer_trx_line_id)
4242: AND NVL(l.inventory_item_id,0) =
4243: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4244: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

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

4239: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4240: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
4241: l.customer_trx_line_id)
4242: AND NVL(l.inventory_item_id,0) =
4243: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4244: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4245: AND l.inventory_item_id = mic.inventory_item_id(+)
4246: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4247: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)

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

4240: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,
4241: l.customer_trx_line_id)
4242: AND NVL(l.inventory_item_id,0) =
4243: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4244: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4245: AND l.inventory_item_id = mic.inventory_item_id(+)
4246: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4247: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4248: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

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

4242: AND NVL(l.inventory_item_id,0) =
4243: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4244: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4245: AND l.inventory_item_id = mic.inventory_item_id(+)
4246: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4247: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4248: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4249: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4250: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,

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

4243: NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(l.inventory_item_id,0))
4244: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4245: AND l.inventory_item_id = mic.inventory_item_id(+)
4246: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4247: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4248: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4249: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4250: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4251: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,

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

4244: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4245: AND l.inventory_item_id = mic.inventory_item_id(+)
4246: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4247: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4248: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4249: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4250: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4251: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4252: NVL(l.accounting_rule_duration,0),0),0),0) <= 1

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

4245: AND l.inventory_item_id = mic.inventory_item_id(+)
4246: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4247: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4248: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4249: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4250: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4251: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4252: NVL(l.accounting_rule_duration,0),0),0),0) <= 1
4253: GROUP BY l.line_number

Line 4250: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,

4246: AND NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4247: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4248: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4249: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4250: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4251: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4252: NVL(l.accounting_rule_duration,0),0),0),0) <= 1
4253: GROUP BY l.line_number
4254: ,l.customer_trx_line_id

Line 4251: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,

4247: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id)
4248: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4249: AND DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,
4250: DECODE(AR_RAAPI_UTIL.g_from_inventory_item_id,NULL,
4251: DECODE(AR_RAAPI_UTIL.g_from_cust_trx_line_id,NULL,
4252: NVL(l.accounting_rule_duration,0),0),0),0) <= 1
4253: GROUP BY l.line_number
4254: ,l.customer_trx_line_id
4255: ,l.memo_line_id

Line 4263: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

4259: CURSOR c_line_salesrep_amount IS
4260: SELECT SUM(NVL(revenue_amount_split,0))
4261: FROM ra_cust_trx_line_salesreps
4262: WHERE customer_trx_line_id = l_line_id
4263: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4264: AND salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)
4265: AND NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));
4266:
4267: CURSOR c_tax_rate_count IS

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

4260: SELECT SUM(NVL(revenue_amount_split,0))
4261: FROM ra_cust_trx_line_salesreps
4262: WHERE customer_trx_line_id = l_line_id
4263: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4264: AND salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)
4265: AND NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));
4266:
4267: CURSOR c_tax_rate_count IS
4268: SELECT NVL(COUNT(DISTINCT tax.item_exception_rate_id||

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

4261: FROM ra_cust_trx_line_salesreps
4262: WHERE customer_trx_line_id = l_line_id
4263: AND customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4264: AND salesrep_id = NVL(AR_RAAPI_UTIL.g_from_salesrep_id,salesrep_id)
4265: AND NVL(revenue_salesgroup_id, -9999) = NVL(AR_RAAPI_UTIL.g_from_salesgroup_id,NVL(revenue_salesgroup_id, -9999));
4266:
4267: CURSOR c_tax_rate_count IS
4268: SELECT NVL(COUNT(DISTINCT tax.item_exception_rate_id||
4269: tax.tax_exemption_id|| tax.vat_tax_id||

Line 4274: WHERE line.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

4270: tax.sales_tax_id|| tax.tax_rate|| tax.tax_precedence),0)
4271: FROM ra_customer_trx_lines line
4272: ,mtl_item_categories mic
4273: ,ra_customer_trx_lines tax
4274: WHERE line.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4275: AND tax.line_type = 'TAX'
4276: AND line.customer_trx_line_id = tax.link_to_cust_trx_line_id
4277: AND line.customer_trx_line_id IN
4278: (NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id, line.customer_trx_line_id),

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

4274: WHERE line.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4275: AND tax.line_type = 'TAX'
4276: AND line.customer_trx_line_id = tax.link_to_cust_trx_line_id
4277: AND line.customer_trx_line_id IN
4278: (NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id, line.customer_trx_line_id),
4279: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id, line.customer_trx_line_id))
4280: AND NVL(line.inventory_item_id,0) IN
4281: (NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(line.inventory_item_id,0)),
4282: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))

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

4275: AND tax.line_type = 'TAX'
4276: AND line.customer_trx_line_id = tax.link_to_cust_trx_line_id
4277: AND line.customer_trx_line_id IN
4278: (NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id, line.customer_trx_line_id),
4279: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id, line.customer_trx_line_id))
4280: AND NVL(line.inventory_item_id,0) IN
4281: (NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(line.inventory_item_id,0)),
4282: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))
4283: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

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

4277: AND line.customer_trx_line_id IN
4278: (NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id, line.customer_trx_line_id),
4279: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id, line.customer_trx_line_id))
4280: AND NVL(line.inventory_item_id,0) IN
4281: (NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(line.inventory_item_id,0)),
4282: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))
4283: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4284: AND line.inventory_item_id = mic.inventory_item_id(+)
4285: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =

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

4278: (NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id, line.customer_trx_line_id),
4279: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id, line.customer_trx_line_id))
4280: AND NVL(line.inventory_item_id,0) IN
4281: (NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(line.inventory_item_id,0)),
4282: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))
4283: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4284: AND line.inventory_item_id = mic.inventory_item_id(+)
4285: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4286: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR

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

4279: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id, line.customer_trx_line_id))
4280: AND NVL(line.inventory_item_id,0) IN
4281: (NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(line.inventory_item_id,0)),
4282: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))
4283: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4284: AND line.inventory_item_id = mic.inventory_item_id(+)
4285: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4286: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR
4287: NVL(AR_RAAPI_UTIL.g_to_category_id,0) =

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

4281: (NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,NVL(line.inventory_item_id,0)),
4282: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))
4283: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4284: AND line.inventory_item_id = mic.inventory_item_id(+)
4285: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4286: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR
4287: NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4288: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id))
4289: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;

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

4282: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(line.inventory_item_id,0)))
4283: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4284: AND line.inventory_item_id = mic.inventory_item_id(+)
4285: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4286: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR
4287: NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4288: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id))
4289: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
4290:

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

4283: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4284: AND line.inventory_item_id = mic.inventory_item_id(+)
4285: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4286: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR
4287: NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4288: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id))
4289: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
4290:
4291: CURSOR c_lines_to_total IS

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

4284: AND line.inventory_item_id = mic.inventory_item_id(+)
4285: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4286: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR
4287: NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4288: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id))
4289: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
4290:
4291: CURSOR c_lines_to_total IS
4292: SELECT NVL(SUM(d.amount),0) amount

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

4285: AND (NVL(AR_RAAPI_UTIL.g_from_category_id,0) =
4286: DECODE(AR_RAAPI_UTIL.g_from_category_id,NULL,0,mic.category_id) OR
4287: NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4288: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id))
4289: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id;
4290:
4291: CURSOR c_lines_to_total IS
4292: SELECT NVL(SUM(d.amount),0) amount
4293: FROM ra_cust_trx_line_gl_dist d

Line 4299: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

4295: ,ra_customer_trx_lines l
4296: WHERE d.customer_trx_line_id = l.customer_trx_line_id
4297: AND d.account_class = 'REV'
4298: AND l.line_type = 'LINE'
4299: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4300: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4301: l.customer_trx_line_id)
4302: AND NVL(l.inventory_item_id,0) =
4303: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))

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

4296: WHERE d.customer_trx_line_id = l.customer_trx_line_id
4297: AND d.account_class = 'REV'
4298: AND l.line_type = 'LINE'
4299: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4300: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4301: l.customer_trx_line_id)
4302: AND NVL(l.inventory_item_id,0) =
4303: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4304: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

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

4299: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4300: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4301: l.customer_trx_line_id)
4302: AND NVL(l.inventory_item_id,0) =
4303: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4304: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4305: AND l.inventory_item_id = mic.inventory_item_id(+)
4306: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4307: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)

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

4300: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4301: l.customer_trx_line_id)
4302: AND NVL(l.inventory_item_id,0) =
4303: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4304: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4305: AND l.inventory_item_id = mic.inventory_item_id(+)
4306: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4307: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4308: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

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

4302: AND NVL(l.inventory_item_id,0) =
4303: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4304: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4305: AND l.inventory_item_id = mic.inventory_item_id(+)
4306: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4307: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4308: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4309: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4310: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,

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

4303: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4304: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4305: AND l.inventory_item_id = mic.inventory_item_id(+)
4306: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4307: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4308: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4309: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4310: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4311: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,

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

4304: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4305: AND l.inventory_item_id = mic.inventory_item_id(+)
4306: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4307: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4308: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4309: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4310: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4311: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4312: NVL(l.accounting_rule_duration,0),2),2),2) > 1;

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

4305: AND l.inventory_item_id = mic.inventory_item_id(+)
4306: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4307: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4308: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4309: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4310: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4311: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4312: NVL(l.accounting_rule_duration,0),2),2),2) > 1;
4313:

Line 4310: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,

4306: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4307: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4308: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4309: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4310: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4311: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4312: NVL(l.accounting_rule_duration,0),2),2),2) > 1;
4313:
4314: CURSOR c_line_to_count IS

Line 4311: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,

4307: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4308: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4309: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4310: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4311: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4312: NVL(l.accounting_rule_duration,0),2),2),2) > 1;
4313:
4314: CURSOR c_line_to_count IS
4315: SELECT COUNT(*)

Line 4318: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

4314: CURSOR c_line_to_count IS
4315: SELECT COUNT(*)
4316: FROM mtl_item_categories mic
4317: ,ra_customer_trx_lines l
4318: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4319: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4320: l.customer_trx_line_id)
4321: AND NVL(l.inventory_item_id,0) =
4322: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))

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

4315: SELECT COUNT(*)
4316: FROM mtl_item_categories mic
4317: ,ra_customer_trx_lines l
4318: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4319: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4320: l.customer_trx_line_id)
4321: AND NVL(l.inventory_item_id,0) =
4322: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4323: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

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

4318: WHERE l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4319: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4320: l.customer_trx_line_id)
4321: AND NVL(l.inventory_item_id,0) =
4322: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4323: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4324: AND l.inventory_item_id = mic.inventory_item_id(+)
4325: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4326: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)

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

4319: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4320: l.customer_trx_line_id)
4321: AND NVL(l.inventory_item_id,0) =
4322: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4323: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4324: AND l.inventory_item_id = mic.inventory_item_id(+)
4325: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4326: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4327: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

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

4321: AND NVL(l.inventory_item_id,0) =
4322: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4323: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4324: AND l.inventory_item_id = mic.inventory_item_id(+)
4325: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4326: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4327: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4328: AND l.line_type = 'LINE'
4329: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,

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

4322: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4323: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4324: AND l.inventory_item_id = mic.inventory_item_id(+)
4325: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4326: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4327: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4328: AND l.line_type = 'LINE'
4329: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4330: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,

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

4323: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4324: AND l.inventory_item_id = mic.inventory_item_id(+)
4325: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4326: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4327: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4328: AND l.line_type = 'LINE'
4329: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4330: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4331: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,

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

4325: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4326: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4327: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4328: AND l.line_type = 'LINE'
4329: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4330: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4331: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4332: NVL(l.accounting_rule_duration,0),2),2),2) > 1;
4333:

Line 4330: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,

4326: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4327: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4328: AND l.line_type = 'LINE'
4329: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4330: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4331: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4332: NVL(l.accounting_rule_duration,0),2),2),2) > 1;
4333:
4334: CURSOR c_lines_to IS

Line 4331: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,

4327: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4328: AND l.line_type = 'LINE'
4329: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4330: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4331: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4332: NVL(l.accounting_rule_duration,0),2),2),2) > 1;
4333:
4334: CURSOR c_lines_to IS
4335: SELECT l.line_number

Line 4348: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id

4344: ,ra_customer_trx_lines l
4345: WHERE d.customer_trx_line_id = l.customer_trx_line_id
4346: AND d.account_class = 'REV'
4347: AND l.line_type = 'LINE'
4348: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4349: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4350: l.customer_trx_line_id)
4351: AND NVL(l.inventory_item_id,0) =
4352: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))

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

4345: WHERE d.customer_trx_line_id = l.customer_trx_line_id
4346: AND d.account_class = 'REV'
4347: AND l.line_type = 'LINE'
4348: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4349: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4350: l.customer_trx_line_id)
4351: AND NVL(l.inventory_item_id,0) =
4352: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4353: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id

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

4348: AND l.customer_trx_id = AR_RAAPI_UTIL.g_customer_trx_id
4349: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4350: l.customer_trx_line_id)
4351: AND NVL(l.inventory_item_id,0) =
4352: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4353: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4354: AND l.inventory_item_id = mic.inventory_item_id(+)
4355: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4356: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)

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

4349: AND l.customer_trx_line_id = NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,
4350: l.customer_trx_line_id)
4351: AND NVL(l.inventory_item_id,0) =
4352: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4353: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4354: AND l.inventory_item_id = mic.inventory_item_id(+)
4355: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4356: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4357: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

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

4351: AND NVL(l.inventory_item_id,0) =
4352: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4353: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4354: AND l.inventory_item_id = mic.inventory_item_id(+)
4355: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4356: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4357: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4358: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4359: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,

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

4352: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,NVL(l.inventory_item_id,0))
4353: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4354: AND l.inventory_item_id = mic.inventory_item_id(+)
4355: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4356: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4357: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4358: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4359: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4360: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,

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

4353: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
4354: AND l.inventory_item_id = mic.inventory_item_id(+)
4355: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4356: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4357: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4358: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4359: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4360: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4361: NVL(l.accounting_rule_duration,0),2),2),2) > 1

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

4354: AND l.inventory_item_id = mic.inventory_item_id(+)
4355: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4356: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4357: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4358: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4359: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4360: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4361: NVL(l.accounting_rule_duration,0),2),2),2) > 1
4362: GROUP BY l.line_number

Line 4359: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,

4355: AND NVL(AR_RAAPI_UTIL.g_to_category_id,0) =
4356: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4357: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4358: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4359: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4360: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4361: NVL(l.accounting_rule_duration,0),2),2),2) > 1
4362: GROUP BY l.line_number
4363: ,l.customer_trx_line_id

Line 4360: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,

4356: DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,0,mic.category_id)
4357: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
4358: AND DECODE(AR_RAAPI_UTIL.g_to_category_id,NULL,
4359: DECODE(AR_RAAPI_UTIL.g_to_inventory_item_id,NULL,
4360: DECODE(AR_RAAPI_UTIL.g_to_cust_trx_line_id,NULL,
4361: NVL(l.accounting_rule_duration,0),2),2),2) > 1
4362: GROUP BY l.line_number
4363: ,l.customer_trx_line_id
4364: ,l.memo_line_id

Line 4407: AR_RAAPI_UTIL.Constant_System_Values;

4403: l_rev_adj_rec.gl_date := trunc(p_rev_adj_rec.gl_date);
4404:
4405: l_rev_adj_rec.adjustment_type := 'LL';
4406:
4407: AR_RAAPI_UTIL.Constant_System_Values;
4408: AR_RAAPI_UTIL.Initialize_Globals;
4409: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
4410: ,p_rev_adj_rec => l_rev_adj_rec
4411: ,p_validation_level => p_validation_level

Line 4408: AR_RAAPI_UTIL.Initialize_Globals;

4404:
4405: l_rev_adj_rec.adjustment_type := 'LL';
4406:
4407: AR_RAAPI_UTIL.Constant_System_Values;
4408: AR_RAAPI_UTIL.Initialize_Globals;
4409: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
4410: ,p_rev_adj_rec => l_rev_adj_rec
4411: ,p_validation_level => p_validation_level
4412: ,x_return_status => x_return_status

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

4405: l_rev_adj_rec.adjustment_type := 'LL';
4406:
4407: AR_RAAPI_UTIL.Constant_System_Values;
4408: AR_RAAPI_UTIL.Initialize_Globals;
4409: AR_RAAPI_UTIL.Validate_Parameters (p_init_msg_list => FND_API.G_FALSE
4410: ,p_rev_adj_rec => l_rev_adj_rec
4411: ,p_validation_level => p_validation_level
4412: ,x_return_status => x_return_status
4413: ,x_msg_count => x_msg_count

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

4416: THEN
4417: RAISE FND_API.G_EXC_ERROR;
4418: END IF;
4419:
4420: IF NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,-100) =
4421: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,-200)
4422: THEN
4423: FND_MESSAGE.SET_NAME (application => 'AR',
4424: name => 'AR_RA_SAME_FROM_AND_TO_LINES');

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

4417: RAISE FND_API.G_EXC_ERROR;
4418: END IF;
4419:
4420: IF NVL(AR_RAAPI_UTIL.g_from_cust_trx_line_id,-100) =
4421: NVL(AR_RAAPI_UTIL.g_to_cust_trx_line_id,-200)
4422: THEN
4423: FND_MESSAGE.SET_NAME (application => 'AR',
4424: name => 'AR_RA_SAME_FROM_AND_TO_LINES');
4425: RAISE invalid_same_lines;

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

4423: FND_MESSAGE.SET_NAME (application => 'AR',
4424: name => 'AR_RA_SAME_FROM_AND_TO_LINES');
4425: RAISE invalid_same_lines;
4426: END IF;
4427: IF NVL(AR_RAAPI_UTIL.g_from_category_id,-100) =
4428: NVL(AR_RAAPI_UTIL.g_to_category_id,-200)
4429: THEN
4430: FND_MESSAGE.SET_NAME (application => 'AR',
4431: name => 'AR_RA_SAME_FROM_AND_TO_CATS');

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

4424: name => 'AR_RA_SAME_FROM_AND_TO_LINES');
4425: RAISE invalid_same_lines;
4426: END IF;
4427: IF NVL(AR_RAAPI_UTIL.g_from_category_id,-100) =
4428: NVL(AR_RAAPI_UTIL.g_to_category_id,-200)
4429: THEN
4430: FND_MESSAGE.SET_NAME (application => 'AR',
4431: name => 'AR_RA_SAME_FROM_AND_TO_CATS');
4432: RAISE invalid_same_lines;

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

4430: FND_MESSAGE.SET_NAME (application => 'AR',
4431: name => 'AR_RA_SAME_FROM_AND_TO_CATS');
4432: RAISE invalid_same_lines;
4433: END IF;
4434: IF NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,-100) =
4435: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,-200)
4436: THEN
4437: FND_MESSAGE.SET_NAME (application => 'AR',
4438: name => 'AR_RA_SAME_FROM_AND_TO_ITEMS');

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

4431: name => 'AR_RA_SAME_FROM_AND_TO_CATS');
4432: RAISE invalid_same_lines;
4433: END IF;
4434: IF NVL(AR_RAAPI_UTIL.g_from_inventory_item_id,-100) =
4435: NVL(AR_RAAPI_UTIL.g_to_inventory_item_id,-200)
4436: THEN
4437: FND_MESSAGE.SET_NAME (application => 'AR',
4438: name => 'AR_RA_SAME_FROM_AND_TO_ITEMS');
4439: RAISE invalid_same_lines;

Line 4455: AR_RAAPI_UTIL.Validate_Amount

4451: OPEN c_lines_from_total;
4452: FETCH c_lines_from_total INTO l_lines_from_total;
4453: CLOSE c_lines_from_total;
4454:
4455: AR_RAAPI_UTIL.Validate_Amount
4456: (p_init_msg_list => FND_API.G_FALSE
4457: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
4458: ,p_adjustment_type => 'LL'
4459: ,p_amount_mode => p_rev_adj_rec.amount_mode

Line 4457: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id

4453: CLOSE c_lines_from_total;
4454:
4455: AR_RAAPI_UTIL.Validate_Amount
4456: (p_init_msg_list => FND_API.G_FALSE
4457: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
4458: ,p_adjustment_type => 'LL'
4459: ,p_amount_mode => p_rev_adj_rec.amount_mode
4460: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
4461: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

Line 4460: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id

4456: (p_init_msg_list => FND_API.G_FALSE
4457: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
4458: ,p_adjustment_type => 'LL'
4459: ,p_amount_mode => p_rev_adj_rec.amount_mode
4460: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
4461: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
4462: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
4463: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
4464: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

Line 4461: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id

4457: ,p_customer_trx_line_id => AR_RAAPI_UTIL.g_from_cust_trx_line_id
4458: ,p_adjustment_type => 'LL'
4459: ,p_amount_mode => p_rev_adj_rec.amount_mode
4460: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
4461: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
4462: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
4463: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
4464: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
4465: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

Line 4462: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id

4458: ,p_adjustment_type => 'LL'
4459: ,p_amount_mode => p_rev_adj_rec.amount_mode
4460: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
4461: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
4462: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
4463: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
4464: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
4465: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
4466: ,p_revenue_amount_in => p_rev_adj_rec.amount

Line 4464: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id

4460: ,p_customer_trx_id => AR_RAAPI_UTIL.g_customer_trx_id
4461: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
4462: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
4463: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
4464: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
4465: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
4466: ,p_revenue_amount_in => p_rev_adj_rec.amount
4467: ,p_revenue_percent => p_rev_adj_rec.percent
4468: ,p_revenue_amount_out => l_revenue_amount

Line 4465: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id

4461: ,p_salesrep_id => AR_RAAPI_UTIL.g_from_salesrep_id
4462: ,p_salesgroup_id => AR_RAAPI_UTIL.g_from_salesgroup_id
4463: ,p_sales_credit_type => p_rev_adj_rec.sales_credit_type
4464: ,p_item_id => AR_RAAPI_UTIL.g_from_inventory_item_id
4465: ,p_category_id => AR_RAAPI_UTIL.g_from_category_id
4466: ,p_revenue_amount_in => p_rev_adj_rec.amount
4467: ,p_revenue_percent => p_rev_adj_rec.percent
4468: ,p_revenue_amount_out => l_revenue_amount
4469: ,p_adjustable_amount_out => l_adj_inv_total

Line 4492: AR_RAAPI_UTIL.g_from_cust_trx_line_id IS NULL AND

4488: FETCH c_line_to_count INTO l_no_of_lines_to;
4489: CLOSE c_line_to_count;
4490:
4491: IF (l_no_of_lines_from = 0 OR l_no_of_lines_to = 0) AND
4492: AR_RAAPI_UTIL.g_from_cust_trx_line_id IS NULL AND
4493: AR_RAAPI_UTIL.g_to_cust_trx_line_id IS NULL
4494: THEN
4495: RAISE invalid_lines;
4496: END IF;

Line 4493: AR_RAAPI_UTIL.g_to_cust_trx_line_id IS NULL

4489: CLOSE c_line_to_count;
4490:
4491: IF (l_no_of_lines_from = 0 OR l_no_of_lines_to = 0) AND
4492: AR_RAAPI_UTIL.g_from_cust_trx_line_id IS NULL AND
4493: AR_RAAPI_UTIL.g_to_cust_trx_line_id IS NULL
4494: THEN
4495: RAISE invalid_lines;
4496: END IF;
4497:

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

4520: END IF;
4521: IF l_line_adjustable <> 0
4522: THEN
4523: l_revenue_amount_prorata := ROUND(l_revenue_amount *
4524: l_line_adjustable / l_adj_inv_total,AR_RAAPI_UTIL.g_trx_precision);
4525: l_line_from_count := l_line_from_count + 1;
4526: l_total_adjusted := l_total_adjusted + l_revenue_amount_prorata;
4527:
4528: IF l_line_from_count = l_no_of_lines_from AND

Line 4537: ,AR_RAAPI_UTIL.g_customer_trx_id

4533: END IF;
4534: IF c1.accounting_rule_id IS NOT NULL
4535: THEN
4536: debit_credit (c1.customer_trx_line_id
4537: ,AR_RAAPI_UTIL.g_customer_trx_id
4538: ,AR_RAAPI_UTIL.g_from_salesrep_id
4539: ,l_revenue_amount_prorata
4540: ,l_rev_adj_rec.gl_date -- 7314406 (raw gl_date)
4541: ,arp_global.sysparam.rev_transfer_clear_ccid

Line 4538: ,AR_RAAPI_UTIL.g_from_salesrep_id

4534: IF c1.accounting_rule_id IS NOT NULL
4535: THEN
4536: debit_credit (c1.customer_trx_line_id
4537: ,AR_RAAPI_UTIL.g_customer_trx_id
4538: ,AR_RAAPI_UTIL.g_from_salesrep_id
4539: ,l_revenue_amount_prorata
4540: ,l_rev_adj_rec.gl_date -- 7314406 (raw gl_date)
4541: ,arp_global.sysparam.rev_transfer_clear_ccid
4542: ,c1.inventory_item_id

Line 4548: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed

4544: ,x_adjustment_id);
4545: ELSE
4546:
4547: /* 7314406 - need to bump/validate gl_date */
4548: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed
4549: (p_gl_date => l_rev_adj_rec.gl_date);
4550:
4551: no_rule_debit_credit (c1.customer_trx_line_id
4552: ,AR_RAAPI_UTIL.g_customer_trx_id

Line 4552: ,AR_RAAPI_UTIL.g_customer_trx_id

4548: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed
4549: (p_gl_date => l_rev_adj_rec.gl_date);
4550:
4551: no_rule_debit_credit (c1.customer_trx_line_id
4552: ,AR_RAAPI_UTIL.g_customer_trx_id
4553: ,AR_RAAPI_UTIL.g_from_salesrep_id
4554: ,l_revenue_amount_prorata
4555: ,l_gl_date_valid -- 7314406
4556: ,arp_global.sysparam.rev_transfer_clear_ccid

Line 4553: ,AR_RAAPI_UTIL.g_from_salesrep_id

4549: (p_gl_date => l_rev_adj_rec.gl_date);
4550:
4551: no_rule_debit_credit (c1.customer_trx_line_id
4552: ,AR_RAAPI_UTIL.g_customer_trx_id
4553: ,AR_RAAPI_UTIL.g_from_salesrep_id
4554: ,l_revenue_amount_prorata
4555: ,l_gl_date_valid -- 7314406
4556: ,arp_global.sysparam.rev_transfer_clear_ccid
4557: ,c1.inventory_item_id

Line 4572: AR_RAAPI_UTIL.g_trx_precision);

4568: IF l_lines_to_total = 0
4569: THEN
4570: l_revenue_amount_prorata :=
4571: ROUND(l_revenue_amount / l_no_of_lines_to,
4572: AR_RAAPI_UTIL.g_trx_precision);
4573: ELSE
4574: l_revenue_amount_prorata := ROUND(l_revenue_amount * c1.amount /
4575: l_lines_to_total, AR_RAAPI_UTIL.g_trx_precision);
4576: END IF;

Line 4575: l_lines_to_total, AR_RAAPI_UTIL.g_trx_precision);

4571: ROUND(l_revenue_amount / l_no_of_lines_to,
4572: AR_RAAPI_UTIL.g_trx_precision);
4573: ELSE
4574: l_revenue_amount_prorata := ROUND(l_revenue_amount * c1.amount /
4575: l_lines_to_total, AR_RAAPI_UTIL.g_trx_precision);
4576: END IF;
4577: l_line_to_count := l_line_to_count + 1;
4578: l_total_adjusted := l_total_adjusted + l_revenue_amount_prorata;
4579: IF l_line_to_count = l_no_of_lines_to AND

Line 4591: ,AR_RAAPI_UTIL.g_customer_trx_id

4587: THEN
4588: IF NVL(c1.accounting_rule_duration,0) > 1
4589: THEN
4590: cr_target_line_unearned(c1.customer_trx_line_id
4591: ,AR_RAAPI_UTIL.g_customer_trx_id
4592: ,l_revenue_amount_prorata
4593: ,l_rev_adj_rec.gl_date
4594: ,c1.inventory_item_id
4595: ,c1.memo_line_id

Line 4603: ,AR_RAAPI_UTIL.g_customer_trx_id

4599: l_credit_ccid := arp_global.sysparam.rev_transfer_clear_ccid;
4600: END IF;
4601:
4602: debit_credit (c1.customer_trx_line_id
4603: ,AR_RAAPI_UTIL.g_customer_trx_id
4604: ,NULL
4605: ,l_revenue_amount_prorata * -1
4606: ,l_rev_adj_rec.gl_date
4607: ,l_credit_ccid

Line 4613: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed

4609: ,c1.memo_line_id
4610: ,x_adjustment_id);
4611: ELSE
4612: /* 7314406 - need to bump/validate gl_date */
4613: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed
4614: (p_gl_date => l_rev_adj_rec.gl_date);
4615:
4616: no_rule_debit_credit(c1.customer_trx_line_id
4617: ,AR_RAAPI_UTIL.g_customer_trx_id

Line 4617: ,AR_RAAPI_UTIL.g_customer_trx_id

4613: l_gl_date_valid := AR_RAAPI_UTIL.bump_gl_date_if_closed
4614: (p_gl_date => l_rev_adj_rec.gl_date);
4615:
4616: no_rule_debit_credit(c1.customer_trx_line_id
4617: ,AR_RAAPI_UTIL.g_customer_trx_id
4618: ,NULL
4619: ,l_revenue_amount_prorata * -1
4620: ,l_gl_date_valid -- 7314406
4621: ,arp_global.sysparam.rev_transfer_clear_ccid

Line 4881: ,AR_RAAPI_UTIL.g_customer_trx_id

4877: ,org_id ) -- Bug 4607673
4878: VALUES
4879: (x_adjustment_id
4880: ,x_adjustment_number
4881: ,AR_RAAPI_UTIL.g_customer_trx_id
4882: ,SYSDATE
4883: ,AR_RAAPI_UTIL.g_from_salesrep_id
4884: ,AR_RAAPI_UTIL.g_to_salesrep_id
4885: ,AR_RAAPI_UTIL.g_from_salesgroup_id

Line 4883: ,AR_RAAPI_UTIL.g_from_salesrep_id

4879: (x_adjustment_id
4880: ,x_adjustment_number
4881: ,AR_RAAPI_UTIL.g_customer_trx_id
4882: ,SYSDATE
4883: ,AR_RAAPI_UTIL.g_from_salesrep_id
4884: ,AR_RAAPI_UTIL.g_to_salesrep_id
4885: ,AR_RAAPI_UTIL.g_from_salesgroup_id
4886: ,AR_RAAPI_UTIL.g_to_salesgroup_id
4887: ,p_rev_adj_rec.adjustment_type

Line 4884: ,AR_RAAPI_UTIL.g_to_salesrep_id

4880: ,x_adjustment_number
4881: ,AR_RAAPI_UTIL.g_customer_trx_id
4882: ,SYSDATE
4883: ,AR_RAAPI_UTIL.g_from_salesrep_id
4884: ,AR_RAAPI_UTIL.g_to_salesrep_id
4885: ,AR_RAAPI_UTIL.g_from_salesgroup_id
4886: ,AR_RAAPI_UTIL.g_to_salesgroup_id
4887: ,p_rev_adj_rec.adjustment_type
4888: ,p_rev_adj_rec.sales_credit_type

Line 4885: ,AR_RAAPI_UTIL.g_from_salesgroup_id

4881: ,AR_RAAPI_UTIL.g_customer_trx_id
4882: ,SYSDATE
4883: ,AR_RAAPI_UTIL.g_from_salesrep_id
4884: ,AR_RAAPI_UTIL.g_to_salesrep_id
4885: ,AR_RAAPI_UTIL.g_from_salesgroup_id
4886: ,AR_RAAPI_UTIL.g_to_salesgroup_id
4887: ,p_rev_adj_rec.adjustment_type
4888: ,p_rev_adj_rec.sales_credit_type
4889: ,p_rev_adj_rec.amount_mode

Line 4886: ,AR_RAAPI_UTIL.g_to_salesgroup_id

4882: ,SYSDATE
4883: ,AR_RAAPI_UTIL.g_from_salesrep_id
4884: ,AR_RAAPI_UTIL.g_to_salesrep_id
4885: ,AR_RAAPI_UTIL.g_from_salesgroup_id
4886: ,AR_RAAPI_UTIL.g_to_salesgroup_id
4887: ,p_rev_adj_rec.adjustment_type
4888: ,p_rev_adj_rec.sales_credit_type
4889: ,p_rev_adj_rec.amount_mode
4890: ,p_rev_adj_rec.amount

Line 4893: ,AR_RAAPI_UTIL.g_from_category_id

4889: ,p_rev_adj_rec.amount_mode
4890: ,p_rev_adj_rec.amount
4891: ,p_rev_adj_rec.percent
4892: ,p_rev_adj_rec.line_selection_mode
4893: ,AR_RAAPI_UTIL.g_from_category_id
4894: ,AR_RAAPI_UTIL.g_to_category_id
4895: ,AR_RAAPI_UTIL.g_from_inventory_item_id
4896: ,AR_RAAPI_UTIL.g_to_inventory_item_id
4897: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id

Line 4894: ,AR_RAAPI_UTIL.g_to_category_id

4890: ,p_rev_adj_rec.amount
4891: ,p_rev_adj_rec.percent
4892: ,p_rev_adj_rec.line_selection_mode
4893: ,AR_RAAPI_UTIL.g_from_category_id
4894: ,AR_RAAPI_UTIL.g_to_category_id
4895: ,AR_RAAPI_UTIL.g_from_inventory_item_id
4896: ,AR_RAAPI_UTIL.g_to_inventory_item_id
4897: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id
4898: ,AR_RAAPI_UTIL.g_to_cust_trx_line_id

Line 4895: ,AR_RAAPI_UTIL.g_from_inventory_item_id

4891: ,p_rev_adj_rec.percent
4892: ,p_rev_adj_rec.line_selection_mode
4893: ,AR_RAAPI_UTIL.g_from_category_id
4894: ,AR_RAAPI_UTIL.g_to_category_id
4895: ,AR_RAAPI_UTIL.g_from_inventory_item_id
4896: ,AR_RAAPI_UTIL.g_to_inventory_item_id
4897: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id
4898: ,AR_RAAPI_UTIL.g_to_cust_trx_line_id
4899: /*Bug 6731185 JVARKEY Making sure GL date has no timestamp*/

Line 4896: ,AR_RAAPI_UTIL.g_to_inventory_item_id

4892: ,p_rev_adj_rec.line_selection_mode
4893: ,AR_RAAPI_UTIL.g_from_category_id
4894: ,AR_RAAPI_UTIL.g_to_category_id
4895: ,AR_RAAPI_UTIL.g_from_inventory_item_id
4896: ,AR_RAAPI_UTIL.g_to_inventory_item_id
4897: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id
4898: ,AR_RAAPI_UTIL.g_to_cust_trx_line_id
4899: /*Bug 6731185 JVARKEY Making sure GL date has no timestamp*/
4900: ,trunc(p_rev_adj_rec.gl_date)

Line 4897: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id

4893: ,AR_RAAPI_UTIL.g_from_category_id
4894: ,AR_RAAPI_UTIL.g_to_category_id
4895: ,AR_RAAPI_UTIL.g_from_inventory_item_id
4896: ,AR_RAAPI_UTIL.g_to_inventory_item_id
4897: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id
4898: ,AR_RAAPI_UTIL.g_to_cust_trx_line_id
4899: /*Bug 6731185 JVARKEY Making sure GL date has no timestamp*/
4900: ,trunc(p_rev_adj_rec.gl_date)
4901: /*,p_rev_adj_rec.gl_date*/

Line 4898: ,AR_RAAPI_UTIL.g_to_cust_trx_line_id

4894: ,AR_RAAPI_UTIL.g_to_category_id
4895: ,AR_RAAPI_UTIL.g_from_inventory_item_id
4896: ,AR_RAAPI_UTIL.g_to_inventory_item_id
4897: ,AR_RAAPI_UTIL.g_from_cust_trx_line_id
4898: ,AR_RAAPI_UTIL.g_to_cust_trx_line_id
4899: /*Bug 6731185 JVARKEY Making sure GL date has no timestamp*/
4900: ,trunc(p_rev_adj_rec.gl_date)
4901: /*,p_rev_adj_rec.gl_date*/
4902: ,p_rev_adj_rec.reason_code

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

5025: CLOSE c_line;
5026:
5027: FOR c1 in c_salesrep LOOP
5028:
5029: l_dist_amount := arpcurr.currround(p_revenue_amount * c1.revenue_percent_split / 100 , AR_RAAPI_UTIL.g_trx_currency);
5030: l_dist_tot := l_dist_tot + l_dist_amount;
5031: l_salesrep_count := l_salesrep_count + 1;
5032: IF l_salesrep_count = l_no_of_salesreps AND
5033: l_dist_tot <> p_revenue_amount

Line 5054: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate

5050: l_dist_acctd_amount :=
5051: ARPCURR.functional_amount(
5052: amount => l_dist_amount
5053: , currency_code => arp_global.functional_currency
5054: , exchange_rate => AR_RAAPI_UTIL.g_exchange_rate
5055: , precision => NULL
5056: , min_acc_unit => NULL );
5057: --
5058: -- Initiate auto accounting procedure

Line 5073: ,AR_RAAPI_UTIL.g_cust_trx_type_id

5069: ,NULL
5070: ,l_dist_tot
5071: ,NULL
5072: ,NULL
5073: ,AR_RAAPI_UTIL.g_cust_trx_type_id
5074: ,c1.salesrep_id
5075: ,p_inventory_item_id
5076: ,p_memo_line_id
5077: ,l_warehouse_id

Line 5417: AR_RAAPI_UTIL.g_invoicing_rule_id IS NOT NULL

5413:
5414: /* 6615118 - create model distribution if srep is revenue type
5415: and transaction has rules */
5416: IF p_type = 'R' AND
5417: AR_RAAPI_UTIL.g_invoicing_rule_id IS NOT NULL
5418: THEN
5419: /* fetch these values for autoaccounting */
5420:
5421: IF NVL(g_line_id, -99) = p_cust_trx_line_id

Line 5464: ,AR_RAAPI_UTIL.g_cust_trx_type_id

5460: ,NULL
5461: ,p_amount
5462: ,NULL
5463: ,NULL
5464: ,AR_RAAPI_UTIL.g_cust_trx_type_id
5465: ,p_salesrep_id
5466: ,g_inventory_item_id
5467: ,g_memo_line_id
5468: ,g_warehouse_id

Line 5590: RETURN AR_RAAPI_UTIL.g_category_set_id;

5586:
5587: FUNCTION category_set_id
5588: RETURN VARCHAR2 IS
5589: BEGIN
5590: RETURN AR_RAAPI_UTIL.g_category_set_id;
5591: END category_set_id;
5592:
5593: FUNCTION inv_org_id
5594: RETURN VARCHAR2 IS

Line 5596: RETURN AR_RAAPI_UTIL.g_inv_org_id;

5592:
5593: FUNCTION inv_org_id
5594: RETURN VARCHAR2 IS
5595: BEGIN
5596: RETURN AR_RAAPI_UTIL.g_inv_org_id;
5597: END inv_org_id;
5598:
5599: -----------------------------------------------------------------------
5600: -- API name : Record_Acceptance

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

5639: WHERE l.customer_trx_id = p_customer_trx_id
5640: AND l.accounting_rule_id = r.rule_id(+)
5641: AND NVL(l.inventory_item_id,0) =
5642: NVL(p_inventory_item_id,NVL(l.inventory_item_id,0))
5643: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
5644: AND l.inventory_item_id = mic.inventory_item_id(+)
5645: AND NVL(p_category_id,0) =
5646: DECODE(p_category_id,NULL,0,mic.category_id)
5647: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id

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

5643: AND mic.organization_id(+) = AR_RAAPI_UTIL.g_inv_org_id
5644: AND l.inventory_item_id = mic.inventory_item_id(+)
5645: AND NVL(p_category_id,0) =
5646: DECODE(p_category_id,NULL,0,mic.category_id)
5647: AND mic.category_set_id(+) = AR_RAAPI_UTIL.g_category_set_id
5648: AND l.line_type = 'LINE'
5649: AND NVL(r.deferred_revenue_flag,'N') <> 'Y';
5650:
5651: BEGIN

Line 5655: AR_RAAPI_UTIL.Constant_System_Values;

5651: BEGIN
5652: IF PG_DEBUG in ('Y', 'C') THEN
5653: arp_util.debug('AR_Revenue_Adjustment_PVT.record_acceptance()+');
5654: END IF;
5655: AR_RAAPI_UTIL.Constant_System_Values;
5656: AR_RAAPI_UTIL.Initialize_Globals;
5657: x_first_rev_adj_id := NULL;
5658: x_last_rev_adj_id := NULL;
5659: l_first_adj_num := NULL;

Line 5656: AR_RAAPI_UTIL.Initialize_Globals;

5652: IF PG_DEBUG in ('Y', 'C') THEN
5653: arp_util.debug('AR_Revenue_Adjustment_PVT.record_acceptance()+');
5654: END IF;
5655: AR_RAAPI_UTIL.Constant_System_Values;
5656: AR_RAAPI_UTIL.Initialize_Globals;
5657: x_first_rev_adj_id := NULL;
5658: x_last_rev_adj_id := NULL;
5659: l_first_adj_num := NULL;
5660: l_last_adj_num := NULL;