Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
3| Name | Data Type | Length | Description |
|---|---|---|---|
| @accion | varchar | 3 | |
| @periodo | varchar | 7 | |
| @fecha | datetime | 8 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec [control_fuente] 'CI',null,'2023-06-01'
exec [control_fuente] 'CE',null,'2023-06-01'
*/
CREATE OR ALTER PROCEDURE dbo.control_fuente
@accion VARCHAR(3),
@periodo VARCHAR(7)=NULL,
@fecha DATETIME=NULL
AS
BEGIN
IF ( @accion = 'FA' )
BEGIN
-- Facturas Apocrifas
SELECT TOP 10 cuit,detectado,publicado,observaciones,created
FROM apocrifas
WHERE apocrifas.visible=1
ORDER BY apocrifas.observaciones DESC;
RETURN;
END
--
IF ( @accion = 'BBF' )
-- BBVA FootPrint
BEGIN
SELECT
anio,
mes,
periodo,
country_code,
country_name,
lista_blanca,
rating,
dtf_global,
footprint,
comentarios,
desde,
hasta,
visible
FROM LB_Footprint
WHERE
periodo=@periodo;
--
RETURN;
END
--
IF ( @accion = 'BBL' )
-- BBVA Limites y Alertas
BEGIN
SELECT
anio,
mes,
periodo,
country_code,
country_name,
umbral_limite,
umbral_alerta,
facturacion_12_meses,
aviso_facturacion,
comentarios,
desde,
hasta,
visible
FROM Limites_alertas
WHERE
periodo=@periodo;
--
RETURN;
END
--
IF ( @accion = 'ARB' )
BEGIN
SELECT TOP 10
razon_social,
cuit,
fecha_de_inicio_de_juicio
FROM Arba
WHERE
CONVERT(date,fecha_de_proceso_arba)=CONVERT(date,@fecha)
AND tipo_movimiento!=4
ORDER BY fecha_de_inicio_de_juicio DESC;
--
RETURN;
END
--
IF ( @accion = 'MA' )
BEGIN
SELECT TOP 10
ACTA,
MARCA,
TMARCA,
TIPO,
CLASE,
NBOL,
TEXP,
PALABUS,
FPRE,
FPUBLI,
TRESO,
NRESO,
FRESO,
RENU_DE,
RENU_POR,
TITULAR,
CODAGE,
PAIS,
COBERTURA,
DISPCONCE,
DISPBOLE,
DISPFBOLE,
PRIORIDAD,
FPRIORIDAD,
PPRIORIDAD,
FVTO
FROM marcas
ORDER BY modified DESC;
--
RETURN;
END
--
IF ( @accion = 'CI' )
BEGIN
SELECT TOP 10
cuit,
procedencia,
fobusd,
posicion,
fecha
FROM comex_importaciones
--WHERE YEAR(fecha)=YEAR(@fecha) AND MONTH(fecha)=MONTH(@fecha);
-- Fecha es campo varchar(10)
WHERE fecha LIKE convert(varchar(7),@fecha,126)+'%'
--
RETURN;
END
--
IF ( @accion = 'CE' )
BEGIN
DECLARE @StartDate DATE, @EndDate DATE
SET @StartDate = DATEADD(DAY, 1, EOMONTH(@Fecha, -1))
SET @EndDate = EOMONTH(@Fecha)
SELECT TOP 10
cuit,
procedencia,
fobusd,
posicion,
fecha
FROM comex_exportaciones
--WHERE YEAR(fecha)=YEAR(@fecha) AND MONTH(fecha)=MONTH(@fecha);
-- Fecha es campo date
WHERE fecha between @StartDate and @EndDate
--
RETURN;
END
--
IF ( @accion = 'CA' )
BEGIN
SELECT TOP 10
cuit,
consumo,
periodo,
temporal,
deposito,
zona_franca
FROM comercio_exterior
WHERE YEAR(periodo)=YEAR(@fecha) AND MONTH(periodo)=MONTH(@fecha);
--
RETURN;
END
--
IF ( @accion = 'CH' )
BEGIN
/* SELECT TOP 10 contenido FROM chequesBCRA_txt_altas;*/
select cuit_firmante,nro_cheque,importe,fecha_rechazo from ChequesBCRA where id_cheque > (select max(id_cheque)-10 from chequesbcra)
--
RETURN;
END
--
IF ( @accion = 'IN' )
BEGIN
SELECT TOP 10 inscripciones
FROM inscripcionestxt;
--
RETURN;
END
--
IF ( @accion = 'SU' )
BEGIN
SELECT TOP 10
tipodoc,
iden,
fecha_desde
FROM cendeu_sit1_desde;
--
RETURN;
END
-- IGJ asambleas
IF ( @accion = 'GA' )
BEGIN
SELECT TOP 10
numero_correlativo,
tipo_societario,
descripcion_tipo_societario,
razon_social,
tipo_asamblea,
descripcion_tipo_asamblea,
fecha_realizacion,
fecha_presentacion,
identificacion,
id,
procesado
FROM igj_asambleas
WHERE fecha_fuente=@fecha;
--
RETURN;
END
-- IGJ autoridades
IF ( @accion = 'GU' )
BEGIN
SELECT TOP 10
numero_correlativo,
apellido_nombre,
tipo_administrador,
descripcion_tipo_administrador,
tipo_documento,
descripcion_tipo_documento,
numero_documento
FROM igj_autoridades
WHERE fecha_fuente=@fecha;
--
RETURN;
END
-- IGJ entidades
IF ( @accion = 'GE' )
BEGIN
SELECT TOP 10
numero_correlativo,
tipo_societario,
descripcion_tipo_societario,
razon_social,
dada_de_baja,
codigo_baja,
detalle_baja,
cuit
FROM igj_entidades
WHERE fecha_fuente=@fecha;
--
RETURN;
END
-- REPSAL
IF ( @accion = 'RE' )
BEGIN
SELECT TOP 10
cuit,
razon_social,
provincia,
localidad,
actividad,
infraccion,
empleados,
publicador,
sancionador,
fecha_constatacion,
fecha_resolucion,
fecha_notificacion,
fecha_regularizacion,
fecha_pago_multa,
fecha_ingreso,
fin_publicacion,
numero_expediente
FROM repsal;
--
RETURN;
END
END
GO
GO
/*
exec [control_fuente] 'CI',null,'2023-06-01'
exec [control_fuente] 'CE',null,'2023-06-01'
*/
CREATE OR ALTER PROCEDURE dbo.control_fuente
@accion VARCHAR(3),
@periodo VARCHAR(7)=NULL,
@fecha DATETIME=NULL
AS
BEGIN
IF ( @accion = 'FA' )
BEGIN
-- Facturas Apocrifas
SELECT TOP 10 cuit,detectado,publicado,observaciones,created
FROM apocrifas
WHERE apocrifas.visible=1
ORDER BY apocrifas.observaciones DESC;
RETURN;
END
--
IF ( @accion = 'BBF' )
-- BBVA FootPrint
BEGIN
SELECT
anio,
mes,
periodo,
country_code,
country_name,
lista_blanca,
rating,
dtf_global,
footprint,
comentarios,
desde,
hasta,
visible
FROM LB_Footprint
WHERE
periodo=@periodo;
--
RETURN;
END
--
IF ( @accion = 'BBL' )
-- BBVA Limites y Alertas
BEGIN
SELECT
anio,
mes,
periodo,
country_code,
country_name,
umbral_limite,
umbral_alerta,
facturacion_12_meses,
aviso_facturacion,
comentarios,
desde,
hasta,
visible
FROM Limites_alertas
WHERE
periodo=@periodo;
--
RETURN;
END
--
IF ( @accion = 'ARB' )
BEGIN
SELECT TOP 10
razon_social,
cuit,
fecha_de_inicio_de_juicio
FROM Arba
WHERE
CONVERT(date,fecha_de_proceso_arba)=CONVERT(date,@fecha)
AND tipo_movimiento!=4
ORDER BY fecha_de_inicio_de_juicio DESC;
--
RETURN;
END
--
IF ( @accion = 'MA' )
BEGIN
SELECT TOP 10
ACTA,
MARCA,
TMARCA,
TIPO,
CLASE,
NBOL,
TEXP,
PALABUS,
FPRE,
FPUBLI,
TRESO,
NRESO,
FRESO,
RENU_DE,
RENU_POR,
TITULAR,
CODAGE,
PAIS,
COBERTURA,
DISPCONCE,
DISPBOLE,
DISPFBOLE,
PRIORIDAD,
FPRIORIDAD,
PPRIORIDAD,
FVTO
FROM marcas
ORDER BY modified DESC;
--
RETURN;
END
--
IF ( @accion = 'CI' )
BEGIN
SELECT TOP 10
cuit,
procedencia,
fobusd,
posicion,
fecha
FROM comex_importaciones
--WHERE YEAR(fecha)=YEAR(@fecha) AND MONTH(fecha)=MONTH(@fecha);
-- Fecha es campo varchar(10)
WHERE fecha LIKE convert(varchar(7),@fecha,126)+'%'
--
RETURN;
END
--
IF ( @accion = 'CE' )
BEGIN
DECLARE @StartDate DATE, @EndDate DATE
SET @StartDate = DATEADD(DAY, 1, EOMONTH(@Fecha, -1))
SET @EndDate = EOMONTH(@Fecha)
SELECT TOP 10
cuit,
procedencia,
fobusd,
posicion,
fecha
FROM comex_exportaciones
--WHERE YEAR(fecha)=YEAR(@fecha) AND MONTH(fecha)=MONTH(@fecha);
-- Fecha es campo date
WHERE fecha between @StartDate and @EndDate
--
RETURN;
END
--
IF ( @accion = 'CA' )
BEGIN
SELECT TOP 10
cuit,
consumo,
periodo,
temporal,
deposito,
zona_franca
FROM comercio_exterior
WHERE YEAR(periodo)=YEAR(@fecha) AND MONTH(periodo)=MONTH(@fecha);
--
RETURN;
END
--
IF ( @accion = 'CH' )
BEGIN
/* SELECT TOP 10 contenido FROM chequesBCRA_txt_altas;*/
select cuit_firmante,nro_cheque,importe,fecha_rechazo from ChequesBCRA where id_cheque > (select max(id_cheque)-10 from chequesbcra)
--
RETURN;
END
--
IF ( @accion = 'IN' )
BEGIN
SELECT TOP 10 inscripciones
FROM inscripcionestxt;
--
RETURN;
END
--
IF ( @accion = 'SU' )
BEGIN
SELECT TOP 10
tipodoc,
iden,
fecha_desde
FROM cendeu_sit1_desde;
--
RETURN;
END
-- IGJ asambleas
IF ( @accion = 'GA' )
BEGIN
SELECT TOP 10
numero_correlativo,
tipo_societario,
descripcion_tipo_societario,
razon_social,
tipo_asamblea,
descripcion_tipo_asamblea,
fecha_realizacion,
fecha_presentacion,
identificacion,
id,
procesado
FROM igj_asambleas
WHERE fecha_fuente=@fecha;
--
RETURN;
END
-- IGJ autoridades
IF ( @accion = 'GU' )
BEGIN
SELECT TOP 10
numero_correlativo,
apellido_nombre,
tipo_administrador,
descripcion_tipo_administrador,
tipo_documento,
descripcion_tipo_documento,
numero_documento
FROM igj_autoridades
WHERE fecha_fuente=@fecha;
--
RETURN;
END
-- IGJ entidades
IF ( @accion = 'GE' )
BEGIN
SELECT TOP 10
numero_correlativo,
tipo_societario,
descripcion_tipo_societario,
razon_social,
dada_de_baja,
codigo_baja,
detalle_baja,
cuit
FROM igj_entidades
WHERE fecha_fuente=@fecha;
--
RETURN;
END
-- REPSAL
IF ( @accion = 'RE' )
BEGIN
SELECT TOP 10
cuit,
razon_social,
provincia,
localidad,
actividad,
infraccion,
empleados,
publicador,
sancionador,
fecha_constatacion,
fecha_resolucion,
fecha_notificacion,
fecha_regularizacion,
fecha_pago_multa,
fecha_ingreso,
fin_publicacion,
numero_expediente
FROM repsal;
--
RETURN;
END
END
GO
Depends On
15Used By
No items found