DBA Data[Home] [Help]

APPS.OKL_BILLING_CONTROLLER_PVT SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 29

        SELECT	MIN(ste.stream_element_date)
       	FROM	OKL_STRM_ELEMENTS		ste,
			OKL_STREAMS			    stm,
			okl_strm_type_v			sty,
			okc_k_headers_b			khr,
			OKL_K_HEADERS			khl,
			okc_k_lines_b			kle,
			okc_statuses_b			khs,
			okc_statuses_b			kls
		WHERE ste.amount 	    <> 0
		AND	stm.id				= ste.stm_id
		AND	ste.date_billed		IS NULL
		AND	stm.active_yn		= 'Y'
		AND	stm.say_code		= 'CURR'
		AND	sty.id				= stm.sty_id
		AND	sty.billable_yn		= 'Y'
		AND	khr.id				= stm.khr_id
	-- changed by zrehman for Bug#6788005 start
		AND	((khr.scs_code	IN ('LEASE', 'LOAN') AND khl.deal_type IS NOT NULL) OR (khr.scs_code = 'INVESTOR'))
        -- changed by zrehman for Bug#6788005 start
        --AND khr.sts_code        IN ( 'BOOKED','EVERGREEN','TERMINATED')
		AND	khr.id	= p_khr_id
		AND	khl.id				= stm.khr_id
		--AND	khl.deal_type		IS NOT NULL
		AND	khs.code			= khr.sts_code
		AND	kle.id			(+)	= stm.kle_id
		AND	kls.code		(+)	= kle.sts_code;
Line: 79

        select nbd.khr_id
        from okl_k_control nbd,
             okl_k_headers_full_v khr
        where nbd.khr_id = khr.id
        and khr.id = p_khr_id;
Line: 89

  l_last_updated_by     okl_k_control.last_updated_by%TYPE := Fnd_Global.USER_ID;
Line: 90

  l_last_update_login   okl_k_control.last_update_login%TYPE := Fnd_Global.LOGIN_ID;
Line: 113

        update okl_k_control
        set EARLIEST_STRM_BILL_DATE = l_next_bill_date,
            LAST_UPDATE_DATE = sysdate,
            LAST_UPDATED_BY = l_last_updated_by,
            LAST_UPDATE_LOGIN = l_last_update_login,
            REQUEST_ID = l_request_id,
            PROGRAM_ID = l_program_id,
            PROGRAM_UPDATE_DATE = sysdate
        where khr_id = l_khr_id;
Line: 125

        INSERT INTO okl_k_control
        (
         khr_id, EARLIEST_STRM_BILL_DATE,
         CREATED_BY,CREATION_DATE,LAST_UPDATE_DATE,LAST_UPDATED_BY,LAST_UPDATE_LOGIN,
         REQUEST_ID,PROGRAM_ID,PROGRAM_UPDATE_DATE
        )
        VALUES
        ( p_khr_id, l_next_bill_date,
         l_last_updated_by,sysdate,sysdate,l_last_updated_by,l_last_update_login,
         l_request_id,l_program_id,sysdate
        );
Line: 158

        select count(*)
        from fnd_concurrent_requests req,
             fnd_concurrent_programs_vl pgm
        where pgm.USER_CONCURRENT_PROGRAM_NAME
            IN ( p_conc_pgm1, p_conc_pgm2)
        and req.concurrent_program_id = pgm.concurrent_program_id
        and req.PHASE_CODE <> 'C';
Line: 173

  l_last_updated_by     okl_parallel_processes.last_updated_by%TYPE := Fnd_Global.USER_ID;
Line: 174

  l_last_update_login   okl_parallel_processes.last_update_login%TYPE := Fnd_Global.LOGIN_ID;
Line: 190

         SELECT Name org_name, organization_id org_id
         FROM hr_operating_units
         WHERE mo_global.check_access(organization_id) = 'Y'; --MOAC
Line: 223

           fnd_file.put_line(fnd_file.log,'** START: Delete all Stream Billing records from OKL_PARALLEL_PROCESSES. **');
Line: 234

              fnd_file.put_line(fnd_file.log,' => Could not perform a delete all for Stream Billing '
                                         ||'records because not all requests have Completed.');
Line: 239

              delete from okl_parallel_processes
              where OBJECT_TYPE = 'CONTRACT';
Line: 245

              fnd_file.put_line(fnd_file.log,' => Deleted '||sql%rowcount||' row(s).');
Line: 250

           fnd_file.put_line(fnd_file.log,'** END: Delete all Stream Billing records from OKL_PARALLEL_PROCESSES. **');
Line: 253

           fnd_file.put_line(fnd_file.log,'** START: Delete Org specific Stream Billing records from OKL_PARALLEL_PROCESSES. **');
Line: 255

           delete from okl_parallel_processes
           where OBJECT_TYPE = 'CONTRACT'
           and org_id = l_org_id
           and request_id in (
                select req.request_id
                from fnd_concurrent_requests req,
                     fnd_concurrent_programs_vl pgm
                where pgm.USER_CONCURRENT_PROGRAM_NAME IN ( 'Master Program -- Process Billable Streams',
                                                            'Process Billable Streams')
                and req.concurrent_program_id = pgm.concurrent_program_id
                and req.PHASE_CODE = 'C');
Line: 270

           fnd_file.put_line(fnd_file.log,' => Deleted '||sql%rowcount||' row(s).');
Line: 272

           fnd_file.put_line(fnd_file.log,'** END: Delete Org specific Stream Billing records from OKL_PARALLEL_PROCESSES. **');
Line: 280

           fnd_file.put_line(fnd_file.log,'** START: Delete all Consolidation records from OKL_PARALLEL_PROCESSES. **');
Line: 289

              fnd_file.put_line(fnd_file.log,' => Could not perform a delete all for Consolidation '
                                         ||'records because not all requests have Completed.');
Line: 293

              delete from okl_parallel_processes
              where OBJECT_TYPE = 'CUSTOMER';
Line: 299

              fnd_file.put_line(fnd_file.log,' => Deleted '||sql%rowcount||' row(s).');
Line: 304

           fnd_file.put_line(fnd_file.log,'** END: Delete all Consolidation records from OKL_PARALLEL_PROCESSES. **');
Line: 307

           fnd_file.put_line(fnd_file.log,'** START: Delete Org specific Consolidation records from OKL_PARALLEL_PROCESSES. **');
Line: 308

           delete from okl_parallel_processes
           where OBJECT_TYPE = 'CUSTOMER'
           and org_id = l_org_id
           and request_id in (
                select req.request_id
                from fnd_concurrent_requests req,
                     fnd_concurrent_programs_vl pgm
                where pgm.USER_CONCURRENT_PROGRAM_NAME IN ( 'Master Program -- Receivables Bills Consolidation',
                                                            'Receivables Bills Consolidation')
                and req.concurrent_program_id = pgm.concurrent_program_id
                and req.PHASE_CODE = 'C');
Line: 323

           fnd_file.put_line(fnd_file.log,' => Deleted '||sql%rowcount||' row(s).');
Line: 327

           fnd_file.put_line(fnd_file.log,'** END: Delete Org specific Consolidation records from OKL_PARALLEL_PROCESSES. **');
Line: 331

           fnd_file.put_line(fnd_file.log,'** START: Delete all Transfer records from OKL_PARALLEL_PROCESSES. **');
Line: 340

              fnd_file.put_line(fnd_file.log,' => Could not perform a delete all for Transfer '
                                         ||'records because not all requests have Completed.');
Line: 344

              delete from okl_parallel_processes
              where OBJECT_TYPE = 'XTRX_CONTRACT';
Line: 350

              fnd_file.put_line(fnd_file.log,' => Deleted '||sql%rowcount||' row(s).');
Line: 355

           fnd_file.put_line(fnd_file.log,'** END: Delete all Transfer records from OKL_PARALLEL_PROCESSES. **');
Line: 358

           fnd_file.put_line(fnd_file.log,'** START: Delete Org Specific Transfer records from OKL_PARALLEL_PROCESSES. **');
Line: 359

           delete from okl_parallel_processes
           where OBJECT_TYPE = 'XTRX_CONTRACT'
           and org_id = l_org_id
           and request_id in (
                select req.request_id
                from fnd_concurrent_requests req,
                     fnd_concurrent_programs_vl pgm
                where pgm.USER_CONCURRENT_PROGRAM_NAME IN ( 'Master Program -- Receivables Invoice Transfer',
                                                            'Receivables Invoice Transfer to AR')
                and req.concurrent_program_id = pgm.concurrent_program_id
                and req.PHASE_CODE = 'C');
Line: 374

           fnd_file.put_line(fnd_file.log,' => Deleted '||sql%rowcount||' row(s).');
Line: 378

           fnd_file.put_line(fnd_file.log,'** END: Delete Org Specific Transfer records from OKL_PARALLEL_PROCESSES. **');
Line: 384

           Fnd_File.put_line(Fnd_File.LOG,'** START: Delete all Prepare Receivables records from OKL_PARALLEL_PROCESSES. **');
Line: 393

              Fnd_File.put_line(Fnd_File.LOG,' => Could not perform a delete all for Prepare Receivables '
                                         ||'records because not all requests have Completed.');
Line: 397

              DELETE FROM okl_parallel_processes
              WHERE OBJECT_TYPE = 'PREP_CONTRACT';
Line: 403

              Fnd_File.put_line(Fnd_File.LOG,' => Deleted '||SQL%rowcount||' row(s).');
Line: 408

           Fnd_File.put_line(Fnd_File.LOG,'** END: Delete all Prepare Receivables records from OKL_PARALLEL_PROCESSES. **');
Line: 411

           Fnd_File.put_line(Fnd_File.LOG,'** START: Delete Org Specific Prepare Receivables records from OKL_PARALLEL_PROCESSES. **');
Line: 412

           DELETE FROM okl_parallel_processes
           WHERE OBJECT_TYPE = 'PREP_CONTRACT'
           AND org_id = l_org_id
           AND request_id IN (
                SELECT req.request_id
                FROM fnd_concurrent_requests req,
                     fnd_concurrent_programs_vl pgm
                WHERE pgm.USER_CONCURRENT_PROGRAM_NAME IN ( 'Master Program -- Prepare Receivables',
                                                            'Prepare Receivables Bills')
                AND req.concurrent_program_id = pgm.concurrent_program_id
                AND req.PHASE_CODE = 'C');
Line: 427

           Fnd_File.put_line(Fnd_File.LOG,' => Deleted '||SQL%rowcount||' row(s).');
Line: 431

           Fnd_File.put_line(Fnd_File.LOG,'** END: Delete Org Specific Prepare Receivables records from OKL_PARALLEL_PROCESSES. **');
Line: 438

           fnd_file.put_line(fnd_file.log,'** START: Delete all Stream Billing records from OKL_PARALLEL_PROCESSES. **');
Line: 448

              fnd_file.put_line(fnd_file.log,' => Could not perform a delete all for Stream Billing '
                                         ||'records because not all requests have Completed.');
Line: 453

              delete from okl_parallel_processes
              where OBJECT_TYPE = 'CONTRACT';
Line: 459

              fnd_file.put_line(fnd_file.log,' => Deleted '||sql%rowcount||' row(s).');
Line: 464

           fnd_file.put_line(fnd_file.log,'** END: Delete all Stream Billing records from OKL_PARALLEL_PROCESSES. **');
Line: 467

           fnd_file.put_line(fnd_file.log,'** START: Delete Org specific Stream Billing records from OKL_PARALLEL_PROCESSES. **');
Line: 469

           delete from okl_parallel_processes
           where OBJECT_TYPE = 'CONTRACT'
           and org_id = l_org_id
           and request_id in (
                select req.request_id
                from fnd_concurrent_requests req,
                     fnd_concurrent_programs_vl pgm
                where pgm.USER_CONCURRENT_PROGRAM_NAME IN ( 'Master Program -- Process Billable Streams',
                                                            'Process Billable Streams')
                and req.concurrent_program_id = pgm.concurrent_program_id
                and req.PHASE_CODE = 'C');
Line: 484

           fnd_file.put_line(fnd_file.log,' => Deleted '||sql%rowcount||' row(s).');
Line: 486

           fnd_file.put_line(fnd_file.log,'** END: Delete Org specific Stream Billing records from OKL_PARALLEL_PROCESSES. **');
Line: 493

           fnd_file.put_line(fnd_file.log,'** START: Delete all Consolidation records from OKL_PARALLEL_PROCESSES. **');
Line: 502

              fnd_file.put_line(fnd_file.log,' => Could not perform a delete all for Consolidation '
                                         ||'records because not all requests have Completed.');
Line: 506

              delete from okl_parallel_processes
              where OBJECT_TYPE = 'CUSTOMER';
