DBA Data[Home] [Help]

APPS.AP_WEB_DB_CCARD_PKG SQL Statements

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

Line: 13

    SELECT ACCT.CATEGORY
    FROM AP_CREDIT_CARD_TRXNS ACCT,
	 AP_EXPENSE_REPORT_LINES AERL
    WHERE AERL.REPORT_HEADER_ID = P_ReportHeaderID
    AND ACCT.TRX_ID = AERL.CREDIT_CARD_TRX_ID;
Line: 47

    Select trx_id,
           transaction_date,
	   folio_type,  --shuh
           merchant_name1,
           merchant_city,
           merchant_province_state,
           billed_amount,
           posted_currency_code,
           transaction_amount,
           cc.card_id,
           nvl(cc.category, c_business)
    FROM ap_credit_card_trxns cc,
         ap_cards card
    WHERE cc.validate_code = 'Y'
      AND cc.payment_flag <> 'Y'
      AND cc.billed_amount is not null
      AND nvl(cc.expensed_amount,0) = 0
      AND nvl(cc.category,'BUSINESS') <> 'DEACTIVATED'
      AND cc.billed_currency_code = p_reimb_curr_code
      AND cc.card_id = card.card_id
      AND cc.card_program_id = card.card_program_id
      AND card.employee_id = p_user_id
      AND card.card_program_id = p_card_prog_id
      AND card.card_id = p_card_id
      AND cc.payment_due_from_code = p_paymentDueFrom
    ORDER BY cc.transaction_date;
Line: 97

                SELECT  DISTINCT
                    cp.card_program_id,
                    cp.card_program_name,
                    card.card_id,
                    trxn.payment_due_from_code
                FROM    ap_card_programs cp,
                        ap_cards card,
                        ap_credit_card_trxns trxn
                WHERE   card.employee_id = p_user_id
                AND     card.card_program_id = cp.card_program_id
                AND     cp.card_type_lookup_code = p_card_type
                AND     trxn.CARD_PROGRAM_ID = card.CARD_PROGRAM_ID
                AND     trxn.CARD_ID = card.CARD_ID
             UNION
                SELECT  cp.card_program_id,
                        cp.card_program_name,
                        card.card_id,
                        cp.payment_due_from_code
                FROM    ap_card_programs cp,
                        ap_cards card
                WHERE   card.employee_id = p_user_id
                AND     card.card_program_id = cp.card_program_id
                AND     cp.card_type_lookup_code = p_card_type;
Line: 145

	SELECT  DISTINCT
		TRX_ID,
		TRANSACTION_DATE,    --3028505
		BILLED_AMOUNT,
		cc.CARD_ID THE_CARD_ID,
                emp.full_name,
                emp.person_id
	FROM	AP_CREDIT_CARD_TRXNS cc,
		AP_CARDS card,
                per_people_x emp
	WHERE   cc.CARD_PROGRAM_ID = p_card_prog_id
	  AND   cc.VALIDATE_CODE = 'Y'
          AND   cc.payment_flag <> 'Y'
	  AND	cc.COMPANY_PREPAID_INVOICE_ID IS NULL
	  AND	cc.BILLED_AMOUNT IS NOT NULL
	  AND	cc.CARD_ID = card.CARD_ID
	  AND	(nvl(cc.billed_date, cc.posted_date) BETWEEN
				nvl(p_start_date, nvl(cc.billed_date, cc.posted_date) - 1) AND
				nvl(p_end_date, nvl(cc.billed_date, cc.posted_date) + 1)
			)
	  AND	cc.payment_due_from_code='COMPANY'
          AND   card.employee_id = emp.person_id
          AND nvl(cc.category,'BUSINESS') <> 'DEACTIVATED'
     ORDER BY
		cc.transaction_date; 	--3028505
Line: 195

       SELECT transaction_date, merchant_name1, billed_amount, billed_currency_code
       FROM
       ap_credit_card_trxns cct,
       ap_cards_all ac
       WHERE
       cct.card_program_id = p_cardProgramId
       and cct.validate_code = 'Y'
       and cct.payment_flag <> 'Y'
       and nvl(cct.expensed_amount,0) = 0
       and nvl(cct.category,c_business) = 'DISPUTED'
       and ac.card_program_id = cct.card_program_id
       and ac.card_id = cct.card_id
       and nvl(cct.billed_date, cct.posted_date) between
           nvl(p_billedStartDate, nvl(cct.billed_date, cct.posted_date)-1) and
           nvl(p_billedEndDate, nvl(cct.billed_date, cct.posted_date)+1)
       and cct.billed_amount > p_minimumAmount
       and ac.employee_id = p_employeeId
       order by cct.transaction_date;
