Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
4| Name | Data Type | Length | Description |
|---|---|---|---|
| @cuit | varchar | 20 | |
| @fecha_inscripcion | varchar | 50 | |
| @fecha_contrato_social | varchar | 50 | |
| @user | int | 4 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.afip_padron_datos_sociedad
@cuit varchar(20),
@fecha_inscripcion varchar(50),
@fecha_contrato_social varchar(50),
@user int
AS
BEGIN
SET NOCOUNT ON;
if ( @fecha_inscripcion = '' ) begin set @fecha_inscripcion = null end
if ( @fecha_contrato_social = '' ) begin set @fecha_contrato_social = null end
declare @id_padron int = (select top 1 id_padron from padrones where identificacion = @cuit and habilitado = 1 order by id_padron)
if (select COUNT(*) from datos_sociedades where cuit = @cuit) = 0
begin
insert into datos_sociedades (cuit, id_padron, fecha_cons, fecha_ins_rpc, created)
values (@cuit, @id_padron, @fecha_contrato_social, @fecha_inscripcion, GETDATE())
end
else
begin
update datos_sociedades
set id_padron = @id_padron,
fecha_cons = @fecha_contrato_social,
fecha_ins_rpc = @fecha_inscripcion,
modified = GETDATE()
where cuit = @cuit
end
return '0'
END
GO
GO
CREATE OR ALTER PROCEDURE dbo.afip_padron_datos_sociedad
@cuit varchar(20),
@fecha_inscripcion varchar(50),
@fecha_contrato_social varchar(50),
@user int
AS
BEGIN
SET NOCOUNT ON;
if ( @fecha_inscripcion = '' ) begin set @fecha_inscripcion = null end
if ( @fecha_contrato_social = '' ) begin set @fecha_contrato_social = null end
declare @id_padron int = (select top 1 id_padron from padrones where identificacion = @cuit and habilitado = 1 order by id_padron)
if (select COUNT(*) from datos_sociedades where cuit = @cuit) = 0
begin
insert into datos_sociedades (cuit, id_padron, fecha_cons, fecha_ins_rpc, created)
values (@cuit, @id_padron, @fecha_contrato_social, @fecha_inscripcion, GETDATE())
end
else
begin
update datos_sociedades
set id_padron = @id_padron,
fecha_cons = @fecha_contrato_social,
fecha_ins_rpc = @fecha_inscripcion,
modified = GETDATE()
where cuit = @cuit
end
return '0'
END
GO
Depends On
2Used By
No items found