Translate

Saturday, June 15, 2019

Reconciled and UnReconciled breakdown of check payments and bank statements

select h.name, c.check_id, c.check_number, c.check_date, c.currency_code, c.amount "Payment Amount", c.status_lookup_code "Check Status"
, decode(c.payment_type_flag, 'A', 'Auto', 'M', 'Manual', 'Q', 'Quick', 'R', 'Refund', c.payment_type_flag) "Payment Type"
, c.payment_method_code, c.vendor_name, c.remit_to_supplier_name,  c.bank_account_name
, h.statement_header_id, h.statement_number, h.statement_date, h.bank_account_id, h.creation_date, h.auto_loaded_flag, h.statement_complete_flag
, l.statement_line_id, l.line_number, l.trx_date, l.trx_type, l.amount "Statement Amount", l.status, l.BANK_TRX_NUMBER
, l.trx_text, l.customer_text, l.invoice_text, l.bank_account_text
from ap_checks_all c, ce_statement_reconcils_all cre
, ce_statement_lines l, ce_statement_headers h
, hr_operating_units h
where 1=1
and cre.statement_line_id = l.statement_line_id
and l.statement_header_id = h.statement_header_id
and c.org_id = h.organization_id
and c.check_id = cre.reference_id
and c.check_date between '01-JAN-2017' and '31-MAR-2017'
and c.status_lookup_code <> 'VOIDED'
and cre.current_record_flag = 'Y'
and cre.reference_type = 'PAYMENT'
and cre.status_flag = 'M'
union
select h.name, c.check_id, c.check_number, c.check_date, c.currency_code, c.amount "Payment Amount", c.status_lookup_code "Check Status"
, decode(c.payment_type_flag, 'A', 'Auto', 'M', 'Manual', 'Q', 'Quick', 'R', 'Refund', c.payment_type_flag) "Payment Type"
, c.payment_method_code, c.vendor_name, c.remit_to_supplier_name,  c.bank_account_name
, h.statement_header_id, h.statement_number, h.statement_date, h.bank_account_id, h.creation_date, h.auto_loaded_flag, h.statement_complete_flag
, l.statement_line_id, l.line_number, l.trx_date, l.trx_type, l.amount "Statement Amount", l.status, l.BANK_TRX_NUMBER
, l.trx_text, l.customer_text, l.invoice_text, l.bank_account_text
from ce_statement_lines l, ce_statement_headers h, ap_checks_all c, ce_bank_accounts ba, hr_operating_units h
where l.statement_header_id = h.statement_header_id
and l.BANK_TRX_NUMBER = to_char(c.check_number)
and ba.bank_account_id = h.bank_account_id
and ba.bank_account_name = c.bank_account_name
and c.org_id = h.organization_id
and c.check_date between '01-JAN-2017' and '31-MAR-2017'
and c.status_lookup_code <> 'VOIDED'
and not exists (select 1 from ce_statement_reconcils_all cre
where cre.current_record_flag = 'Y'
and cre.reference_type = 'PAYMENT'
and cre.status_flag in ('M')
and c.check_id = cre.reference_id)
union
select h.name, c.check_id, c.check_number, c.check_date, c.currency_code, c.amount "Payment Amount", c.status_lookup_code "Check Status" --36,273
, decode(c.payment_type_flag, 'A', 'Auto', 'M', 'Manual', 'Q', 'Quick', 'R', 'Refund', c.payment_type_flag) "Payment Type"
, c.payment_method_code, c.vendor_name, c.remit_to_supplier_name,  c.bank_account_name
, null, null, null,null,null,null,null
, null, null, null, null, null,null,null
, null, null, null, null
from ap_checks_all c, hr_operating_units h
where 1=1
and c.check_date between '01-JAN-2017' and '31-MAR-2017'
and c.status_lookup_code not in ('VOIDED', 'RECONCILED')
and h.organization_id = c.org_id
and not exists (select 1 from ce_statement_lines l, ce_statement_headers h, ce_bank_accounts ba
where l.statement_header_id = h.statement_header_id
and ba.bank_account_id = h.bank_account_id
and ba.bank_account_name = c.bank_account_name
and l.BANK_TRX_NUMBER = to_char(c.check_number))
union
select null, null, null, null, null, null, null, null, null, null, null, ba.bank_account_name
, h.statement_header_id, h.statement_number, h.statement_date, h.bank_account_id, h.creation_date, h.auto_loaded_flag, h.statement_complete_flag
, l.statement_line_id, l.line_number, l.trx_date, l.trx_type, l.amount "Statement Amount", l.status, l.BANK_TRX_NUMBER
, l.trx_text, l.customer_text, l.invoice_text, l.bank_account_text
from ce_statement_lines l, ce_statement_headers h, ce_bank_accounts ba
where l.statement_header_id = h.statement_header_id
and ba.bank_account_id = h.bank_account_id
and h.creation_date between '01-JAN-2017' and '31-MAR-2017'
and trx_type = 'DEBIT'
and l.status = 'UNRECONCILED'
and ba.account_owner_org_id in (23281,23301,23302,23303,23304,23305)
and not exists (select 1 from ap_checks_all c
where c.status_lookup_code <> 'VOIDED'
and l.BANK_TRX_NUMBER = to_char(c.check_number)
and ba.bank_account_name = c.bank_account_name)
and not exists (select 1 from CE_STATEMENT_RECONCILS_ALL  csr
    where csr.statement_line_id = l.statement_line_id
    and REFERENCE_TYPE = 'JE_LINE') 

No comments:

Post a Comment

Text Message

Outside Processing Setups and Cycle in Oracle EBS R12

  OSP Cycle This post is about Oracle Outside Processing Cycle. Outside processing is used when we don't have in house resources to comp...