Line: 242

       SELECT 	distinct transaction_date,
		merchant_name1,
		billed_amount,
		billed_currency_code,
		erh.invoice_num,
		AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode
                                       (erh.source,erh.workflow_approved_flag,
                                        erh.report_header_id), --2615448
		cct.trx_id              -- Bug 3241358
       FROM
       ap_credit_card_trxns 	cct,
       ap_cards 		ac,
       ap_expense_report_headers erh
       WHERE
       cct.card_program_id = p_cardProgramId
       and cct.validate_code = 'Y'
       and cct.payment_flag <> 'Y'
       and cct.expensed_amount <> 0
       and nvl(cct.category,c_business) NOT IN
              ( 'DISPUTED', 'PERSONAL' , 'MATCHED' ,'CREDIT','DEACTIVATED') -- 3234232 , --3307864
       and ac.card_program_id = cct.card_program_id
       and ac.card_id = cct.card_id
       and nvl(cct.billed_date, cct.posted_date) between
           nvl(p_billedStartDate, nvl(cct.billed_date, cct.posted_date)-1) and
           nvl(p_billedEndDate, nvl(cct.billed_date, cct.posted_date)+1)
       and abs(cct.billed_amount) > nvl(p_minimumAmount,0)
       and erh.report_header_id = cct.report_header_id --3130923
       and ac.employee_id = erh.employee_id --3130923
       and AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode
                                 (erh.source,erh.workflow_approved_flag,
                                  erh.report_header_id) in
          ('EMPAPPR', 'RESOLUTN','RETURNED','REJECTED','WITHDRAWN', 'SAVED') --2615448
       and ac.employee_id = p_employeeId
       and rownum < 41
     UNION ALL
       SELECT 	transaction_date,
		merchant_name1,
		billed_amount,
		billed_currency_code,
		null,
		'UNUSED',
		cct.trx_id              -- Bug 3241358
       FROM
       ap_credit_card_trxns 	cct,
       ap_cards 		ac
       WHERE
       cct.card_program_id = p_cardProgramId
       and cct.validate_code = 'Y'
       and cct.payment_flag <> 'Y'
       and nvl(cct.expensed_amount,0) = 0
       and nvl(cct.category,c_business) NOT IN ('DISPUTED','MATCHED','CREDIT','DEACTIVATED') --Bug 3307864
       and cct.report_header_id is NULL
       and ac.card_program_id = cct.card_program_id
       and ac.card_id = cct.card_id
       and nvl(cct.billed_date, cct.posted_date) between
           nvl(p_billedStartDate, nvl(cct.billed_date, cct.posted_date)-1) and
           nvl(p_billedEndDate, nvl(cct.billed_date, cct.posted_date)+1)
       and abs(cct.billed_amount) > nvl(p_minimumAmount,0)
       and ac.employee_id = p_employeeId
       and rownum < 41
       and p_chargeType = 'UNUSED'
     UNION ALL
       SELECT 	distinct transaction_date,
		merchant_name1,
		billed_amount,
		billed_currency_code,
		erh.invoice_num,
		AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode
                                       (erh.source,erh.workflow_approved_flag,
                                        erh.report_header_id), --2615448
		cct.trx_id              -- Bug 3241358
       FROM
       ap_credit_card_trxns 	cct,
       ap_cards 		ac,
       ap_expense_report_headers erh
       WHERE
       cct.card_program_id = p_cardProgramId
       and cct.validate_code = 'Y'
       and cct.payment_flag <> 'Y'
       and cct.expensed_amount <> 0
       and nvl(cct.category,c_business) = 'PERSONAL'
       and ac.card_program_id = cct.card_program_id
       and ac.card_id = cct.card_id
       and nvl(cct.billed_date, cct.posted_date) between
           nvl(p_billedStartDate, nvl(cct.billed_date, cct.posted_date)-1) and
           nvl(p_billedEndDate, nvl(cct.billed_date, cct.posted_date)+1)
       and abs(cct.billed_amount) > nvl(p_minimumAmount,0)
       and erh.report_header_id = cct.report_header_id
       and ac.employee_id = erh.employee_id --3130923
       and AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode
                                 (erh.source,erh.workflow_approved_flag,
                                  erh.report_header_id) in
          ('EMPAPPR', 'RESOLUTN','RETURNED','REJECTED','WITHDRAWN', 'SAVED') --2615448
       and ac.employee_id = p_employeeId
       and rownum < 41;
