miércoles, 31 de enero de 2024

AGM (3) Gestion Tributaria (2) Vehiculos

 

1. Vehículos (CENSOVEHICULOS.xls) 


-------------------------------------

-- VEHICULOS

-------------------------------------

SELECT

OTIV.ID_OTIV AS ID_IVTM_VEH,

OTIV.ID_TIVE || '?????' AS COD_Z_VEH,

OTIV.ID_PERS_OTIV AS ID_SUJETO,

'46240' AS COD_ENTIDAD,

'?????' AS COD_Z_INCID,

CASE

WHEN NVL(REGE.IBAN_REGE, DOMI.IBAN_DOMI) IS NOT NULL THEN 'S'

ELSE 'N'

END AS DOMICILIADO,

SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI), 5, 4) AS DOM_ENTIDAD,

SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI), 9, 4) AS DOM_OFICINA,

SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI),13, 2) AS DOM_DC,

SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI),15,10) AS DOM_CUENTA,

--SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI), 1, 2) AS DOM_COD_PAIS,

--SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI), 3, 2) AS DOM_IBAN_DC,

OTIV.NUM_MATRICULA_OTIV AS MATRICULA,

CASE

WHEN SUBSTR(TRIM(OTIV.NUM_MATRICULA_OTIV),1,1)>'9' THEN SUBSTR(TRIM(OTIV.NUM_MATRICULA_OTIV),1,1)

ELSE ''

END ||

CASE

WHEN SUBSTR(TRIM(OTIV.NUM_MATRICULA_OTIV),2,1)>'9' THEN SUBSTR(TRIM(OTIV.NUM_MATRICULA_OTIV),2,1)

ELSE ''

END AS MAT_LETRAS_ANT,

REGEXP_REPLACE(TRIM(OTIV.NUM_MATRICULA_OTIV), '[^0-9]+', '') AS MAT_NUMERO,

REGEXP_REPLACE(SUBSTR(TRIM(OTIV.NUM_MATRICULA_OTIV),3) , '[0-9]+', '') AS MAT_LETRAS_POS,

OTIV.NUM_BASTIDOR_OTIV AS BASTIDOR,

regexp_replace(OTIV.MARCA_MODELO_OTIV,'(((\w+)\s+){1}).*','\1') AS MARCA,

REPLACE(OTIV.MARCA_MODELO_OTIV,regexp_replace(OTIV.MARCA_MODELO_OTIV,'(((\w+)\s+){1}).*','\1'),'') AS MODELO,

OTIV.CILINDRADA_OTIV AS CC,

OTIV.POTENCIA_FISCAL_OTIV AS CV,

--OTIV.NUM_PLAZAS_OTIV AS PLAZAS,

LSOT.PLAZAS AS PLAZAS,

LSOT.NUM_PLAZAS_MAX AS PLAZAS_TXT,

--OTIV.TARA_OTIV AS KG,

LSOT.TARA_LSOT AS KG,

'?????' AS ID_CALCULO,

'?????' AS USAR_DT,

'?????' AS BE_OFICIO_PETICION,

DIRE.COD_PROV AS DT_COD_PROVINCIA,

DIRE.COD_CAT_MUNE AS DT_COD_MUNICIPIO,

DIRE.ID_CALL AS DT_ID_VIA,

DIRE.NUM_DIRE AS DT_NUMERO,

DIRE.BLOQUE_DIRE AS DT_PORTAL,

DIRE.ESCALERA_DIRE AS DT_ESCALERA,

DIRE.PLANTA_DIRE AS DT_PISO,

DIRE.PUERTA_DIRE AS DT_PUERTA,

DIRE.DISTRITO_POSTAL_DIRE AS DT_CP,

DIRE.REF_CAT_1_DIRE || DIRE.REF_CAT_2_DIRE || DIRE.REF_CAT_NUM_DIRE || DIRE.REF_CAT_DC_1_DIRE || DIRE.REF_CAT_DC_2_DIRE AS DT_REFCAT,

--'?????' AS ID_TARIFA,---ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ

CASE

--WHEN OTIV.ID_TIVE='TU' THEN OTIV.POTENCIA_FISCAL_OTIV

