Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
3| Name | Data Type | Length | Description |
|---|---|---|---|
| @p_id_personal | int | 4 | |
| @p_Cuit | varchar | 20 | |
| @p_visible | bit | 1 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.backend_dotacion_personal
@p_id_personal int, -- si viene nulo busca los otros dos campos, si viene con valor solo busca por este id.
@p_Cuit varchar(20),
@p_visible bit
AS
BEGIN
SET NOCOUNT ON;
if (@p_id_personal is not null)
begin
set @p_cuit = null
set @p_visible = null
end
begin
select dotacion_personal.*,
estado = case dotacion_personal.visible
when 1 then 'ACTIVO'
when 0 then 'INACTIVO'
end,
tipo_personal.per_nombre,
(select sum(cantidad) from dotacion_personal
where (@p_Cuit is not null and
cuit = @p_Cuit
and visible = '1')) as total_personal
from dotacion_personal
inner join tipo_personal
on tipo_personal.per_codigo = dotacion_personal.per_codigo
where (@p_Cuit is not null and
cuit = @p_Cuit
and visible = @p_visible)
or (@p_id_personal is not null and
id_personal = @p_id_personal)
order by per_nombre
end
END
GO
GO
CREATE OR ALTER PROCEDURE dbo.backend_dotacion_personal
@p_id_personal int, -- si viene nulo busca los otros dos campos, si viene con valor solo busca por este id.
@p_Cuit varchar(20),
@p_visible bit
AS
BEGIN
SET NOCOUNT ON;
if (@p_id_personal is not null)
begin
set @p_cuit = null
set @p_visible = null
end
begin
select dotacion_personal.*,
estado = case dotacion_personal.visible
when 1 then 'ACTIVO'
when 0 then 'INACTIVO'
end,
tipo_personal.per_nombre,
(select sum(cantidad) from dotacion_personal
where (@p_Cuit is not null and
cuit = @p_Cuit
and visible = '1')) as total_personal
from dotacion_personal
inner join tipo_personal
on tipo_personal.per_codigo = dotacion_personal.per_codigo
where (@p_Cuit is not null and
cuit = @p_Cuit
and visible = @p_visible)
or (@p_id_personal is not null and
id_personal = @p_id_personal)
order by per_nombre
end
END
GO
Depends On
2Used By
No items found