Line: 367

       SELECT distinct 	transaction_date,
		merchant_name1,
		billed_amount,
		billed_currency_code,
		erh.invoice_num,
                AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode
                               (erh.source,erh.workflow_approved_flag,
                                erh.report_header_id), --2615448
		cct.trx_id              -- Bug 3241358
       FROM
       ap_credit_card_trxns 	cct,
       ap_cards 		ac,
       ap_expense_report_headers erh
       WHERE
       cct.card_program_id = p_cardProgramId
       and cct.validate_code = 'Y'
       and cct.payment_flag <> 'Y'
       and cct.expensed_amount <> 0
       and nvl(cct.category,c_business) NOT IN
                    ('DISPUTED','CREDIT', 'MATCHED','PERSONAL','DEACTIVATED') --Bug 3307864
       and ac.card_program_id = cct.card_program_id
       and ac.card_id = cct.card_id
       and nvl(cct.billed_date, cct.posted_date) between
           nvl(p_billedStartDate, nvl(cct.billed_date, cct.posted_date)-1) and
           nvl(p_billedEndDate, nvl(cct.billed_date, cct.posted_date)+1)
       and abs(cct.billed_amount) > nvl(p_minimumAmount,0)
       and erh.report_header_id = cct.report_header_id --3130923
       and ac.employee_id = erh.employee_id --3130923
       and AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode(erh.source,erh.workflow_approved_flag,
                                                    erh.report_header_id) in
          ('EMPAPPR', 'RESOLUTN','RETURNED','REJECTED','WITHDRAWN', 'SAVED')  --2615448
       and ac.employee_id = p_employeeId
     UNION ALL
       SELECT 	transaction_date,
		merchant_name1,
		billed_amount,
		billed_currency_code,
		null,
		'UNUSED',
		cct.trx_id              -- Bug 3241358
       FROM
       ap_credit_card_trxns 	cct,
       ap_cards 		ac
       WHERE
       cct.card_program_id = p_cardProgramId
       and cct.validate_code = 'Y'
       and cct.payment_flag <> 'Y'
       and nvl(cct.expensed_amount,0) = 0
       and nvl(cct.category,c_business) NOT IN ( 'DISPUTED','CREDIT','MATCHED','DEACTIVATED') --Bug 3307864
       and cct.report_header_id is NULL
       and ac.card_program_id = cct.card_program_id
       and ac.card_id = cct.card_id
       and nvl(cct.billed_date, cct.posted_date) between
           nvl(p_billedStartDate, nvl(cct.billed_date, cct.posted_date)-1) and
           nvl(p_billedEndDate, nvl(cct.billed_date, cct.posted_date)+1)
       and abs(cct.billed_amount) > nvl(p_minimumAmount,0)
       and ac.employee_id = p_employeeId
       and p_chargeType = 'UNUSED'
     UNION ALL
       SELECT distinct 	transaction_date,
		merchant_name1,
		billed_amount,
		billed_currency_code,
		erh.invoice_num,
                AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode
                               (erh.source,erh.workflow_approved_flag,
                                erh.report_header_id), --2615448
		cct.trx_id              -- Bug 3241358
       FROM
       ap_credit_card_trxns 	cct,
       ap_cards 		ac,
       ap_expense_report_headers erh
       WHERE
       cct.card_program_id = p_cardProgramId
       and cct.validate_code = 'Y'
       and cct.payment_flag <> 'Y'
       and cct.expensed_amount <> 0
       and nvl(cct.category,c_business) = 'PERSONAL'
       and ac.card_program_id = cct.card_program_id
       and ac.card_id = cct.card_id
       and nvl(cct.billed_date, cct.posted_date) between
           nvl(p_billedStartDate, nvl(cct.billed_date, cct.posted_date)-1) and
           nvl(p_billedEndDate, nvl(cct.billed_date, cct.posted_date)+1)
       and abs(cct.billed_amount) > nvl(p_minimumAmount,0)
       and erh.report_header_id = cct.report_header_id
       and ac.employee_id = erh.employee_id --3130923
       and AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode(erh.source,erh.workflow_approved_flag,
                                                    erh.report_header_id) in
          ('EMPAPPR', 'RESOLUTN','RETURNED','REJECTED','WITHDRAWN', 'SAVED')  --2615448
       and ac.employee_id = p_employeeId;
Line: 488

       SELECT distinct 	transaction_date,
		merchant_name1,
		billed_amount,
		billed_currency_code,
                cct.posted_currency_code, --3339380
		erh.invoice_num,
                NVL(AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode
                                           (erh.source,erh.workflow_approved_flag,
                                            erh.report_header_id),'UNUSED'), --2615505
		nvl(cct.billed_date, cct.posted_date) billed_date,
	        cct.posted_date, --Notification Esc
	        cct.transaction_amount,--Notification Esc
	        AP_WEB_DB_CCARD_PKG.GETLOCATION(cct.merchant_city , cct.merchant_province_state),  --Notification Esc
		cct.trx_id              -- Bug 3241358
       FROM
       ap_credit_card_trxns 		cct,
       ap_cards 			ac,
       ap_expense_report_headers 	erh
       WHERE
       cct.card_program_id = p_cardProgramId
       and cct.validate_code = 'Y'
       and cct.payment_flag <> 'Y'
       and nvl(cct.category,c_business) NOT IN ( 'DISPUTED','PERSONAL' ,'MATCHED','CREDIT','DEACTIVATED')
       and cct.expensed_amount <> 0
       and ac.card_program_id = cct.card_program_id
       and ac.card_id = cct.card_id
       and trunc(sysdate) - cct.posted_date between p_min_bucket and p_max_bucket
       and erh.report_header_id = cct.report_header_id
       and AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode(erh.source,erh.workflow_approved_flag,
                                            erh.report_header_id)
		in ('SAVED','REJECTED', 'RESOLUTN','EMPAPPR','RETURNED','WITHDRAWN')
       and ac.employee_id = p_employeeId
       and rownum < 41
       --order by cct.transaction_date;
Line: 523

       SELECT distinct  transaction_date,
                merchant_name1,
                billed_amount,
                billed_currency_code,
                cct.posted_currency_code, --3339380
                erh.invoice_num,
                AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode
                                           (erh.source,erh.workflow_approved_flag,
                                            erh.report_header_id),
                nvl(cct.billed_date, cct.posted_date) billed_date,
                cct.posted_date, --Notification Esc
                cct.transaction_amount,--Notification Esc
                AP_WEB_DB_CCARD_PKG.GETLOCATION(cct.merchant_city , cct.merchant_province_state),   --Notification Esc
		cct.trx_id              -- Bug 3241358
       FROM
       ap_credit_card_trxns             cct,
       ap_cards                         ac,
       ap_expense_report_headers        erh
       WHERE
       cct.card_program_id = p_cardProgramId
       and cct.validate_code = 'Y'
       and cct.payment_flag <> 'Y'
       and nvl(cct.category,c_business) = 'PERSONAL'
       and cct.expensed_amount <> 0
       and ac.card_program_id = cct.card_program_id
       and ac.card_id = cct.card_id
       and trunc(sysdate) - cct.posted_date between p_min_bucket and p_max_bucket
       and erh.report_header_id = cct.report_header_id
       and NVL(AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode(erh.source,erh.workflow_approved_flag,
                                            erh.report_header_id),'UNUSED')
                in ('SAVED','REJECTED', 'RESOLUTN','EMPAPPR','RETURNED','WITHDRAWN')
       and ac.employee_id = p_employeeId
       and rownum < 41
     UNION ALL
       SELECT   distinct transaction_date,
                merchant_name1,
                billed_amount,
                billed_currency_code,
                cct.posted_currency_code, --3339380
                null,
                'UNUSED',
                nvl(cct.billed_date, cct.posted_date) billed_date,
	        cct.posted_date, --Notification Esc
	        cct.transaction_amount,--Notification Esc
	        AP_WEB_DB_CCARD_PKG.GETLOCATION(cct.merchant_city , cct.merchant_province_state),  --Notification Esc
                cct.trx_id              -- Bug 3241358
       FROM
       ap_credit_card_trxns     cct,
       ap_cards                 ac
       WHERE
       cct.card_program_id = p_cardProgramId
       and cct.validate_code = 'Y'
       and cct.payment_flag <> 'Y'
       and nvl(cct.expensed_amount,0) = 0
       and nvl(cct.category,'BUSINESS') <> 'DEACTIVATED'
       and cct.report_header_id is null
       and ac.card_program_id = cct.card_program_id
       and ac.card_id = cct.card_id
       and trunc(sysdate) - nvl(cct.billed_date, cct.posted_date) between p_min_bucket and p_max_bucket
       and ac.employee_id = p_employeeId
       and rownum < 41;
Line: 612

       SELECT distinct 	transaction_date,
		merchant_name1,
		billed_amount,
		billed_currency_code,
		erh.invoice_num,
                NVL(AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode
                                           (erh.source,erh.workflow_approved_flag,
                                            erh.report_header_id),'UNUSED'), --2615505
		nvl(cct.billed_date, cct.posted_date) billed_date,
		cct.trx_id              -- Bug 3241358
       FROM
       ap_credit_card_trxns 		cct,
       ap_cards 			ac,
       ap_expense_report_headers 	erh
       WHERE
       cct.card_program_id = p_cardProgramId
       and cct.validate_code = 'Y'
       and cct.payment_flag <> 'Y'
       and nvl(cct.category,c_business) NOT IN
              ('DISPUTED' , 'CREDIT' , 'MATCHED','PERSONAL','DEACTIVATED') --Bug 3307864
       and ac.card_program_id = cct.card_program_id
       and ac.card_id = cct.card_id
       and trunc(sysdate) - nvl(cct.billed_date, cct.posted_date) between p_min_bucket and p_max_bucket
       and erh.report_header_id = cct.report_header_id
       and cct.expensed_amount <> 0
       and erh.report_header_id = cct.report_header_id
       and AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode(erh.source,erh.workflow_approved_flag,
                                            erh.report_header_id)
		in ('SAVED','REJECTED', 'RESOLUTN','EMPAPPR','RETURNED','WITHDRAWN')
       and ac.employee_id = p_employeeId
   UNION ALL
       SELECT  DISTINCT  transaction_date,
                merchant_name1,
                billed_amount,
                billed_currency_code,
                erh.invoice_num,
                AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode
                                           (erh.source,erh.workflow_approved_flag,
                                            erh.report_header_id),
                nvl(cct.billed_date, cct.posted_date) billed_date,
                cct.trx_id
       FROM
       ap_credit_card_trxns             cct,
       ap_cards                         ac,
       ap_expense_report_headers        erh
       WHERE
       cct.card_program_id = p_cardProgramId
       and cct.validate_code = 'Y'
       and cct.payment_flag <> 'Y'
       and nvl(cct.category,c_business) = 'PERSONAL'
       and cct.expensed_amount <> 0
       and ac.card_program_id = cct.card_program_id
       and ac.card_id = cct.card_id
       and trunc(sysdate) - nvl(cct.billed_date, cct.posted_date) between p_min_bucket and p_max_bucket
       and erh.report_header_id = cct.report_header_id
       and NVL(AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode(erh.source,erh.workflow_approved_flag,
                                            erh.report_header_id),'UNUSED')
                in ('SAVED','REJECTED', 'RESOLUTN','EMPAPPR','RETURNED','WITHDRAWN')
       and ac.employee_id = p_employeeId
     UNION ALL
       SELECT   distinct transaction_date,
                merchant_name1,
                billed_amount,
                billed_currency_code,
                null,
                'UNUSED',
                nvl(cct.billed_date, cct.posted_date) billed_date,
                cct.trx_id              -- Bug 3241358
       FROM
       ap_credit_card_trxns     cct,
       ap_cards                 ac
       WHERE
       cct.card_program_id = p_cardProgramId
       and cct.validate_code = 'Y'
       and cct.payment_flag <> 'Y'
       and nvl(cct.expensed_amount,0) = 0
       and nvl(cct.category,'BUSINESS') <> 'DEACTIVATED'
       and cct.report_header_id is null
       and ac.card_program_id = cct.card_program_id
       and ac.card_id = cct.card_id
       and trunc(sysdate) - nvl(cct.billed_date, cct.posted_date) between p_min_bucket and p_max_bucket
       and ac.employee_id = p_employeeId;
