SELECT
hca.account_number act_no
, hca.cust_account_id cust_id
, hcsua.site_use_id
, hp.party_number
, hps.party_site_number site_num
, DECODE(hcasa.status,
'I'
,
'Inactive'
,
'A'
,
'Active'
,
'Other'
) status
, hp.party_name
, hcsua.location
, hcsua.site_use_code
, hcasa.creation_date site_created_date
, fu.description created_by
, hcasa.last_update_date site_update_date
, fu2.description updated_by
, rcrm.cust_receipt_method_id
, rcrm.customer_id
, rcrm.receipt_method_id
, rcrm.primary_flag
, rcrm.start_date
, rcrm.end_date
, rcrm.site_use_id
, rcrm.creation_date
FROM
apps.hz_parties hp
, ar.hz_party_sites hps
, apps.hz_cust_accounts hca
, apps.hz_cust_acct_sites_all hcasa
, apps.hz_cust_site_uses_all hcsua
, applsys.fnd_user fu
, applsys.fnd_user fu2
, apps.ar_receipt_methods arm
, apps.ra_cust_receipt_methods rcrm
WHERE
hp.party_id = hca.party_id
AND
hp.party_id = hps.party_id
AND
hcasa.party_site_id = hps.party_site_id
AND
hca.cust_account_id = hcasa.cust_account_id
AND
hcasa.cust_acct_site_id = hcsua.cust_acct_site_id
AND
hcsua.created_by = fu.user_id
AND
hcsua.last_updated_by = fu2.user_id
AND
arm.receipt_method_id = rcrm.receipt_method_id
AND
rcrm.customer_id = hca.cust_account_id
AND
rcrm.site_use_id = hcsua.site_use_id
AND
hcasa.status <>
'I'
AND
hca.cust_account_id = 123
AND
rcrm.end_date
IS
NULL
AND
1 = 1
ORDER
BY
hp.party_name;
No comments:
Post a Comment