21: (select report_header_id
22: from
23: (
24: select report_header_id
25: from ap_expense_report_headers_all
26: where source in ('CREDIT CARD', 'SelfService', 'XpenseXpress')
27: and trunc(creation_date) < p_source_date
28: and expense_status_code = 'PAID'
29: UNION
28: and expense_status_code = 'PAID'
29: UNION
30: -- For Both Pay reports, make sure that the parent report is also paid.
31: select a.report_header_id
32: from ap_expense_report_headers_all a,
33: ap_expense_report_headers_all b
34: where a.source = 'Both Pay'
35: and trunc(a.creation_date) < p_source_date
36: and a.expense_status_code = 'PAID'
29: UNION
30: -- For Both Pay reports, make sure that the parent report is also paid.
31: select a.report_header_id
32: from ap_expense_report_headers_all a,
33: ap_expense_report_headers_all b
34: where a.source = 'Both Pay'
35: and trunc(a.creation_date) < p_source_date
36: and a.expense_status_code = 'PAID'
37: and a.bothpay_parent_id = b.report_header_id
44: (select report_header_id
45: from
46: (
47: select report_header_id
48: from ap_expense_report_headers_all
49: where source in ('CREDIT CARD', 'SelfService', 'XpenseXpress')
50: and trunc(creation_date) < p_source_date
51: and org_id = p_org_id
52: and expense_status_code = 'PAID'
52: and expense_status_code = 'PAID'
53: UNION
54: -- For Both Pay reports, make sure that the parent report is also paid.
55: select a.report_header_id
56: from ap_expense_report_headers_all a,
57: ap_expense_report_headers_all b
58: where a.source = 'Both Pay'
59: and trunc(a.creation_date) < p_source_date
60: and a.org_id = p_org_id
53: UNION
54: -- For Both Pay reports, make sure that the parent report is also paid.
55: select a.report_header_id
56: from ap_expense_report_headers_all a,
57: ap_expense_report_headers_all b
58: where a.source = 'Both Pay'
59: and trunc(a.creation_date) < p_source_date
60: and a.org_id = p_org_id
61: and a.expense_status_code = 'PAID'
305: IMAGE_RECEIPTS_STATUS,
306: IMAGE_RECEIPTS_RECEIVED_DATE,
307: MISSING_IMG_JUST,
308: OVERDUE_REQUEST_ID
309: from ap_expense_report_headers_all a, AP_EXP_REPORT_HEADERS_GT gt
310: where gt.report_header_id = a.report_header_id);
311: fnd_file.put_line(fnd_file.log,'Archived ' || SQL%ROWCOUNT || ' Headers');
312:
313: -- Insert into Lines
1588: ----------------------------------------------------------------------
1589: l_debug_info := 'Delete Headers.';
1590: ----------------------------------------------------------------------
1591:
1592: DELETE FROM ap_expense_report_headers_all
1593: WHERE report_header_id IN (
1594: SELECT report_header_id
1595: FROM ap_expense_report_headers_arc
1596: WHERE arc_req_id = p_request_id);