154: and l.customer_trx_id = customer_trx_id1
155: and i.interface_line_context = p_so_source_code
156: and (EXISTS
157: ( select 'valid_trx_type'
158: from ra_cust_trx_types ty
159: where (i.cust_trx_type_name = ty.name OR
160: i.cust_trx_type_id = ty.cust_trx_type_id)
161: AND ty.type = 'INV')
162: OR EXISTS (select 'valid sub_trx_type'
160: i.cust_trx_type_id = ty.cust_trx_type_id)
161: AND ty.type = 'INV')
162: OR EXISTS (select 'valid sub_trx_type'
163: from ra_customer_trx trx,
164: ra_cust_trx_types ty
165: where trx.customer_trx_id = customer_trx_id1
166: and trx.cust_trx_type_id = ty.cust_trx_type_id
167: and (i.cust_trx_type_name is null AND
168: i.cust_trx_type_id is null AND