Line: 512

              fnd_file.put_line(fnd_file.log,' => Deleted '||sql%rowcount||' row(s).');
Line: 516

           fnd_file.put_line(fnd_file.log,'** END: Delete all Consolidation records from OKL_PARALLEL_PROCESSES. **');
Line: 519

           fnd_file.put_line(fnd_file.log,'** START: Delete Org specific Consolidation records from OKL_PARALLEL_PROCESSES. **');
Line: 521

           delete from okl_parallel_processes
           where OBJECT_TYPE = 'CUSTOMER'
           and org_id = l_org_id
           and request_id in (
                select req.request_id
                from fnd_concurrent_requests req,
                     fnd_concurrent_programs_vl pgm
                where pgm.USER_CONCURRENT_PROGRAM_NAME IN ( 'Master Program -- Receivables Bills Consolidation',
                                                            'Receivables Bills Consolidation')
                and req.concurrent_program_id = pgm.concurrent_program_id
                and req.PHASE_CODE = 'C');
Line: 536

           fnd_file.put_line(fnd_file.log,' => Deleted '||sql%rowcount||' row(s).');
Line: 540

           fnd_file.put_line(fnd_file.log,'** END: Delete Org specific Consolidation records from OKL_PARALLEL_PROCESSES. **');
Line: 543

           fnd_file.put_line(fnd_file.log,'** START: Delete all Transfer records from OKL_PARALLEL_PROCESSES. **');
Line: 554

              fnd_file.put_line(fnd_file.log,' => Could not perform a delete all for Transfer '
                                         ||'records because not all requests have Completed.');
Line: 558

              delete from okl_parallel_processes
              where OBJECT_TYPE = 'XTRX_CONTRACT';
Line: 564

              fnd_file.put_line(fnd_file.log,' => Deleted '||sql%rowcount||' row(s).');
Line: 570

           fnd_file.put_line(fnd_file.log,'** END: Delete all Transfer records from OKL_PARALLEL_PROCESSES. **');
Line: 573

           fnd_file.put_line(fnd_file.log,'** START: Delete Org Specific Transfer records from OKL_PARALLEL_PROCESSES. **');
Line: 574

           delete from okl_parallel_processes
           where OBJECT_TYPE = 'XTRX_CONTRACT'
           and org_id = l_org_id
           and request_id in (
                select req.request_id
                from fnd_concurrent_requests req,
                     fnd_concurrent_programs_vl pgm
                where pgm.USER_CONCURRENT_PROGRAM_NAME IN ( 'Master Program -- Receivables Invoice Transfer',
                                                            'Receivables Invoice Transfer to AR')
                and req.concurrent_program_id = pgm.concurrent_program_id
                and req.PHASE_CODE = 'C');
Line: 589

           fnd_file.put_line(fnd_file.log,' => Deleted '||sql%rowcount||' row(s).');
Line: 594

           fnd_file.put_line(fnd_file.log,'** END: Delete Org Specific Transfer records from OKL_PARALLEL_PROCESSES. **');
Line: 601

           Fnd_File.put_line(Fnd_File.LOG,'** START: Delete all Prepare Receivables records from OKL_PARALLEL_PROCESSES. **');
Line: 612

              Fnd_File.put_line(Fnd_File.LOG,' => Could not perform a delete all for Prepare Receivables '
                                         ||'records because not all requests have Completed.');
Line: 616

              DELETE FROM okl_parallel_processes
              WHERE OBJECT_TYPE = 'PREP_CONTRACT';
Line: 622

              Fnd_File.put_line(Fnd_File.LOG,' => Deleted '||SQL%rowcount||' row(s).');
Line: 628

           Fnd_File.put_line(Fnd_File.LOG,'** END: Delete all Prepare Receivables records from OKL_PARALLEL_PROCESSES. **');
Line: 631

           Fnd_File.put_line(Fnd_File.LOG,'** START: Delete Org Specific Prepare Receivables records from OKL_PARALLEL_PROCESSES. **');
Line: 632

           DELETE FROM okl_parallel_processes
           WHERE OBJECT_TYPE = 'PREP_CONTRACT'
           AND org_id = l_org_id
           AND request_id IN (
                SELECT req.request_id
                FROM fnd_concurrent_requests req,
                     fnd_concurrent_programs_vl pgm
                WHERE pgm.USER_CONCURRENT_PROGRAM_NAME IN ( 'Master Program -- Prepare Receivables',
                                                            'Prepare Receivables Bills')
                AND req.concurrent_program_id = pgm.concurrent_program_id
                AND req.PHASE_CODE = 'C');
Line: 647

           Fnd_File.put_line(Fnd_File.LOG,' => Deleted '||SQL%rowcount||' row(s).');
Line: 652

           Fnd_File.put_line(Fnd_File.LOG,'** END: Delete Org Specific Prepare Receivables records from OKL_PARALLEL_PROCESSES. **');
Line: 687

    Fnd_File.PUT_LINE (Fnd_File.OUTPUT, '                Number of Deleted Stream Billing Records: '||l_print_strm_cnt);
Line: 690

    Fnd_File.PUT_LINE (Fnd_File.OUTPUT, '                Number of Deleted AR Transfer Records   : '||l_print_xfer_cnt);
Line: 753

  cursor chk_update_header_csr ( p_date date, orgId VARCHAr2 ) is -- rmunjulu R12 Forward Port missing on R12 (oklh bug 4728636)
                                              -- -- bug# 5872306 (ssiruvol)
       SELECT  khr.contract_number contract_number, khr.id khr_id
       FROM    okc_k_headers_b khr,  -- rmunjulu R12 Forward Port missing on R12 (oklh bug 4728636)
               okl_k_control nbd -- rmunjulu R12 Forward Port missing on R12 (oklh bug 4728636)
       WHERE ((p_contract_number is not null and KHR.CONTRACT_NUMBER=p_contract_number)
            or (p_contract_number is null and KHR.CONTRACT_NUMBER=KHR.CONTRACT_NUMBER))
        AND ((p_cust_acct_id is not null and KHR.CUST_ACCT_ID=p_cust_acct_id)
            or (p_cust_acct_id is null and KHR.CUST_ACCT_ID=KHR.CUST_ACCT_ID))
        AND    khr.scs_code IN ('LEASE', 'LOAN')
        AND    khr.sts_code IN ( 'BOOKED','EVERGREEN','TERMINATED', 'EXPIRED')  -- Bug 6472228  added - Expired status
        AND    p_source = 'BILL_STREAMS'
        AND    khr.id = nbd.khr_id -- rmunjulu R12 Forward Port missing on R12 (oklh bug 4728636)
 -- rmunjulu R12 Forward Port missing on R12 (oklh bug 4728636) + fixes for bug 5634652 logic to check for print lead days
         AND     nbd.earliest_strm_bill_date <= (NVL(p_date, SYSDATE) +
                                                  --Bug# 7701159 - Susbtitute SQL query for PL/SQL call
                                                  NVL( NVL(
                                                  (SELECT RULE.RULE_INFORMATION3 FROM OKC_RULES_B RULE, OKC_RULE_GROUPS_B RGP
                                                  WHERE RGP.ID = RULE.RGP_ID AND RGP.DNZ_CHR_ID                 = KHR.ID
                                                  AND RGP.RGD_CODE = 'LABILL' AND RULE.RULE_INFORMATION_CATEGORY = 'LAINVD'
                                                  ),
                                                  (SELECT TERM.PRINTING_LEAD_DAYS FROM HZ_CUSTOMER_PROFILES CP,
                                                  RA_TERMS TERM where KHR.BILL_TO_SITE_USE_ID = CP.SITE_USE_ID AND CP.STANDARD_TERMS = TERM.TERM_ID)
                                                  ),0)
                                                 )

         -- OKL_STREAM_BILLING_PVT.get_printing_lead_days(khr.id)) -- Added for Bug#6794547
        AND    KHR.authoring_org_id   = NVL(TO_NUMBER(orgId),-99)
        AND    nvl(p_ia_contract_type, L_CONTRACT_TYPE) = L_CONTRACT_TYPE
	AND    NOT EXISTS
		       (SELECT '1'
			    FROM OKL_PARALLEL_PROCESSES opp
		        WHERE khr.contract_number = opp.object_value
		        AND opp.object_type = 'CONTRACT'
		        AND opp.process_status in ('PENDING_ASSIGNMENT', 'ASSIGNED'))
        --fmiao 5209209 change
-- rmunjulu R12 fixes - comment out Prepare Recvbles
/*        UNION
	--3 levels
	SELECT  khr.contract_number contract_number, khr.id khr_id
	FROM okc_k_headers_b khr
	WHERE id IN (
                SELECT  CHR.id
                FROM    okl_txd_ar_ln_dtls_b tld,
                okl_txl_ar_inv_lns_b til,
                okl_trx_ar_invoices_b tai,
				okl_strm_type_v       sty,
                okc_k_headers_b    CHR
		WHERE tai.trx_status_code = 'SUBMITTED'
		AND   tai.khr_id          = CHR.id
		AND   til.tai_id = tai.id
		AND   tld.til_id_details = til.id
		AND   sty.id = tld.sty_id
		AND    p_source = 'AR_PREPARE'
        AND    NOT EXISTS
 		       (SELECT '1'
 			    FROM OKL_PARALLEL_PROCESSES opp
 		        WHERE CHR.contract_number = opp.object_value
 		        AND opp.object_type = 'PREP_CONTRACT'
 		        AND opp.process_status IN ('PENDING_ASSIGNMENT', 'ASSIGNED')) )
        GROUP BY khr.contract_number, khr.id

		UNION
		-- 2 levels
		SELECT  khr.contract_number contract_number, khr.id khr_id
		FROM okc_k_headers_b khr
		WHERE id IN (
        SELECT  CHR.id
        FROM    okl_txl_ar_inv_lns_b til,
                okl_trx_ar_invoices_b tai,
				    okl_strm_type_v       sty,
                okc_k_headers_b    CHR
		    WHERE tai.trx_status_code = 'SUBMITTED'
		    AND   tai.khr_id          = CHR.id
		    AND   til.tai_id = tai.id
		    AND   til.sty_id = sty.id
		    AND    p_source = 'AR_PREPARE'
		    AND    NOT EXISTS
		       (SELECT *
			  	FROM okl_txd_ar_ln_dtls_b tld
			   	WHERE tld.til_id_details = til.id
			  	)
        AND    NOT EXISTS
 		       (SELECT '1'
 			    FROM OKL_PARALLEL_PROCESSES opp
 		        WHERE CHR.contract_number = opp.object_value
 		        AND opp.object_type = 'PREP_CONTRACT'
 		        AND opp.process_status IN ('PENDING_ASSIGNMENT', 'ASSIGNED')) )
        GROUP BY khr.contract_number, khr.id
		    --fmiao 5209209 end
*/
-- rmunjulu R12 Fixes modify AR Transfer
        UNION
        SELECT  khr.contract_number contract_number, khr.id khr_id
        FROM okc_k_headers_b khr
        WHERE id in (
        SELECT  TAI.khr_id -- rmunjulu R12 fixes - changed to TAI
        FROM    --okl_ext_sell_invs_b xsi, -- rmunjulu R12 fixes - commented
                --okl_xtl_sell_invs_b xls, -- rmunjulu R12 fixes - commented
                --okl_txd_ar_ln_dtls_b tld,-- rmunjulu R12 fixes - commented
                --okl_txl_ar_inv_lns_b til,-- rmunjulu R12 fixes - commented
                okl_trx_ar_invoices_b tai,
                okc_k_headers_b    chr-- rmunjulu R12 fixes - commented
        WHERE  tai.TRX_STATUS_CODE = 'SUBMITTED'  -- rmunjulu R12 fixes - changed to TAI + SUBMITTED
        --AND    XSI.ID = XLS.XSI_ID_DETAILS -- rmunjulu R12 fixes - commented
        --AND    xls.tld_id = tld.id  -- rmunjulu R12 fixes - commented
        --and    tld.til_id_details = til.id -- rmunjulu R12 fixes - commented
        --and    til.tai_id = tai.id -- rmunjulu R12 fixes - commented
        and    tai.khr_id = chr.id
        AND    p_source = 'AR_TRANSFER'
        AND    NOT EXISTS
 		       (SELECT '1'
 			    FROM OKL_PARALLEL_PROCESSES opp
 		        WHERE chr.contract_number = opp.object_value
 		        AND opp.object_type = 'XTRX_CONTRACT'
 		        AND opp.process_status in ('PENDING_ASSIGNMENT', 'ASSIGNED')) )
        group by khr.contract_number, khr.id
