SELECT DISTINCT
gjh.je_source source,
gjh.je_category category,
gjb.name journal,
gjl.je_line_num line_num,
gjh.actual_flag actual_flag,
gjh.period_name period,
gjl.effective_date gl_date,
gcc.segment1 fund,
gcc.segment2 FUNCTION,
gcc.segment3 object,
gcc.segment4 sub_object,
gcc.segment5 org,
gcc.segment6 yr,
gcc.segment7 program,
gjl.entered_dr debit,
gjl.entered_cr credit,
Flv.displayed_field type,
NULL purchase_document_num,
pv.vendor_name vendor,
aia.invoice_num,
aid.distribution_line_number,
aca.CHECK_NUMBER check_num,
to_date(aca.check_date) trx_date
FROM
ap_payment_history_all aph,
ap_payment_hist_dists phd,
xla_distribution_links xdl,
ap_invoice_distributions_all aid,
ap_invoices_all aia,
po_vendors pv,
ap_checks_all aca,
xla.xla_ae_lines xal,
xla.xla_ae_headers xah,
gl_import_references gir,
gl_je_lines gjl,
gl_je_headers gjh,
gl_je_batches gjb,
gl_code_combinations gcc,
ap_lookup_codes flv
WHERE
phd.payment_history_id = aph.payment_history_id
AND xdl.source_distribution_type = 'AP_PMT_DIST'
AND xdl.source_distribution_id_num_1 = payment_hist_dist_id
AND NVL("SOURCE_DISTRIBUTION_ID_NUM_2",(-99))= -99
AND phd.invoice_distribution_id = aid.invoice_distribution_id
AND aid.invoice_id = aia.invoice_id
AND aia.vendor_id = pv.vendor_id
AND aca.check_id = aph.check_id
AND xal.ae_header_id = xdl.ae_header_id
AND xal.ae_line_num = xdl.ae_line_num
AND xal.application_id = xdl.application_id
AND xal.ae_header_id = xah.ae_header_id
AND xal.ae_header_id = xah.application_id
AND gir.gl_sl_link_id = xal.gl_sl_link_id
AND gir.gl_sl_link_table = xal.gl_sl_link_table
AND gjl.je_header_id = gir.je_header_id
AND gjl.je_line_num = gir.je_line_num
AND gjh.je_header_id = gir.je_header_id
AND gjh.je_category = 'Payments'
AND gjh.actual_flag = 'A'
AND gjh.status = 'P'
AND gjl.status = 'P'
AND gjb.je_batch_id = gjh.je_batch_id
AND gjl.code_combination_id = gcc.code_combination_id
AND flv.lookup_type = 'PAYMENT METHOD'
AND lookup_code = aca.payment_method_lookup_code;
No comments:
Post a Comment