WHEN OTIV.ID_TIVE='TU' AND OTIV.POTENCIA_FISCAL_OTIV<8 THEN 'TURISM08'

WHEN OTIV.ID_TIVE='TU' AND OTIV.POTENCIA_FISCAL_OTIV>=8 AND OTIV.POTENCIA_FISCAL_OTIV<12 THEN 'TURISM12'

WHEN OTIV.ID_TIVE='TU' AND OTIV.POTENCIA_FISCAL_OTIV>=12 AND OTIV.POTENCIA_FISCAL_OTIV<16 THEN 'TURISM16'

WHEN OTIV.ID_TIVE='TU' AND OTIV.POTENCIA_FISCAL_OTIV>=16 AND OTIV.POTENCIA_FISCAL_OTIV<20 THEN 'TURISM20'

WHEN OTIV.ID_TIVE='TU' AND OTIV.POTENCIA_FISCAL_OTIV>=20 THEN 'TURISM99'

-- WHEN OTIV.ID_TIVE='AU' THEN OTIV.NUM_PLAZAS__OTIV

WHEN OTIV.ID_TIVE='AU' AND OTIV.NUM_PLAZAS_OTIV <21 THEN 'AUTOB21'

WHEN OTIV.ID_TIVE='AU' AND OTIV.NUM_PLAZAS_OTIV>=21 AND OTIV.NUM_PLAZAS_OTIV<=50 THEN 'AUTOB50'

WHEN OTIV.ID_TIVE='AU' AND OTIV.NUM_PLAZAS_OTIV >50 THEN 'AUTOB99'

-- WHEN OTIV.ID_TIVE='CA' THEN OTIV.CARGA_UTIL_OTIV

WHEN OTIV.ID_TIVE='CA' AND OTIV.CARGA_UTIL_OTIV<1000 THEN 'CAMION01K'

WHEN OTIV.ID_TIVE='CA' AND OTIV.CARGA_UTIL_OTIV>=1000 AND OTIV.CARGA_UTIL_OTIV<3000 THEN 'CAMION03K'

WHEN OTIV.ID_TIVE='CA' AND OTIV.CARGA_UTIL_OTIV>=3000 AND OTIV.CARGA_UTIL_OTIV<10000 THEN 'CAMION10K'

WHEN OTIV.ID_TIVE='CA' AND OTIV.CARGA_UTIL_OTIV>=10000 THEN 'CAMION99K'

-- WHEN OTIV.ID_TIVE='TR' THEN OTIV.POTENCIA_FISCAL_OTIV

WHEN OTIV.ID_TIVE='TR' AND OTIV.POTENCIA_FISCAL_OTIV<16 THEN 'TRACTOR16'

WHEN OTIV.ID_TIVE='TR' AND OTIV.POTENCIA_FISCAL_OTIV>16 AND OTIV.POTENCIA_FISCAL_OTIV<=25 THEN 'TRACTOR25'

WHEN OTIV.ID_TIVE='TR' AND OTIV.POTENCIA_FISCAL_OTIV>25 THEN 'TRACTOR99'

-- WHEN OTIV.ID_TIVE='RE' THEN OTIV.CARGA_UTIL_OTIV

-- WHEN OTIV.ID_TIVE='SE' THEN OTIV.CARGA_UTIL_OTIV

WHEN OTIV.ID_TIVE IN ('RE','SE') AND OTIV.CARGA_UTIL_OTIV<=750 THEN 'REMSEM750'

WHEN OTIV.ID_TIVE IN ('RE','SE') AND OTIV.CARGA_UTIL_OTIV>750 AND OTIV.CARGA_UTIL_OTIV<1000 THEN 'REMSEM01T'

WHEN OTIV.ID_TIVE IN ('RE','SE') AND OTIV.CARGA_UTIL_OTIV>=1000 AND OTIV.CARGA_UTIL_OTIV<3000 THEN 'REMSEM03T'

WHEN OTIV.ID_TIVE IN ('RE','SE') AND OTIV.CARGA_UTIL_OTIV>=3000 THEN 'REMSEM99T'

-- WHEN OTIV.ID_TIVE='CI' THEN OTIV.CILINDRADA_OTIV

