USE [PAGOS]
GO
/****** Object: Table [dbo].[Concepto] Script Date: 03/03/2015 00:47:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Concepto](
[Codigo] [INT] NOT NULL,
[Descrip] [VARCHAR](MAX) NOT NULL,
[Tipo] [CHAR](1) NULL,
PRIMARY KEY CLUSTERED
(
[Codigo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[Cargo] Script Date: 03/03/2015 00:47:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Cargo](
[Codigo] [INT] NOT NULL,
[Descripcion] [VARCHAR](MAX) NOT NULL,
[Salario] [REAL] NOT NULL,
CONSTRAINT [PK__Cargo__06370DAD0425A276] PRIMARY KEY CLUSTERED
(
[Codigo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[Periodo] Script Date: 03/03/2015 00:47:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Periodo](
[Codigo] [INT] NOT NULL,
[Ano] [CHAR](4) NULL,
[Fechaini] [smalldatetime] NOT NULL,
[Fechafin] [smalldatetime] NOT NULL,
PRIMARY KEY CLUSTERED
(
[Codigo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: StoredProcedure [dbo].[listadeperiodos] Script Date: 03/03/2015 00:47:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[listadeperiodos]
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT Codigo FROM Periodo
END
GO
/****** Object: StoredProcedure [dbo].[listadeconceptos] Script Date: 03/03/2015 00:47:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[listadeconceptos]
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT Codigo , Descrip FROM Concepto
END
GO
/****** Object: StoredProcedure [dbo].[listadecargos] Script Date: 03/03/2015 00:47:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[listadecargos]
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT Codigo,Descripcion FROM Cargo
END
GO
/****** Object: Table [dbo].[Empleado] Script Date: 03/03/2015 00:47:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Empleado](
[Id] [INT] NOT NULL,
[Nombres] [VARCHAR](MAX) NOT NULL,
[Apellidos] [VARCHAR](MAX) NOT NULL,
[Sexo] [CHAR](1) NULL,
[Cargo] [INT] NOT NULL,
PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: StoredProcedure [dbo].[buscarinicial] Script Date: 03/03/2015 00:47:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[buscarinicial]
-- Add the parameters for the stored procedure here
@inicial VARCHAR(10),@sexo VARCHAR(10)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT Id,nombres,apellidos FROM Empleado WHERE Nombres LIKE @inicial+'%' AND sexo LIKE @sexo
END
GO
/****** Object: Table [dbo].[MovimientoNomina] Script Date: 03/03/2015 00:47:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MovimientoNomina](
[idPeriodo] [INT] NOT NULL,
[IdEmpleado] [INT] NOT NULL,
[idConcepto] [INT] NOT NULL,
[Valor] [REAL] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Liquidacion] Script Date: 03/03/2015 00:47:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Liquidacion](
[Periodo] [INT] NOT NULL,
[IdEmpleado] [INT] NOT NULL,
[Neto] [REAL] NULL
) ON [PRIMARY]
GO
/****** Object: StoredProcedure [dbo].[ingresarmovimiento] Script Date: 03/03/2015 00:47:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[ingresarmovimiento]
-- Add the parameters for the stored procedure here
@periodo INT,
@empleado INT,
@concepto INT,
@valor REAL
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO MovimientoNomina VALUES(@periodo,@empleado,@concepto,@valor)
END
GO
/****** Object: StoredProcedure [dbo].[liquidar] Script Date: 03/03/2015 00:47:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[liquidar]
-- Add the parameters for the stored procedure here
@periodo INT,
@empleado INT,
@neto REAL
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO Liquidacion VALUES(@periodo,@empleado,@neto)
END
GO
/****** Object: ForeignKey [FK_Empleado_Cargo] Script Date: 03/03/2015 00:47:11 ******/
ALTER TABLE [dbo].[Empleado] WITH CHECK ADD CONSTRAINT [FK_Empleado_Cargo] FOREIGN KEY([Cargo])
REFERENCES [dbo].[Cargo] ([Codigo])
GO
ALTER TABLE [dbo].[Empleado] CHECK CONSTRAINT [FK_Empleado_Cargo]
GO
/****** Object: ForeignKey [FK_Liquidacion_IdEmpleado] Script Date: 03/03/2015 00:47:11 ******/
ALTER TABLE [dbo].[Liquidacion] WITH CHECK ADD CONSTRAINT [FK_Liquidacion_IdEmpleado] FOREIGN KEY([IdEmpleado])
REFERENCES [dbo].[Empleado] ([Id])
GO
ALTER TABLE [dbo].[Liquidacion] CHECK CONSTRAINT [FK_Liquidacion_IdEmpleado]
GO
/****** Object: ForeignKey [FK_Liquidacion_Periodo] Script Date: 03/03/2015 00:47:11 ******/
ALTER TABLE [dbo].[Liquidacion] WITH CHECK ADD CONSTRAINT [FK_Liquidacion_Periodo] FOREIGN KEY([Periodo])
REFERENCES [dbo].[Periodo] ([Codigo])
GO
ALTER TABLE [dbo].[Liquidacion] CHECK CONSTRAINT [FK_Liquidacion_Periodo]
GO
/****** Object: ForeignKey [FK_Movimientos_idConcepto] Script Date: 03/03/2015 00:47:11 ******/
ALTER TABLE [dbo].[MovimientoNomina] WITH CHECK ADD CONSTRAINT [FK_Movimientos_idConcepto] FOREIGN KEY([idConcepto])
REFERENCES [dbo].[Concepto] ([Codigo])
GO
ALTER TABLE [dbo].[MovimientoNomina] CHECK CONSTRAINT [FK_Movimientos_idConcepto]
GO
/****** Object: ForeignKey [FK_Movimientos_IdEmpleado] Script Date: 03/03/2015 00:47:11 ******/
ALTER TABLE [dbo].[MovimientoNomina] WITH CHECK ADD CONSTRAINT [FK_Movimientos_IdEmpleado] FOREIGN KEY([IdEmpleado])
REFERENCES [dbo].[Empleado] ([Id])
GO
ALTER TABLE [dbo].[MovimientoNomina] CHECK CONSTRAINT [FK_Movimientos_IdEmpleado]
GO
/****** Object: ForeignKey [FK_Movimientos_idPeriodo] Script Date: 03/03/2015 00:47:11 ******/
ALTER TABLE [dbo].[MovimientoNomina] WITH CHECK ADD CONSTRAINT [FK_Movimientos_idPeriodo] FOREIGN KEY([idPeriodo])
REFERENCES [dbo].[Periodo] ([Codigo])
GO
ALTER TABLE [dbo].[MovimientoNomina] CHECK CONSTRAINT [FK_Movimientos_idPeriodo]
GO