﻿-------------------------Ali 2023-09-11---------------------------

update NotificationTemplateType set IsNotificationTimingEnabled=1 where NotificationTemplateTypeCode NOT IN(3,4)
Go
-------------------------End 2023-09-11---------------------------
--------------------------------------- Hammad  2023-06-06 ------

INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES (661, N' Vaction Due', N' أرصدة الإجازات', 485, N'/NotificationService/EmailVactionDue', N'Index', N'fa fa-thumb-tack', N'get', 2, 1, 1)
GO
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (16031, N' أرصدة الإجازات', N'Vaction Due', 661, 1)
GO
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (16032, N'عرض  أرصدة الإجازات', N'View Vaction Due', 661, 2)
GO
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (16033, N'إضافة  أرصدة الإجازات', N'Add Vaction Due  ', 661, 2)
GO
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (16034, N'تعديل  أرصدة الإجازات', N'Edit Vaction Due', 661, 2)
GO
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (16035, N'حفظ  أرصدة الإجازات', N'Save Vaction Due', 661, 2)


INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (1082, N'NotificationService', N'EmailVactionDue', N'Index', 0, N'get', 16031)
GO
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (1083, N'NotificationService', N'EmailVactionDue', N'EmailVactionDue_Read', 0, N'post', 16032)
GO
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (1084, N'NotificationService', N'EmailVactionDue', N'Save', 2, N'get', 16033)
GO
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (1085, N'NotificationService', N'EmailVactionDue', N'Save', 0, N'post', 16034)
GO
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (1086, N'NotificationService', N'EmailVactionDue', N'Delete', 0, N'post', 16035)
GO


INSERT [dbo].[SystemMenuModule] ([SystemMenuCode], [AppModuleCode]) VALUES (661, 13)



