USE [Clinica]
GO
/****** Object:  Table [Caja].[CicloCaja]    Script Date: 18-08-2025 21:40:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Caja].[CicloCaja](
	[IdCicloCaja] [int] IDENTITY(1,1) NOT NULL,
	[IdCaja] [int] NOT NULL,
	[FechaApertura] [datetime] NULL,
	[IdUsuarioCajero] [int] NOT NULL,
	[SaldoInicial] [decimal](16, 2) NOT NULL,
	[FechaCierre] [datetime] NULL,
	[SaldoFinal] [decimal](16, 2) NOT NULL,
	[FechaValidacion] [datetime] NULL,
	[IdUsuarioValidacion] [int] NULL,
	[ArchivoPdfInicial] [varchar](512) NOT NULL,
	[ArchivoPdfFirmado] [varchar](512) NOT NULL,
 CONSTRAINT [PK__CicloCaj__F982EF852E91C681] PRIMARY KEY CLUSTERED 
(
	[IdCicloCaja] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [Caja].[CicloCaja] ADD  CONSTRAINT [DF__CicloCaja__Saldo__7834CCDD]  DEFAULT ((0)) FOR [SaldoInicial]
GO
ALTER TABLE [Caja].[CicloCaja] ADD  CONSTRAINT [DF__CicloCaja__Saldo__7928F116]  DEFAULT ((0)) FOR [SaldoFinal]
GO
ALTER TABLE [Caja].[CicloCaja] ADD  CONSTRAINT [DF__CicloCaja__Archi__7B113988]  DEFAULT ('') FOR [ArchivoPdfInicial]
GO
ALTER TABLE [Caja].[CicloCaja] ADD  CONSTRAINT [DF__CicloCaja__Archi__7C055DC1]  DEFAULT ('') FOR [ArchivoPdfFirmado]
GO
ALTER TABLE [Caja].[CicloCaja]  WITH CHECK ADD  CONSTRAINT [FK__CicloCaja__IdCaj__764C846B] FOREIGN KEY([IdCaja])
REFERENCES [Caja].[Caja] ([IdCaja])
GO
ALTER TABLE [Caja].[CicloCaja] CHECK CONSTRAINT [FK__CicloCaja__IdCaj__764C846B]
GO
ALTER TABLE [Caja].[CicloCaja]  WITH CHECK ADD  CONSTRAINT [FK__CicloCaja__IdUsu__7740A8A4] FOREIGN KEY([IdUsuarioCajero])
REFERENCES [Core].[Usuario] ([IdUsuario])
GO
ALTER TABLE [Caja].[CicloCaja] CHECK CONSTRAINT [FK__CicloCaja__IdUsu__7740A8A4]
GO
ALTER TABLE [Caja].[CicloCaja]  WITH CHECK ADD  CONSTRAINT [FK__CicloCaja__IdUsu__7A1D154F] FOREIGN KEY([IdUsuarioValidacion])
REFERENCES [Core].[Usuario] ([IdUsuario])
GO
ALTER TABLE [Caja].[CicloCaja] CHECK CONSTRAINT [FK__CicloCaja__IdUsu__7A1D154F]
GO