WHEN OTIV.ID_TIVE='CI' THEN 'CICLOM'

-- WHEN OTIV.ID_TIVE='MO' THEN OTIV.CILINDRADA_OTIV

WHEN OTIV.ID_TIVE='MO' AND OTIV.CILINDRADA_OTIV<125 THEN 'MOTOCI125'

WHEN OTIV.ID_TIVE='MO' AND OTIV.CILINDRADA_OTIV>=125 AND OTIV.CILINDRADA_OTIV<250 THEN 'MOTOCI250'

WHEN OTIV.ID_TIVE='MO' AND OTIV.CILINDRADA_OTIV>=250 AND OTIV.CILINDRADA_OTIV<500 THEN 'MOTOCI500'

WHEN OTIV.ID_TIVE='MO' AND OTIV.CILINDRADA_OTIV>=500 AND OTIV.CILINDRADA_OTIV<=1000 THEN 'MOTOCI01K'

WHEN OTIV.ID_TIVE='MO' AND OTIV.CILINDRADA_OTIV>=1000 THEN 'MOTOCI99K'

ELSE ''

END AS ID_TARIFA,

OTIV.ID_TBIV AS COD_Z_BON_EXE,

CASE

WHEN OTIV.ANYO_INICIO_OTIV IS NOT NULL AND OTIV.ID_TBIV IS NOT NULL THEN '01/01/' || TO_CHAR(OTIV.ANYO_INICIO_OTIV)

ELSE NULL

END AS F_INI_BE,

CASE

WHEN OTIV.ANYO_FIN_OTIV IS NOT NULL AND OTIV.ID_TBIV IS NOT NULL THEN '31/12/' || TO_CHAR(OTIV.ANYO_FIN_OTIV)

ELSE NULL

END AS F_FIN_BE,

'?????'||OTIV.MAT_COD_TRAMITE_OTIV AS TRAMITE_ALTA,

--OTIV.FECHA_PRIMERA_MATRI AS F_ALTA,

'?????' AS F_ALTA,

OTIV.FECHA_TRAMITE_OTIV AS F_ALTA_PADRON,

CASE

--WHEN SUBSTR(OTIV.COD_TOIV,1) IN ('B') THEN OTIV.FECHA_TRAMITE_OTIV

WHEN LSOT.TIPO_REGISTRO_LSOT ='B' THEN OTIV.FECHA_TRAMITE_OTIV

ELSE NULL

END AS F_BAJA_PADRON,

CASE

--WHEN SUBSTR(OTIV.COD_TOIV,1) IN ('B') THEN 'S'

WHEN LSOT.TIPO_REGISTRO_LSOT ='B' THEN 'S'

ELSE 'N'

END || '??????' AS BAJA_EN_PADRON,

'?????' AS TRAMITE_BAJA,

'?????' AS BAJA,

OTIV.NIF_SP_OTIV AS NIF_TRAFICO,

NVL(PPPP.FECHA_OPERACION_PPP, DOMI.FECHA_ALTA_DOMI) AS FECHA_DOMICILIACION,

SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI), 1, 2) AS DOM_COD_PAIS,

SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI), 3, 2) AS DOM_IBAN_DC,

OTIV.SERVICIO_TIT_OTIV AS COD_Z_SERVICIO,

OTIV.PROVINCIA_SP_OTIV AS PROVINCIA_FISCAL,

OTIV.MUNICIPIO_SP_OTIV AS MUNICIPIO_FISCAL,

'?????' AS LOCALIDAD_FISCAL,

OTIV.DOMICILIO_NOTTIT_OTIV AS DOMICILIO_FISCAL,

OTIV.CP_NOTTIT_OTIV AS CP_FISCAL,

'????' AS NIVE,

OTIV.FECHA_MATRICULACION_OTIV AS F_MATRICULACION,

OTIV.FECHA_PRIMERA_MATRI AS F_PRIMERA_MATRICULACION,

OTIV.CLAS_INDUSTRIA_OTIV AS CLASIFICACION_INDUSTRIA,

OTIV.CAT_HOMOLOGACIONUE_OTIV AS CATEGORIA_UE,