-- rmunjulu R12 Fixes -- below select not needed as will be same as above select
/*
        UNION
        SELECT  khr.contract_number contract_number, khr.id khr_id
        FROM okc_k_headers_b khr
        WHERE id in (
        SELECT  chr.id
        FROM    okl_ext_sell_invs_b xsi,
                okl_xtl_sell_invs_b xls,
                okl_txl_ar_inv_lns_b til,
                okl_trx_ar_invoices_b tai,
                okc_k_headers_b    chr
        WHERE  XSI.TRX_STATUS_CODE = 'WORKING'
        AND    XSI.ID = XLS.XSI_ID_DETAILS
        AND    xls.til_id = til.id
        and    til.tai_id = tai.id
        and    tai.khr_id = chr.id
        AND    p_source = 'AR_TRANSFER'
        AND    NOT EXISTS
 		       (SELECT '1'
 			    FROM OKL_PARALLEL_PROCESSES opp
 		        WHERE chr.contract_number = opp.object_value
 		        AND opp.object_type = 'XTRX_CONTRACT'
 		        AND opp.process_status in ('PENDING_ASSIGNMENT', 'ASSIGNED')) )
        group by khr.contract_number, khr.id
*/
-- rmunjulu R12 Fixes -- comment out Consolidation
/*
        UNION
        SELECT to_char(CUSTOMER_ID), null khr_id
        FROM OKL_EXT_SELL_INVS_B ext
        WHERE ext.TRX_STATUS_CODE    = 'SUBMITTED'
        AND p_source = 'CONSOLIDATION'
        AND    NOT EXISTS
		       (SELECT '1'
			    FROM OKL_PARALLEL_PROCESSES opp
		        WHERE ext.CUSTOMER_ID = to_number(opp.object_value)
		        AND opp.object_type = 'CUSTOMER'
		        AND opp.process_status in ('PENDING_ASSIGNMENT', 'ASSIGNED'));
Line: 912

        SELECT  khr.contract_number contract_number, khr.id khr_id
        FROM    okc_k_headers_b khr,
                okl_k_control nbd,
		okc_k_lines_b cle
        WHERE ((p_contract_number is not null and KHR.CONTRACT_NUMBER=p_contract_number)
             or (p_contract_number is null and KHR.CONTRACT_NUMBER=KHR.CONTRACT_NUMBER))
         AND ((p_inv_cust_acct_id is not null and cle.CUST_ACCT_ID IS NOT NULL AND cle.CUST_ACCT_ID = p_inv_cust_acct_id )
            or (p_inv_cust_acct_id is null and cle.CUST_ACCT_ID = cle.CUST_ACCT_ID))
	 AND cle.dnz_chr_id = khr.id
	 AND khr.scs_code ='INVESTOR'
         AND khr.sts_code = 'ACTIVE'
         AND p_source = 'BILL_STREAMS'
         AND nvl(p_ia_contract_type, L_IA_TYPE) = L_IA_TYPE
	 AND khr.id = nbd.khr_id
         AND nbd.earliest_strm_bill_date <= (NVL(p_date, SYSDATE) + OKL_STREAM_BILLING_PVT.get_printing_lead_days(khr.id))
         AND KHR.authoring_org_id   = NVL(TO_NUMBER(orgId),-99)
         AND NOT EXISTS
 		       (SELECT '1'
              		FROM OKL_PARALLEL_PROCESSES opp
		        WHERE khr.contract_number = opp.object_value
		        AND opp.object_type = 'CONTRACT'
		        AND opp.process_status in ('PENDING_ASSIGNMENT', 'ASSIGNED'))
-- modified by zrehman for Bug#6788005 on 01-Feb-2008 end
;
Line: 939

        SELECT
          opp.object_value CONTRACT_NUMBER,
          COUNT(STE.ID) LINE_COUNT
        FROM
          OKL_STRM_ELEMENTS STE,
          OKL_STREAMS STM,
          OKL_STRM_TYPE_V STY,
          OKL_PARALLEL_PROCESSES OPP
        WHERE
          OPP.ASSIGNED_PROCESS = p_seq_next AND
          OPP.OBJECT_TYPE =     'CONTRACT' AND
         (
            (p_date_from is not null and STE.STREAM_ELEMENT_DATE >= p_date_from)
            OR
            (p_date_from is null)
         ) AND
           STE.STREAM_ELEMENT_DATE <= (NVL(p_date_to, SYSDATE) +
                                            NVL( NVL(
                                            (SELECT RULE.RULE_INFORMATION3 FROM OKC_RULES_B RULE, OKC_RULE_GROUPS_B RGP, okc_k_headers_b khr
                                              WHERE opp.khr_id = khr.id AND RGP.ID = RULE.RGP_ID AND RGP.DNZ_CHR_ID = KHR.ID
                                                AND RGP.RGD_CODE = 'LABILL' AND RULE.RULE_INFORMATION_CATEGORY = 'LAINVD'
                                            ),
                                            (SELECT TERM.PRINTING_LEAD_DAYS FROM HZ_CUSTOMER_PROFILES CP, RA_TERMS TERM, okc_k_headers_b khr
                                              WHERE opp.khr_id = khr.id AND KHR.BILL_TO_SITE_USE_ID = CP.SITE_USE_ID AND CP.STANDARD_TERMS = TERM.TERM_ID)
                                            ),0)
                                                  --Bug# 7701159 - Susbtitute SQL query for PL//*/*SQL call
                                                  /*NVL((SELECT NVL(RULE.RULE_INFORMATION3,TERM.PRINTING_LEAD_DAYS)
                                                       FROM   OKC_RULES_B          RULE,
                                                              OKC_RULE_GROUPS_B    RGP,
                                                              HZ_CUSTOMER_PROFILES CP,
                                                              RA_TERMS             TERM
                                                               ,okc_k_headers_b khr
                                                       WHERE  opp.khr_id = khr.id and
                                                             RGP.ID         = RULE.RGP_ID
                                                          AND RGP.DNZ_CHR_ID = KHR.ID
                                                          AND RGP.RGD_CODE   = 'LABILL'
                                                          AND RULE.RULE_INFORMATION_CATEGORY = 'LAINVD'
                                                          AND KHR.BILL_TO_SITE_USE_ID        = CP.SITE_USE_ID
                                                          AND CP.STANDARD_TERMS              = TERM.TERM_ID),
                                                         0)*/
                                      ) and
--          STE.STREAM_ELEMENT_DATE <= (NVL(p_date_to, SYSDATE) + OKL_STREAM_BILLING_PVT.get_printing_lead_days(opp.khr_id))  AND -- Bug 6377127
          STE.AMOUNT <> 0 AND
          STM.ID = STE.STM_ID AND
          STE.DATE_BILLED IS NULL     AND
          STM.ACTIVE_YN = 'Y' AND
          STM.SAY_CODE = 'CURR' AND
          STY.ID = STM.STY_ID     AND
          STY.BILLABLE_YN = 'Y' AND
          opp.khr_id = STM.KHR_ID AND
          p_source =     'BILL_STREAMS'
	  GROUP BY opp.object_value
        --fmiao 5209209 change
-- rmunjulu R12 Fixes comment out Prepare Recevbles
/*
        UNION
        -- 3 levels
	SELECT
          CHR.CONTRACT_NUMBER CONTRACT_NUMBER,
          COUNT(*) LINE_COUNT
        FROM
          OKL_TXD_AR_LN_DTLS_B TLD,
          OKL_TXL_AR_INV_LNS_B TIL,
          OKL_TRX_AR_INVOICES_B TAI,
          OKC_K_HEADERS_B CHR,
		  OKL_STRM_TYPE_V       STY,
          OKL_PARALLEL_PROCESSES OPP
		WHERE tai.trx_status_code = 'SUBMITTED'
		AND   tai.khr_id          = CHR.id
		AND   til.tai_id = tai.id
		AND   tld.til_id_details = til.id
		AND   sty.id = tld.sty_id
		AND   OPP.OBJECT_VALUE =     CHR.CONTRACT_NUMBER
		AND   OPP.ASSIGNED_PROCESS = p_seq_next
		AND   OPP.OBJECT_TYPE =     'PREP_CONTRACT'
		AND   p_source = 'AR_PREPARE'
        GROUP BY CHR.CONTRACT_NUMBER
        UNION
		--2 levels
        SELECT
          CHR.CONTRACT_NUMBER     CONTRACT_NUMBER,
          COUNT(*) LINE_COUNT
        FROM
          OKL_TXL_AR_INV_LNS_B TIL,
          OKL_TRX_AR_INVOICES_B TAI,
          OKC_K_HEADERS_B CHR,
		  OKL_STRM_TYPE_V       STY,
          OKL_PARALLEL_PROCESSES OPP
		WHERE tai.trx_status_code = 'SUBMITTED'
		AND   tai.khr_id          = CHR.id
		AND   til.tai_id = tai.id
		AND   til.sty_id = sty.id
		AND   OPP.OBJECT_VALUE = CHR.CONTRACT_NUMBER
		AND	  OPP.ASSIGNED_PROCESS = p_seq_next
		AND	  OPP.OBJECT_TYPE = 'PREP_CONTRACT'
		AND	  p_source = 'AR_PREPARE'
		AND    NOT EXISTS
		       (SELECT *
			  	FROM okl_txd_ar_ln_dtls_b tld
			   	WHERE tld.til_id_details = til.id
			  	)
        GROUP BY CHR.CONTRACT_NUMBER
		--fmiao 5209209 end
*/
-- rmunjulu R12 Fixes Modify AR TRANSFER
        UNION
-- transfer 3
        SELECT
          KHR.CONTRACT_NUMBER CONTRACT_NUMBER,
          COUNT(*) LINE_COUNT
        FROM
          --OKL_EXT_SELL_INVS_B XSI, -- rmunjulu R12 fixes - commented
          --OKL_XTL_SELL_INVS_B XLS, -- rmunjulu R12 fixes - commented
          --OKL_TXD_AR_LN_DTLS_B TLD, -- rmunjulu R12 fixes - commented
          --OKL_TXL_AR_INV_LNS_B TIL, -- rmunjulu R12 fixes - commented
          OKL_TRX_AR_INVOICES_B TAI,
          OKC_K_HEADERS_B KHR,
          OKL_PARALLEL_PROCESSES OPP
        WHERE
          TAI.TRX_STATUS_CODE = 'SUBMITTED' AND -- rmunjulu R12 fixes - changed to TAI and SUBMITTED
          --XSI.ID =     XLS.XSI_ID_DETAILS AND -- rmunjulu R12 fixes - commented
          --XLS.TLD_ID = TLD.ID AND -- rmunjulu R12 fixes - commented
          --TLD.TIL_ID_DETAILS = TIL.ID     AND -- rmunjulu R12 fixes - commented
          --TIL.TAI_ID = TAI.ID AND -- rmunjulu R12 fixes - commented
          TAI.KHR_ID = KHR.ID AND
          OPP.OBJECT_VALUE =     KHR.CONTRACT_NUMBER AND
          OPP.ASSIGNED_PROCESS = p_seq_next AND
          OPP.OBJECT_TYPE =     'XTRX_CONTRACT' AND
          p_source = 'AR_TRANSFER'
        GROUP BY KHR.CONTRACT_NUMBER
