Monday, November 24, 2014

R12 Customer / Resource

select col.name , hcp.CREDIT_CHECKING , hcsu.PRIMARY_SALESREP_ID 
from hz_cust_accounts hca ,
              hz_parties hp,
              hz_party_sites hps,
              hz_cust_acct_sites_all hcas,
              hz_cust_site_uses_all   hcsu,
              hz_customer_profiles hcp,
              ar_collectors           col
where hp.party_id = hca.party_id
and hps.party_id =  hca.party_id
and hps.party_site_id = hcas.party_site_id
and hp.party_id            =  hcp.party_id 
and hca.cust_account_id    =  hcp.cust_account_id
and hcsu.SITE_USE_ID = hcp.SITE_USE_ID
and hcas.cust_acct_site_id = hcsu.cust_acct_site_id
and hcas.ORG_ID = hcsu.org_id
AND col.collector_id       =  hcp.collector_id
--and hca.cust_account_id = :cust_id
and hca.account_number = '200084' 
and SITE_USE_CODE = 'BILL_TO'
and hcas.ORG_ID = nvl(:p_org_id,hcas.ORG_ID)


SELECT   RESOURCE_NAME
  FROM   jtf_rs_salesreps jrs, jtf_rs_resource_extns_vl jrre
 WHERE   jrs.resource_id = jrre.resource_id
 AND jrs.SALESREP_ID = 100015087

No comments:

Post a Comment