624: WHERE gt.ship_to_customer_name IS NOT NULL
625: AND NOT EXISTS
626: (SELECT 'X'
627: FROM hz_cust_accounts cust_acct,
628: hz_parties party
629: WHERE cust_acct.party_id = party.party_id
630: AND party.party_name = gt.ship_to_customer_name);
631:
632: IF pg_debug = 'Y' THEN
706: WHERE gt.bill_to_customer_name IS NOT NULL
707: AND NOT EXISTS
708: (SELECT 'X'
709: FROM hz_cust_accounts cust_acct,
710: hz_parties party
711: WHERE cust_acct.party_id = party.party_id
712: AND party.party_name = gt.bill_to_customer_name);
713:
714: IF pg_debug = 'Y' THEN
788: WHERE gt.bill_to_contact_id IS NOT NULL
789: AND NOT EXISTS
790: (SELECT 'X'
791: FROM hz_cust_account_roles acct_role,
792: hz_parties party,
793: hz_relationships rel,
794: hz_org_contacts org_cont,
795: hz_parties rel_party
796: WHERE acct_role.party_id = rel.party_id
791: FROM hz_cust_account_roles acct_role,
792: hz_parties party,
793: hz_relationships rel,
794: hz_org_contacts org_cont,
795: hz_parties rel_party
796: WHERE acct_role.party_id = rel.party_id
797: AND acct_role.role_type = 'CONTACT'
798: and org_cont.party_relationship_id = rel.relationship_id
799: and rel.subject_id = party.party_id
797: AND acct_role.role_type = 'CONTACT'
798: and org_cont.party_relationship_id = rel.relationship_id
799: and rel.subject_id = party.party_id
800: and rel.party_id = rel_party.party_id
801: and rel.subject_table_name = 'HZ_PARTIES'
802: and rel.object_table_name = 'HZ_PARTIES'
803: and rel.directional_flag = 'F'
804: and acct_role.cust_account_id = gt.bill_to_customer_id
805: and ( acct_role.cust_acct_site_id = gt.bill_to_address_id
798: and org_cont.party_relationship_id = rel.relationship_id
799: and rel.subject_id = party.party_id
800: and rel.party_id = rel_party.party_id
801: and rel.subject_table_name = 'HZ_PARTIES'
802: and rel.object_table_name = 'HZ_PARTIES'
803: and rel.directional_flag = 'F'
804: and acct_role.cust_account_id = gt.bill_to_customer_id
805: and ( acct_role.cust_acct_site_id = gt.bill_to_address_id
806: or acct_role.cust_acct_site_id IS NULL )
843: WHERE gt.ship_to_contact_id IS NOT NULL
844: AND NOT EXISTS
845: (SELECT 'X'
846: FROM hz_cust_account_roles acct_role,
847: hz_parties party,
848: hz_relationships rel,
849: hz_org_contacts org_cont,
850: hz_parties rel_party
851: WHERE acct_role.party_id = rel.party_id
846: FROM hz_cust_account_roles acct_role,
847: hz_parties party,
848: hz_relationships rel,
849: hz_org_contacts org_cont,
850: hz_parties rel_party
851: WHERE acct_role.party_id = rel.party_id
852: AND acct_role.role_type = 'CONTACT'
853: and org_cont.party_relationship_id = rel.relationship_id
854: and rel.subject_id = party.party_id
852: AND acct_role.role_type = 'CONTACT'
853: and org_cont.party_relationship_id = rel.relationship_id
854: and rel.subject_id = party.party_id
855: and rel.party_id = rel_party.party_id
856: and rel.subject_table_name = 'HZ_PARTIES'
857: and rel.object_table_name = 'HZ_PARTIES'
858: and rel.directional_flag = 'F'
859: and acct_role.cust_account_id = gt.ship_to_customer_id
860: and ( acct_role.cust_acct_site_id = gt.ship_to_address_id
853: and org_cont.party_relationship_id = rel.relationship_id
854: and rel.subject_id = party.party_id
855: and rel.party_id = rel_party.party_id
856: and rel.subject_table_name = 'HZ_PARTIES'
857: and rel.object_table_name = 'HZ_PARTIES'
858: and rel.directional_flag = 'F'
859: and acct_role.cust_account_id = gt.ship_to_customer_id
860: and ( acct_role.cust_acct_site_id = gt.ship_to_address_id
861: or acct_role.cust_acct_site_id IS NULL )
2700: WHERE gt.agreement_id IS NOT NULL
2701: AND NOT EXISTS (
2702: SELECT 'X'
2703: from hz_cust_accounts cust_acct,
2704: hz_parties party,
2705: so_agreements a,
2706: qp_lookups sl
2707: where a.agreement_type_code = sl.lookup_code
2708: and sl.lookup_type = 'QP_AGREEMENT_TYPE'
3044: UPDATE ar_trx_header_gt gt
3045: SET gt.bill_to_customer_id =
3046: (SELECT cust_acct.cust_account_id
3047: FROM hz_cust_accounts cust_acct,
3048: hz_parties party
3049: WHERE cust_acct.party_id = party.party_id
3050: AND party.party_name = gt.bill_to_customer_name
3051: AND gt.bill_to_customer_id IS NULL
3052: AND gt.bill_to_customer_name IS NOT NULL
3391: LOOP
3392: BEGIN
3393: SELECT distinct ACCT_ROLE.CUST_ACCOUNT_ROLE_ID -- CONTACT_ID
3394: INTO l_contact_id
3395: FROM HZ_CUST_ACCOUNT_ROLES ACCT_ROLE,HZ_PARTIES PARTY,HZ_RELATIONSHIPS REL,
3396: HZ_ORG_CONTACTS ORG_CONT,HZ_PARTIES REL_PARTY
3397: WHERE ACCT_ROLE.PARTY_ID = REL.PARTY_ID
3398: AND ACCT_ROLE.ROLE_TYPE = 'CONTACT'
3399: AND ORG_CONT.PARTY_RELATIONSHIP_ID = REL.RELATIONSHIP_ID
3392: BEGIN
3393: SELECT distinct ACCT_ROLE.CUST_ACCOUNT_ROLE_ID -- CONTACT_ID
3394: INTO l_contact_id
3395: FROM HZ_CUST_ACCOUNT_ROLES ACCT_ROLE,HZ_PARTIES PARTY,HZ_RELATIONSHIPS REL,
3396: HZ_ORG_CONTACTS ORG_CONT,HZ_PARTIES REL_PARTY
3397: WHERE ACCT_ROLE.PARTY_ID = REL.PARTY_ID
3398: AND ACCT_ROLE.ROLE_TYPE = 'CONTACT'
3399: AND ORG_CONT.PARTY_RELATIONSHIP_ID = REL.RELATIONSHIP_ID
3400: AND REL.SUBJECT_ID = PARTY.PARTY_ID
3398: AND ACCT_ROLE.ROLE_TYPE = 'CONTACT'
3399: AND ORG_CONT.PARTY_RELATIONSHIP_ID = REL.RELATIONSHIP_ID
3400: AND REL.SUBJECT_ID = PARTY.PARTY_ID
3401: AND REL.PARTY_ID = REL_PARTY.PARTY_ID
3402: AND REL.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
3403: AND REL.OBJECT_TABLE_NAME = 'HZ_PARTIES'
3404: AND REL.DIRECTIONAL_FLAG = 'F'
3405: AND ACCT_ROLE.CUST_ACCOUNT_ID = bill_to_customer_id_rec.bill_to_customer_id
3406: AND ACCT_ROLE.CUST_ACCT_SITE_ID = bill_to_customer_id_rec.bill_to_address_id
3399: AND ORG_CONT.PARTY_RELATIONSHIP_ID = REL.RELATIONSHIP_ID
3400: AND REL.SUBJECT_ID = PARTY.PARTY_ID
3401: AND REL.PARTY_ID = REL_PARTY.PARTY_ID
3402: AND REL.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
3403: AND REL.OBJECT_TABLE_NAME = 'HZ_PARTIES'
3404: AND REL.DIRECTIONAL_FLAG = 'F'
3405: AND ACCT_ROLE.CUST_ACCOUNT_ID = bill_to_customer_id_rec.bill_to_customer_id
3406: AND ACCT_ROLE.CUST_ACCT_SITE_ID = bill_to_customer_id_rec.bill_to_address_id
3407: AND ACCT_ROLE.STATUS = 'A' ;
3472: UPDATE ar_trx_header_gt gt
3473: SET gt.ship_to_customer_id =
3474: (SELECT cust_acct.cust_account_id
3475: FROM hz_cust_accounts cust_acct,
3476: hz_parties party
3477: WHERE cust_acct.party_id = party.party_id
3478: AND party.party_name = gt.ship_to_customer_name
3479: AND cust_acct.status = 'A'
3480: AND gt.ship_to_customer_id IS NULL
3590: LOOP
3591: BEGIN
3592: SELECT distinct ACCT_ROLE.CUST_ACCOUNT_ROLE_ID -- CONTACT_ID
3593: INTO l_contact_id
3594: FROM HZ_CUST_ACCOUNT_ROLES ACCT_ROLE,HZ_PARTIES PARTY,HZ_RELATIONSHIPS REL,
3595: HZ_ORG_CONTACTS ORG_CONT,HZ_PARTIES REL_PARTY
3596: WHERE ACCT_ROLE.PARTY_ID = REL.PARTY_ID
3597: AND ACCT_ROLE.ROLE_TYPE = 'CONTACT'
3598: AND ORG_CONT.PARTY_RELATIONSHIP_ID = REL.RELATIONSHIP_ID
3591: BEGIN
3592: SELECT distinct ACCT_ROLE.CUST_ACCOUNT_ROLE_ID -- CONTACT_ID
3593: INTO l_contact_id
3594: FROM HZ_CUST_ACCOUNT_ROLES ACCT_ROLE,HZ_PARTIES PARTY,HZ_RELATIONSHIPS REL,
3595: HZ_ORG_CONTACTS ORG_CONT,HZ_PARTIES REL_PARTY
3596: WHERE ACCT_ROLE.PARTY_ID = REL.PARTY_ID
3597: AND ACCT_ROLE.ROLE_TYPE = 'CONTACT'
3598: AND ORG_CONT.PARTY_RELATIONSHIP_ID = REL.RELATIONSHIP_ID
3599: AND REL.SUBJECT_ID = PARTY.PARTY_ID
3597: AND ACCT_ROLE.ROLE_TYPE = 'CONTACT'
3598: AND ORG_CONT.PARTY_RELATIONSHIP_ID = REL.RELATIONSHIP_ID
3599: AND REL.SUBJECT_ID = PARTY.PARTY_ID
3600: AND REL.PARTY_ID = REL_PARTY.PARTY_ID
3601: AND REL.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
3602: AND REL.OBJECT_TABLE_NAME = 'HZ_PARTIES'
3603: AND REL.DIRECTIONAL_FLAG = 'F'
3604: AND ACCT_ROLE.CUST_ACCOUNT_ID = ship_to_customer_id_rec.ship_to_customer_id
3605: AND ACCT_ROLE.CUST_ACCT_SITE_ID = ship_to_customer_id_rec.ship_to_address_id
3598: AND ORG_CONT.PARTY_RELATIONSHIP_ID = REL.RELATIONSHIP_ID
3599: AND REL.SUBJECT_ID = PARTY.PARTY_ID
3600: AND REL.PARTY_ID = REL_PARTY.PARTY_ID
3601: AND REL.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
3602: AND REL.OBJECT_TABLE_NAME = 'HZ_PARTIES'
3603: AND REL.DIRECTIONAL_FLAG = 'F'
3604: AND ACCT_ROLE.CUST_ACCOUNT_ID = ship_to_customer_id_rec.ship_to_customer_id
3605: AND ACCT_ROLE.CUST_ACCT_SITE_ID = ship_to_customer_id_rec.ship_to_address_id
3606: AND ACCT_ROLE.STATUS = 'A' ;
5313: LOOP
5314: SELECT party.party_id
5315: INTO l_party_id
5316: FROM hz_cust_accounts hca,
5317: hz_parties party
5318: WHERE hca.party_id = party.party_id
5319: AND hca.cust_account_id = ctrxHeaderRec.paying_customer_id ;
5320:
5321: SELECT INSTR_ASSIGNMENT_ID