/* -- rmunjulu R12 Fixes -- below select not needed as will be same as above select
        UNION
-- transfer 2
        SELECT
          KHR.CONTRACT_NUMBER     CONTRACT_NUMBER,
          COUNT(*) LINE_COUNT
        FROM
          OKL_EXT_SELL_INVS_V XSI,
          OKL_XTL_SELL_INVS_V XLS,
          OKL_TXL_AR_INV_LNS_V TIL,
          OKL_TRX_AR_INVOICES_V TAI,
          OKC_K_HEADERS_B KHR,
          OKL_PARALLEL_PROCESSES OPP
        WHERE
          XSI.TRX_STATUS_CODE = 'WORKING' AND
          XSI.ID = XLS.XSI_ID_DETAILS AND
          XLS.TIL_ID = TIL.ID AND
          TIL.TAI_ID = TAI.ID     AND
          TAI.KHR_ID = KHR.ID AND
          OPP.OBJECT_VALUE = KHR.CONTRACT_NUMBER AND
          OPP.ASSIGNED_PROCESS = p_seq_next AND
          OPP.OBJECT_TYPE = 'XTRX_CONTRACT' AND
          p_source = 'AR_TRANSFER'
        GROUP BY KHR.CONTRACT_NUMBER

        UNION
*/
-- consolidation
/* -- rmunjulu -- comment out consolidation
        SELECT
          TO_CHAR(CUSTOMER_ID) CONTRACT_NUMBER,
          COUNT(*)
        FROM
          OKL_EXT_SELL_INVS_B EXT,
          OKL_PARALLEL_PROCESSES OPP
        WHERE
          EXT.TRX_STATUS_CODE = 'SUBMITTED' AND
          OPP.OBJECT_VALUE = EXT.CUSTOMER_ID AND
          OPP.ASSIGNED_PROCESS =  p_seq_next AND
          OPP.OBJECT_TYPE = 'CUSTOMER' AND
          p_source = 'CONSOLIDATION'
        GROUP BY CUSTOMER_ID;
Line: 1156

  l_last_updated_by     okl_parallel_processes.last_updated_by%TYPE := Fnd_Global.USER_ID;
Line: 1157

  l_last_update_login   okl_parallel_processes.last_update_login%TYPE := Fnd_Global.LOGIN_ID;
Line: 1165

	select count(*)
		from fnd_concurrent_requests req,
		     fnd_concurrent_programs pgm
		where req.PRIORITY_REQUEST_ID = p_request_id
		and req.concurrent_program_id = pgm.concurrent_program_id
		and req.PHASE_CODE = 'C'
		and request_id <> p_request_id
		and STATUS_CODE = 'E'
	--end modified abhsaxen for performance SQLID 20562749
	;
Line: 1182

	select count(*)
        from fnd_concurrent_requests req,
             fnd_concurrent_programs pgm
        where req.priority_request_id = p_request_id
        and req.concurrent_program_id = pgm.concurrent_program_id
        and req.phase_code = 'C'
        and request_id <> p_request_id
        and status_code = 'G'
--end modified abhsaxen for performance SQLID 20562754
	;
Line: 1197

        select decode(chr.scs_code, 'INVESTOR', 'IA', 'LEASE', 'C', null)
	from
	okc_k_headers_all_b chr
	,okl_k_headers khr
	where chr.id = khr.id
	and chr.scs_code in ('INVESTOR', 'LEASE')
	and chr.contract_number = p_contract_number;
Line: 1310

  select okl_opp_seq.nextval
  into l_seq_next
  from dual ;
Line: 1325

  for chk_update_header_csr_rec in chk_update_header_csr (lp_date_to, orgId) loop -- rmunjulu R12 Forward Port missing on R12 (oklh bug 4728636)

    INSERT INTO OKL_PARALLEL_PROCESSES
    (
     object_type, object_value, assigned_process, process_status, start_date, khr_id,
     ORG_ID,CREATED_BY,CREATION_DATE,LAST_UPDATE_DATE,LAST_UPDATED_BY,LAST_UPDATE_LOGIN,
     REQUEST_ID,PROGRAM_ID,PROGRAM_UPDATE_DATE
    )
    VALUES
    (decode (p_source,'BILL_STREAMS','CONTRACT',
             'AR_TRANSFER','XTRX_CONTRACT',
             'CONSOLIDATION','CUSTOMER',
             --fmiao 5209209 change
	     'AR_PREPARE','PREP_CONTRACT',NULL), -- fmiao 5209209 end
     chk_update_header_csr_rec.contract_number, to_char(l_seq_next),'PENDING_ASSIGNMENT', sysdate, chk_update_header_csr_rec.khr_id,
     l_org_id,l_last_updated_by,sysdate,sysdate,l_last_updated_by,l_last_update_login,
     l_request_id,l_program_id,sysdate
    );
Line: 1354

        update okl_parallel_processes opp
        set volume =  (select count(*)
                       from okc_k_lines_b chl
                       where chl.dnz_chr_id = opp.khr_id)
        WHERE OPP.ASSIGNED_PROCESS = TO_CHAR(l_seq_next); -- bug# 5872306 (ssiruvol)
Line: 1362

        update okl_parallel_processes opp
        -- set volume = volume* (select ceil((lp_date_to - nbd.earliest_strm_bill_date)/30) -- rmunjulu R12 Forward Port bug 5634652
        SET volume = volume* (SELECT CEIL((lp_date_to
-- rmunjulu R12 Forward Port bug 5634652 logic to check print lead days
                                      +
                                      NVL( NVL(
                                      (SELECT RULE.RULE_INFORMATION3 FROM OKC_RULES_B RULE, OKC_RULE_GROUPS_B RGP, okc_k_headers_b khr
                                        WHERE opp.khr_id = khr.id AND RGP.ID = RULE.RGP_ID AND RGP.DNZ_CHR_ID = KHR.ID
                                          AND RGP.RGD_CODE = 'LABILL' AND RULE.RULE_INFORMATION_CATEGORY = 'LAINVD'
                                      ),
                                      (SELECT TERM.PRINTING_LEAD_DAYS FROM HZ_CUSTOMER_PROFILES CP, RA_TERMS TERM, okc_k_headers_b khr
                                        WHERE opp.khr_id = khr.id AND KHR.BILL_TO_SITE_USE_ID = CP.SITE_USE_ID AND CP.STANDARD_TERMS = TERM.TERM_ID)
                                      ),0)
                                       --Bug# 7701159   - Susbtitute SQL query for PL/SQL call
                                       /*NVL((SELECT NVL(RULE.RULE_INFORMATION3,TERM.PRINTING_LEAD_DAYS)
                                                       FROM   OKC_RULES_B          RULE,
                                                              OKC_RULE_GROUPS_B    RGP,
                                                              HZ_CUSTOMER_PROFILES CP,
                                                              RA_TERMS             TERM
                                                               ,okc_k_headers_b khr
                                                       WHERE  opp.khr_id = khr.id and
                                                             RGP.ID         = RULE.RGP_ID
                                                          AND RGP.DNZ_CHR_ID = KHR.ID
                                                          AND RGP.RGD_CODE   = 'LABILL'
                                                          AND RULE.RULE_INFORMATION_CATEGORY = 'LAINVD'
                                                          AND KHR.BILL_TO_SITE_USE_ID        = CP.SITE_USE_ID
                                                          AND CP.STANDARD_TERMS              = TERM.TERM_ID),
                                                         0)*/
--                                + OKL_STREAM_BILLING_PVT.get_printing_lead_days(opp.khr_id)
-- rmunjulu R12 Forward Port bug 5710903 Add ONE to account for scenario where these dates are same
                                - nbd.earliest_strm_bill_date + 1)/30)
                              from okl_k_control nbd
                              where nbd.khr_id = opp.khr_id)

        WHERE OPP.ASSIGNED_PROCESS = TO_CHAR(l_seq_next); -- bug# 5872306 (ssiruvol)
Line: 1434

        l_contract_tab.DELETE(i);
Line: 1463

            l_contract_tab.DELETE(i);
Line: 1511

              UPDATE OKL_PARALLEL_PROCESSES
              SET
  		      assigned_process =  l_seq_next||'-'||l_sort_tab1(i).worker_number,
                volume = l_sort_tab1(i).line_count,
                process_status = 'ASSIGNED'
              WHERE object_Type = 'CONTRACT'
              AND   object_value = l_sort_tab1(i).contract_number
              AND   process_status = 'PENDING_ASSIGNMENT';
Line: 1524

              UPDATE OKL_PARALLEL_PROCESSES
              SET
  		      assigned_process =  l_seq_next||'-'||l_sort_tab1(i).worker_number,
                volume = l_sort_tab1(i).line_count,
                process_status = 'ASSIGNED'
              WHERE object_Type = 'PREP_CONTRACT'
              AND   object_value = l_sort_tab1(i).contract_number
              AND   process_status = 'PENDING_ASSIGNMENT';
Line: 1536

              UPDATE OKL_PARALLEL_PROCESSES
              SET
  		      assigned_process =  l_seq_next||'-'||l_sort_tab1(i).worker_number,
                volume = l_sort_tab1(i).line_count,
                process_status = 'ASSIGNED'
              WHERE object_Type = 'XTRX_CONTRACT'
              AND   object_value = l_sort_tab1(i).contract_number
              AND   process_status = 'PENDING_ASSIGNMENT';
Line: 1548

              UPDATE OKL_PARALLEL_PROCESSES
              SET
  		      assigned_process =  l_seq_next||'-'||l_sort_tab1(i).worker_number,
                volume = l_sort_tab1(i).line_count,
                process_status = 'ASSIGNED'
              WHERE object_Type = 'CUSTOMER'
              AND   object_value = l_sort_tab1(i).contract_number
              AND   process_status = 'PENDING_ASSIGNMENT';
Line: 1563

            l_sort_tab1.DELETE(i);
Line: 1756

    DELETE OKL_PARALLEL_PROCESSES
    WHERE process_status = 'PENDING_ASSIGNMENT'
    AND assigned_process =  to_char(l_seq_next);
Line: 1763

    DELETE OKL_PARALLEL_PROCESSES
    WHERE volume = 0
    AND assigned_process like  to_char(l_seq_next)||'%';
Line: 1777

    DELETE OKL_PARALLEL_PROCESSES
    WHERE assigned_process =  to_char(l_seq_next);
Line: 1817

    DELETE OKL_PARALLEL_PROCESSES
    WHERE assigned_process =  to_char(g_opp_seq_num);
Line: 1848

    DELETE OKL_PARALLEL_PROCESSES
    WHERE assigned_process =  to_char(g_opp_seq_num);
Line: 1877

    DELETE OKL_PARALLEL_PROCESSES
    WHERE assigned_process =  to_char(g_opp_seq_num);
Line: 1907

    DELETE OKL_PARALLEL_PROCESSES
    WHERE assigned_process =  TO_CHAR(g_opp_seq_num);
Line: 1919

           l_update_tbl         IN OUT NOCOPY update_tbl_type)
IS

    l_old_cnr_id                NUMBER;
Line: 1942

   IF l_update_tbl.COUNT > 0 THEN
      IF saved_bill_rec.l_overall_status IS NULL THEN
         l_old_cnr_id := -9;
Line: 1949

         FOR m in l_update_tbl.FIRST..l_update_tbl.LAST LOOP

            PRINT_TO_LOG( 'l_update_tbl.cnr_id '||l_update_tbl(m).cnr_id);
Line: 1952

            PRINT_TO_LOG( 'l_update_tbl.cons_inv_number '||l_update_tbl(m).cons_inv_number);
Line: 1953

            PRINT_TO_LOG( 'l_update_tbl.lln_id '||l_update_tbl(m).lln_id);
Line: 1954

            PRINT_TO_LOG( 'l_update_tbl.lsm_id '||l_update_tbl(m).lsm_id);
Line: 1955

            PRINT_TO_LOG( 'l_update_tbl.asset_number '||l_update_tbl(m).asset_number);
Line: 1956

            PRINT_TO_LOG( 'l_update_tbl.invoice_format '||l_update_tbl(m).invoice_format);
Line: 1957

            PRINT_TO_LOG( 'l_update_tbl.line_type '||l_update_tbl(m).line_type);
Line: 1958

            PRINT_TO_LOG( 'l_update_tbl.sty_name '||l_update_tbl(m).sty_name);
Line: 1959

            PRINT_TO_LOG( 'l_update_tbl.contract_number '||l_update_tbl(m).contract_number);
Line: 1960

            PRINT_TO_LOG( 'l_update_tbl.lsm_amount '||l_update_tbl(m).lsm_amount);
Line: 1961

            PRINT_TO_LOG( 'l_update_tbl.xsi_id '||l_update_tbl(m).xsi_id);
Line: 1962

            PRINT_TO_LOG( 'l_update_tbl.xls_id '||l_update_tbl(m).xls_id);
Line: 1965

            g_xsi_tbl(g_xsi_counter).id :=l_update_tbl(m).xsi_id;
Line: 1974

            g_xsi_tl_tbl(g_xsi_tl_counter).id :=l_update_tbl(m).xsi_id;
Line: 1976

            g_xsi_tl_tbl(g_xsi_tl_counter).xtrx_cons_invoice_number := l_update_tbl(m).cons_inv_number;
Line: 1977

            g_xsi_tl_tbl(g_xsi_tl_counter).xtrx_format_type := l_update_tbl(m).invoice_format;
Line: 1978

            g_xsi_tl_tbl(g_xsi_tl_counter).xtrx_private_label := l_update_tbl(m).private_label;
Line: 1981

            g_xls_tbl(g_xls_counter).id :=l_update_tbl(m).xls_id;
Line: 1982

            g_xls_tbl(g_xls_counter).lsm_id :=l_update_tbl(m).LSM_ID;
Line: 1983

            g_xls_tbl(g_xls_counter).xtrx_cons_stream_id :=l_update_tbl(m).lsm_id;
Line: 1986

            g_xls_tl_tbl(g_xls_tl_counter).id :=l_update_tbl(m).xls_id;
Line: 1987

            g_xls_tl_tbl(g_xls_tl_counter).xtrx_contract := l_update_tbl(m).contract_number;
