﻿
  -----------------------------------------’Mostafa 2025-07-2--------------------
  
INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(1175,N'Employee Rule Filter',N'ترشحات الموظفين',1039,N'/EmployeeRuleFilter',N'Index','fa-solid fa-users',N'get',20,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(1175,6)
Go

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(1438,N'ترشحات الموظفين',N'Employee Rule Filter',1175,1)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(1439,N'عرض ترشحات الموظفين',N'View Employee Rule Filter',1175,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(1440,N'إضافة ترشحات الموظفين',N'Add Employee Rule Filter',1175,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(1441,N'تعديل ترشحات الموظفين',N'Edit Employee Rule Filter',1175,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(1442,N'حذف ترشحات الموظفين',N'Delete Employee Rule Filter',1175,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(1443,N'حفظ ترشحات الموظفين',N'Save Employee Rule Filter',1175,2)
Go



  -----------------------------------------End 2025-07-2--------------------
  -----------------------------------------Ali 2025-07-7--------------------

   INSERT[dbo].[ConfigParameter]  ([ConfigKey], [Name], [Arabic_Name], [ConfigValue], [ConfigCategoryCode], [OrderNo], [ConfigType], [IsVisible], [ModifiedBy], [ModificationDate], [RequestTypeId],[ConfigDescription])
VALUES(N'Wf_HideReplacementEmployee',N'Hide replacement employee',N'اخفاء الموظف البديل',N'false',2,53,1,1,Null,Null,11,N'اخفاء الموظف البديل بحيث يكون لها اولويه عن الموظف البديل اجبارى فى نوع الاجازه')
Go
  -----------------------------------------End 2025-07-7--------------------
  -----------------------------------------Ali 2025-07-8--------------------
  
   ALTER TABLE dbo.Rec_RecruitEmployeeExperiance ADD
	IsHotel bit NOT NULL CONSTRAINT DF_Rec_RecruitEmployeeExperiance_IsHotel DEFAULT ((0)),
	Area nvarchar(150) NULL,
	AverageServiceAllowance float(53) NULL,
	PreviousSalary float(53) NULL,
	RoomNumber int NULL
GO
  -----------------------------------------End 2025-07-8--------------------
  -----------------------------------------Hammad 2025-07-8-----------------

INSERT [dbo].[NotificationTemplateType] ([NotificationTemplateTypeCode], [Name], [Arabic_Name], [IsEditable], [NotificationTiming], [IsNotificationTimingEnabled], [DurationType], [Duration], [IsDurationEnabled], [SenderUserName], [SenderFrom], [SenderPassword], [SenderHostName], [SenderPort], [SenderName], [IsActive], [MinVacationBalance], [IsSendToOldManager], [MDT], [EnableSsl], [EnableAttachment], [HaveUserAccount], [IsSendWhatsAppNotifications], [IsSendRealTimeMobileNotifications], [IsSendEmailNotifications], [NotificationTypeCondition]) 
VALUES (28, N'Salary Approval', N'إعتماد المرتبات', 0, 6, 1, 1, 1, 0, N'sstdev65@gmail.com', N'sstdev65@gmail.com', N'Oxe5A5B94hEAX71eHkljEg==', N'smtp.gmail.com', 587, N'SST System', 1, NULL, 0, NULL, 1, 0, 1, 0, 0, 1, NULL)
GO

INSERT [dbo].[NotificationTemplate] ([Name], [Arabic_Name], [NotificationTemplateTypeCode], [Subject], [Body], [IsDefault], [MDT], [NotificationBody], [NotificationBody_Arabic]) 
VALUES ( N'Salary Approval', N'إعتماد المرتبات', 28, N'إعتماد المرتبات', N'تم&nbsp;إعتماد المرتبات', 1, NULL, NULL, NULL)
GO
  -----------------------------------------End 2025-07-8-----------------
 -----------------------------------------Hammad 2025-07-9--------------
  ALTER TABLE dbo.Closing ADD
	NotifIsSent bit NOT NULL CONSTRAINT DF_Closing_NotifIsSent DEFAULT 0
GO

update Closing set NotifIsSent=1
Go
-----------------------------------------End 2025-07-9--------------

  -----------------------------------------Ali 2025-07-9-----------------
   ALTER TABLE dbo.Rec_RecruitEmployeeExperiance ADD
	RecruitJobCode int NULL
GO
  -----------------------------------------End 2025-07-9----------------- 
  -----------------------------------------SHEHAB 2025-07-9-----------------
 ALTER TABLE dbo.Employees
ADD ShortName NVARCHAR(500) NULL , ShortNameAr NVARCHAR(500) NULL;
Go

update dbo.Employees
set ShortName = Name , ShortNameAr = Arabic_Name
Go
  -----------------------------------------End 2025-07-9-----------------

   
  ---------------------------------Sayed 2025-07-09--------------------------
  INSERT [dbo].[LabelsName] ([LabelKey], [Name], [Arabic_Name]) VALUES (N'VacationRemark ', N'Comment', N'التعليق')
GO
-------------------------------End----------------------------------------------
----------------------------------------- SHEHAB 2025-07-10 -----------------
GO
INSERT [dbo].[ConfigParameter] ([ConfigKey], [Name], [Arabic_Name], [ConfigValue], [ConfigCategoryCode], [OrderNo], [ConfigType], [IsVisible], [ModifiedBy], [ModificationDate], 
[RequestTypeId], [ConfigDescription]) VALUES (N'DisplayEmployeeShortName', N'Display Employee Short Name', N'عرض الاسم المختصر للموظف', N'false', 1, 67, 1, 1, NULL, NULL, NULL, N'عرض الاسم المختصر للموظف')

----------------------------------------- End 2025-07-10 -----------------
  ---------------------------------mostafa 2025-07-15--------------------------

INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(1176,N'CV Bank',N'بنك السيرة الذاتية',47,N'/Recruitment/CVBank',N'Index','fa-solid fa-briefcase',N'get',12,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(1176,4)
Go

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(5157,N'بنك السيرة الذاتية',N'CV Bank',1176,1)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(5158,N'عرض بنك السيرة الذاتية',N'View CV Bank',1176,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(5159,N'إضافة بنك السيرة الذاتية',N'Add CV Bank',1176,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(5160,N'تعديل بنك السيرة الذاتية',N'Edit CV Bank',1176,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(5161,N'حذف بنك السيرة الذاتية',N'Delete CV Bank',1176,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(5162,N'حفظ بنك السيرة الذاتية',N'Save CV Bank',1176,2)
Go
  ---------------------------------End 2025-07-15--------------------------
----------------------------------------- SHEHAB 2025-07-14 -----------------
    GO
    update securityPrivilege
    set PrivilegeType=2
    where id=3592

----------------------------------------- End 2025-07-14 -----------------


  -----------------------------------------Ali 2025-07-15-----------------
  
    ALTER TABLE dbo.SecurityUserBranch ADD
	IsConsolidated bit NOT NULL CONSTRAINT DF_SecurityUserBranch_IsConsolidated DEFAULT ((0))
GO

  update SecurityUserBranch set  IsConsolidated=1
  Go

  INSERT[dbo].[ConfigParameter]  ([ConfigKey], [Name], [Arabic_Name], [ConfigValue], [ConfigCategoryCode], [OrderNo], [ConfigType], [IsVisible], [ModifiedBy], [ModificationDate], [RequestTypeId],[ConfigDescription])
VALUES(N'Rec_WorkByCentralRecruitment',N'Work By Central Recruitment',N'العمل بنظام التوظيف المركزي',N'false',4,6,1,1,Null,Null,Null,N'ربط التوظيف بطلب تعيين المرشحين وطلب موظفين جدد بنظام مركزى للتوظيف')
Go

ALTER TABLE WF_StaffReplacement
DROP CONSTRAINT FK_WF_StaffReplacement_Employees;
GO

  ALTER TABLE dbo.Sections ADD
	CentralCode nvarchar(20)  NULL
GO

  ALTER TABLE dbo.Positions ADD
	CentralCode nvarchar(20)  NULL
GO

  -----------------------------------------End 2025-07-15-----------------
   ----------------------------------------- AK 2025-07-16 --------------------
BEGIN TRANSACTION
GO
ALTER TABLE dbo.Divisions ADD
	AccountsPayable1Code int NULL,
	AccountsPayable2Code int NULL
GO
ALTER TABLE dbo.Divisions SET (LOCK_ESCALATION = TABLE)
GO
COMMIT
INSERT [dbo].[UserType] ([UserTypeCode], [Name], [Arabic_Name], [HaveEmployee], [OrganizationCategoryCode], [IsVisible]) VALUES (44, N'Accounts Payable1', N'الحسابات الدائنة1', 1, NULL, 1)
Go
INSERT [dbo].[UserType] ([UserTypeCode], [Name], [Arabic_Name], [HaveEmployee], [OrganizationCategoryCode], [IsVisible]) VALUES (45, N'Accounts Payable2', N'الحسابات الدائنة2', 1, NULL, 1)
Go
 -----------------------------------------END AK 2025-07-16 --------------------
 -----------------------------------------Hammad 2025-07-17 --------------------
 INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES (720, N'Business Trip Request', N' طلب مامورية', 498, N'/WorkFlow/MissionRequest', N'Index', N'fas fa-unlock-alt', N'get', 6, 1, 1)
GO
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (15568, N'طلب مامورية', N'Business Trip Request', 720, 1)
GO
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (15569, N'عرض طلب مامورية', N'View Business Trip Request', 720, 2)
GO
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (15570, N'اضافة طلب مامورية', N'Add Business Trip Request', 720, 2)
GO
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (15571, N'تعديل طلب مامورية', N'Edit Business Trip Request', 720, 2)
GO
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (15572, N'حذف طلب مامورية', N'Delete Business Trip Request', 720, 2)
GO
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (15574, N'الغاء طلب مامورية', N'Cancel Business Trip Request', 720, 2)
GO
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (15575, N'حفظ طلب مامورية', N'Save Business Trip Request', 720, 2)
GO

INSERT [dbo].[SystemMenuModule] ([SystemMenuCode], [AppModuleCode]) VALUES (720, 1)
GO
 -----------------------------------------End Hammad 2025-07-17 --------------------
   -----------------------------------------SHEHAB 2025-07-20-----------------
 ALTER TABLE dbo.Employees
ADD ShortName NVARCHAR(500) NULL , ShortNameAr NVARCHAR(500) NULL;
Go

update dbo.Employees
set ShortName = Name , ShortNameAr = Arabic_Name
Go

  ALTER TABLE dbo.Divisions ADD
	AccountsPayable1Code int NULL,
	AccountsPayable2Code int NULL
GO
  -----------------------------------------End 2025-07-20-----------------
  -----------------------------------------Hammad 2025-07-27-----------------

  INSERT [dbo].[ConfigParameter] ([ConfigKey], [Name], [Arabic_Name], [ConfigValue], [ConfigCategoryCode], [OrderNo], [ConfigType], [IsVisible], [ModifiedBy], [ModificationDate], [RequestTypeId], [ConfigDescription])
VALUES (N'WFUsersChangeRefusedRequests', N'Users Can Change Refused Requests', N' مستخدم تغير الاعتمادات المرفوضة  ', N'1', 2, 6, 2, 1, NULL, NULL, 0, N'المستخدم الذى له حق تغير الاعتمادات المرفوضة    ')
GO
  -----------------------------------------End 2025-07-27-----------------
  -----------------------------------------End 2025-07-20-----------------
  -----------------------------------------Mostafa 2025-07-23-----------------


  ALTER TABLE dbo.Employees
ADD EmployeeGuide  NVARCHAR(max) NULL 
Go

  -----------------------------------------End 2025-07-23-----------------
  -----------------------------------------Mostafa 2025-07-27-----------------
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[GetOrganizationChartLevels]
@id [int],
@groupId [int]
AS
BEGIN
declare @tblorganizationLevels table(
Id int 			
);
with organizationLevels as(
select OrganizationStructureId from OrganizationStructure where OrganizationStructureId = @Id
union all
select org2.OrganizationStructureId from OrganizationStructure org2, organizationLevels  
where org2.ParentId = organizationLevels.OrganizationStructureId
) Insert into @tblorganizationLevels select * from organizationLevels option (maxrecursion 0); 
select
dbo.OrganizationStructure.OrganizationStructureId as OrganizationStructureId 
, dbo.OrganizationStructure.OrganizationStructureCode as OrganizationStructureCode 
, dbo.OrganizationStructure.ParentId as ParentId 
, dbo.OrganizationStructure.Nickname as Nickname 
, dbo.OrganizationStructure.Arabic_Nickname as Arabic_Nickname 
, dbo.OrganizationStructure.Name as Name 
, dbo.OrganizationStructure.Arabic_Name as Arabic_Name 
, dbo.OrganizationCategory.FontSize as CategoryFontSize 
, dbo.OrganizationCategory.Color as CategoryBackgroundColor 
, dbo.OrganizationCategory.FontColor as CategoryFontColor 
, dbo.OrganizationCategory.ViewInOrgChart as ViewInOrgChart 
,dbo.Employees.Arabic_Name as EmployeNameAr 
,dbo.Employees.Name as EmployeName 
,dbo.Employees.HiringDate as HiringDate
,dbo.Employees.EmployeeCode as EmployeeCode 
,dbo.Employees.EmployeeGuide as EmployeeGuide 
,dbo.Positions.Name as PositionName
,dbo.Positions.Arabic_Name as PositionNameAr
,dbo.Sections.Name as SectionName
,dbo.Sections.Arabic_Name as SectionNameAr
from [dbo].OrganizationStructure
join [dbo].[OrganizationCategory] on [dbo].[OrganizationCategory].OrganizationCategoryCode = [dbo].OrganizationStructure.OrganizationCategoryCode
join [dbo].OrganizationStructureAndGroups on [dbo].[OrganizationStructureAndGroups].OrganizationStructureId = [dbo].OrganizationStructure.OrganizationStructureId and 
[dbo].[OrganizationStructureAndGroups].OrganizationGroupCode = @groupId
join [dbo].[Employees] on [dbo].[Employees].EmployeeCode = [dbo].OrganizationStructureAndGroups.ManagerCode
inner join [dbo].Positions on [dbo].[Employees].PositionCode= Positions.PositionCode
inner join [dbo].Sections on [dbo].[Employees].SectionCode= Sections.SectionCode
where [dbo].OrganizationStructure.OrganizationStructureId in (select * from @tblorganizationLevels)
END
  -----------------------------------------End 2025-07-27-----------------
----------------------------------------- AK 2025-07-28 --------------------
UPDATE SecurityPrivilegeActions SET ControllerName=N'PurchasesRequest', ActionName=N'Cancel', SecurityPrivilegeID=3415  WHERE ID=917
Go
UPDATE SecurityPrivilege SET SystemMenuCode=1173 WHERE ID BETWEEN 22041 AND 22049
GO
-----------------------------------------END AK 2025-07-28 --------------------
  -----------------------------------------End 2025-07-20-----------------
  -----------------------------------------Ali 2025-07-23-----------------

  INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(1177,N'Interview Schedule',N'مواعيد المقابلات',1001,N'/Recruitment/InterviewSchedule',N'index','fa fa-thumb-tack',N'Get',7,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(1177,4)
Go

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(5163,N'مواعيد المقابلات',N'Interview Schedule',1177,1)
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(5164,N'عرض مواعيد المقابلات',N'View Interview Schedule',1177,2)
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(5165,N'إضافة مواعيد المقابلات',N'Add Interview Schedule',1177,2)
Go

 INSERT[dbo].[ConfigParameter]  ([ConfigKey], [Name], [Arabic_Name], [ConfigValue], [ConfigCategoryCode], [OrderNo], [ConfigType], [IsVisible], [ModifiedBy], [ModificationDate], [RequestTypeId],[ConfigDescription])
VALUES(N'Rec_ManagerScheduleInterviews',N'Manager Schedule interviews',N'تحديد مواعيد المقابلات من المدير',N'false',4,7,1,1,Null,Null,Null,N'تحديد مواعيد المقابلات من المدير قبل ارسال الدعوه')
Go

  -----------------------------------------End 2025-07-23-----------------
