1001: billing_date
1002: FROM ar_trx_header_gt
1003: WHERE term_id IS NOT NULL
1004: AND billing_date IS NULL
1005: AND ar_bfb_utils_pvt.is_payment_term_bfb(term_id) = 'Y'
1006: AND nvl(ar_bfb_utils_pvt.get_cycle_type (ar_bfb_utils_pvt.get_billing_cycle(term_id)),'XXX') = 'EVENT';
1007:
1008: -- R12:BFB : BFB is not allowed with open Rec = No
1009: INSERT INTO ar_trx_errors_gt (
1002: FROM ar_trx_header_gt
1003: WHERE term_id IS NOT NULL
1004: AND billing_date IS NULL
1005: AND ar_bfb_utils_pvt.is_payment_term_bfb(term_id) = 'Y'
1006: AND nvl(ar_bfb_utils_pvt.get_cycle_type (ar_bfb_utils_pvt.get_billing_cycle(term_id)),'XXX') = 'EVENT';
1007:
1008: -- R12:BFB : BFB is not allowed with open Rec = No
1009: INSERT INTO ar_trx_errors_gt (
1010: trx_header_id,
1015: term_id
1016: FROM ar_trx_header_gt
1017: WHERE term_id IS NOT NULL
1018: AND cust_trx_type_id IS NOT NULL
1019: AND ar_bfb_utils_pvt.is_payment_term_bfb(term_id) = 'Y'
1020: AND ar_bfb_utils_pvt.get_open_rec(cust_trx_type_id) = 'N';
1021:
1022: -- R12:BFB : billing_date validation
1023: INSERT INTO ar_trx_errors_gt (
1016: FROM ar_trx_header_gt
1017: WHERE term_id IS NOT NULL
1018: AND cust_trx_type_id IS NOT NULL
1019: AND ar_bfb_utils_pvt.is_payment_term_bfb(term_id) = 'Y'
1020: AND ar_bfb_utils_pvt.get_open_rec(cust_trx_type_id) = 'N';
1021:
1022: -- R12:BFB : billing_date validation
1023: INSERT INTO ar_trx_errors_gt (
1024: trx_header_id,
1032: AND billing_date IS NOT NULL
1033: AND
1034: (
1035: (-- billing_date should be null for non-BFB
1036: ar_bfb_utils_pvt.is_payment_term_bfb(term_id) = 'N'
1037: )
1038: OR
1039: (-- BFB is not valid for open_rec = No, so there should be NO billing date either
1040: cust_trx_type_id IS NOT NULL
1037: )
1038: OR
1039: (-- BFB is not valid for open_rec = No, so there should be NO billing date either
1040: cust_trx_type_id IS NOT NULL
1041: AND ar_bfb_utils_pvt.is_payment_term_bfb(term_id) = 'Y'
1042: AND ar_bfb_utils_pvt.get_open_rec(cust_trx_type_id) = 'N'
1043: )
1044: );
1045:
1038: OR
1039: (-- BFB is not valid for open_rec = No, so there should be NO billing date either
1040: cust_trx_type_id IS NOT NULL
1041: AND ar_bfb_utils_pvt.is_payment_term_bfb(term_id) = 'Y'
1042: AND ar_bfb_utils_pvt.get_open_rec(cust_trx_type_id) = 'N'
1043: )
1044: );
1045:
1046: IF pg_debug = 'Y' THEN
3819: AND NVL(t_cp2.end_date_active(+),
3820: gt.trx_date))
3821: WHERE gt.term_id IS NULL
3822: AND gt.trx_class in ('INV','DM') -- added for ER 5869149
3823: AND ar_bfb_utils_pvt.get_bill_level(gt.bill_to_customer_id) = 'N';
3824:
3825: -- R12:BFB : get term_id for BFB-enabled customers
3826: UPDATE ar_trx_header_gt gt
3827: SET term_id = ar_bfb_utils_pvt.get_default_term(
3823: AND ar_bfb_utils_pvt.get_bill_level(gt.bill_to_customer_id) = 'N';
3824:
3825: -- R12:BFB : get term_id for BFB-enabled customers
3826: UPDATE ar_trx_header_gt gt
3827: SET term_id = ar_bfb_utils_pvt.get_default_term(
3828: gt.cust_trx_type_id,
3829: gt.trx_date,
3830: gt.org_id,
3831: gt.bill_to_site_use_id,
3831: gt.bill_to_site_use_id,
3832: gt.bill_to_customer_id)
3833: WHERE gt.term_id IS NULL
3834: AND gt.trx_class in ('INV','DM') -- added for ER 5869149 **addtional condition**
3835: AND ar_bfb_utils_pvt.get_bill_level(gt.bill_to_customer_id) in ('A','S');
3836:
3837: IF pg_debug = 'Y'
3838: THEN
3839: debug ('Getting term_id(-)' );
3840: debug ('Getting billing_date(+)');
3841: END IF;
3842:
3843: UPDATE ar_trx_header_gt gt
3844: SET billing_date = ar_bfb_utils_pvt.get_billing_date
3845: (ar_bfb_utils_pvt.get_billing_cycle(gt.term_id),
3846: nvl(gt.trx_date,sysdate))
3847: WHERE gt.term_id IS NOT NULL
3848: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'Y'
3841: END IF;
3842:
3843: UPDATE ar_trx_header_gt gt
3844: SET billing_date = ar_bfb_utils_pvt.get_billing_date
3845: (ar_bfb_utils_pvt.get_billing_cycle(gt.term_id),
3846: nvl(gt.trx_date,sysdate))
3847: WHERE gt.term_id IS NOT NULL
3848: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'Y'
3849: AND gt.billing_date IS NULL
3844: SET billing_date = ar_bfb_utils_pvt.get_billing_date
3845: (ar_bfb_utils_pvt.get_billing_cycle(gt.term_id),
3846: nvl(gt.trx_date,sysdate))
3847: WHERE gt.term_id IS NOT NULL
3848: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'Y'
3849: AND gt.billing_date IS NULL
3850: AND ar_bfb_utils_pvt.get_bill_level(gt.bill_to_customer_id) in ('A','S')
3851: AND nvl(ar_bfb_utils_pvt.get_cycle_type
3852: (ar_bfb_utils_pvt.get_billing_cycle(term_id)),'XXX') = 'RECURRING';
3846: nvl(gt.trx_date,sysdate))
3847: WHERE gt.term_id IS NOT NULL
3848: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'Y'
3849: AND gt.billing_date IS NULL
3850: AND ar_bfb_utils_pvt.get_bill_level(gt.bill_to_customer_id) in ('A','S')
3851: AND nvl(ar_bfb_utils_pvt.get_cycle_type
3852: (ar_bfb_utils_pvt.get_billing_cycle(term_id)),'XXX') = 'RECURRING';
3853:
3854: -- override incorrect billing dates
3847: WHERE gt.term_id IS NOT NULL
3848: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'Y'
3849: AND gt.billing_date IS NULL
3850: AND ar_bfb_utils_pvt.get_bill_level(gt.bill_to_customer_id) in ('A','S')
3851: AND nvl(ar_bfb_utils_pvt.get_cycle_type
3852: (ar_bfb_utils_pvt.get_billing_cycle(term_id)),'XXX') = 'RECURRING';
3853:
3854: -- override incorrect billing dates
3855: UPDATE ar_trx_header_gt gt
3848: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'Y'
3849: AND gt.billing_date IS NULL
3850: AND ar_bfb_utils_pvt.get_bill_level(gt.bill_to_customer_id) in ('A','S')
3851: AND nvl(ar_bfb_utils_pvt.get_cycle_type
3852: (ar_bfb_utils_pvt.get_billing_cycle(term_id)),'XXX') = 'RECURRING';
3853:
3854: -- override incorrect billing dates
3855: UPDATE ar_trx_header_gt gt
3856: SET billing_date = ar_bfb_utils_pvt.get_billing_date
3852: (ar_bfb_utils_pvt.get_billing_cycle(term_id)),'XXX') = 'RECURRING';
3853:
3854: -- override incorrect billing dates
3855: UPDATE ar_trx_header_gt gt
3856: SET billing_date = ar_bfb_utils_pvt.get_billing_date
3857: (ar_bfb_utils_pvt.get_billing_cycle(gt.term_id),
3858: gt.billing_date)
3859: WHERE gt.term_id IS NOT NULL
3860: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'Y'
3853:
3854: -- override incorrect billing dates
3855: UPDATE ar_trx_header_gt gt
3856: SET billing_date = ar_bfb_utils_pvt.get_billing_date
3857: (ar_bfb_utils_pvt.get_billing_cycle(gt.term_id),
3858: gt.billing_date)
3859: WHERE gt.term_id IS NOT NULL
3860: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'Y'
3861: AND gt.billing_date IS NOT NULL
3856: SET billing_date = ar_bfb_utils_pvt.get_billing_date
3857: (ar_bfb_utils_pvt.get_billing_cycle(gt.term_id),
3858: gt.billing_date)
3859: WHERE gt.term_id IS NOT NULL
3860: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'Y'
3861: AND gt.billing_date IS NOT NULL
3862: AND billing_date <> ar_bfb_utils_pvt.get_billing_date(
3863: ar_bfb_utils_pvt.get_billing_cycle(term_id),
3864: gt.billing_date)
3858: gt.billing_date)
3859: WHERE gt.term_id IS NOT NULL
3860: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'Y'
3861: AND gt.billing_date IS NOT NULL
3862: AND billing_date <> ar_bfb_utils_pvt.get_billing_date(
3863: ar_bfb_utils_pvt.get_billing_cycle(term_id),
3864: gt.billing_date)
3865: AND nvl(ar_bfb_utils_pvt.get_cycle_type
3866: (ar_bfb_utils_pvt.get_billing_cycle(term_id)),'XXX') = 'RECURRING';
3859: WHERE gt.term_id IS NOT NULL
3860: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'Y'
3861: AND gt.billing_date IS NOT NULL
3862: AND billing_date <> ar_bfb_utils_pvt.get_billing_date(
3863: ar_bfb_utils_pvt.get_billing_cycle(term_id),
3864: gt.billing_date)
3865: AND nvl(ar_bfb_utils_pvt.get_cycle_type
3866: (ar_bfb_utils_pvt.get_billing_cycle(term_id)),'XXX') = 'RECURRING';
3867:
3861: AND gt.billing_date IS NOT NULL
3862: AND billing_date <> ar_bfb_utils_pvt.get_billing_date(
3863: ar_bfb_utils_pvt.get_billing_cycle(term_id),
3864: gt.billing_date)
3865: AND nvl(ar_bfb_utils_pvt.get_cycle_type
3866: (ar_bfb_utils_pvt.get_billing_cycle(term_id)),'XXX') = 'RECURRING';
3867:
3868: IF pg_debug = 'Y'
3869: THEN
3862: AND billing_date <> ar_bfb_utils_pvt.get_billing_date(
3863: ar_bfb_utils_pvt.get_billing_cycle(term_id),
3864: gt.billing_date)
3865: AND nvl(ar_bfb_utils_pvt.get_cycle_type
3866: (ar_bfb_utils_pvt.get_billing_cycle(term_id)),'XXX') = 'RECURRING';
3867:
3868: IF pg_debug = 'Y'
3869: THEN
3870: debug ('Getting billing_date(-)');
3879: UPDATE ar_trx_header_gt gt
3880: SET term_due_date = trunc(arpt_sql_func_util.get_First_Due_Date(
3881: gt.term_id, NVL(gt.trx_date,sysdate)))
3882: WHERE gt.term_id IS NOT NULL
3883: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'N'
3884: AND NOT EXISTS
3885: (SELECT 'X'
3886: FROM ar_trx_errors_gt errgt
3887: WHERE errgt.trx_header_id = gt.trx_header_id);
3887: WHERE errgt.trx_header_id = gt.trx_header_id);
3888:
3889: -- get due_date for BFB enabled
3890: UPDATE ar_trx_header_gt gt
3891: SET term_due_date = ar_bfb_utils_pvt.get_due_date(gt.billing_date, gt.term_id)
3892: WHERE gt.term_id IS NOT NULL
3893: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'Y'
3894: AND gt.billing_date IS NOT NULL
3895: AND NOT EXISTS
3889: -- get due_date for BFB enabled
3890: UPDATE ar_trx_header_gt gt
3891: SET term_due_date = ar_bfb_utils_pvt.get_due_date(gt.billing_date, gt.term_id)
3892: WHERE gt.term_id IS NOT NULL
3893: AND ar_bfb_utils_pvt.is_payment_term_bfb(gt.term_id) = 'Y'
3894: AND gt.billing_date IS NOT NULL
3895: AND NOT EXISTS
3896: (SELECT 'X'
3897: FROM ar_trx_errors_gt errgt