OTIV.POTENCIA_NETA_OTIV AS POTENCIA_NETA,

OTIV.TARA_OTIV AS TARA,

OTIV.COMBUSTIBLE_OTIV AS COMBUSTIBLE,

OTIV.TIPO_ALIMENTACION_OTIV AS TIPO_ALIMENTACION,

OTIV.CONSUMO_OTIV AS CONSUMO,

OTIV.NIVEL_EMISIONES_OTIV AS NIVEL_EMISIONES,

OTIV.EMISIONES_CO2_OTIV AS EMISIONES_CO2,

OTIV.IND_TRANSFERENCIA_OTIV AS INDICADOR_TRANSFERENCIA,

OTIV.IND_SUSTRACCION_OTIV AS INDICADOR_SUSTRACCION,

OTIV.IND_PRECINTO_OTIV AS INDICADOR_PRECINTO,

OTIV.IND_EMBARGO_OTIV AS INDICADOR_EMBARGO,

OTIV.CAT_ELECTRICA_OTIV AS CATEGORIA_ELECTRICO,

OTIV.AUTO_ELECTRICA_OTIV AS AUTONOMIA_ELECTRICA,

'?????' AS MASA_ORDEN_MARCHA,

'?????' AS COD_Z_RES_NOT,

'?????' AS FECHA_ALTA_MATRICULA,

'N' AS PAGO_FRACCIONADO,

'?????' AS CLASE_AMBIENTAL,

NULL AS F_PAGO_FRACCIONADO,

OTIV.TIPO_VEHICULO_OTIV AS TIPO_VEHICULO,

NVL(PERS_PPPP.NIF_PERG ,DOMI.NIF_TITULAR_DOMI) AS DOM_NIF,

NVL(PERS_PPPP.NOMBRE_PERG, DOMI.TITULAR_CUENTA_DOMI) AS DOM_TITULAR,

'?????' AS CODIDGO_MULTI_ENTIDAD,

'?????' AS MANDATO_SEPA,

'S' AS CENSADO

FROM OPS$GTTORA.OTIV_OBJETO_TRIBUTARIO_IVTM OTIV

LEFT JOIN OPS$GTTORA.LSOT_LINEAS_SOP_TRAFICO_IVTM LSOT ON LSOT.MATRICULA =OTIV.NUM_MATRICULA_OTIV

AND NOT EXISTS (SELECT * FROM OPS$GTTORA.LSOT_LINEAS_SOP_TRAFICO_IVTM LSOT1 WHERE LSOT1.ID_SOOT = LSOT.ID_SOOT AND LSOT1.ID_LSOT >LSOT.ID_LSOT)

--

JOIN OPS$GTTORA.EPER_ELEMENTOS_PERSONA EPER_DIRE ON EPER_DIRE.ID_PERS = OTIV.ID_PERS_OTIV AND EPER_DIRE.TIPO_EPER = 'DI'

JOIN OPS$GTTORA.DIRE_DIRECCIONES DIRE ON DIRE.ID_EPER =EPER_DIRE.ID_EPER

AND NOT EXISTS (

SELECT *

FROM OPS$GTTORA.EPER_ELEMENTOS_PERSONA EPER_DIRE1

JOIN OPS$GTTORA.DIRE_DIRECCIONES DIRE1

ON EPER_DIRE1.ID_PERS = OTIV.ID_PERS_OTIV AND EPER_DIRE.TIPO_EPER = 'DI'

AND DIRE1.ID_EPER = EPER_DIRE1.ID_EPER AND DIRE1.FECHA_MODIFICACION_DIRE >DIRE.FECHA_MODIFICACION_DIRE)

LEFT JOIN OPS$GTTORA.DOMI_DOMICILIACIONES DOMI

ON DOMI.ID_EPER_OT=OTIV.ID_EPER_OT AND DOMI.ESTADO_DOMI='A'

AND NOT EXISTS (SELECT * FROM OPS$GTTORA.DOMI_DOMICILIACIONES DOMI1 WHERE DOMI1.ID_EPER_OT=DOMI.ID_EPER_OT AND DOMI1.FECHA_ALTA_DOMI>DOMI.FECHA_ALTA_DOMI)

LEFT JOIN OPS$GTTORA.EPER_ELEMENTOS_PERSONA EPER_PPP ON EPER_PPP.ID_PERS = OTIV.ID_PERS_OTIV AND EPER_PPP.TIPO_EPER ='PP'

LEFT JOIN OPS$GTTORA.PPPP_PAGO_PLAZOS PPPP ON PPPP.ID_EPER=EPER_PPP.ID_EPER

LEFT JOIN OPS$GTTORA.REGE_REGISTRO_ENTRADA REGE ON REGE.ID_EPER_SP= PPPP.ID_EPER_SP

LEFT JOIN OPS$GTTORA.PERS_PERSONAS PERS_PPPP ON PERS_PPPP.ID_PERS = EPER_PPP.ID_PERS

-- Tablas de codigo - Descripción

LEFT JOIN OPS$GTTORA.SIOT_SITUACION_OT_IVTM SIOT ON SIOT.ID_SIOT=OTIV.ID_SIOT

LEFT JOIN OPS$GTTORA.TOIV_TIPO_OPERACION_IVTM TOIV ON TOIV.COD_TOIV=OTIV.COD_TOIV

LEFT JOIN OPS$GTTORA.ORIG_ORIGENES_IVTM ORIG ON ORIG.ID_ORIG = OTIV.ID_ORIG

LEFT JOIN OPS$GTTORA.TIMA_TIPO_MATRICULAS_IVTM TIMA ON TIMA.ID_TIMA= OTIV.ID_TIMA

LEFT JOIN OPS$GTTORA.CLVE_CLASE_VEHICULO_IVTM CLVE ON CLVE.ID_CLVE= OTIV.ID_CLVE

LEFT JOIN OPS$GTTORA.SCVE_SUBCLASE_VEHICULO_IVTM SCVE ON SCVE.ID_SCVE = OTIV.ID_SCVE

LEFT JOIN OPS$GTTORA.TIVE_TIPO_VEHICULO_IVTM TIVE ON TIVE.ID_TIVE = OTIV.ID_TIVE

LEFT JOIN OPS$GTTORA.DAEI_DATO_ECONOMICO_IVTM DAEI ON DAEI.COD_DAEI =TIVE.COD_DAEI --viene de TIVE_TIPO_VEHICULO_IVTM

LEFT JOIN OPS$GTTORA.BISB_SUBTIPO_BIEN BISB ON BISB.COD_BISB =TIVE.COD_BISB --viene de TIVE_TIPO_VEHICULO_IVTM

WHERE OTIV.REG_ACTIVO='S' --AND OTIV.ID_SIOT <>'B'

ORDER BY OTIV.NUM_MATRICULA_OTIV ;


2. Bonificaciones de Vehículos (IVTMBONIFICACIONES.xls) 


-------------------------------------

-- BONIFICACIONES DE VEHICULOS

-------------------------------------

SELECT

OTIV.NUM_MATRICULA_OTIV AS MATRICULA,

OTIV.NUM_BASTIDOR_OTIV AS BASTIDOR,

OTIV.NIF_SP_OTIV AS NIF,

OTIV.NOMBRE_SP_OTIV AS TX_NOMBRE_COMPLETO,

OTIV.ID_TBIV AS COD_Z_BON_EXE,

CASE

WHEN OTIV.ID_TBIV IS NULL THEN 'NO BONIFICAT '

WHEN OTIV.ID_TBIV ='AY' THEN 'BONIFICAT-AJUNTAMENT'

WHEN OTIV.ID_TBIV ='CR' THEN 'BONIFICAT-CREU ROJA'

WHEN OTIV.ID_TBIV ='VA' THEN 'BONIFICAT-AGRÍCOLA'

WHEN OTIV.ID_TBIV ='VH' THEN 'BONIFICAT-HISTÒRIC'

WHEN OTIV.ID_TBIV ='VM' THEN 'BONIFICAT-DISCAPACITAT'

WHEN OTIV.ID_TBIV ='VO' THEN 'BONIFICAT-VEHICLE OFICIAL'

ELSE 'NO BONIFICAT'

END AS DESCRIPCION,

