﻿------------------------------Hammad 2021-12-05-------------------------
 ALTER TABLE dbo.WF_CompensationAllowanceTypes ADD
	WorkingHourExchangeCode int NULL
GO
update WF_CompensationAllowanceTypes  set WorkingHourExchangeCode=( CASE ForcingBreak 
   WHEN 0 THEN 1 
   WHEN 1 THEN 2 
   ELSE 3
    END )
GO
ALTER TABLE [dbo].[WF_CompensationAllowanceTypes] DROP CONSTRAINT [DF_WF_CompensationAllowanceTypes_ForcingBreak]
GO
ALTER TABLE WF_CompensationAllowanceTypes
DROP COLUMN ForcingBreak
Go
 INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
 VALUES (573, N'Financial Privilege', N'الصلاحيات المالية', NULL, NULL, NULL, NULL, N'get', 1, 0, 1)
 Go
 INSERT [dbo].[SystemMenuModule] ([SystemMenuCode], [AppModuleCode]) 
 VALUES (573, 1)
 Go
Update SecurityPrivilege set SystemMenuCode=573 where ID=1298
 Go
Insert into SecurityPrivilege values (1299,N'الصلاحيات المالية',N'Financial Privilege',573,1)
Go

------------------------------End 2021-12-05-------------------------
------------------------------Hammad2021-12-07---------------------

INSERT [dbo].[ConfigParameter] ([ConfigKey], [Name], [Arabic_Name], [ConfigValue], [ConfigCategoryCode], [OrderNo], [ConfigType], [IsVisible], [ModifiedBy], [ModificationDate], [RequestTypeId]) 
VALUES (N'WFOvertimeRelatedIsToVacation', N' Overtime is related to vacation', N'   الوقت الإضافى مربوط بإجازة ', N'false', 2, 16, 1, 1, NULL, NULL, 3)
INSERT [dbo].[ConfigParameter] ([ConfigKey], [Name], [Arabic_Name], [ConfigValue], [ConfigCategoryCode], [OrderNo], [ConfigType], [IsVisible], [ModifiedBy], [ModificationDate], [RequestTypeId])
VALUES (N'WFOvertimeRelatedToVacationCode', N' Overtime related to vacation code', N' الوقت الإضافى مربوط بكودإجازة   ', N'0', 2, 17, 2, 1, NULL, NULL, 3)
Go
ALTER TABLE dbo.WF_OverTimeRequest ADD
	VacationDate datetime NULL,
	VacationCode tinyint NULL
GO
------------------------------End2021-12-07----------------------
---------------------AK 2021-12-07--------
/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
ALTER TABLE dbo.WF_MasterRequests ADD
	MasterRequestNUmber int NULL
GO
ALTER TABLE dbo.WF_MasterRequests SET (LOCK_ESCALATION = TABLE)
GO
COMMIT

UPDATE mr SET mr.MasterRequestNo = mrNum.RowNo
FROM WF_MasterRequests AS mr INNER JOIN 
(SELECT RequestTypeCode, MasterRequestCode, MasterRequestNo,ROW_NUMBER() OVER(PARTITION BY RequestTypeCode ORDER BY RequestTypeCode, MasterRequestCode ASC) AS RowNo FROM WF_MasterRequests  ORDER BY RequestTypeCode, MasterRequestCode) mrNum
	  ON mr.MasterRequestCode=mrNum.MasterRequestCode
GO

UPDATE mr SET mr.MasterRequestNo = mrNum.RowNo
FROM WF_MasterRequests AS mr INNER JOIN 
(SELECT RequestTypeCode, MasterRequestCode, MasterRequestNo,ROW_NUMBER() OVER(PARTITION BY RequestTypeCode ORDER BY RequestTypeCode, MasterRequestCode ASC) AS RowNo FROM WF_MasterRequests  ORDER BY RequestTypeCode, MasterRequestCode) mrNum
	  ON mr.MasterRequestCode=mrNum.MasterRequestCode
GO
---------------------End 2021-12-07--------
---------------------Ali 2021-12-07--------

 ALTER TABLE WF_NewHireRequestFiles
ALTER COLUMN [DocumentsTypeCode] int NULL;
Go
---------------------Ali 2021-12-07--------
