﻿ ---------------------Ali 2021-06-28----------------------

 ALTER TABLE dbo.EmployeOrientation ADD
	LastRemindTime datetime NULL
GO
 ---------------------End 2021-06-28----------------------

 ---------------------Ali 2021-06-30----------------------

 SET IDENTITY_INSERT [dbo].[EmailTemplateType] ON 
INSERT [dbo].[EmailTemplateType] ([EmailTemplateTypeCode], [Name], [Arabic_Name], [IsEditable], [AppModuleCode]) VALUES (265, N'Orientation Reminder Notification', N'اشعار تذكير التوجيه', 0, 1)
SET IDENTITY_INSERT [dbo].[EmailTemplateType] OFF
Go
SET IDENTITY_INSERT [dbo].[EmailTemplate] ON 
INSERT [dbo].[EmailTemplate] ([EmailTemplateCode], [Name], [Arabic_Name], [EmailTemplateTypeCode], [Subject], [Body], [IsDefault], [SubjectAppendCode], [GeneralTypeCode], [JobTypeCode]) VALUES (265, N'Orientation Reminder Notification', N'اشعار تذكير التوجيه', 265, N'تذكير بالتوجيه', N'تذكير بالتوجيه', 1, NULL, NULL, NULL)
SET IDENTITY_INSERT [dbo].[EmailTemplate] OFF
Go



   INSERT[dbo].[ConfigParameter]  ([ConfigKey], [Name], [Arabic_Name], [ConfigValue], [ConfigCategoryCode], [OrderNo], [ConfigType], [IsVisible], [ModifiedBy], [ModificationDate], [RequestTypeId])
VALUES(N'NumberOfCalculation',N'Number of Calculation',N'عدد مرات الاحتساب',N'1',1,18,2,1,Null,Null,Null)
Go



ALTER procedure [dbo].[Emp_GetPaySlip] 
(
	@EmpCpde		nvarchar(50),
	@TemTable		nvarchar(100),
	@CalculateNo	nvarchar(10)
)
as


--Create  table TempPaySlip(EmployeeCode int,LineValue float,BandCode int,LE_Share float,CurrencyCode tinyint,Effect bit,Hide bit,CollectIn int,CollectInEx int );
declare @query nvarchar(2000);

set @query=' insert into TempPaySlip
SELECT 
      [EmployeeCode]     
      ,[LineValue]    
      ,Basis.[BandCode]    
      ,[LE_Share]    
      ,[CurrencyCode]
	  ,Effect
	  ,[Hide]
	  ,[CollectIn]
	  ,[CollectInEx]
     
  FROM '+@TemTable +' as result inner join [dbo].[Basis] on Basis.BandCode=result.BandCode

  where [EmployeeCode]='+@EmpCpde
  if(@CalculateNo!='0')
  begin
 set @query=@query +'and CalculateNumber='+@CalculateNo;
   end 

exec(@query);

--SELECT * from paySlip
--INSERT into @tempPaySlip SELECT * from paySlip;

SELECT * from  TempPaySlip
delete  from   TempPaySlip

Go


CREATE TABLE [dbo].[OrientationFiles](
	[OrientationFileCode] [int] IDENTITY(1,1) NOT NULL,
	[OrientationCode] [int] NOT NULL,
	[FileName] [nvarchar](500) NOT NULL,
 CONSTRAINT [PK_OrientationFiles] PRIMARY KEY CLUSTERED 
(
	[OrientationFileCode] 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].[OrientationFiles]  WITH CHECK ADD  CONSTRAINT [FK_OrientationFiles_Orientations] FOREIGN KEY([OrientationCode])
REFERENCES [dbo].[Orientations] ([OrientationCode])
GO

ALTER TABLE [dbo].[OrientationFiles] CHECK CONSTRAINT [FK_OrientationFiles_Orientations]
GO


ALTER TABLE dbo.Orientations
	DROP COLUMN FileName
GO

 ---------------------End 2021-06-30----------------------

 ---------------------Hammad 2021-06-30------------------
 INSERT [dbo].[ConfigParameter] ([ConfigKey], [Name], [Arabic_Name], [ConfigValue], [ConfigCategoryCode], [OrderNo], [ConfigType], [IsVisible], [ModifiedBy], [ModificationDate], [RequestTypeId])
 VALUES (N'ReadTimeAttandancePayRoll', N'Read time attandance from source data ', N'قراءة الحضور والانصراف من قاعدة البيانات الاساسية  ', N'false', 1, 18, 1, 1, NULL, NULL, NULL)
  ---------------------End 2021-06-30------------------


   ---------------------Mostafa 2021-07-04------------------
  INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage]) VALUES (545, N'Employe View Orientation', N'اجابة الاسئلة', 544, N'/EmployeOrientation', N'OrientationQuestionAnswer', N'fa fa-thumb-tack', N'get', 6, 0, 0)
INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage]) VALUES (546, N'Show Answers To Questions', N'عرض اجابات  الاسئلة', 544, N'/Orientation', N'QuestionAnswerEmployee', N'fa fa-thumb-tack', N'get', 10, 0, 0)
GO
   ---------------------End 2021-07-04------------------


      ---------------------Mostafa 2021-07-04------------------
   CREATE TABLE [dbo].[OrientationQuestionAnswer](
	[OrientationQuestionAnswerCode] [int] IDENTITY(1,1) NOT NULL,
	[OrientationCode] [int] NOT NULL,
	[EmployeCode] [int] NOT NULL,
	[QuestionTemplateCode] [int] NOT NULL,
	[QuestionAnswer] [nvarchar](250) NULL,
	[AnswerGrade] [int] NULL,
	[IsTrue] [bit] NULL,
 CONSTRAINT [PK_OrientationQuestionAnswer] PRIMARY KEY CLUSTERED 
(
	[OrientationQuestionAnswerCode] 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].[OrientationQuestionAnswer]  WITH CHECK ADD  CONSTRAINT [FK_OrientationQuestionAnswer_Employees] FOREIGN KEY([EmployeCode])
REFERENCES [dbo].[Employees] ([EmployeeCode])
GO
ALTER TABLE [dbo].[OrientationQuestionAnswer] CHECK CONSTRAINT [FK_OrientationQuestionAnswer_Employees]
GO
ALTER TABLE [dbo].[OrientationQuestionAnswer]  WITH CHECK ADD  CONSTRAINT [FK_OrientationQuestionAnswer_Orientations] FOREIGN KEY([OrientationCode])
REFERENCES [dbo].[Orientations] ([OrientationCode])
GO
ALTER TABLE [dbo].[OrientationQuestionAnswer] CHECK CONSTRAINT [FK_OrientationQuestionAnswer_Orientations]
GO
ALTER TABLE [dbo].[OrientationQuestionAnswer]  WITH CHECK ADD  CONSTRAINT [FK_OrientationQuestionAnswer_Rec_QuestionTemplate] FOREIGN KEY([QuestionTemplateCode])
REFERENCES [dbo].[Rec_QuestionTemplate] ([QuestionTemplateCode])
GO
ALTER TABLE [dbo].[OrientationQuestionAnswer] CHECK CONSTRAINT [FK_OrientationQuestionAnswer_Rec_QuestionTemplate]
GO
     ---------------------End 2021-07-04------------------
     ---------------------Hammad 2021-07-04------------------

	 ALTER TABLE [SST.ERP_Client].dbo.Clients ADD
	InventoryBranchCountLicense nvarchar(100) NULL
GO
ALTER TABLE [SST.ERP_Client].dbo.Branches ADD
	InventoryBranchCountLicense nvarchar(100) NULL
GO
     ---------------------End 2021-07-04------------------