OTIV.PORCENTAJE_BENEF_FISCAL_OTIV AS PORCENTAJE,

CASE

WHEN OTIV.ANYO_INICIO_OTIV IS NOT NULL AND OTIV.ID_TBIV IS NOT NULL THEN '01/01/' || TO_CHAR(OTIV.ANYO_INICIO_OTIV)

ELSE NULL

END AS F_INI_BE,

CASE

WHEN OTIV.ANYO_FIN_OTIV IS NOT NULL AND OTIV.ID_TBIV IS NOT NULL THEN '31/12/' || TO_CHAR(OTIV.ANYO_FIN_OTIV)

ELSE NULL

END AS F_FIN_BE

FROM OPS$GTTORA.OTIV_OBJETO_TRIBUTARIO_IVTM OTIV

WHERE OTIV.REG_ACTIVO='S' AND OTIV.PORCENTAJE_BENEF_FISCAL_OTIV >0

ORDER BY OTIV.NUM_MATRICULA_OTIV ;


3. Domiciliaciones Vehículos (IVTMDOMICILIACIONES.xls) 


------------------------------------

-- DOMICILIACIONES DE VEHICULOS

-------------------------------------

SELECT

OTIV.NUM_MATRICULA_OTIV AS MATRICULA,

OTIV.NUM_BASTIDOR_OTIV AS BASTIDOR,

OTIV.NOMBRE_SP_OTIV AS TX_NOMBRE_COMPLETO,

SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI), 1, 2) AS DOM_COD_PAIS,

SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI), 3, 2) AS DOM_IBAN_DC,

SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI), 5, 4) AS DOM_ENTIDAD,

SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI), 9, 4) AS DOM_OFICINA,

SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI),13, 2) AS DOM_DC,

SUBSTR(NVL(REGE.IBAN_REGE,DOMI.IBAN_DOMI),15,10) AS DOM_CUENTA,

NVL(PPPP.FECHA_OPERACION_PPP, DOMI.FECHA_ALTA_DOMI) AS FECHA_DOMICILIACION,

'?????' AS MANDATO_SEPA

FROM OPS$GTTORA.OTIV_OBJETO_TRIBUTARIO_IVTM OTIV

LEFT JOIN OPS$GTTORA.LSOT_LINEAS_SOP_TRAFICO_IVTM LSOT ON LSOT.MATRICULA =OTIV.NUM_MATRICULA_OTIV

AND NOT EXISTS (SELECT * FROM OPS$GTTORA.LSOT_LINEAS_SOP_TRAFICO_IVTM LSOT1 WHERE LSOT1.ID_SOOT = LSOT.ID_SOOT AND LSOT1.ID_LSOT >LSOT.ID_LSOT)

LEFT JOIN OPS$GTTORA.DOMI_DOMICILIACIONES DOMI

ON DOMI.ID_EPER_OT=OTIV.ID_EPER_OT AND DOMI.ESTADO_DOMI='A'

AND NOT EXISTS (SELECT * FROM OPS$GTTORA.DOMI_DOMICILIACIONES DOMI1 WHERE DOMI1.ID_EPER_OT=DOMI.ID_EPER_OT AND DOMI1.FECHA_ALTA_DOMI>DOMI.FECHA_ALTA_DOMI)

LEFT JOIN OPS$GTTORA.EPER_ELEMENTOS_PERSONA EPER_PPP ON EPER_PPP.ID_PERS = OTIV.ID_PERS_OTIV AND EPER_PPP.TIPO_EPER ='PP'

LEFT JOIN OPS$GTTORA.PPPP_PAGO_PLAZOS PPPP ON PPPP.ID_EPER=EPER_PPP.ID_EPER AND PPPP.COD_PPSI ='AC'

LEFT JOIN OPS$GTTORA.REGE_REGISTRO_ENTRADA REGE ON REGE.ID_EPER_SP= PPPP.ID_EPER_SP

WHERE OTIV.REG_ACTIVO='S'

AND (REGE.IBAN_REGE IS NOT NULL OR DOMI.IBAN_DOMI IS NOT NULL)

ORDER BY OTIV.NUM_MATRICULA_OTIV ;









No hay comentarios :

Publicar un comentario