Query to get customer tax registration details in R12

By admin

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

SQL Querysql
1--Customer Account Tax Registration Details
2
3SELECT party_name,
4       account_number,
5       ps.party_site_number,
6       (SELECT LISTAGG (al.meaning, ', ') WITHIN GROUP (ORDER BY al.meaning)
7          FROM apps.hz_cust_acct_sites_all s,
8               apps.hz_cust_site_uses_all  u,
9               apps.ar_lookups             al
10         WHERE     s.cust_acct_site_id = hcas.cust_acct_site_id
11               AND u.cust_acct_site_id = s.cust_acct_site_id
12               AND u.status = 'A'
13               AND al.lookup_type = 'SITE_USE_CODE'
14               AND al.lookup_code = u.site_use_code)
15          purposes,
16       DECODE (ps.status,  'A', 'Active',  'I', 'Inactive',  ps.status)
17          AS site_status,
18       hcas.ORG_ID,
19       ou.name                   AS operating_unit,
20       terr.territory_short_name AS country_name,
21          lc.address1
22       || DECODE (lc.address2, NULL, '', CHR (10))
23       || lc.address2
24       || DECODE (lc.address3, NULL, '', CHR (10))
25       || lc.address3
26       || DECODE (lc.address4, NULL, '', CHR (10))
27       || lc.address4
28       || DECODE (lc.city, NULL, '', CHR (10))
29       || lc.city
30       || DECODE (lc.state, NULL, '', ',')
31       || lc.state
32       || DECODE (lc.postal_code, '', ',')
33       || lc.postal_code
34          address,
35       qrs.registration_number,
36       qrs.tax_regime_code,
37       qrs.tax,
38       qrs.registration_status_code,
39       qrs.effective_from,
40       qrs.effective_to
41  FROM apps.hz_cust_acct_sites_all hcas,
42       apps.hz_party_sites         ps,
43       apps.hz_cust_accounts_all   hca,
44       apps.hz_locations           lc,
45       apps.fnd_territories_vl     terr,
46       apps.hr_operating_units     ou,
47       apps.hz_parties             hp,
48       (SELECT zr.registration_number,
49               zr.tax_regime_code,
50               zr.tax,
51               zr.registration_status_code,
52               zr.effective_from,
53               zr.effective_to,
54               zptp.party_id,
55               zptp.party_tax_profile_id
56          FROM apps.zx_registrations zr, apps.zx_party_tax_profile zptp
57         WHERE zr.party_tax_profile_id = zptp.party_tax_profile_id) qrs
58 WHERE     hp.party_id = hca.party_id
59       AND hp.party_id = ps.party_id
60       AND hca.cust_account_id = hcas.cust_account_id(+)
61       AND ps.party_site_id(+) = hcas.party_site_id
62       AND hcas.party_site_id = ps.party_site_id
63       AND ps.location_id = lc.location_id
64       AND terr.territory_code = lc.country
65       AND hcas.org_id = ou.organization_id
66       AND hca.status = 'A'
67       AND hcas.status = 'A'
68       AND qrs.party_id(+) = hcas.party_site_id
69       -- AND hca.account_number = p_cust_acct_num
70       AND hcas.org_id IN (123);

Related posts: