Query to get customer tax registration details in R12

Query to get customer tax registration details in R12
oracle apps r12 tax tables
customer tax registration number in oracle apps r12 query
oracle apps customer tax id query

--Customer Account Tax Registration Details

SELECT party_name,
       account_number,
       ps.party_site_number,
       (SELECT LISTAGG (al.meaning, ', ') WITHIN GROUP (ORDER BY al.meaning)
          FROM apps.hz_cust_acct_sites_all s,
               apps.hz_cust_site_uses_all  u,
               apps.ar_lookups             al
         WHERE     s.cust_acct_site_id = hcas.cust_acct_site_id
               AND u.cust_acct_site_id = s.cust_acct_site_id
               AND u.status = 'A'
               AND al.lookup_type = 'SITE_USE_CODE'
               AND al.lookup_code = u.site_use_code)
          purposes,
       DECODE (ps.status,  'A', 'Active',  'I', 'Inactive',  ps.status)
          AS site_status,
       hcas.ORG_ID,
       ou.name                   AS operating_unit,
       terr.territory_short_name AS country_name,
          lc.address1
       || DECODE (lc.address2, NULL, '', CHR (10))
       || lc.address2
       || DECODE (lc.address3, NULL, '', CHR (10))
       || lc.address3
       || DECODE (lc.address4, NULL, '', CHR (10))
       || lc.address4
       || DECODE (lc.city, NULL, '', CHR (10))
       || lc.city
       || DECODE (lc.state, NULL, '', ',')
       || lc.state
       || DECODE (lc.postal_code, '', ',')
       || lc.postal_code
          address,
       qrs.registration_number,
       qrs.tax_regime_code,
       qrs.tax,
       qrs.registration_status_code,
       qrs.effective_from,
       qrs.effective_to
  FROM apps.hz_cust_acct_sites_all hcas,
       apps.hz_party_sites         ps,
       apps.hz_cust_accounts_all   hca,
       apps.hz_locations           lc,
       apps.fnd_territories_vl     terr,
       apps.hr_operating_units     ou,
       apps.hz_parties             hp,
       (SELECT zr.registration_number,
               zr.tax_regime_code,
               zr.tax,
               zr.registration_status_code,
               zr.effective_from,
               zr.effective_to,
               zptp.party_id,
               zptp.party_tax_profile_id
          FROM apps.zx_registrations zr, apps.zx_party_tax_profile zptp
         WHERE zr.party_tax_profile_id = zptp.party_tax_profile_id) qrs
 WHERE     hp.party_id = hca.party_id
       AND hp.party_id = ps.party_id
       AND hca.cust_account_id = hcas.cust_account_id(+)
       AND ps.party_site_id(+) = hcas.party_site_id
       AND hcas.party_site_id = ps.party_site_id
       AND ps.location_id = lc.location_id
       AND terr.territory_code = lc.country
       AND hcas.org_id = ou.organization_id
       AND hca.status = 'A'
       AND hcas.status = 'A'
       AND qrs.party_id(+) = hcas.party_site_id
       -- AND hca.account_number = p_cust_acct_num
       AND hcas.org_id IN (123);
Related posts: Upload your own post and refer it anywhere anytime:

Leave a Reply