Line: 1988

            g_xls_tl_tbl(g_xls_tl_counter).xtrx_asset := l_update_tbl(m).asset_number;
Line: 1989

            g_xls_tl_tbl(g_xls_tl_counter).xtrx_stream_type := l_update_tbl(m).sty_name;
Line: 1990

            g_xls_tl_tbl(g_xls_tl_counter).xtrx_stream_group := l_update_tbl(m).line_type;
Line: 1994

     l_update_tbl.DELETE;
Line: 2029

    select RULE_INFORMATION1
    from okc_rule_groups_v      rgp,
        okc_rules_v            rul
    where rgp.dnz_chr_id = cp_khr_id AND
    rgp.chr_id             = rgp.dnz_chr_id                  AND
    rgp.id                 = rul.rgp_id                      AND
    rgp.cle_id             IS NULL                           AND
    rgp.rgd_code           = 'LABILL'                        AND
    rul.rule_information_category = 'LAINVD';
Line: 2092

   		  SELECT id,
		  		 priority,
		  		 pkg_name,
				 proc_name
		  FROM okl_invoice_mssgs_v;
Line: 2156

	 g_cnr_tbl(g_header_counter).last_update_date := SYSDATE;
Line: 2157

	 g_cnr_tbl(g_header_counter).last_updated_by := Fnd_Global.USER_ID;
Line: 2163

	 g_cnr_tbl(g_header_counter).program_update_date := SYSDATE;
Line: 2228

	    PRINT_TO_LOG('=***********> SELECT id FROM okl_cnsld_ar_lines_v');
Line: 2246

   	    PRINT_TO_LOG('=***********> SELECT id FROM okl_cnsld_ar_lines_v');
Line: 2265

        PRINT_TO_LOG('=***********> SELECT id FROM okl_cnsld_ar_lines_v');
Line: 2280

	    PRINT_TO_LOG('=***********> SELECT id FROM okl_cnsld_ar_lines_v');
Line: 2373

     g_lln_tbl(g_line_counter).last_update_date := SYSDATE;
Line: 2374

     g_lln_tbl(g_line_counter).last_updated_by := Fnd_Global.USER_ID;
Line: 2385

       g_lln_tbl(g_line_counter).program_update_date := SYSDATE;
Line: 2494

       SELECT language_code
       FROM FND_LANGUAGES
       WHERE INSTALLED_FLAG IN ('I', 'B');
Line: 2523

		-- because it will be inserted next time around
        g_cnr_tbl.DELETE(g_header_counter);
Line: 2548

            g_cnr_tl_tbl(tl_count).last_updated_by   := fnd_global.user_id;
Line: 2549

            g_cnr_tl_tbl(tl_count).last_update_date  := sysdate;
Line: 2550

            g_cnr_tl_tbl(tl_count).last_update_login := fnd_global.login_id;
Line: 2610

                     OKL_DEBUG_PUB.LOG_DEBUG(L_LEVEL_PROCEDURE,L_MODULE,'Begin Debug OKLRKONB.pls call okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT ');
Line: 2614

		  	   okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT(
	  	  		     p_api_version
    				,p_init_msg_list
    				,x_return_status
    				,x_msg_count
    				,x_msg_data
    				,p_imav_rec
    				,x_imav_rec
			  );
Line: 2625

                   OKL_DEBUG_PUB.LOG_DEBUG(L_LEVEL_PROCEDURE,L_MODULE,'End Debug OKLRKONB.pls call okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT ');
Line: 2645

	    PRINT_TO_LOG('Performing bulk insert for cnr, record count is '||g_cnr_tbl.count);
Line: 2653

                    insert into okl_cnsld_ar_hdrs_b
                    values g_cnr_tbl(x);
Line: 2658

                    insert into okl_cnsld_ar_hdrs_tl
                    values g_cnr_tl_tbl(d);
Line: 2665

           PRINT_TO_LOG('Error during Header Insertion, rollback to H1');
Line: 2667

           g_cnr_tbl.DELETE;
Line: 2668

           g_cnr_tl_tbl.DELETE;
Line: 2669

           g_lln_tbl.DELETE;
Line: 2670

           g_lln_tl_tbl.DELETE;
Line: 2671

           g_lsm_tbl.DELETE;
Line: 2672

           g_lsm_tl_tbl.DELETE;
Line: 2673

           g_xsi_tbl.DELETE;
Line: 2674

           g_xsi_tl_tbl.DELETE;
Line: 2675

           g_xls_tbl.DELETE;
Line: 2676

           g_xls_tl_tbl.DELETE;
Line: 2683

     g_cnr_tbl.delete;
Line: 2684

     g_cnr_tl_tbl.delete;
Line: 2702

		-- because it will be inserted next time around
        g_lln_tbl.DELETE(g_line_counter);
Line: 2721

            g_lln_tl_tbl(tl_count).last_updated_by   := fnd_global.user_id;
Line: 2722

            g_lln_tl_tbl(tl_count).last_update_date  := sysdate;
Line: 2723

            g_lln_tl_tbl(tl_count).last_update_login := fnd_global.login_id;
Line: 2732

	    PRINT_TO_LOG('Performing bulk insert for lln, record count is '||g_lln_tbl.count);
Line: 2739

           insert into okl_cnsld_ar_lines_b
           values g_lln_tbl(x);
Line: 2744

           insert into okl_cnsld_ar_lines_tl
           values g_lln_tl_tbl(e);
Line: 2751

           PRINT_TO_LOG('Error during Line Insertion, rollback to L1');
Line: 2753

           g_lln_tl_tbl.DELETE;
Line: 2754

           g_lsm_tbl.DELETE;
Line: 2755

           g_lsm_tl_tbl.DELETE;
Line: 2756

           g_xsi_tbl.DELETE;
Line: 2757

           g_xsi_tl_tbl.DELETE;
Line: 2758

           g_xls_tbl.DELETE;
Line: 2759

           g_xls_tl_tbl.DELETE;
Line: 2765

              delete from okl_cnsld_ar_hdrs_b
              where id = g_lln_tbl(e).cnr_id;
Line: 2771

           g_lln_tbl.DELETE;
Line: 2778

      g_lln_tbl.delete;
Line: 2779

      g_lln_tl_tbl.delete;
Line: 2807

             g_lsm_tl_tbl(tl_count).last_updated_by   := fnd_global.user_id;
Line: 2808

             g_lsm_tl_tbl(tl_count).last_update_date  := sysdate;
Line: 2809

             g_lsm_tl_tbl(tl_count).last_update_login := fnd_global.login_id;
Line: 2814

	   PRINT_TO_LOG('Performing bulk insert for lsm, record count is '||g_lsm_tbl.count);
Line: 2820

         insert into okl_cnsld_ar_strms_b
         values g_lsm_tbl(x);
Line: 2825

         insert into okl_cnsld_ar_strms_tl
         values g_lsm_tl_tbl(f);
Line: 2831

           PRINT_TO_LOG('Error during Stream Insertion, rollback to D1');
Line: 2833

           g_cnr_tl_tbl.delete;
Line: 2834

           g_lln_tl_tbl.DELETE;
Line: 2835

           g_lsm_tl_tbl.DELETE;
Line: 2836

           g_xsi_tbl.DELETE;
Line: 2837

           g_xsi_tl_tbl.DELETE;
Line: 2838

           g_xls_tbl.DELETE;
Line: 2839

           g_xls_tl_tbl.DELETE;
Line: 2850

                 delete from okl_cnsld_ar_hdrs_b
                 where id = g_lln_tbl(f).cnr_id;
Line: 2856

              delete from okl_cnsld_ar_lines_b
              where id = g_lsm_tbl(e).lln_id;
Line: 2862

           g_lsm_tbl.DELETE;
Line: 2863

           g_lln_tbl.DELETE;
Line: 2864

           g_cnr_tbl.DELETE;
Line: 2869

     g_lsm_tbl.delete;
Line: 2870

     g_lsm_tl_tbl.delete;
Line: 2880

            Okl_Debug_Pub.LOG_DEBUG(L_LEVEL_PROCEDURE,L_MODULE,'Begin Debug OKLRKONB.pls call okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT ');
Line: 2884

        Okl_Inv_Mssg_Att_Pub.INSERT_INV_MSSG_ATT(
                            p_api_version
                           ,p_init_msg_list
                           ,x_return_status
                           ,x_msg_count
                           ,x_msg_data
                           ,g_imav_tbl
                           ,x_imav_tbl
                 );
Line: 2896

           Okl_Debug_Pub.LOG_DEBUG(L_LEVEL_PROCEDURE,L_MODULE,'End Debug OKLRKONB.pls call okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT ');
Line: 2907

        g_imav_tbl.DELETE;
Line: 2924

   g_lsm_tbl(g_stream_counter).last_update_date := (SYSDATE);
Line: 2925

   g_lsm_tbl(g_stream_counter).last_updated_by := Fnd_Global.USER_ID;
Line: 2931

     g_lsm_tbl(g_stream_counter).program_update_date := (SYSDATE);
Line: 2973

	    PRINT_TO_LOG('Performing  bulk update for xsi, record count is '||g_xsi_tbl.COUNT );
Line: 2978

            update okl_ext_sell_invs_b
            set trx_status_code = g_xsi_tbl(indx).trx_status_code,
--                xtrx_invoice_pull_yn = g_xsi_tbl(indx).xtrx_invoice_pull_yn,
                last_update_date = sysdate,
                last_updated_by = fnd_global.user_id,
                last_update_login = fnd_global.login_id
            where id = g_xsi_tbl(indx).id;
Line: 2988

           PRINT_TO_LOG('Error during Update of okl_ext_sell_invs_b, rollback to U1');
Line: 2995

     g_xsi_tbl.delete;
Line: 2999

	    PRINT_TO_LOG('Performing  bulk update for xls, record count is '||g_xls_tbl.COUNT );
Line: 3003

              update okl_xtl_sell_invs_b
              set lsm_id              = g_xls_tbl(s).lsm_id,
                  xtrx_cons_stream_id  = g_xls_tbl(s).lsm_id,
                  last_update_date     = sysdate,
                  last_updated_by      = fnd_global.user_id,
                  last_update_login    = fnd_global.login_id
              where id = g_xls_tbl(s).id;
Line: 3013

           PRINT_TO_LOG('Error during Update of okl_xtl_sell_invs_b, rollback to U2');
Line: 3020

     g_xls_tbl.delete;
Line: 3024

	    PRINT_TO_LOG('Performing bulk update for xsi tl, record count is '||g_xsi_tl_tbl.COUNT );
Line: 3028

           update okl_ext_sell_invs_tl
           set xtrx_cons_invoice_number = g_xsi_tl_tbl(u).xtrx_cons_invoice_number,
               xtrx_format_type = g_xsi_tl_tbl(u).xtrx_format_type,
               xtrx_private_label = g_xsi_tl_tbl(u).xtrx_private_label,
               last_update_date = sysdate,
               last_updated_by = fnd_global.user_id,
               last_update_login = fnd_global.login_id
           where id = g_xsi_tl_tbl(u).id;
Line: 3039

           PRINT_TO_LOG('Error during Update of okl_ext_sell_invs_tl, rollback to U3');
Line: 3046

     g_xsi_tl_tbl.delete;
Line: 3050

	    PRINT_TO_LOG('Performing bulk update for xls tl, record count is '||g_xls_tl_tbl.COUNT );
Line: 3055

           update okl_xtl_sell_invs_tl
           set    xtrx_contract     = g_xls_tl_tbl(t).xtrx_contract,
                  xtrx_asset        = g_xls_tl_tbl(t).xtrx_asset,
                  xtrx_stream_type  = g_xls_tl_tbl(t).xtrx_stream_type,
                  xtrx_stream_group = g_xls_tl_tbl(t).xtrx_stream_group,
                  last_update_date  = sysdate,
                  last_updated_by   = fnd_global.user_id,
                  last_update_login = fnd_global.login_id
           where id = g_xls_tl_tbl(t).id;
Line: 3067

           PRINT_TO_LOG('Error during Update of okl_xtl_sell_invs_tl, rollback to U4');
Line: 3074

     g_xls_tl_tbl.delete;
Line: 3099

           p_update_tbl         IN OUT NOCOPY update_tbl_type)
IS


    l_api_name	                 CONSTANT VARCHAR2(30)  := 'process_cons_bill_tbl';
Line: 3127

    l_update_tbl                 update_tbl_type;
Line: 3137

       SELECT chr_id
       FROM okc_k_lines_b
       WHERE id = p_cle_id;
Line: 3142

            SELECT name
            FROM  okc_k_lines_v
            WHERE id = p_cle_id;
