[Home] [Help]
536: FROM ar_trx_header_gt gt
537: WHERE gt.paying_site_use_id IS NOT NULL
538: AND NOT EXISTS
539: (SELECT 'X'
540: FROM hz_cust_acct_sites acct_site,
541: hz_cust_site_uses site_uses
542: WHERE acct_site.cust_acct_site_id = site_uses.cust_acct_site_id
543: AND acct_site.cust_account_id = gt.paying_customer_id
544: AND site_uses.site_use_id = gt.paying_site_use_id
1691: FROM hz_cust_site_uses ct
1692: WHERE site_use_code = 'BILL_TO'
1693: AND cust_acct_site_id in (
1694: SELECT cust_acct_site_id
1695: FROM hz_cust_acct_sites
1696: WHERE cust_account_id = gt.bill_to_customer_id)
1697: AND site_use_id = gt.bill_to_site_use_id);
1698:
1699: IF pg_debug = 'Y'
1733: FROM ar_trx_header_gt gt
1734: WHERE gt.bill_to_address_id IS NOT NULL
1735: AND NOT EXISTS (
1736: SELECT 'X'
1737: FROM HZ_CUST_ACCT_SITES ACCT_SITE,
1738: HZ_PARTY_SITES PARTY_SITE,
1739: --HZ_LOCATIONS LOC,
1740: HZ_CUST_SITE_USES SU
1741: -- FND_TERRITORIES_VL T
1849: SELECT 'X'
1850: FROM hz_cust_site_uses ct
1851: WHERE site_use_code = 'SHIP_TO'
1852: and cust_acct_site_id in (
1853: select cust_acct_site_id from hz_cust_acct_sites
1854: where cust_account_id = gt.ship_to_customer_id)
1855: and site_use_id = gt.ship_to_site_use_id);
1856:
1857: else
1908: A.STATUS A_STATUS ,
1909: SU.STATUS SU_STATUS ,
1910: SU.SITE_USE_ID SITE_USE_ID
1911: FROM
1912: HZ_CUST_ACCT_SITES A,
1913: HZ_CUST_SITE_USES SU
1914: WHERE
1915: A.CUST_ACCT_SITE_ID = SU.CUST_ACCT_SITE_ID
1916: AND SU.SITE_USE_CODE = 'SHIP_TO'
1985: WHERE primary_flag = 'Y'
1986: AND site_use_code = 'SHIP_TO'
1987: AND cust_acct_site_id IN (
1988: SELECT cust_acct_site_id
1989: FROM hz_cust_acct_sites
1990: WHERE cust_account_id = gt.ship_to_customer_id))
1991: WHERE gt.ship_to_site_use_id IS NULL;
1992:
1993: IF pg_debug = 'Y' THEN
2042: A.STATUS A_STATUS ,
2043: SU.STATUS SU_STATUS ,
2044: SU.SITE_USE_ID SITE_USE_ID
2045: FROM
2046: HZ_CUST_ACCT_SITES A,
2047: HZ_CUST_SITE_USES SU
2048: WHERE
2049: A.CUST_ACCT_SITE_ID = SU.CUST_ACCT_SITE_ID
2050: AND SU.SITE_USE_CODE = 'SHIP_TO'
2153: FROM ar_trx_header_gt gt
2154: WHERE gt.primary_salesrep_id IS NOT NULL
2155: AND NOT EXISTS (
2156: SELECT 'X'
2157: FROM HZ_CUST_ACCT_SITES ACCT_SITE,
2158: HZ_PARTY_SITES PARTY_SITE,
2159: HZ_LOCATIONS LOC,
2160: HZ_CUST_SITE_USES SU,
2161: FND_TERRITORIES_VL T
2953: /*Bug8266696*/
2954: UPDATE ar_trx_header_gt gt
2955: SET gt.primary_salesrep_id =
2956: ( SELECT SU.PRIMARY_SALESREP_ID
2957: FROM HZ_CUST_ACCT_SITES ACCT_SITE,
2958: HZ_PARTY_SITES PARTY_SITE,
2959: HZ_LOCATIONS LOC,
2960: HZ_CUST_SITE_USES SU,
2961: FND_TERRITORIES_VL T
3123: WHERE primary_flag = 'Y'
3124: AND site_use_code = 'BILL_TO'
3125: AND cust_acct_site_id IN (
3126: SELECT cust_acct_site_id
3127: FROM hz_cust_acct_sites
3128: WHERE cust_account_id = gt.bill_to_customer_id))
3129: WHERE gt.bill_to_site_use_id IS NULL;
3130:
3131: IF pg_debug = 'Y' THEN
3181: WHERE primary_flag = 'Y'
3182: AND site_use_code = 'BILL_TO'
3183: AND cust_acct_site_id IN (
3184: SELECT cust_acct_site_id
3185: FROM hz_cust_acct_sites
3186: WHERE cust_account_id = gt.paying_customer_id))
3187: WHERE gt.paying_site_use_id IS NULL;
3188:
3189: IF pg_debug = 'Y' THEN
3224:
3225: UPDATE ar_trx_header_gt gt
3226: SET gt.bill_to_address_id = (
3227: SELECT su.cust_acct_site_id
3228: FROM hz_cust_acct_sites acct_site,
3229: hz_party_sites party_site,
3230: hz_locations loc,
3231: hz_cust_site_uses su,
3232: fnd_territories_vl t
3274: SELECT su.site_use_id,
3275: loc.state,
3276: loc.country,
3277: loc.postal_code
3278: FROM hz_cust_acct_sites acct_site,
3279: hz_party_sites party_site,
3280: hz_locations loc,
3281: hz_cust_site_uses su
3282: WHERE acct_site.cust_acct_site_id = su.cust_acct_site_id
3305:
3306: UPDATE ar_trx_header_gt gt
3307: SET remit_to_address_id = (
3308: SELECT acct_site.cust_acct_site_id
3309: FROM hz_cust_acct_sites acct_site,
3310: hz_party_sites party_site,
3311: hz_locations loc,
3312: fnd_territories_vl territory,
3313: ra_remit_tos rt
3532:
3533: UPDATE ar_trx_header_gt gt
3534: SET gt.ship_to_address_id = (
3535: SELECT su.cust_acct_site_id
3536: FROM hz_cust_acct_sites acct_site,
3537: hz_party_sites party_site,
3538: hz_locations loc,
3539: hz_cust_site_uses su,
3540: fnd_territories_vl t