Line: 717

    SELECT	card_program_currency_code
    INTO 	p_curr_code
    FROM 	ap_card_programs
    WHERE 	card_program_id = p_card_prog_id;
Line: 743

  	SELECT category
  	INTO   p_category
  	FROM   ap_credit_card_trxns
  	WHERE  trx_id = p_trx_id;
Line: 772

  	SELECT company_prepaid_invoice_id
  	INTO   p_prepaid_invoice_id
  	FROM   ap_credit_card_trxns
  	WHERE  trx_id = p_trx_id;
Line: 799

    	select 	expensed_amount
	into 	p_amt
	from 	ap_credit_card_trxns
    	where 	trx_id = p_id;
Line: 827

	SELECT  VENDOR_ID,
		VENDOR_SITE_ID,
		CARD_PROGRAM_CURRENCY_CODE
	INTO	p_vendor_id,
		p_vendor_site_id,
		p_invoice_curr_code
	FROM 	AP_CARD_PROGRAMS
	WHERE	CARD_PROGRAM_ID = p_card_prog_id;
Line: 856

  	SELECT 	distinct acp.vendor_id,
  	 	acp.vendor_site_id
  	INTO   	p_vendor_id,
  	 	p_vendor_site_id
  	FROM   	ap_credit_card_trxns cc,
  	 	ap_card_programs acp
  	WHERE  	cc.report_header_id = p_report_header_id
  	AND    	cc.card_program_id = acp.card_program_id;
Line: 885

  	select card_program_name
  	into   p_cardProgramName
  	from   ap_card_programs
  	where  card_program_id = p_cardProgramID;
Line: 911

  	select card_program_id
  	into   p_cardProgramID
  	from   ap_card_programs
  	where  card_program_name = p_cardProgramName;
Line: 939

    	select 'Y'
    	into 	p_companyHasCardProgram
	from 	ap_card_programs
        where 	card_type_lookup_code = 'TRAVEL';
Line: 967

                 SELECT 'Y'
                 INTO p_userHasCreditCard
                 FROM AP_CARD_PROGRAMS_all CP ,
                             AP_CARDS_all CARD ,
                            AP_LOOKUP_CODES ALC,
                            ( SELECT CARD_PROGRAM_ID,CARD_ID, PAYMENT_DUE_FROM_CODE
                              FROM  AP_CREDIT_CARD_TRXNS_all
	                      WHERE VALIDATE_CODE = 'Y'
                              AND PAYMENT_FLAG <> 'Y'
                              AND BILLED_AMOUNT IS NOT NULL
                              AND NVL ( CATEGORY , 'BUSINESS' ) <> 'DEACTIVATED' )  TRXN
                 WHERE  CARD.EMPLOYEE_ID =  p_userId
                 AND CARD.CARD_PROGRAM_ID = CP.CARD_PROGRAM_ID
                 AND CP.CARD_TYPE_LOOKUP_CODE = 'TRAVEL'
                 AND ALC.LOOKUP_TYPE = 'PAYMENT_DUE_FROM'
                 AND ( ALC.LOOKUP_CODE = CP.PAYMENT_DUE_FROM_CODE
                          OR ALC.LOOKUP_CODE = TRXN.PAYMENT_DUE_FROM_CODE)
                 AND TRUNC ( SYSDATE ) BETWEEN TRUNC ( NVL  (ALC.START_DATE_ACTIVE , SYSDATE ) )
                                                                               AND TRUNC ( NVL ( ALC.INACTIVE_DATE , SYSDATE ) )
                 AND TRXN.CARD_PROGRAM_ID(+) = CARD.CARD_PROGRAM_ID
                 AND TRXN.CARD_ID(+) = CARD.CARD_ID
                 AND ROWNUM = 1;
Line: 1010

        UPDATE ap_credit_card_trxns
        SET    report_header_id = p_new_report_id
        WHERE  report_header_id = p_report_header_id;
Line: 1036

      UPDATE ap_credit_card_trxns
      SET    report_header_id = p_new_expense_report_id
      WHERE  trx_id IN  (SELECT credit_card_trx_id
			FROM   ap_expense_report_lines
			WHERE  report_header_id = p_new_expense_report_id
      			AND    nvl(policy_shortpay_flag,'N') = 'Y');