Line: 3147

           SELECT FA.ID
           FROM OKC_K_HEADERS_B CHR,
                OKC_K_LINES_B TOP_CLE,
                OKC_LINE_STYLES_b TOP_LSE,
                OKC_K_LINES_B SUB_CLE,
                OKC_LINE_STYLES_b SUB_LSE,
                OKC_K_ITEMS CIM,
                OKC_K_LINES_V  FA,
                OKC_LINE_STYLES_B AST_LSE,
                OKL_CNSLD_AR_STRMS_B LSM
            WHERE
                CHR.ID           = TOP_CLE.DNZ_CHR_ID              AND
                TOP_CLE.LSE_ID   = TOP_LSE.ID                      AND
                TOP_LSE.LTY_CODE IN('SOLD_SERVICE','FEE')          AND
                TOP_CLE.ID       = SUB_CLE.CLE_ID                  AND
                SUB_CLE.LSE_ID   = SUB_LSE.ID                      AND
                SUB_LSE.LTY_CODE IN ('LINK_SERV_ASSET', 'LINK_FEE_ASSET') AND
                SUB_CLE.ID       =  LSM.KLE_ID                     AND
                LSM.ID           =  p_lsm_id                       AND
                CIM.CLE_ID       = SUB_CLE.ID                      AND
                CIM.JTOT_OBJECT1_CODE = 'OKX_COVASST'              AND
                CIM.OBJECT1_ID1  = FA.ID                           AND
                FA.LSE_ID        = AST_LSE.ID                      AND
                AST_LSE.LTY_CODE = 'FREE_FORM1';
Line: 3174

		      SELECT
				inf.name inf_name,
				inf.contract_level_yn,
				ity.id ity_id,
		        ity.name ity_name,
				ity.group_asset_yn,
				ity.group_by_contract_yn,
				ilt.id	ilt_id,
				ilt.sequence_number,
				ilt.name ilt_name,
       			sty.name sty_name
	           FROM   okl_invoice_formats_v   inf,
       			      okl_invoice_types_v     ity,
       			      okl_invc_line_types_v   ilt,
       			      okl_invc_frmt_strms_v   frs,
       			      okl_strm_type_v         sty
		      WHERE   inf.id                  = p_format_id
		      AND     ity.inf_id              = inf.id
		      AND     ilt.ity_id              = ity.id
		      AND     frs.ilt_id              = ilt.id
		      AND     sty.id                  = frs.sty_id
		      AND	  frs.sty_id		      = p_stream_id;
Line: 3198

	 	     SELECT
    		  	inf.name inf_name,
    			inf.contract_level_yn,
    			ity.id ity_id,
            	ity.name ity_name,
    			ity.group_asset_yn,
    			ity.group_by_contract_yn,
    			ilt.id ilt_id,
    			ilt.sequence_number,
    			ilt.name ilt_name
       		 FROM    okl_invoice_formats_v   inf,
      		  		 okl_invoice_types_v     ity,
            		 okl_invc_line_types_v   ilt
    		 WHERE   inf.id                 = p_format_id
    		 AND     ity.inf_id             = inf.id
    		 AND     ilt.ity_id             = ity.id
    		 AND 	inf.ilt_id 				= ilt.id;
Line: 3226

	       SELECT id, name
	       FROM okl_strm_type_v;
Line: 3240

		      SELECT
                inf.id inf_id,
				inf.name inf_name,
				inf.contract_level_yn,
				ity.id ity_id,
		        ity.name ity_name,
				ity.group_asset_yn,
				ity.group_by_contract_yn,
				ilt.id	ilt_id,
				ilt.sequence_number,
				ilt.name ilt_name,
       			sty.name sty_name,
       			frs.sty_id  sty_id
	           FROM   okl_invoice_formats_v   inf,
       			      okl_invoice_types_v     ity,
       			      okl_invc_line_types_v   ilt,
       			      okl_invc_frmt_strms_v   frs,
       			      okl_strm_type_v         sty
		      WHERE   ity.inf_id              = inf.id
		      AND     ilt.ity_id              = ity.id
		      AND     frs.ilt_id              = ilt.id
		      AND     sty.id                  = frs.sty_id
           UNION -- default invlice format
   	 	     SELECT
   	 	        inf.id inf_id,
    		  	inf.name inf_name,
    			inf.contract_level_yn,
    			ity.id ity_id,
            	ity.name ity_name,
    			ity.group_asset_yn,
    			ity.group_by_contract_yn,
    			ilt.id ilt_id,
    			ilt.sequence_number,
    			ilt.name ilt_name,
       			'DEFAULT FORMAT' sty_name,
       			NULL
       		 FROM    okl_invoice_formats_v   inf,
      		  		 okl_invoice_types_v     ity,
            		 okl_invc_line_types_v   ilt
    		 WHERE   ity.inf_id             = inf.id
    		 AND     ilt.ity_id             = ity.id
    		 AND 	inf.ilt_id 				= ilt.id;
Line: 3311

   	   SELECT id, priority, pkg_name, proc_name
                    , start_date, end_date
	   FROM okl_invoice_mssgs_v;
Line: 3494

                                      p_update_tbl);
Line: 3497

                        p_update_tbl     := l_update_tbl;
Line: 3587

                                      p_update_tbl);
Line: 3590

        p_update_tbl     := l_update_tbl;
Line: 3701

     l_asset_tbl.delete;
Line: 3733

    l_cnt := p_update_tbl.count;
Line: 3736

    PRINT_TO_LOG( 'DEL Updates (p_saved_bill_rec.l_cons_inv_num)'||p_saved_bill_rec.l_cons_inv_num);
Line: 3737

    PRINT_TO_LOG( 'DEL Updates (l_format_name)'||l_format_name);
Line: 3739

    p_update_tbl(l_cnt).cnr_id			    := p_saved_bill_rec.l_cnr_id;
Line: 3740

    p_update_tbl(l_cnt).cons_inv_number     := p_saved_bill_rec.l_cons_inv_num;
Line: 3741

    p_update_tbl(l_cnt).lln_id			    := p_saved_bill_rec.l_lln_id;
Line: 3742

    p_update_tbl(l_cnt).lsm_id			    := l_lsm_id;
Line: 3743

    p_update_tbl(l_cnt).asset_number        := l_asset_name;
Line: 3744

    p_update_tbl(l_cnt).invoice_format      := l_format_name;
Line: 3745

    p_update_tbl(l_cnt).line_type           := l_cons_line_name;
Line: 3746

    p_update_tbl(l_cnt).sty_name            := l_sty_name;
Line: 3747

    p_update_tbl(l_cnt).contract_number     := p_cons_bill_tbl(k).contract_number;
Line: 3750

    p_update_tbl(l_cnt).private_label     := p_cons_bill_tbl(k).private_label;
Line: 3753

    p_update_tbl(l_cnt).lsm_amount          := p_cons_bill_tbl(k).amount;
Line: 3754

    p_update_tbl(l_cnt).xsi_id			    := p_cons_bill_tbl(k).xsi_id;
Line: 3755

    p_update_tbl(l_cnt).xls_id			    := p_cons_bill_tbl(k).xls_id;
Line: 3758

      p_update_tbl(l_cnt).cnr_total           := p_update_tbl(l_cnt).cnr_total + p_cons_bill_tbl(k).amount;
Line: 3760

      p_update_tbl(l_cnt).cnr_total           := p_cons_bill_tbl(k).amount;
Line: 3765

      p_update_tbl(l_cnt).lln_total           := p_update_tbl(l_cnt).lln_total + p_cons_bill_tbl(k).amount;
Line: 3767

      p_update_tbl(l_cnt).lln_total           := p_cons_bill_tbl(k).amount;
Line: 3809

		SELECT
	xsib.customer_id	 customer_id,
	xsib.currency_code currency,
	xsib.customer_address_id	 bill_to_site,
	xsib.receipt_method_id	 payment_method,
	xsit.xtrx_private_label	 private_label,
	TRUNC(xsiB.TRX_DATE)	 date_consolidated,
	NVL(
		nvl(
		(SELECT ity.id ity_id
		 FROM  okl_invoice_types_b     ity,
			okl_invc_line_types_b   ilt,
			okl_invc_frmt_strms   frs
		WHERE    ity.inf_id    = inf.id
			AND     ilt.ity_id     = ity.id
			AND     frs.ilt_id     = ilt.id
			AND     tld.sty_id     = frs.sty_id),
		 (select ity1.id
		 from okl_invoice_types_b ity1,
				  okl_invc_line_types_b ilt1
		  where ilt1.id = inf.ilt_id
			and ilt1.ity_id = ity1.id)),  -1
	) inv_type,
	xsib.inf_id         inf_id,
	tai.khr_id	contract_id,
	chr.contract_number  contract_number,
	'-1'                  prev_cons_invoice_num,
	xsib.org_id	 org_id,
	xsib.set_of_books_id set_of_books_id,
	til.kle_id	kle_id,
	tld.sty_id	stream_id,
	xsib.id		 xsi_id,
	xls.id		xls_id,
	xls.amount	c_amount,
	xls.sel_id       sel_id,
	xsib.legal_entity_id  legal_entity_id -- for LE Uptake project 08-11-2006
	FROM
	okl_ext_sell_invs_b	   xsib,
	okl_ext_sell_invs_tl	   xsit,
	okl_xtl_sell_invs_b	   xls,
	okl_txd_ar_ln_dtls_b   tld,
	okl_txl_ar_inv_lns_b   til,
	okl_trx_ar_invoices_b  tai,
	okc_k_headers_b	       chr,
	okl_invoice_formats_b   inf, -- 5138822
	okl_parallel_processes pws
	WHERE
	xsiB.TRX_STATUS_CODE    = 'SUBMITTED' AND
	xls.xsi_id_details 	   = xsiB.id		AND
	tld.id				   = xls.tld_id AND
	til.id				   = tld.TIL_ID_DETAILS AND
	tai.id				   = til.tai_id 		AND
	tai.khr_id             = chr.id
	AND
	chr.contract_number    = NVL(p_contract_number,chr.contract_number) AND
	tai.clg_id			   IS NULL				AND
	tai.cpy_id			   IS NULL				AND
	tai.qte_id			   IS NULL				AND
	xls.amount >=0                              AND
	xsiB.inf_id           = inf.id (+)           AND
	pws.object_type = 'CUSTOMER'           AND
	XSIB.CUSTOMER_ID = to_number(pws.object_value) AND
	pws.assigned_process = p_assigned_process    AND
	XSIB.ID = XSIT.ID
	and XSIT.LANGUAGE = USERENV('LANG')
	UNION
	SELECT
	xsib.customer_id			   	 customer_id,
	xsib.currency_code   		 currency,
	xsib.customer_address_id		 bill_to_site,
	xsib.receipt_method_id		 payment_method,
	xsit.xtrx_private_label		 private_label,
	TRUNC(xsib.TRX_DATE)			 date_consolidated,
	NVL(
	NVL((SELECT ity.id ity_id
	FROM  okl_invoice_types_b     ity,
	okl_invc_line_types_b   ilt,
	okl_invc_frmt_strms   frs
	WHERE    ity.inf_id    = inf.id
	AND     ilt.ity_id     = ity.id
	AND     frs.ilt_id     = ilt.id
	AND     tld.sty_id     = frs.sty_id),
		 (select ity1.id from okl_invoice_types_b ity1,
				   okl_invc_line_types_b ilt1
	where ilt1.id = inf.ilt_id
		  and ilt1.ity_id = ity1.id)),  -1
	) inv_type,                            -- bug 5138822
	xsib.inf_id                   inf_id,
	tai.khr_id					 contract_id, -- get contract Id
	chr.contract_number          contract_number,
	'-1'                         prev_cons_invoice_num,
	xsib.org_id					 org_id,
	xsib.set_of_books_id			 set_of_books_id,
	til.kle_id					 kle_id,
	tld.sty_id					 stream_id, -- to get the line seq #
	xsib.id						 xsi_id,
	xls.id						 xls_id,
	xls.amount					 c_amount,
	xls.sel_id                   sel_id,
	xsib.legal_entity_id                      legal_entity_id -- for LE Uptake project 08-11-2006
	FROM
	okl_ext_sell_invs_b	   xsib,
	okl_ext_sell_invs_tl	   xsit,
	okl_xtl_sell_invs_b	   xls,
	okl_txd_ar_ln_dtls_b   tld,
	okl_txl_ar_inv_lns_b   til,
	okl_trx_ar_invoices_b  tai,
	okc_k_headers_b	       chr,
	okl_invoice_formats_b   inf  -- 5138822
	WHERE
	xsib.TRX_STATUS_CODE    = 'SUBMITTED' AND
	xls.xsi_id_details 	   = xsib.id		AND
	tld.id				   = xls.tld_id AND
	til.id				   = tld.TIL_ID_DETAILS AND
	tai.id				   = til.tai_id 		AND
	tai.khr_id             = chr.id
	AND
	chr.contract_number    = p_contract_number AND
	tai.clg_id			   IS NULL				AND
	tai.cpy_id			   IS NULL				AND
	tai.qte_id			   IS NULL				AND
	xls.amount >= 0                             AND
	xsib.inf_id           = inf.id (+)          and
	XSIB.ID = XSIT.ID and
	XSIT.LANGUAGE = USERENV('LANG')
	ORDER BY 1,2,3,4,5,6,7,8,9,10
	--end modified abhsaxen for performance SQLID 20563033
	;
