You are on page 1of 7

select (select to_char(correspondence_date,'MM/DD/YYYY') from iex_dunnings where

dunning_id=:DUNNING_ID) currsysdate,

decode((per.person_first_name || per.person_last_name), null,


ARPT_SQL_FUNC_UTIL.get_lookup_meaning('RESPONSIBILITY', 'APS'), per.person_first_name)
first_name,

per.person_last_name last_name,

org.party_name org_name,

loc.address1 address1,

loc.address2 address2,

loc.city city,

loc.state state,

loc.postal_code postal_code,

per.person_first_name first_name1,

(select sum(aps.acctd_amount_due_remaining)

from

iex_delinquencies_all dd,

ar_payment_schedules_all aps

where

dd.payment_schedule_id = aps.payment_schedule_id and

dd.status = 'DELINQUENT' and

aps.amount_due_remaining <> 0 and


dd.party_cust_id = org.party_id and

dd.cust_account_id = :ACCOUNT_ID) total_due_remaining,

(SELECT ACCOUNT_NUMBER FROM HZ_CUST_ACCOUNTS WHERE CUST_ACCOUNT_ID = :ACCOUNT_ID )


CUST_NO,

rs.source_name collector_name,

rs.source_job_title collector_title,

rs.source_phone collector_phone,

CURSOR

(select

ct.trx_number invoice_number,

ar.amount_due_remaining amount_due_remaining,

ct.invoice_currency_code invoice_currency_code,

ar.acctd_amount_due_remaining acctd_amount_due_remaining,

gl.currency_code functional_currency,

to_char(ar.due_date, 'YYYY-MM-DD') due_date,

CT.PURCHASE_ORDER CUST_PO,

((SELECT CORRESPONDENCE_DATE FROM IEX_DUNNINGS WHERE DUNNING_ID=:DUNNING_ID)-


AR.DUE_DATE) NO_DAYS

from

iex_delinquencies_all d,

ar_payment_schedules_all ar,

ra_customer_trx_all ct,

ar_system_parameters_all ars,

gl_sets_of_books gl

where

d.party_cust_id = org.party_id

and d.cust_account_id = :ACCOUNT_ID

and d.payment_schedule_id = ar.payment_schedule_id

and d.status = 'DELINQUENT'


and ar.customer_trx_id = ct.customer_trx_id

and ar.amount_due_remaining <> 0

and ars.set_of_books_id=gl.set_of_books_id

and ars.org_id = ar.org_id

) as payment_history,

loc.location_id,per.party_id,rs.RESOURCE_ID

from

HZ_LOCATIONS loc

,hz_parties org

,hz_parties per

,jtf_rs_resource_extns rs

where

loc.location_id = :LOCATION_ID

and org.party_id= :PARTY_ID

and per.party_id = nvl(:CONTACT_ID, org.party_id)

and rs.RESOURCE_ID = :RESOURCE_ID

You might also like