Line: 1063

	UPDATE ap_credit_card_trxns
      	SET    report_header_id = p_new_expense_report_id
      	WHERE  trx_id IN  (SELECT credit_card_trx_id
			FROM   ap_expense_report_lines
			WHERE  report_header_id = p_new_expense_report_id
      			AND    receipt_required_flag = 'Y'
      			AND    nvl(receipt_verified_flag,'N') = 'N'
      			AND    nvl(policy_shortpay_flag, 'N') = 'N');
Line: 1088

FUNCTION UpdateExpensedAmount(
	p_trxn_id		IN	ccTrxn_trxID,
	p_report_id		IN	ccTrxn_headerID,
	p_expensed_amount	IN	ccTrxn_expensedAmt
) RETURN BOOLEAN IS
--------------------------------------------------------------------------------
BEGIN
	UPDATE	ap_credit_card_trxns
	SET	expensed_amount = p_expensed_amount,
		report_header_id = p_report_id,
		category = null
	WHERE	trx_id = p_trxn_id;
Line: 1108

		AP_WEB_DB_UTIL_PKG.RaiseException( 'UpdateExpensedAmount' );
Line: 1112

END UpdateExpensedAmount;
Line: 1120

       UPDATE ap_credit_card_trxns cc
       SET    expensed_amount = 0,
              report_header_id = null,
              category = null
       WHERE  report_header_id = p_report_header_id;
Line: 1145

       	UPDATE ap_credit_card_trxns
       	SET    expense_status = p_status
       	where  report_header_id = p_report_header_id;
Line: 1170

	UPDATE 	ap_credit_card_trxns
	SET     expensed_amount = 0,
		report_header_id = NULL
	WHERE 	report_header_id IN (SELECT report_header_id
				     FROM ap_expense_report_headers
				     WHERE report_header_id = p_report_header_id
				     AND workflow_approved_flag in
                  (AP_WEB_DB_EXPRPT_PKG.C_WORKFLOW_APPROVED_REJECTED,
                   AP_WEB_DB_EXPRPT_PKG.C_WORKFLOW_APPROVED_RETURNED,
                     --ER 1552747 - withdraw expense report
                   AP_WEB_DB_EXPRPT_PKG.C_WORKFLOW_APPROVED_WITHDRAW));
Line: 1202

      	update	ap_credit_card_trxns
      	set 	expensed_amount = 0,
		report_header_id = null
      	where 	(report_header_id = p_reportID)
	and     (category = c_personal);
Line: 1228

        UPDATE ap_credit_card_trxns cc
	SET    expensed_amount = 0,
	       report_header_id = null
        WHERE  cc.report_header_id IN  (SELECT report_header_id erh_headerID
                                        FROM   ap_expense_report_headers
                                        WHERE  report_header_id = p_report_header_id
				        AND workflow_approved_flag in
                    (AP_WEB_DB_EXPRPT_PKG.C_WORKFLOW_APPROVED_REJECTED,
                     AP_WEB_DB_EXPRPT_PKG.C_WORKFLOW_APPROVED_RETURNED,
                       --ER 1552747 - withdraw expense report
                     AP_WEB_DB_EXPRPT_PKG.C_WORKFLOW_APPROVED_WITHDRAW))
        AND    category = c_personal;
Line: 1263

	UPDATE	ap_credit_card_trxns_all
	SET	company_prepaid_invoice_id = p_invoice_id
	WHERE	trx_id = p_card_trxn_id;
Line: 1275

		AP_WEB_DB_UTIL_PKG.RaiseException( 'UpdateInvoiceId' );
Line: 1288

    SELECT trx_id,
           transaction_date,
	   folio_type,   	--shuh
           merchant_name1,
           merchant_city,
           merchant_province_state,
           billed_amount,
           posted_currency_code,
           transaction_amount,
           cc.card_id,
           nvl(cc.category, c_business),
           cc.card_program_id
    INTO   p_trxn_info_rec.trxn_id, p_trxn_info_rec.trxn_date,
	   p_trxn_info_rec.folio_type, p_trxn_info_rec.merchant_name,
	   p_trxn_info_rec.merchant_city, p_trxn_info_rec.merchant_prov,
	   p_trxn_info_rec.billed_amount, p_trxn_info_rec.posted_curr_code,
	   p_trxn_info_rec.trxn_amount, p_trxn_info_rec.card_id,
	   p_trxn_info_rec.category, p_trxn_info_rec.card_prog_id
    FROM ap_credit_card_trxns cc
    WHERE trx_id = p_trxn_id;
Line: 1323

FUNCTION UpdateCCardCategory(
	p_trxn_id	IN	ccTrxn_trxID,
	p_category	IN	ccTrxn_category
) RETURN BOOLEAN IS
------------------------------------------------------------------------------
BEGIN
      	UPDATE	ap_credit_card_trxns
      	SET 	category = p_category
      	WHERE 	trx_id = p_trxn_id;
Line: 1339

		AP_WEB_DB_UTIL_PKG.RaiseException( 'UpdateCCardCategory' );