Line: 3941

CURSOR c1 IS SELECT
	   	 		xsi.customer_id			   	 customer_id,
				xsi.currency_code   		 currency,
				xsi.customer_address_id		 bill_to_site,
				xsi.receipt_method_id		 payment_method,
				xsi.xtrx_private_label		 private_label,
				TRUNC(xsi.TRX_DATE)			 date_consolidated,
				NVL(
				    NVL((SELECT ity.id ity_id
       			         FROM  okl_invoice_types_b     ity,
       			               okl_invc_line_types_b   ilt,
       			               okl_invc_frmt_strms   frs
		                 WHERE    ity.inf_id    = inf.id
		                 AND     ilt.ity_id     = ity.id
		                 AND     frs.ilt_id     = ilt.id
		                 AND     til.sty_id     = frs.sty_id),
						 (select ity1.id from okl_invoice_types_b ity1,
						                   okl_invc_line_types_b ilt1
			              where ilt1.id = inf.ilt_id
						  and ilt1.ity_id = ity1.id)),  -1
				   ) inv_type,                            -- bug 5138822
                xsi.inf_id                   inf_id,
				tai.khr_id					 contract_id,
                chr.contract_number          contract_number,
                '-1'                         prev_cons_invoice_num,
				xsi.org_id					 org_id,
				xsi.set_of_books_id			 set_of_books_id,
				til.kle_id					 kle_id,
				til.sty_id					 stream_id,
				xsi.id						 xsi_id,
				xls.id						 xls_id,
				xls.amount					 c1_amount,
                                xls.sel_id                   sel_id,
                 		xsi.legal_entity_id          legal_entity_id -- for LE Uptake project 08-11-2006
	     	 FROM
				okl_ext_sell_invs_v	   xsi,
				okl_xtl_sell_invs_v	   xls,
				okl_txl_ar_inv_lns_v   til,
				okl_trx_ar_invoices_v  tai,
                okc_k_headers_b	       chr,
				okl_invoice_formats_b   inf, -- 5138822
                okl_parallel_processes pws
			 WHERE
				xsi.TRX_STATUS_CODE    = 'SUBMITTED' AND
				xls.xsi_id_details 	   = xsi.id		 AND
				til.id				   = xls.til_id  AND
				tai.id				   = til.tai_id  AND
                tai.khr_id             = chr.id    AND
                -- Contract Specific consolidation
                chr.contract_number    = NVL(p_contract_number,chr.contract_number) AND
                -- Contract Specific consolidation
  				tai.clg_id			   IS NULL		AND
				tai.cpy_id			   IS NULL		AND
				tai.qte_id			   IS NULL		AND
				xls.amount >= 0                     AND
				xsi.inf_id           = inf.id (+)   AND    -- 5138822
                pws.object_type = 'CUSTOMER'             AND
                XSI.CUSTOMER_ID = to_number(pws.object_value) AND
                pws.assigned_process = p_assigned_process
			 ORDER BY 1,2,3,4,5,6,7,8,9,10;
Line: 4005

   SELECT language_code
   FROM FND_LANGUAGES
   WHERE INSTALLED_FLAG IN ('I', 'B');
Line: 4019

l_update_tbl         update_tbl_type;
Line: 4032

	SELECT *
	FROM okl_cnsld_ar_lines_v
	WHERE cnr_id = p_cnr_id
	ORDER BY sequence_number;
Line: 4046

    TYPE cnr_update_rec_type IS RECORD (
	 cnr_id			NUMBER,
	 lln_id			NUMBER,
	 lsm_id			NUMBER,
	 xsi_id			NUMBER,
	 xls_id			NUMBER,
	 return_status  VARCHAR2(1)
	);
Line: 4055

    TYPE cnr_update_tbl_type IS TABLE OF cnr_update_rec_type
	     INDEX BY BINARY_INTEGER;
Line: 4058

	cnr_update_tbl 				 cnr_update_tbl_type;
Line: 4112

	   SELECT contract_number
	   FROM okc_k_headers_b
	   WHERE id = p_id;
Line: 4117

	   SELECT name
	   FROM okl_strm_type_v
	   WHERE id = p_id;
Line: 4128

	   SELECT khr_id
	   FROM okl_cnsld_ar_strms_b
	   WHERE id = p_lsm_id;
Line: 4142

  SELECT
        DECODE(Fnd_Global.CONC_REQUEST_ID,-1,NULL,Fnd_Global.CONC_REQUEST_ID)
  FROM dual;
Line: 4150

       SELECT NAME
       FROM hr_operating_units
       WHERE ORGANIZATION_ID=MO_GLOBAL.GET_CURRENT_ORG_ID;--MOAC- Concurrent request
Line: 4245

        cons_bill_tbl.delete;
Line: 4246

        l_update_tbl.delete;
Line: 4250

        cons_bill_tbl.delete;
Line: 4264

                p_update_tbl        => l_update_tbl);
Line: 4276

                      l_update_tbl);
Line: 4308

            g_cnr_tl_tbl(tl_count).last_updated_by   := fnd_global.user_id;
Line: 4309

            g_cnr_tl_tbl(tl_count).last_update_date  := sysdate;
Line: 4310

            g_cnr_tl_tbl(tl_count).last_update_login := fnd_global.login_id;
Line: 4368

                        OKL_DEBUG_PUB.LOG_DEBUG(L_LEVEL_PROCEDURE,L_MODULE,'Begin Debug OKLRKONB.pls call okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT ');
Line: 4372

		  	      okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT(
	  	  		     p_api_version
    				,p_init_msg_list
    				,x_return_status
    				,x_msg_count
    				,x_msg_data
    				,p_imav_rec
    				,x_imav_rec);
Line: 4383

                      OKL_DEBUG_PUB.LOG_DEBUG(L_LEVEL_PROCEDURE,L_MODULE,'End Debug OKLRKONB.pls call okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT ');
Line: 4405

	    PRINT_TO_LOG('Performing bulk insert for cnr, record count is '||g_cnr_tbl.count);
Line: 4408

          insert into okl_cnsld_ar_hdrs_b
          values g_cnr_tbl(x);
Line: 4413

          insert into okl_cnsld_ar_hdrs_tl
          values g_cnr_tl_tbl(d);
Line: 4419

           PRINT_TO_LOG('Error during Header Insertion, rollback to H2');
Line: 4420

           g_cnr_tbl.DELETE;
Line: 4421

           g_cnr_tl_tbl.DELETE;
Line: 4422

           g_lln_tbl.DELETE;
Line: 4423

           g_lln_tl_tbl.DELETE;
Line: 4424

           g_lsm_tbl.DELETE;
Line: 4425

           g_lsm_tl_tbl.DELETE;
Line: 4426

           g_xsi_tbl.DELETE;
Line: 4427

           g_xsi_tl_tbl.DELETE;
Line: 4428

           g_xls_tbl.DELETE;
Line: 4429

           g_xls_tl_tbl.DELETE;
Line: 4435

     g_cnr_tbl.delete;
Line: 4436

     g_cnr_tl_tbl.delete;
Line: 4453

            g_lln_tl_tbl(tl_count).last_updated_by   := fnd_global.user_id;
Line: 4454

            g_lln_tl_tbl(tl_count).last_update_date  := sysdate;
Line: 4455

            g_lln_tl_tbl(tl_count).last_update_login := fnd_global.login_id;
Line: 4464

	    PRINT_TO_LOG('Performing bulk insert for lln, record count is '||g_lln_tbl.count);
Line: 4467

           insert into okl_cnsld_ar_lines_b
           values g_lln_tbl(x);
Line: 4472

           insert into okl_cnsld_ar_lines_tl
           values g_lln_tl_tbl(e);
Line: 4477

           PRINT_TO_LOG('Error during Line Insertion, rollback to L2');
Line: 4479

           g_lln_tl_tbl.DELETE;
Line: 4480

           g_lsm_tbl.DELETE;
Line: 4481

           g_lsm_tl_tbl.DELETE;
Line: 4482

           g_xsi_tbl.DELETE;
Line: 4483

           g_xsi_tl_tbl.DELETE;
Line: 4484

           g_xls_tbl.DELETE;
Line: 4485

           g_xls_tl_tbl.DELETE;
Line: 4488

              delete from okl_cnsld_ar_hdrs_b
              where id = g_lln_tbl(e).cnr_id;
Line: 4491

           g_lln_tbl.DELETE;
Line: 4497

     g_lln_tbl.delete;
Line: 4498

     g_lln_tl_tbl.delete;
Line: 4516

            g_lsm_tl_tbl(tl_count).last_updated_by   := fnd_global.user_id;
Line: 4517

            g_lsm_tl_tbl(tl_count).last_update_date  := sysdate;
Line: 4518

            g_lsm_tl_tbl(tl_count).last_update_login := fnd_global.login_id;
Line: 4526

	   PRINT_TO_LOG('Performing bulk insert for lsm, record count is '||g_lsm_tbl.count);
Line: 4529

         insert into okl_cnsld_ar_strms_b
         values g_lsm_tbl(x);
Line: 4534

         insert into okl_cnsld_ar_strms_tl
         values g_lsm_tl_tbl(f);
Line: 4540

           PRINT_TO_LOG('Error during Stream Insertion, rollback to D2');
Line: 4542

           g_cnr_tl_tbl.delete;
Line: 4543

           g_lln_tl_tbl.DELETE;
Line: 4544

           g_lsm_tl_tbl.DELETE;
Line: 4545

           g_xsi_tbl.DELETE;
Line: 4546

           g_xsi_tl_tbl.DELETE;
Line: 4547

           g_xls_tbl.DELETE;
Line: 4548

           g_xls_tl_tbl.DELETE;
Line: 4552

                 delete from okl_cnsld_ar_hdrs_b
                 where id = g_lln_tbl(f).cnr_id;
Line: 4555

              delete from okl_cnsld_ar_lines_b
              where id = g_lsm_tbl(e).lln_id;
Line: 4558

           g_lsm_tbl.DELETE;
Line: 4559

           g_lln_tbl.DELETE;
Line: 4560

           g_cnr_tbl.DELETE;
Line: 4566

     g_lsm_tbl.delete;
Line: 4567

     g_lsm_tl_tbl.delete;
Line: 4575

            Okl_Debug_Pub.LOG_DEBUG(L_LEVEL_PROCEDURE,L_MODULE,'Begin Debug OKLRKONB.pls call okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT ');
Line: 4579

        Okl_Inv_Mssg_Att_Pub.INSERT_INV_MSSG_ATT(
                            p_api_version
                           ,p_init_msg_list
                           ,x_return_status
                           ,x_msg_count
                           ,x_msg_data
                           ,g_imav_tbl
                           ,x_imav_tbl
                 );
Line: 4590

           Okl_Debug_Pub.LOG_DEBUG(L_LEVEL_PROCEDURE,L_MODULE,'End Debug OKLRKONB.pls call okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT ');
Line: 4601

        g_imav_tbl.DELETE;
Line: 4609

	    PRINT_TO_LOG('Performing final bulk update for xsi, record count is '||g_xsi_tbl.COUNT );
Line: 4615

            update okl_ext_sell_invs_b
            set trx_status_code = g_xsi_tbl(indx).trx_status_code,
--                xtrx_invoice_pull_yn = g_xsi_tbl(indx).xtrx_invoice_pull_yn,
                last_update_date = sysdate,
                last_updated_by = fnd_global.user_id,
                last_update_login = fnd_global.login_id
            where id = g_xsi_tbl(indx).id;
Line: 4625

        g_xsi_tbl.delete;
Line: 4629

           PRINT_TO_LOG('Error during Update of okl_ext_sell_invs_b, rollback to U5');
Line: 4637

	    PRINT_TO_LOG('Performing final bulk update for xls, record count is '||g_xls_tbl.COUNT );
Line: 4641

           update okl_xtl_sell_invs_b
           set lsm_id              = g_xls_tbl(s).lsm_id,
               xtrx_cons_stream_id  = g_xls_tbl(s).lsm_id,
               last_update_date     = sysdate,
               last_updated_by      = fnd_global.user_id,
               last_update_login    = fnd_global.login_id
           where id = g_xls_tbl(s).id;
