dbo.abm_monotributo

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

7
Name Data Type Length Description
@accion varchar 20
@id_monotributo int 4
@categoria varchar 2
@monto decimal 9
@periodo date 3
@createdBy int 4
@modified_by int 4

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.abm_monotributo
@accion varchar(20),
@id_monotributo int,
@categoria varchar(2),
@monto decimal,
@periodo date,
@createdBy int = null,
@modified_by int = null
AS

BEGIN
    SET NOCOUNT ON;
IF @accion = 'INSERT'
BEGIN
    if @categoria is not null and @monto is not null and @periodo is not null
    BEGIN
        if @categoria <> '' and @periodo <> ''
        BEGIN
            insert into monotributo(categoria, monto, periodo, created_By, modified, modified_by) values (@categoria, @monto, @periodo, @createdBy, null, null)
        END
    END
end    
IF @accion = 'UPDATE'
BEGIN
    if (select count(*) from monotributo m WHERE m.id_monotributo = @id_monotributo) = 1
    begin 
        if @categoria is not null and @monto is not null and @periodo is not null
        BEGIN
            if @categoria <> '' and @periodo <> ''
            BEGIN
                update monotributo set categoria = @categoria , monto = @monto, periodo = @periodo, modified = GETDATE(), modified_by = @modified_by    WHERE  id_monotributo = @id_monotributo
            END
        END
    end
end
if @accion = 'SEARCH'
BEGIN
    select m.categoria, m.monto, m.periodo, ISNULL(u.first_name, '') +' '+ iSNULL(u.last_name, '') modifyBy, m.id_monotributo 
    from monotributo m
    left join users u on u.user_id = m.modified_by
    WHERE m.id_monotributo = @id_monotributo
END
IF @accion = 'SELECT' 
begin
      select m.categoria, m.monto, m.periodo, ISNULL(u.first_name, '') +' '+ iSNULL(u.last_name, '') modifyBy, m.id_monotributo  
      from monotributo m
      left join users u on u.user_id = m.modified_by
END
END
GO

Depends On

2

Used By

No items found