SELECT
amount_dr,
amount_cr,
acctd_amount_dr,
acct_amount_cr,
gcc.segment1
||’.’
||gcc.segment2
||’.’
||gcc.segment3
||’.’
||gcc.segment4
||’.’
||gcc.segment5
FROM
ar.ar_distributions_all ad,
gl.gl_code_combinations gcc
WHERE 1=1
and source_table=’CRH’
and ad.code_combination_id=gcc.code_combination_id
and EXISTS(
SELECT ‘T’
FROM ar.ar_cash_receipt_history_all a,
ar.ar_cash_receipts_all b
WHERE a.cash_receipt_id=b.cash_receipt_id
and source_id=cash_receipt_history_id
and b.org_id=:P_ORG_ID
and b.org_id=a.org_id
and b.receipt_number like :P_RECEIPT_NUM)
UNION ALL
SELECT
amount_dr,
amount_cr,
acctd_amount_dr,
acct_amount_cr,
gcc.segment1
||’.’
||gcc.segment2
||’.’
||gcc.segment3
||’.’
||gcc.segment4
||’.’
||gcc.segment5
FROM
ar.ar_distributions_all ad,
gl.gl_code_combinations gcc
WHERE 1=1
and source_table=’RA’
and ad.code_combination_id=gcc.code_combination_id
and EXISTS(
SELECT ‘T’
FROM ar.ar_cash_receipt_history_all a,
ar.ar_cash_receipts_all b
WHERE a.cash_receipt_id=b.cash_receipt_id
and source_id=cash_receipt_history_id
and b.org_id=:P_ORG_ID
and b.org_id=a.org_id
and b.receipt_number like :P_RECEIPT_NUM)
Recent Posts