CREATE TABLE [dbo].[NotifVactionDue](
	[NotifVactionDueCode] [int] IDENTITY(1,1) NOT NULL,
	[PYear] [smallint] NOT NULL,
	[Period] [tinyint] NOT NULL,
	[CreatedBy] [int] NOT NULL,
	[CreationDate] [datetime] NOT NULL,
	[ModifiedBy] [int] NULL,
	[ModificationDate] [datetime] NULL,
	[SectionCode] [nvarchar](max) NULL,
	[MDT] [datetime] NULL,
	[Status] [tinyint] NULL,
	[ConPeriod] [tinyint] NOT NULL,
 CONSTRAINT [PK_NotifVactionDue] PRIMARY KEY CLUSTERED 
(
	[NotifVactionDueCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[NotifVactionDue]  WITH CHECK ADD  CONSTRAINT [FK_NotifVactionDue_ConPeriod] FOREIGN KEY([ConPeriod])
REFERENCES [dbo].[Periods] ([Period])
GO

ALTER TABLE [dbo].[NotifVactionDue] CHECK CONSTRAINT [FK_NotifVactionDue_ConPeriod]
GO

ALTER TABLE [dbo].[NotifVactionDue]  WITH CHECK ADD  CONSTRAINT [FK_NotifVactionDue_CreatedBy] FOREIGN KEY([CreatedBy])
REFERENCES [dbo].[SecurityUser] ([SecurityUserCode])
GO

ALTER TABLE [dbo].[NotifVactionDue] CHECK CONSTRAINT [FK_NotifVactionDue_CreatedBy]
GO

ALTER TABLE [dbo].[NotifVactionDue]  WITH CHECK ADD  CONSTRAINT [FK_NotifVactionDue_ModifiedBy] FOREIGN KEY([ModifiedBy])
REFERENCES [dbo].[SecurityUser] ([SecurityUserCode])
GO

ALTER TABLE [dbo].[NotifVactionDue] CHECK CONSTRAINT [FK_NotifVactionDue_ModifiedBy]
GO

ALTER TABLE [dbo].[NotifVactionDue]  WITH CHECK ADD  CONSTRAINT [FK_NotifVactionDue_Periods] FOREIGN KEY([Period])
REFERENCES [dbo].[Periods] ([Period])
GO

ALTER TABLE [dbo].[NotifVactionDue] CHECK CONSTRAINT [FK_NotifVactionDue_Periods]
GO




CREATE TABLE [dbo].[NotifVactionDueDetail](
	[NotifVactionDueDetailCode] [int] IDENTITY(1,1) NOT NULL,
	[NotifVactionDueCode] [int] NOT NULL,
	[EmployeeCode] [int] NOT NULL,
	[EMail] [varchar](250) NULL,
	[IsSent] [bit] NOT NULL,
	[SentDate] [datetime] NULL,
	[Reason] [nvarchar](max) NULL,
	[MDT] [datetime] NULL,
 CONSTRAINT [PK_NotifVactionDueDetail] PRIMARY KEY CLUSTERED 
(
	[NotifVactionDueDetailCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[NotifVactionDueDetail]  WITH CHECK ADD  CONSTRAINT [FK_NotifVactionDueDetail_Employees] FOREIGN KEY([EmployeeCode])
REFERENCES [dbo].[Employees] ([EmployeeCode])
GO

ALTER TABLE [dbo].[NotifVactionDueDetail] CHECK CONSTRAINT [FK_NotifVactionDueDetail_Employees]
GO

ALTER TABLE [dbo].[NotifVactionDueDetail]  WITH CHECK ADD  CONSTRAINT [FK_NotifVactionDueDetail_NotifVactionDue] FOREIGN KEY([NotifVactionDueCode])
REFERENCES [dbo].[NotifVactionDue] ([NotifVactionDueCode])
GO

ALTER TABLE [dbo].[NotifVactionDueDetail] CHECK CONSTRAINT [FK_NotifVactionDueDetail_NotifVactionDue]
GO




CREATE TABLE [dbo].[EmployeesFlags](
	[EmployeeCode] [int] NOT NULL,
	[IgnoreCostCenterdifferent] [bit] NULL,
	[StopPrivateTimePermissions] [bit] NULL,
	[NotApplicableToConvertToAbsentOption] [bit] NULL,
	[MDT] [datetime] NULL,
	[StopUpdateOtherSystem] [bit] NULL,
	[OutofSymbioticContribution] [bit] NULL,
	[NotApplicableToConvertToAbsentOptionOneTime] [bit] NULL,
	[CovertTimeOutToTimeIn] [bit] NULL,
	[HeHasNoRightToReceiveVacationsBalancesReport] [bit] NULL,
 CONSTRAINT [PK_EmployeesFlags] PRIMARY KEY CLUSTERED 
(
	[EmployeeCode] 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

ALTER TABLE [dbo].[EmployeesFlags] ADD  CONSTRAINT [DF_EmployeesFlags_IgnoreCostCenterdifferent]  DEFAULT ((0)) FOR [IgnoreCostCenterdifferent]
GO

ALTER TABLE [dbo].[EmployeesFlags] ADD  CONSTRAINT [DF_EmployeesFlags_StopPrivateTimePermissions]  DEFAULT ((0)) FOR [StopPrivateTimePermissions]
GO

ALTER TABLE [dbo].[EmployeesFlags] ADD  CONSTRAINT [DF_EmployeesFlags_NotApplicableToConvertToAbsentOption]  DEFAULT ((0)) FOR [NotApplicableToConvertToAbsentOption]
GO

ALTER TABLE [dbo].[EmployeesFlags] ADD  CONSTRAINT [DF_EmployeesFlags_StopUpdateOtherSystem]  DEFAULT ((0)) FOR [StopUpdateOtherSystem]
GO

ALTER TABLE [dbo].[EmployeesFlags] ADD  CONSTRAINT [DF_EmployeesFlags_OutofSymbioticContribution]  DEFAULT ((0)) FOR [OutofSymbioticContribution]
GO

ALTER TABLE [dbo].[EmployeesFlags] ADD  CONSTRAINT [DF_EmployeesFlags_NotApplicableToConvertToAbsentOptionOneTime]  DEFAULT ((0)) FOR [NotApplicableToConvertToAbsentOptionOneTime]
GO

ALTER TABLE [dbo].[EmployeesFlags] ADD  CONSTRAINT [DF_EmployeesFlags_CovertTimeOutToTimeIn]  DEFAULT ((0)) FOR [CovertTimeOutToTimeIn]
GO




--------------------------------------- End  2023-06-06 ------
