CUST_ACCT.ACCOUNT_NUMBER customer_number,
party.status customer_status,
party.creation_date Customer_Creation_date,
party.last_update_date Customer_Last_Update_Date,
cust_acct.customer_class_code,
sua.site_use_code,
decode(sua.status,'A','Active','I','Inactive') site_status,
sua.location,
loc.address1||','||loc.address2||','||loc.address3||','||loc.address4||','||loc.city||','||loc.state||','||loc.postal_code||','||loc.country address,
CPV.STANDARD_TERMS_NAME SITE_TERMS,
(Select Aa.Standard_Terms_Name From Ar_Customer_Profiles_V Aa Where CUST_ACCT.CUST_ACCOUNT_ID = Aa.Customer_Id And Aa.Site_Use_Id Is Null) Customer_Header_Terms,
cpv.Profile_Class_Name,
cpv.Collector_Name,
AMT.TRX_CREDIT_LIMIT ORDER_CREDIT_LIMIT,
amt.overall_credit_limit
FROM HZ_PARTIES PARTY,
HZ_CUST_ACCOUNTS CUST_ACCT,
HZ_PARTY_SITES PARTY_SITE,
HZ_LOCATIONS LOC,
HZ_CUST_ACCT_SITES_ALL ACC_SITE,
HZ_CUST_SITE_USES_ALL SUA,
AR_CUSTOMER_PROFILES_V CPV,
HZ_CUST_PROFILE_AMTS AMT
WHERE PARTY.PARTY_ID = CUST_ACCT.PARTY_ID
AND PARTY.PARTY_ID=PARTY_SITE.PARTY_ID
AND PARTY_SITE.PARTY_SITE_ID=ACC_SITE.PARTY_SITE_ID
AND CUST_ACCT.CUST_ACCOUNT_ID =ACC_SITE.CUST_ACCOUNT_ID
AND PARTY_SITE.LOCATION_ID = LOC.LOCATION_ID
AND ACC_SITE.CUST_ACCT_SITE_ID = SUA.CUST_ACCT_SITE_ID
and sua.site_use_code = 'BILL_TO'
AND CPV.SITE_USE_ID(+) = SUA.SITE_USE_ID
AND CPV.CUSTOMER_PROFILE_ID = AMT.CUST_ACCOUNT_PROFILE_ID(+)
AND PARTY.STATUS='A'
and ACC_SITE.org_id= P_operating_unit;
No comments:
Post a Comment