Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.screening_OUT_AMX
AS
BEGIN
declare @IDCliente int = 5546348
/*
select DISTINCT TIPO_REG from screening_prov_OUT where cliente=@IDCliente
*/
/*LISTA DE EMPLEADOS PROVISTA*/
select DISTINCT 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit, screening_empleados.CUIL,PADRONES.nombre_persona from screening_empleados LEFT JOIN PADRONES ON screening_empleados.cuil=PADRONES.identificacion where cliente=@IDCliente
ORDER BY PADRONES.nombre_persona ASC
/*PROVEEDORES APERTURADOS*/
select DISTINCT
'AMX ARGENTINA SOCIEDAD ANONIMA' AS razon_social,
'30663288497' as [CUIT CLIENTE],
/*
seo.razon_social as CLIENTE,seo.cuit as [CUIT CLIENTE],
*/
spo.razon_social as PROVEEDOR,spo.cuit as [CUIT PROVEEDOR],
CASE
WHEN spo.tipo_reg = 'FAMIL_EMP' THEN 'FAMILIAR DE EMPLEADO'
WHEN spo.tipo_reg = 'SOC_CONS_1' THEN 'SOCIEDADES/CONSTITUCIONES DE PROVEEDORES'
WHEN spo.tipo_reg = 'SOC_CONS_2' THEN 'SOCIEDADES/CONSTITUCIONES DE PROVEEDORES'
WHEN spo.tipo_reg = 'PROV_EMP' THEN 'EMPLEADO DEL PROVEEDOR'
WHEN spo.tipo_reg = 'ACCIONISTA' THEN 'ACCIONISTA'
WHEN spo.tipo_reg = 'DIRECTOR' THEN 'DIRECTOR'
WHEN spo.tipo_reg = 'EMPLE_INT' THEN 'EMPLEADO DEL INTEGRANTE DE SOCIEDAD'
WHEN spo.tipo_reg = 'FAMIL_INT' THEN 'FAMILIAR DEL INTEGRANTE DE SOCIEDAD'
END AS VINCULACION,
/*
,spo.tipo_reg,
*/
spo.soc_vinculada as [SOCIEDAD VINCULADA],spo.cuit_soc_vinculada as [CUIT DE SOCIEDAD VINCULADA]
,
padrones.nombre_persona as [APELLIDO Y NOMBRE], /*seo.nombre_integrante as [EMPLEADO],*/
seo.cuit_int as [CUIL]
from screening_prov_out spo
inner join screening_prov_out seo on seo.cuit_int = spo.cuit_int
inner join padrones on seo.cuit_int = padrones.identificacion
where
/*SEO.tipo_reg <> '2EMPLEOS' and seo.cliente=@IDCliente
and seo.tipo_reg is not null
and seo.razon_social is not null
AND */
spo.cuit in (select distinct cuit from screening_prov where cliente=@IDCliente)
/*
union all
select DISTINCT seo.razon_social as CLIENTE,seo.cuit as [CUIT CLIENTE],
seo.nombre_integrante as [EMPLEADO DEL CLIENTE],
seo.cuit_int as [CUIT DEL EMPLEADO DEL CLIENTE],
CASE
WHEN seo.tipo_reg = '2EMPLEOS' THEN 'MULTIPLES EMPLEADORES'
END AS VINCULACION,
seo.soc_vinculada as EMPLEADOR,seo.cuit_soc_vinculada as [CUIT EMPLEADOR],
seo.nombre_integrante as [EMPLEADO],
seo.cuit_int as [CUIT DEL EMPLEADO]
from screening_prov_out spo
--inner join screening_empleados_out seo on seo.cuit = spo.cuit
right join screening_empleados_out seo on seo.cuit_int = spo.cuit_int
where SEO.tipo_reg = '2EMPLEOS' and seo.cliente=@IDCliente
and seo.tipo_reg is not null
and seo.razon_social is not null
order by seo.soc_vinculada ASC
*/
/*EMPLEADOS OUT*/
/*
select DISTINCT TIPO_REG from screening_prov_OUT where cliente=@IDCliente
*/
/*
select DISTINCT
'AMX ARGENTINA SOCIEDAD ANONIMA' AS razon_social,
'30663288497' as [CUIT CLIENTE],
*/
select distinct razon_social,cuit,
/*soc_vinculada as EMPLEADO,*/
padrones.nombre_persona as EMPLEADO,
cuit_soc_vinculada as cuit_empleado,tipo_reg,Nombre_integrante as VINCULADO,cuit_int as cuit_vinculado
from screening_empleados_out INNER JOIN Padrones on screening_empleados_out.cuit_soc_vinculada = padrones.identificacion
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where screening_empleados_out.cliente=@IDCliente and upper(tipo_reg) = 'FAMIL_EMP'
and cuit_soc_vinculada in (select distinct cuil from screening_empleados where cliente=@IDCliente)
union all
select distinct razon_social,cuit,
/*Nombre_integrante as empleado,*/
padrones.nombre_persona as empleado,
cuit_int as cuit_empleado,
tipo_reg,
soc_vinculada as vinculado,cuit_soc_vinculada as cuit_vinculado
from screening_empleados_out INNER JOIN Padrones on screening_empleados_out.cuit_int = padrones.identificacion
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where screening_empleados_out.cliente=@IDCliente and upper(tipo_reg) = '2EMPLEOS' and cuit_int in (select distinct cuil from screening_empleados where cliente=@IDCliente
)
union all
select distinct 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit,
/*Nombre_integrante as empleado,*/
padrones.nombre_persona as empleado,
cuit_int as cuit_empleado,
tipo_reg,
soc_vinculada as vinculado,cuit_soc_vinculada as cuit_vinculado
from screening_empleados_out INNER JOIN Padrones on screening_empleados_out.cuit_int = padrones.identificacion
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where cliente=@IDCliente and upper(tipo_reg) = 'Accio' and cuit_int in (select distinct cuil from screening_empleados where cliente=@IDCliente
)
UNION ALL
select distinct 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit,
/*Nombre_integrante as empleado,*/
padrones.nombre_persona as empleado,
cuit_int as cuit_empleado,
tipo_reg,
soc_vinculada as vinculado,cuit_soc_vinculada as cuit_vinculado
from screening_empleados_out INNER JOIN Padrones on screening_empleados_out.cuit_int = padrones.identificacion
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where cliente=@IDCliente and upper(tipo_reg) = 'SOCIOS' and cuit_int in (select distinct cuil from screening_empleados where cliente=@IDCliente)
UNION ALL
select distinct 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit,
/*Nombre_integrante as empleado,*/
padrones.nombre_persona as empleado,
cuit_int as cuit_empleado,
tipo_reg,
soc_vinculada as vinculado,cuit_soc_vinculada as cuit_vinculado
from screening_empleados_out INNER JOIN Padrones on screening_empleados_out.cuit_int = padrones.identificacion
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where cliente=@IDCliente and upper(tipo_reg) = 'SOCIOSF' and cuit_int in (select distinct cuil from screening_empleados where cliente=@IDCliente)
UNION ALL
select distinct 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit,
/*Nombre_integrante as empleado,*/
padrones.nombre_persona as empleado,
cuit_int as cuit_empleado,
tipo_reg,
soc_vinculada as vinculado,cuit_soc_vinculada as cuit_vinculado
from screening_empleados_out INNER JOIN Padrones on screening_empleados_out.cuit_int = padrones.identificacion
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where cliente=@IDCliente and tipo_reg LIKE 'SOC_CONS%' and cuit_int in (select distinct cuil from screening_empleados where cliente=@IDCliente)
order by empleado asc,VINCULADO ASC
/*
EXEC screening_OUT
declare @IDCliente int = 5546348
select distinct cuiL from screening_empleados where cliente=@IDCliente
AND CUIL = 20939309943
select DISTINCT CUIL AS BLACKLIST_AMX from screening_empleados where cliente = @IDCliente
AND CUIL=20145409366
*/
SELECT * FROM screening_cruce_revision
SELECT DISTINCT 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit, BLACKLIST_PROVEEDORES_AMX.CUIT,PADRONES.nombre_persona
FROM BLACKLIST_PROVEEDORES_AMX LEFT JOIN PADRONES ON BLACKLIST_PROVEEDORES_AMX.CUIT=PADRONES.identificacion
ORDER BY PADRONES.nombre_persona
/*
select DISTINCT 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit, screening_empleados.CUIL,PADRONES.nombre_persona from screening_empleados LEFT JOIN PADRONES ON screening_empleados.cuil=PADRONES.identificacion where cliente=@IDCliente
ORDER BY PADRONES.nombre_persona ASC
*/
/*
SELECT * FROM screening_prov_out WHERE CLIENTE = @IDCliente AND cuit_soc_vinculada IN (SELECT DISTINCT CUIT FROM BLACKLIST_PROVEEDORES_AMX)
SELECT * FROM screening_prov_out WHERE CLIENTE = @IDCliente AND (cuit_int IN (SELECT DISTINCT CUIT FROM BLACKLIST_PROVEEDORES_AMX) OR cuit_integrante IN (SELECT DISTINCT CUIT FROM BLACKLIST_PROVEEDORES_AMX))
*/
/*
SELECT DISTINCT 'AMX ARGENTINA SOCIEDAD ANONIMA','30663288497', razon_social,CUIT,nombre_integrante,cuit_int,soc_vinculada,cuit_soc_vinculada,TITULO,CARGO FROM screening_EMPLEADOS_out WHERE CLIENTE = @IDCliente AND cuit_soc_vinculada IN (SELECT DISTINCT CUIT FROM BLACKLIST_PROVEEDORES_AMX)
AND razon_social IS NOT NULL
ORDER BY razon_social
*/
SELECT DISTINCT 'AMX ARGENTINA SOCIEDAD ANONIMA','30663288497', razon_social,CUIT,nombre_integrante,cuit_int,soc_vinculada,cuit_soc_vinculada,TITULO,CARGO
FROM screening_EMPLEADOS_out WHERE CLIENTE = @IDCliente AND (cuit_int IN (SELECT DISTINCT CUIT FROM BLACKLIST_PROVEEDORES_AMX ) OR cuit_integrante IN (SELECT DISTINCT CUIT FROM BLACKLIST_PROVEEDORES_AMX))
AND razon_social IS NOT NULL
ORDER BY razon_social
/*
spo.cuit in (select distinct cuit from screening_empleados where cliente=@IDCliente)
*/
select * from screening_prov where cuit = 30625390636
SELECT * FROM PADRONES WHERE IDENTIFICACION IN (SELECT DISTINCT CUIT FROM empleados WHERE CUIL = '27270167905')
SELECT * FROM empleados WHERE CUIL = '27270167905' order by periodo desc
/*proveedores OUT*/
select distinct razon_social,cuit,'' as EMPLEADO,'' as cuit_empleado,'PARTICIPACION EN SOCIEDADES' AS tipo_reg,Nombre_integrante as VINCULADO,cuit_int as cuit_vinculado
from screening_prov_out
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where tipo_reg = 'ACCIONISTA' AND CUIT_INT IS NOT NULL and cliente=@IDCliente
union all
select distinct razon_social,cuit,'' as EMPLEADO,'' as cuit_empleado,'PARTICIPACION EN SOCIEDADES' AS tipo_reg,Nombre_integrante as VINCULADO,cuit_int as cuit_vinculado
from screening_prov_out
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where tipo_reg = 'DIRECTOR' AND CUIT_INT IS NOT NULL and cliente=@IDCliente
union all
select distinct razon_social,cuit,nombre_integrante as EMPLEADO,cuit_int as cuit_empleado,'EMPLEADO DE PROVEEDORES' AS tipo_reg,'' as VINCULADO,'' as cuit_vinculado
from screening_prov_out
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where tipo_reg = 'prov_emp' AND CUIT_INT IS NOT NULL and cliente=@IDCliente
union all
select distinct razon_social,cuit,soc_vinculada as EMPLEADO,cuit_soc_vinculada as cuit_empleado,'FAMILIAR DE LOS INTEGRANTES DE SOCIEDADES' AS tipo_reg,Nombre_integrante as VINCULADO,cuit_int as cuit_vinculado
from screening_prov_out
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where tipo_reg = 'FAMIL_INT' AND CUIT_INT IS NOT NULL and cliente=@IDCliente
union all
select distinct razon_social,cuit,'' as EMPLEADO,'' as cuit_empleado,'SOCIEDADES/CONSTITUCIONES DE PROVEEDORES' AS tipo_reg,Nombre_integrante as VINCULADO, cuit_int as cuit_vinculado
from screening_prov_out
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where tipo_reg = 'SOC_CONS_1' AND CUIT_INT IS NOT NULL and cliente=@IDCliente
union all
select distinct razon_social,cuit,'' as EMPLEADO,'' as cuit_empleado,'SOCIEDADES/CONSTITUCIONES 2DO NIVEL' AS tipo_reg,Nombre_integrante as VINCULADO, cuit_int as cuit_vinculado
from screening_prov_out
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where tipo_reg = 'SOC_CONS_2' AND CUIT_INT IS NOT NULL and cliente=@IDCliente
END
GO
GO
CREATE OR ALTER PROCEDURE dbo.screening_OUT_AMX
AS
BEGIN
declare @IDCliente int = 5546348
/*
select DISTINCT TIPO_REG from screening_prov_OUT where cliente=@IDCliente
*/
/*LISTA DE EMPLEADOS PROVISTA*/
select DISTINCT 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit, screening_empleados.CUIL,PADRONES.nombre_persona from screening_empleados LEFT JOIN PADRONES ON screening_empleados.cuil=PADRONES.identificacion where cliente=@IDCliente
ORDER BY PADRONES.nombre_persona ASC
/*PROVEEDORES APERTURADOS*/
select DISTINCT
'AMX ARGENTINA SOCIEDAD ANONIMA' AS razon_social,
'30663288497' as [CUIT CLIENTE],
/*
seo.razon_social as CLIENTE,seo.cuit as [CUIT CLIENTE],
*/
spo.razon_social as PROVEEDOR,spo.cuit as [CUIT PROVEEDOR],
CASE
WHEN spo.tipo_reg = 'FAMIL_EMP' THEN 'FAMILIAR DE EMPLEADO'
WHEN spo.tipo_reg = 'SOC_CONS_1' THEN 'SOCIEDADES/CONSTITUCIONES DE PROVEEDORES'
WHEN spo.tipo_reg = 'SOC_CONS_2' THEN 'SOCIEDADES/CONSTITUCIONES DE PROVEEDORES'
WHEN spo.tipo_reg = 'PROV_EMP' THEN 'EMPLEADO DEL PROVEEDOR'
WHEN spo.tipo_reg = 'ACCIONISTA' THEN 'ACCIONISTA'
WHEN spo.tipo_reg = 'DIRECTOR' THEN 'DIRECTOR'
WHEN spo.tipo_reg = 'EMPLE_INT' THEN 'EMPLEADO DEL INTEGRANTE DE SOCIEDAD'
WHEN spo.tipo_reg = 'FAMIL_INT' THEN 'FAMILIAR DEL INTEGRANTE DE SOCIEDAD'
END AS VINCULACION,
/*
,spo.tipo_reg,
*/
spo.soc_vinculada as [SOCIEDAD VINCULADA],spo.cuit_soc_vinculada as [CUIT DE SOCIEDAD VINCULADA]
,
padrones.nombre_persona as [APELLIDO Y NOMBRE], /*seo.nombre_integrante as [EMPLEADO],*/
seo.cuit_int as [CUIL]
from screening_prov_out spo
inner join screening_prov_out seo on seo.cuit_int = spo.cuit_int
inner join padrones on seo.cuit_int = padrones.identificacion
where
/*SEO.tipo_reg <> '2EMPLEOS' and seo.cliente=@IDCliente
and seo.tipo_reg is not null
and seo.razon_social is not null
AND */
spo.cuit in (select distinct cuit from screening_prov where cliente=@IDCliente)
/*
union all
select DISTINCT seo.razon_social as CLIENTE,seo.cuit as [CUIT CLIENTE],
seo.nombre_integrante as [EMPLEADO DEL CLIENTE],
seo.cuit_int as [CUIT DEL EMPLEADO DEL CLIENTE],
CASE
WHEN seo.tipo_reg = '2EMPLEOS' THEN 'MULTIPLES EMPLEADORES'
END AS VINCULACION,
seo.soc_vinculada as EMPLEADOR,seo.cuit_soc_vinculada as [CUIT EMPLEADOR],
seo.nombre_integrante as [EMPLEADO],
seo.cuit_int as [CUIT DEL EMPLEADO]
from screening_prov_out spo
--inner join screening_empleados_out seo on seo.cuit = spo.cuit
right join screening_empleados_out seo on seo.cuit_int = spo.cuit_int
where SEO.tipo_reg = '2EMPLEOS' and seo.cliente=@IDCliente
and seo.tipo_reg is not null
and seo.razon_social is not null
order by seo.soc_vinculada ASC
*/
/*EMPLEADOS OUT*/
/*
select DISTINCT TIPO_REG from screening_prov_OUT where cliente=@IDCliente
*/
/*
select DISTINCT
'AMX ARGENTINA SOCIEDAD ANONIMA' AS razon_social,
'30663288497' as [CUIT CLIENTE],
*/
select distinct razon_social,cuit,
/*soc_vinculada as EMPLEADO,*/
padrones.nombre_persona as EMPLEADO,
cuit_soc_vinculada as cuit_empleado,tipo_reg,Nombre_integrante as VINCULADO,cuit_int as cuit_vinculado
from screening_empleados_out INNER JOIN Padrones on screening_empleados_out.cuit_soc_vinculada = padrones.identificacion
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where screening_empleados_out.cliente=@IDCliente and upper(tipo_reg) = 'FAMIL_EMP'
and cuit_soc_vinculada in (select distinct cuil from screening_empleados where cliente=@IDCliente)
union all
select distinct razon_social,cuit,
/*Nombre_integrante as empleado,*/
padrones.nombre_persona as empleado,
cuit_int as cuit_empleado,
tipo_reg,
soc_vinculada as vinculado,cuit_soc_vinculada as cuit_vinculado
from screening_empleados_out INNER JOIN Padrones on screening_empleados_out.cuit_int = padrones.identificacion
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where screening_empleados_out.cliente=@IDCliente and upper(tipo_reg) = '2EMPLEOS' and cuit_int in (select distinct cuil from screening_empleados where cliente=@IDCliente
)
union all
select distinct 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit,
/*Nombre_integrante as empleado,*/
padrones.nombre_persona as empleado,
cuit_int as cuit_empleado,
tipo_reg,
soc_vinculada as vinculado,cuit_soc_vinculada as cuit_vinculado
from screening_empleados_out INNER JOIN Padrones on screening_empleados_out.cuit_int = padrones.identificacion
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where cliente=@IDCliente and upper(tipo_reg) = 'Accio' and cuit_int in (select distinct cuil from screening_empleados where cliente=@IDCliente
)
UNION ALL
select distinct 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit,
/*Nombre_integrante as empleado,*/
padrones.nombre_persona as empleado,
cuit_int as cuit_empleado,
tipo_reg,
soc_vinculada as vinculado,cuit_soc_vinculada as cuit_vinculado
from screening_empleados_out INNER JOIN Padrones on screening_empleados_out.cuit_int = padrones.identificacion
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where cliente=@IDCliente and upper(tipo_reg) = 'SOCIOS' and cuit_int in (select distinct cuil from screening_empleados where cliente=@IDCliente)
UNION ALL
select distinct 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit,
/*Nombre_integrante as empleado,*/
padrones.nombre_persona as empleado,
cuit_int as cuit_empleado,
tipo_reg,
soc_vinculada as vinculado,cuit_soc_vinculada as cuit_vinculado
from screening_empleados_out INNER JOIN Padrones on screening_empleados_out.cuit_int = padrones.identificacion
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where cliente=@IDCliente and upper(tipo_reg) = 'SOCIOSF' and cuit_int in (select distinct cuil from screening_empleados where cliente=@IDCliente)
UNION ALL
select distinct 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit,
/*Nombre_integrante as empleado,*/
padrones.nombre_persona as empleado,
cuit_int as cuit_empleado,
tipo_reg,
soc_vinculada as vinculado,cuit_soc_vinculada as cuit_vinculado
from screening_empleados_out INNER JOIN Padrones on screening_empleados_out.cuit_int = padrones.identificacion
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where cliente=@IDCliente and tipo_reg LIKE 'SOC_CONS%' and cuit_int in (select distinct cuil from screening_empleados where cliente=@IDCliente)
order by empleado asc,VINCULADO ASC
/*
EXEC screening_OUT
declare @IDCliente int = 5546348
select distinct cuiL from screening_empleados where cliente=@IDCliente
AND CUIL = 20939309943
select DISTINCT CUIL AS BLACKLIST_AMX from screening_empleados where cliente = @IDCliente
AND CUIL=20145409366
*/
SELECT * FROM screening_cruce_revision
SELECT DISTINCT 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit, BLACKLIST_PROVEEDORES_AMX.CUIT,PADRONES.nombre_persona
FROM BLACKLIST_PROVEEDORES_AMX LEFT JOIN PADRONES ON BLACKLIST_PROVEEDORES_AMX.CUIT=PADRONES.identificacion
ORDER BY PADRONES.nombre_persona
/*
select DISTINCT 'AMX ARGENTINA SOCIEDAD ANONIMA' as razon_social, '30663288497' as cuit, screening_empleados.CUIL,PADRONES.nombre_persona from screening_empleados LEFT JOIN PADRONES ON screening_empleados.cuil=PADRONES.identificacion where cliente=@IDCliente
ORDER BY PADRONES.nombre_persona ASC
*/
/*
SELECT * FROM screening_prov_out WHERE CLIENTE = @IDCliente AND cuit_soc_vinculada IN (SELECT DISTINCT CUIT FROM BLACKLIST_PROVEEDORES_AMX)
SELECT * FROM screening_prov_out WHERE CLIENTE = @IDCliente AND (cuit_int IN (SELECT DISTINCT CUIT FROM BLACKLIST_PROVEEDORES_AMX) OR cuit_integrante IN (SELECT DISTINCT CUIT FROM BLACKLIST_PROVEEDORES_AMX))
*/
/*
SELECT DISTINCT 'AMX ARGENTINA SOCIEDAD ANONIMA','30663288497', razon_social,CUIT,nombre_integrante,cuit_int,soc_vinculada,cuit_soc_vinculada,TITULO,CARGO FROM screening_EMPLEADOS_out WHERE CLIENTE = @IDCliente AND cuit_soc_vinculada IN (SELECT DISTINCT CUIT FROM BLACKLIST_PROVEEDORES_AMX)
AND razon_social IS NOT NULL
ORDER BY razon_social
*/
SELECT DISTINCT 'AMX ARGENTINA SOCIEDAD ANONIMA','30663288497', razon_social,CUIT,nombre_integrante,cuit_int,soc_vinculada,cuit_soc_vinculada,TITULO,CARGO
FROM screening_EMPLEADOS_out WHERE CLIENTE = @IDCliente AND (cuit_int IN (SELECT DISTINCT CUIT FROM BLACKLIST_PROVEEDORES_AMX ) OR cuit_integrante IN (SELECT DISTINCT CUIT FROM BLACKLIST_PROVEEDORES_AMX))
AND razon_social IS NOT NULL
ORDER BY razon_social
/*
spo.cuit in (select distinct cuit from screening_empleados where cliente=@IDCliente)
*/
select * from screening_prov where cuit = 30625390636
SELECT * FROM PADRONES WHERE IDENTIFICACION IN (SELECT DISTINCT CUIT FROM empleados WHERE CUIL = '27270167905')
SELECT * FROM empleados WHERE CUIL = '27270167905' order by periodo desc
/*proveedores OUT*/
select distinct razon_social,cuit,'' as EMPLEADO,'' as cuit_empleado,'PARTICIPACION EN SOCIEDADES' AS tipo_reg,Nombre_integrante as VINCULADO,cuit_int as cuit_vinculado
from screening_prov_out
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where tipo_reg = 'ACCIONISTA' AND CUIT_INT IS NOT NULL and cliente=@IDCliente
union all
select distinct razon_social,cuit,'' as EMPLEADO,'' as cuit_empleado,'PARTICIPACION EN SOCIEDADES' AS tipo_reg,Nombre_integrante as VINCULADO,cuit_int as cuit_vinculado
from screening_prov_out
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where tipo_reg = 'DIRECTOR' AND CUIT_INT IS NOT NULL and cliente=@IDCliente
union all
select distinct razon_social,cuit,nombre_integrante as EMPLEADO,cuit_int as cuit_empleado,'EMPLEADO DE PROVEEDORES' AS tipo_reg,'' as VINCULADO,'' as cuit_vinculado
from screening_prov_out
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where tipo_reg = 'prov_emp' AND CUIT_INT IS NOT NULL and cliente=@IDCliente
union all
select distinct razon_social,cuit,soc_vinculada as EMPLEADO,cuit_soc_vinculada as cuit_empleado,'FAMILIAR DE LOS INTEGRANTES DE SOCIEDADES' AS tipo_reg,Nombre_integrante as VINCULADO,cuit_int as cuit_vinculado
from screening_prov_out
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where tipo_reg = 'FAMIL_INT' AND CUIT_INT IS NOT NULL and cliente=@IDCliente
union all
select distinct razon_social,cuit,'' as EMPLEADO,'' as cuit_empleado,'SOCIEDADES/CONSTITUCIONES DE PROVEEDORES' AS tipo_reg,Nombre_integrante as VINCULADO, cuit_int as cuit_vinculado
from screening_prov_out
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where tipo_reg = 'SOC_CONS_1' AND CUIT_INT IS NOT NULL and cliente=@IDCliente
union all
select distinct razon_social,cuit,'' as EMPLEADO,'' as cuit_empleado,'SOCIEDADES/CONSTITUCIONES 2DO NIVEL' AS tipo_reg,Nombre_integrante as VINCULADO, cuit_int as cuit_vinculado
from screening_prov_out
/*
where cuit_soc_vinculada in (select distinct cuil from screening_empleados)
or (cuit_int in (select distinct cuil from screening_empleados))
*/
where tipo_reg = 'SOC_CONS_2' AND CUIT_INT IS NOT NULL and cliente=@IDCliente
END
GO
Depends On
8Used By
No items found