Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
1| Name | Data Type | Length | Description |
|---|---|---|---|
| @accion | varchar | 10 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- exec balances_backup 'CONPDF'
CREATE OR ALTER PROCEDURE dbo.balances_backup
@accion varchar(10)
AS
BEGIN
if (@accion = 'CONPDF')
BEGIN
/* select a.cuit,PADRONES.nombre_persona AS razon_social, clae.cod_clae, clae.descripcion, ramos1.cod_ramo, ramos1.descripcion, max(year(fecha_balance)) as periodo,a.ruta_archivo
from balances_contables a
inner join padrones on (identificacion = a.cuit and identificador in (select identificador from identificadores where country_code = 'AR') AND HABILITADO=1)
left join clae on (clae.cuit = a.cuit and clae.principal = 1 and clae.visible = 1 and formulario = 883)
left join ramos on (ramos.cod_subramo = clae.cod_clae and ramos.cod_ramo > 100)
left join ramos ramos1 on (ramos1.cod_ramo = ramos.cod_ramo and ramos1.tipo_ramo = 'R')
where isnull(a.ruta_archivo,'') != ''
and a.bal_manifestacion = 'B'
and a.cuit like '3%'
and a.visible = 1 and a.estado = 'PUBLICADO'
and not exists (select * from balances_contables b where b.cuit = a.cuit and b.fecha_balance > a.fecha_balance and isnull(b.ruta_archivo,'') = ''
and b.bal_manifestacion = 'B'
and b.visible = 1 and b.estado = 'PUBLICADO')
group by a.cuit,clae.cod_clae, clae.descripcion, ramos1.cod_ramo, ramos1.descripcion,a.ruta_archivo,PADRONES.nombre_persona
*/
select a.cuit,PADRONES.nombre_persona AS razon_social, year(fecha_balance) as periodo,a.ruta_archivo
from balances_contables a
inner join padrones on (identificacion = a.cuit and identificador in (select identificador from identificadores where country_code = 'AR') AND HABILITADO=1)
where isnull(a.ruta_archivo,'') != ''
and a.bal_manifestacion = 'B'
and a.cuit like '3%'
-- and a.cuit='30708527501'
and a.visible = 1 and a.estado = 'PUBLICADO'
and not exists (select * from balances_contables b where b.cuit = a.cuit and b.fecha_balance > a.fecha_balance and isnull(b.ruta_archivo,'') = ''
and b.bal_manifestacion = 'B'
and b.visible = 1 and b.estado = 'PUBLICADO')
--group by a.cuit,a.ruta_archivo,PADRONES.nombre_persona
END
if (@accion = 'SINPDF')
BEGIN
/*select a.cuit,PADRONES.nombre_persona AS razon_social,clae.cod_clae, clae.descripcion, ramos1.cod_ramo, ramos1.descripcion, max(year(fecha_balance)) as periodo,a.ruta_archivo
from balances_contables a
inner join padrones on (identificacion = a.cuit and identificador in (select identificador from identificadores where country_code = 'AR') and habilitado=1)
left join clae on (clae.cuit = a.cuit and clae.principal = 1 and clae.visible = 1 and formulario = 883 )
left join ramos on (ramos.cod_subramo = clae.cod_clae and ramos.cod_ramo > 100)
left join ramos ramos1 on (ramos1.cod_ramo = ramos.cod_ramo and ramos1.tipo_ramo = 'R')
where isnull(a.ruta_archivo,'') = ''
and a.bal_manifestacion = 'B'
and a.cuit like '3%'
and a.cuit='30504792362'
and a.visible = 1 and a.estado = 'PUBLICADO'
and not exists (select * from balances_contables b where b.cuit = a.cuit and b.fecha_balance > a.fecha_balance and isnull(b.ruta_archivo,'') != ''
and b.bal_manifestacion = 'B'
and b.visible = 1 and b.estado = 'PUBLICADO')
group by a.cuit,clae.cod_clae, clae.descripcion, ramos1.cod_ramo, ramos1.descripcion,a.ruta_archivo,PADRONES.nombre_persona
*/
-- exec balances_backup 'SINPDF'
select a.cuit,PADRONES.nombre_persona AS razon_social, year(fecha_balance) as periodo
--,a.ruta_archivo
from balances_contables a
inner join padrones on (identificacion = a.cuit and identificador in (select identificador from identificadores where country_code = 'AR') and habilitado=1)
where isnull(a.ruta_archivo,'') = ''
and a.bal_manifestacion = 'B'
and a.cuit like '3%'
--and a.cuit='30504792362'
and a.cuit !='30111111118'
and a.visible = 1 and a.estado = 'PUBLICADO'
and not exists (select * from balances_contables b where b.cuit = a.cuit and b.fecha_balance > a.fecha_balance and isnull(b.ruta_archivo,'') != ''
and b.bal_manifestacion = 'B'
and b.visible = 1 and b.estado = 'PUBLICADO')
--group by a.cuit,a.ruta_archivo,PADRONES.nombre_persona
END
END
GO
GO
-- exec balances_backup 'CONPDF'
CREATE OR ALTER PROCEDURE dbo.balances_backup
@accion varchar(10)
AS
BEGIN
if (@accion = 'CONPDF')
BEGIN
/* select a.cuit,PADRONES.nombre_persona AS razon_social, clae.cod_clae, clae.descripcion, ramos1.cod_ramo, ramos1.descripcion, max(year(fecha_balance)) as periodo,a.ruta_archivo
from balances_contables a
inner join padrones on (identificacion = a.cuit and identificador in (select identificador from identificadores where country_code = 'AR') AND HABILITADO=1)
left join clae on (clae.cuit = a.cuit and clae.principal = 1 and clae.visible = 1 and formulario = 883)
left join ramos on (ramos.cod_subramo = clae.cod_clae and ramos.cod_ramo > 100)
left join ramos ramos1 on (ramos1.cod_ramo = ramos.cod_ramo and ramos1.tipo_ramo = 'R')
where isnull(a.ruta_archivo,'') != ''
and a.bal_manifestacion = 'B'
and a.cuit like '3%'
and a.visible = 1 and a.estado = 'PUBLICADO'
and not exists (select * from balances_contables b where b.cuit = a.cuit and b.fecha_balance > a.fecha_balance and isnull(b.ruta_archivo,'') = ''
and b.bal_manifestacion = 'B'
and b.visible = 1 and b.estado = 'PUBLICADO')
group by a.cuit,clae.cod_clae, clae.descripcion, ramos1.cod_ramo, ramos1.descripcion,a.ruta_archivo,PADRONES.nombre_persona
*/
select a.cuit,PADRONES.nombre_persona AS razon_social, year(fecha_balance) as periodo,a.ruta_archivo
from balances_contables a
inner join padrones on (identificacion = a.cuit and identificador in (select identificador from identificadores where country_code = 'AR') AND HABILITADO=1)
where isnull(a.ruta_archivo,'') != ''
and a.bal_manifestacion = 'B'
and a.cuit like '3%'
-- and a.cuit='30708527501'
and a.visible = 1 and a.estado = 'PUBLICADO'
and not exists (select * from balances_contables b where b.cuit = a.cuit and b.fecha_balance > a.fecha_balance and isnull(b.ruta_archivo,'') = ''
and b.bal_manifestacion = 'B'
and b.visible = 1 and b.estado = 'PUBLICADO')
--group by a.cuit,a.ruta_archivo,PADRONES.nombre_persona
END
if (@accion = 'SINPDF')
BEGIN
/*select a.cuit,PADRONES.nombre_persona AS razon_social,clae.cod_clae, clae.descripcion, ramos1.cod_ramo, ramos1.descripcion, max(year(fecha_balance)) as periodo,a.ruta_archivo
from balances_contables a
inner join padrones on (identificacion = a.cuit and identificador in (select identificador from identificadores where country_code = 'AR') and habilitado=1)
left join clae on (clae.cuit = a.cuit and clae.principal = 1 and clae.visible = 1 and formulario = 883 )
left join ramos on (ramos.cod_subramo = clae.cod_clae and ramos.cod_ramo > 100)
left join ramos ramos1 on (ramos1.cod_ramo = ramos.cod_ramo and ramos1.tipo_ramo = 'R')
where isnull(a.ruta_archivo,'') = ''
and a.bal_manifestacion = 'B'
and a.cuit like '3%'
and a.cuit='30504792362'
and a.visible = 1 and a.estado = 'PUBLICADO'
and not exists (select * from balances_contables b where b.cuit = a.cuit and b.fecha_balance > a.fecha_balance and isnull(b.ruta_archivo,'') != ''
and b.bal_manifestacion = 'B'
and b.visible = 1 and b.estado = 'PUBLICADO')
group by a.cuit,clae.cod_clae, clae.descripcion, ramos1.cod_ramo, ramos1.descripcion,a.ruta_archivo,PADRONES.nombre_persona
*/
-- exec balances_backup 'SINPDF'
select a.cuit,PADRONES.nombre_persona AS razon_social, year(fecha_balance) as periodo
--,a.ruta_archivo
from balances_contables a
inner join padrones on (identificacion = a.cuit and identificador in (select identificador from identificadores where country_code = 'AR') and habilitado=1)
where isnull(a.ruta_archivo,'') = ''
and a.bal_manifestacion = 'B'
and a.cuit like '3%'
--and a.cuit='30504792362'
and a.cuit !='30111111118'
and a.visible = 1 and a.estado = 'PUBLICADO'
and not exists (select * from balances_contables b where b.cuit = a.cuit and b.fecha_balance > a.fecha_balance and isnull(b.ruta_archivo,'') != ''
and b.bal_manifestacion = 'B'
and b.visible = 1 and b.estado = 'PUBLICADO')
--group by a.cuit,a.ruta_archivo,PADRONES.nombre_persona
END
END
GO
Depends On
3Used By
No items found