Line: 1343

END UpdateCCardCategory;
Line: 1352

	SELECT	expensed_amount
	INTO	p_exp_amount
	FROM 	ap_credit_card_trxns
    	WHERE 	trx_id = p_trxn_id;
Line: 1382

        select count(distinct payment_due_from_code)
        into  paymentMethodCount
        from ap_credit_card_trxns
        where card_program_id = p_cardProgramID
        and   card_id = p_card_id;
Line: 1418

       SELECT DISTINCT payment_due_from_code
       INTO   p_paymentDueCode
       FROM   ap_credit_card_trxns trx
       WHERE  trx.trx_id  = p_trxn_id;
Line: 1542

  select prevent_cash_cc_age_limit
  into   l_prevent_cash_cc_age_limit
  from   ap_expense_params;
Line: 1612

    select count(1)
    into   p_num_old
    from   ap_card_programs cp,
           ap_cards card,
           ap_credit_card_trxns trxns
    where  card.employee_id = p_employee_id
    and    card.card_program_id = cp.card_program_id
    and    cp.card_type_lookup_code = 'TRAVEL'
    and    trxns.card_program_id = card.card_program_id
    and    trxns.card_id = card.card_id
    and    trxns.validate_code = 'Y'
    and    trxns.payment_flag <> 'Y'
    and    trxns.billed_amount is not null
    and    trxns.report_header_id is null
    and    (nvl(trxns.category, 'BUSINESS') not in ('DISPUTED', 'CREDIT', 'MATCHED','DEACTIVATED'))
    and    sysdate - trxns.posted_date > l_prevent_cash_cc_age_limit;
Line: 1654

  select count(1)
  into   p_num_disputed
  from   ap_card_programs cp,
         ap_cards card,
         ap_credit_card_trxns trxns
  where  card.employee_id = p_employee_id
  and    card.card_program_id = cp.card_program_id
  and    cp.card_type_lookup_code = 'TRAVEL'
  and    trxns.card_program_id = card.card_program_id
  and    trxns.card_id = card.card_id
  and    trxns.validate_code = 'Y'
  and    trxns.payment_flag <> 'Y'
  and    trxns.billed_amount is not null
  and    trxns.report_header_id is null
  and    nvl(trxns.category,c_business) = 'DISPUTED';
Line: 1693

  select count(1)
  into   p_num_credits
  from   ap_card_programs cp,
         ap_cards card,
         ap_credit_card_trxns trxns
  where  card.employee_id = p_employee_id
  and    card.card_program_id = cp.card_program_id
  and    cp.card_type_lookup_code = 'TRAVEL'
  and    trxns.card_program_id = card.card_program_id
  and    trxns.card_id = card.card_id
  and    trxns.validate_code = 'Y'
  and    trxns.payment_flag <> 'Y'
  and    trxns.billed_amount < 0
  and    trxns.report_header_id is null
  and    nvl(trxns.category, 'BUSINESS') not in ('DISPUTED', 'CREDIT', 'MATCHED','DEACTIVATED');
Line: 1737

    SELECT h.employee_id
    FROM   per_employees_x h, ak_web_user_sec_attr_values a
    WHERE  a.attribute_code = 'ICX_HR_PERSON_ID'
      AND  a.web_user_id = p_user_id
      AND  h.employee_id = a.number_value
      AND NOT AP_WEB_DB_HR_INT_PKG.isPersonCwk(h.employee_id)='Y'
    UNION ALL
    SELECT h.person_id employee_id
    FROM   per_cont_workers_current_x h, ak_web_user_sec_attr_values a
    WHERE  a.attribute_code = 'ICX_HR_PERSON_ID'
      AND  a.web_user_id = p_user_id
      AND  h.person_id = a.number_value;
Line: 1869

          SELECT distinct  transaction_date,
                merchant_name1,
                billed_amount,
                billed_currency_code,
                cct.posted_currency_code, --3339380
                nvl(cct.billed_date, cct.posted_date) billed_date,
                cct.posted_date, --Notification Esc
                cct.transaction_amount,--Notification Esc
                AP_WEB_DB_CCARD_PKG.GETLOCATION(cct.merchant_city , cct.merchant_province_state)  --Notification Esc
          from
          ap_credit_card_trxns cct,
          ap_cards_all ac
          where
          cct.card_program_id = p_cardProgramId
          and cct.validate_code = 'Y'
          and cct.payment_flag <> 'Y'
          and nvl(cct.expensed_amount , 0) = 0
          and nvl(cct.category,'BUSINESS') = 'DISPUTED'
          and ac.card_program_id = cct.card_program_id
          and ac.card_id = cct.card_id
          and trunc(sysdate) - (cct.posted_date+nvl(p_grace_days,0)) between p_min_bucket and p_max_bucket
          and ac.employee_id = p_employeeId
          and rownum < 41;
