The following lines contain the word 'select', 'insert', 'update' or 'delete':
select nvl(version, C_WebApplicationVersion)
into l_version
from fnd_responsibility
where application_id = fnd_global.resp_appl_id() and responsibility_id = fnd_global.resp_id();
SELECT DEFAULT_APPROVER_ID, DEFAULT_SOURCE into p_ApproverId, l_DefaultSource
FROM AP_WEB_PREFERENCES
WHERE EMPLOYEE_ID = p_EmpId;
SELECT OVERRIDE_APPROVER_ID into p_ApproverId
FROM
( SELECT OVERRIDE_APPROVER_ID
FROM AP_EXPENSE_REPORT_HEADERS_ALL
WHERE EMPLOYEE_ID = p_EmpId AND BOTHPAY_PARENT_ID IS NULL
ORDER BY report_header_id DESC
) WHERE ROWNUM=1;
RETURN 'EXISTS (SELECT 1
FROM mo_glob_org_access_tmp oa
WHERE oa.organization_id = org_id
)
OR org_id = -99';
PROCEDURE UpdateExpenseStatusCode(
p_invoice_id AP_INVOICES_ALL.invoice_id%TYPE
) IS
t_paid_status CONSTANT VARCHAR2(10) := 'PAID';
SELECT 'PARENT' Identifier,
parent_aerh.report_header_id report_header_id,
DECODE(parent_APS.GROSS_AMOUNT ,0,'PAID',
DECODE(parent_AI.Payment_status_flag,
'Y','PAID','N','INVOICED','P','PARPAID',NULL) ) invoice_status
FROM ap_expense_report_headers_all parent_aerh,
ap_expense_report_headers_all main_aerh,
ap_invoices_all parent_ai,
ap_payment_schedules_all parent_aps
WHERE
main_aerh.bothpay_parent_id = parent_aerh.report_header_id (+) and
parent_aerh.vouchno = parent_ai.invoice_id and
parent_ai.invoice_id = parent_aps.invoice_id and
main_aerh.vouchno = l_invoice_id
UNION
-- main/actual cash or cc
SELECT 'MAIN' Identifier,
main_aerh.report_header_id report_header_id,
DECODE(main_APS.GROSS_AMOUNT ,0,'PAID',
DECODE(main_AI.Payment_status_flag,
'Y','PAID','N','INVOICED','P','PARPAID',NULL) ) invoice_status
FROM
ap_expense_report_headers_all main_aerh,
ap_invoices_all main_ai,
ap_payment_schedules_all main_aps
WHERE
main_aerh.vouchno = main_ai.invoice_id and
main_ai.invoice_id = main_aps.invoice_id and
main_aerh.vouchno = l_invoice_id
UNION
-- cash in bp
SELECT 'CHILD' Identifier,
child_aerh.report_header_id report_header_id,
DECODE(child_APS.GROSS_AMOUNT ,0,'PAID',
DECODE(child_AI.Payment_status_flag,
'Y','PAID','N','INVOICED','P','PARPAID',NULL) ) invoice_status
FROM
ap_expense_report_headers_all child_aerh,
ap_expense_report_headers_all main_aerh,
ap_invoices_all child_ai,
ap_payment_schedules_all child_aps
WHERE child_aerh.bothpay_parent_id (+) = main_aerh.report_header_id and
child_aerh.vouchno = child_ai.invoice_id and
child_ai.invoice_id = child_aps.invoice_id and
main_aerh.vouchno = l_invoice_id;
UPDATE ap_expense_report_headers_all
SET expense_status_code = l_parent_report_status
WHERE report_header_id = l_parent_report_header_id;
UPDATE ap_expense_report_headers_all
SET expense_status_code = l_main_report_status
WHERE report_header_id = l_main_report_header_id;
END UpdateExpenseStatusCode;