Line: 4651

        g_xls_tbl.delete;
Line: 4655

           PRINT_TO_LOG('Error during Update of okl_xtl_sell_invs_b, rollback to U6');
Line: 4663

	    PRINT_TO_LOG('Performing final bulk update for xsi tl, record count is '||g_xsi_tl_tbl.COUNT );
Line: 4667

           update okl_ext_sell_invs_tl
           set xtrx_cons_invoice_number = g_xsi_tl_tbl(u).xtrx_cons_invoice_number,
               xtrx_format_type = g_xsi_tl_tbl(u).xtrx_format_type,
               xtrx_private_label = g_xsi_tl_tbl(u).xtrx_private_label,
               last_update_date = sysdate,
               last_updated_by = fnd_global.user_id,
               last_update_login = fnd_global.login_id
           where id = g_xsi_tl_tbl(u).id;
Line: 4678

        g_xsi_tl_tbl.delete;
Line: 4682

           PRINT_TO_LOG('Error during Update of okl_ext_sell_invs_tl, rollback to U7');
Line: 4690

	    PRINT_TO_LOG('Performing final bulk update for xls tl, record count is '||g_xls_tl_tbl.COUNT );
Line: 4694

           update okl_xtl_sell_invs_tl
           set    xtrx_contract     = g_xls_tl_tbl(t).xtrx_contract,
                  xtrx_asset        = g_xls_tl_tbl(t).xtrx_asset,
                  xtrx_stream_type  = g_xls_tl_tbl(t).xtrx_stream_type,
                  xtrx_stream_group = g_xls_tl_tbl(t).xtrx_stream_group,
                  last_update_date  = sysdate,
                  last_updated_by   = fnd_global.user_id,
                  last_update_login = fnd_global.login_id
           where id = g_xls_tl_tbl(t).id;
Line: 4706

        g_xls_tl_tbl.delete;
Line: 4710

           PRINT_TO_LOG('Error during Update of okl_xtl_sell_invs_tl, rollback to U8');
Line: 4723

        cons_bill_tbl.delete;
Line: 4724

        l_update_tbl.delete;
Line: 4727

           g_cnr_tbl.DELETE;
Line: 4728

           g_cnr_tl_tbl.DELETE;
Line: 4729

           g_lln_tbl.DELETE;
Line: 4730

           g_lln_tl_tbl.DELETE;
Line: 4731

           g_lsm_tbl.DELETE;
Line: 4732

           g_lsm_tl_tbl.DELETE;
Line: 4733

           g_xsi_tbl.DELETE;
Line: 4734

           g_xsi_tl_tbl.DELETE;
Line: 4735

           g_xls_tbl.DELETE;
Line: 4736

           g_xls_tl_tbl.DELETE;
Line: 4741

        cons_bill_tbl.delete;
Line: 4756

                p_update_tbl        => l_update_tbl);
Line: 4768

                      l_update_tbl);
Line: 4781

        cons_bill_tbl.delete;
Line: 4782

        l_update_tbl.delete;
Line: 4817

            g_cnr_tl_tbl(tl_count).last_updated_by   := fnd_global.user_id;
Line: 4818

            g_cnr_tl_tbl(tl_count).last_update_date  := sysdate;
Line: 4819

            g_cnr_tl_tbl(tl_count).last_update_login := fnd_global.login_id;
Line: 4876

                        OKL_DEBUG_PUB.LOG_DEBUG(L_LEVEL_PROCEDURE,L_MODULE,'Begin Debug OKLRKONB.pls call okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT ');
Line: 4880

		  	      okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT(
	  	  		     p_api_version
    				,p_init_msg_list
    				,x_return_status
    				,x_msg_count
    				,x_msg_data
    				,p_imav_rec
    				,x_imav_rec);
Line: 4891

                      OKL_DEBUG_PUB.LOG_DEBUG(L_LEVEL_PROCEDURE,L_MODULE,'End Debug OKLRKONB.pls call okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT ');
Line: 4913

	    PRINT_TO_LOG('Performing final bulk insert for cnr, record count is '||g_cnr_tbl.count);
Line: 4916

          insert into okl_cnsld_ar_hdrs_b
          values g_cnr_tbl(x);
Line: 4921

          insert into okl_cnsld_ar_hdrs_tl
          values g_cnr_tl_tbl(d);
Line: 4927

           PRINT_TO_LOG('Error during Header Insertion, rollback to H2');
Line: 4928

           g_cnr_tbl.DELETE;
Line: 4929

           g_cnr_tl_tbl.DELETE;
Line: 4930

           g_lln_tbl.DELETE;
Line: 4931

           g_lln_tl_tbl.DELETE;
Line: 4932

           g_lsm_tbl.DELETE;
Line: 4933

           g_lsm_tl_tbl.DELETE;
Line: 4934

           g_xsi_tbl.DELETE;
Line: 4935

           g_xsi_tl_tbl.DELETE;
Line: 4936

           g_xls_tbl.DELETE;
Line: 4937

           g_xls_tl_tbl.DELETE;
Line: 4943

     g_cnr_tbl.delete;
Line: 4944

     g_cnr_tl_tbl.delete;
Line: 4960

            g_lln_tl_tbl(tl_count).last_updated_by   := fnd_global.user_id;
Line: 4961

            g_lln_tl_tbl(tl_count).last_update_date  := sysdate;
Line: 4962

            g_lln_tl_tbl(tl_count).last_update_login := fnd_global.login_id;
Line: 4971

	    PRINT_TO_LOG('Performing final bulk insert for lln, record count is '||g_lln_tbl.count);
Line: 4974

           insert into okl_cnsld_ar_lines_b
           values g_lln_tbl(x);
Line: 4979

           insert into okl_cnsld_ar_lines_tl
           values g_lln_tl_tbl(e);
Line: 4984

           PRINT_TO_LOG('Error during Line Insertion, rollback to L2');
Line: 4986

           g_lln_tl_tbl.DELETE;
Line: 4987

           g_lsm_tbl.DELETE;
Line: 4988

           g_lsm_tl_tbl.DELETE;
Line: 4989

           g_xsi_tbl.DELETE;
Line: 4990

           g_xsi_tl_tbl.DELETE;
Line: 4991

           g_xls_tbl.DELETE;
Line: 4992

           g_xls_tl_tbl.DELETE;
Line: 4995

              delete from okl_cnsld_ar_hdrs_b
              where id = g_lln_tbl(e).cnr_id;
Line: 4998

           g_lln_tbl.DELETE;
Line: 5004

     g_lln_tbl.delete;
Line: 5005

     g_lln_tl_tbl.delete;
Line: 5022

            g_lsm_tl_tbl(tl_count).last_updated_by   := fnd_global.user_id;
Line: 5023

            g_lsm_tl_tbl(tl_count).last_update_date  := sysdate;
Line: 5024

            g_lsm_tl_tbl(tl_count).last_update_login := fnd_global.login_id;
Line: 5032

	   PRINT_TO_LOG('Performing final bulk insert for lsm, record count is '||g_lsm_tbl.count);
Line: 5035

         insert into okl_cnsld_ar_strms_b
         values g_lsm_tbl(x);
Line: 5040

         insert into okl_cnsld_ar_strms_tl
         values g_lsm_tl_tbl(f);
Line: 5046

           PRINT_TO_LOG('Error during Stream Insertion, rollback to D2');
Line: 5048

           g_cnr_tl_tbl.delete;
Line: 5049

           g_lln_tl_tbl.DELETE;
Line: 5050

           g_lsm_tl_tbl.DELETE;
Line: 5051

           g_xsi_tbl.DELETE;
Line: 5052

           g_xsi_tl_tbl.DELETE;
Line: 5053

           g_xls_tbl.DELETE;
Line: 5054

           g_xls_tl_tbl.DELETE;
Line: 5058

                 delete from okl_cnsld_ar_hdrs_b
                 where id = g_lln_tbl(f).cnr_id;
Line: 5061

              delete from okl_cnsld_ar_lines_b
              where id = g_lsm_tbl(e).lln_id;
Line: 5064

           g_lsm_tbl.DELETE;
Line: 5065

           g_lln_tbl.DELETE;
Line: 5066

           g_cnr_tbl.DELETE;
Line: 5072

     g_lsm_tbl.delete;
Line: 5073

     g_lsm_tl_tbl.delete;
Line: 5079

            Okl_Debug_Pub.LOG_DEBUG(L_LEVEL_PROCEDURE,L_MODULE,'Begin Debug OKLRKONB.pls call okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT ');
Line: 5083

        Okl_Inv_Mssg_Att_Pub.INSERT_INV_MSSG_ATT(
                            p_api_version
                           ,p_init_msg_list
                           ,x_return_status
                           ,x_msg_count
                           ,x_msg_data
                           ,g_imav_tbl
                           ,x_imav_tbl
                 );
Line: 5094

           Okl_Debug_Pub.LOG_DEBUG(L_LEVEL_PROCEDURE,L_MODULE,'End Debug OKLRKONB.pls call okl_inv_mssg_att_pub.INSERT_INV_MSSG_ATT ');
Line: 5105

        g_imav_tbl.DELETE;
Line: 5113

	    PRINT_TO_LOG('Performing final bulk update for xsi, record count is '||g_xsi_tbl.COUNT );
Line: 5119

            update okl_ext_sell_invs_b
            set trx_status_code = g_xsi_tbl(indx).trx_status_code,
--                xtrx_invoice_pull_yn = g_xsi_tbl(indx).xtrx_invoice_pull_yn,
                last_update_date = sysdate,
                last_updated_by = fnd_global.user_id,
                last_update_login = fnd_global.login_id
            where id = g_xsi_tbl(indx).id;
Line: 5129

        g_xsi_tbl.delete;
Line: 5133

           PRINT_TO_LOG('Error during Update of okl_ext_sell_invs_b, rollback to U5');
Line: 5142

	    PRINT_TO_LOG('Performing final bulk update for xls, record count is '||g_xls_tbl.COUNT );
Line: 5146

           update okl_xtl_sell_invs_b
           set lsm_id              = g_xls_tbl(s).lsm_id,
               xtrx_cons_stream_id  = g_xls_tbl(s).lsm_id,
               last_update_date     = sysdate,
               last_updated_by      = fnd_global.user_id,
               last_update_login    = fnd_global.login_id
           where id = g_xls_tbl(s).id;
Line: 5156

        g_xls_tbl.delete;
Line: 5160

           PRINT_TO_LOG('Error during Update of okl_xtl_sell_invs_b, rollback to U6');
Line: 5168

	    PRINT_TO_LOG('Performing final bulk update for xsi tl, record count is '||g_xsi_tl_tbl.COUNT );
Line: 5172

           update okl_ext_sell_invs_tl
           set xtrx_cons_invoice_number = g_xsi_tl_tbl(u).xtrx_cons_invoice_number,
               xtrx_format_type = g_xsi_tl_tbl(u).xtrx_format_type,
               xtrx_private_label = g_xsi_tl_tbl(u).xtrx_private_label,
               last_update_date = sysdate,
               last_updated_by = fnd_global.user_id,
               last_update_login = fnd_global.login_id
           where id = g_xsi_tl_tbl(u).id;
Line: 5183

        g_xsi_tl_tbl.delete;
Line: 5187

           PRINT_TO_LOG('Error during Update of okl_ext_sell_invs_tl, rollback to U7');
Line: 5195

	    PRINT_TO_LOG('Performing final bulk update for xls tl, record count is '||g_xls_tl_tbl.COUNT );
Line: 5199

           update okl_xtl_sell_invs_tl
           set    xtrx_contract     = g_xls_tl_tbl(t).xtrx_contract,
                  xtrx_asset        = g_xls_tl_tbl(t).xtrx_asset,
                  xtrx_stream_type  = g_xls_tl_tbl(t).xtrx_stream_type,
                  xtrx_stream_group = g_xls_tl_tbl(t).xtrx_stream_group,
                  last_update_date  = sysdate,
                  last_updated_by   = fnd_global.user_id,
                  last_update_login = fnd_global.login_id
           where id = g_xls_tl_tbl(t).id;
Line: 5211

        g_xls_tl_tbl.delete;
Line: 5215

           PRINT_TO_LOG('Error during Update of okl_xtl_sell_invs_tl, rollback to U8');
Line: 5246

            delete okl_parallel_processes
            where assigned_process = p_assigned_process;
Line: 5271

            delete okl_parallel_processes
            where assigned_process = p_assigned_process;
Line: 5295

            delete okl_parallel_processes
            where assigned_process = p_assigned_process;