Line: 1921

   SELECT sum(amount)
   INTO   p_totalAmount
   FROM
        (
          SELECT DISTINCT cct.trx_id, cct.billed_amount amount
          FROM
              ap_credit_card_trxns_all cct,
              ap_cards_all ac,
              ap_expense_report_headers_all erh
          WHERE
              cct.card_program_id = p_cardProgramId
          and cct.validate_code = 'Y'
          and cct.payment_flag <> 'Y'
          and AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode(
                                erh.source,erh.workflow_approved_flag,
                                erh.report_header_id)
             in
          ('EMPAPPR', 'RESOLUTN','RETURNED',
           'REJECTED','SAVED','WITHDRAWN','UNUSED')
          and erh.report_header_id = cct.report_header_id
          and  NVL(erh.vouchno, 0) = 0
          and ac.card_program_id = cct.card_program_id
          and ac.card_id = cct.card_id
          and ac.employee_id = p_employeeId
          UNION ALL
          SELECT DISTINCT cct.trx_id, cct.billed_amount amount
          FROM
              ap_credit_card_trxns_all cct,
              ap_cards_all ac
          WHERE
              cct.card_program_id = p_cardProgramId
          and cct.validate_code = 'Y'
          and cct.payment_flag <> 'Y'
          and nvl(cct.expensed_amount , 0) =0
          and nvl(cct.category,'BUSINESS') <> 'DEACTIVATED'
          and ac.card_program_id = cct.card_program_id
          and ac.card_id = cct.card_id
          and ac.employee_id = p_employeeId
         );
Line: 1992

       SELECT   count(1), sum(amount)
       INTO p_total_outstanding,
            p_total_amt_outstanding
       FROM
           ( SELECT DISTINCT trx_id, cct.billed_amount amount
             FROM
                    ap_credit_card_trxns             cct,
                    ap_cards                         ac,
                    ap_expense_report_headers        erh
             WHERE
                    cct.card_program_id = p_cardProgramId
             and cct.validate_code = 'Y'
             and cct.payment_flag <> 'Y'
             and nvl(cct.category,c_business) NOT IN
                    ('DISPUTED','CREDIT','MATCHED','DEACTIVATED')--Bug 3307864
             and ac.card_program_id = cct.card_program_id
             and ac.card_id = cct.card_id
             and trunc(sysdate) - cct.posted_date between p_min_bucket and p_max_bucket
             and erh.report_header_id = cct.report_header_id
             and AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode(erh.source,
                                                              erh.workflow_approved_flag,
                                                              erh.report_header_id) --2615505
                in ('SAVED','UNUSED','REJECTED',
                    'RESOLUTN','EMPAPPR','RETURNED','WITHDRAWN')
             and ac.employee_id = p_employeeId
             UNION ALL
             SELECT DISTINCT trx_id, cct.billed_amount amount
             FROM
                    ap_credit_card_trxns             cct,
                    ap_cards                         ac
             WHERE
                    cct.card_program_id = p_cardProgramId
             and cct.validate_code = 'Y'
             and cct.payment_flag <> 'Y'
             and nvl(cct.expensed_amount , 0) = 0
             and nvl(cct.category,c_business) NOT IN
                    ('DISPUTED','CREDIT','MATCHED','DEACTIVATED')--Bug 3307864
             and cct.report_header_id is null
             and ac.card_program_id = cct.card_program_id
             and ac.card_id = cct.card_id
             and trunc(sysdate) - cct.posted_date between p_min_bucket and p_max_bucket
             and ac.employee_id = p_employeeId
             );
Line: 2068

       SELECT   count(1), sum(amount)
       INTO p_total_dispute,
            p_total_amt_dispute
       FROM
           ( SELECT DISTINCT trx_id, cct.billed_amount amount
             FROM
                    ap_credit_card_trxns             cct,
                    ap_cards                         ac,
                    ap_expense_report_headers        erh
             WHERE
                 cct.card_program_id = p_cardProgramId
             and cct.validate_code = 'Y'
             and cct.payment_flag <> 'Y'
             and nvl(cct.category,c_business) = 'DISPUTED'
             and ac.card_program_id = cct.card_program_id
             and ac.card_id = cct.card_id
             and trunc(sysdate) - (cct.posted_date+nvl(p_grace_days,0))
                 between p_min_bucket and p_max_bucket
             and erh.report_header_id(+) = cct.report_header_id
             and NVL(AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode(erh.source,
                                                              erh.workflow_approved_flag,
                                                              erh.report_header_id),
                                                              'UNUSED') --2615505
                in ('SAVED','UNUSED','REJECTED',
                    'RESOLUTN','EMPAPPR','RETURNED','WITHDRAWN')
             and ac.employee_id = p_employeeId);
Line: 2130

  select nvl(min(posted_date), sysdate)
  into   l_oldest_posted_date
  from   ap_credit_card_trxns cct
  where  cct.card_program_id = p_cardProgramId
  and    cct.card_id = p_cardId
  and    cct.payment_due_from_code = p_paymentDueFromCode
  and    cct.billed_currency_code = p_reimb_curr_code
  and    cct.validate_code = 'Y'
  and    cct.payment_flag <> 'Y'
  and    nvl(cct.category, c_business) not in (c_disputed, c_credit, c_matched, c_deactivated)
  and    (cct.report_header_id is null or cct.report_header_id = p_report_header_id)
  and    cct.billed_amount is not null;