IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'current-client-details' AND [ControlName] IS  NULL) 
BEGIN
	INSERT INTO [KaaSCtlMaster](
		[ComponentName], 
		[ControlName], 
		[FriendlyName], 
		[IsVisible], 
		[ParentId], 
		[Deleted]) 
	VALUES (
		'current-client-details',
		null, 
		'Current Client Details', 
		0, 
		0, 
		0)
END
GO

--KCL Master
IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'change-matter-security-permissions' AND [ControlName] IS NULL) 
BEGIN
	INSERT INTO [KaaSCtlMaster](
		[ComponentName], 
		[ControlName], 
		[FriendlyName], 
		[IsVisible], 
		[ParentId], 
		[Deleted]) 
	VALUES ('change-matter-security-permissions',
		null, 
		'Change Matter Security Permissions', 
		0, 
		0, 
		0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'current-client-billing' AND [ControlName] IS NULL) 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], 
	[ControlName], 
	[FriendlyName], 
	[IsVisible], 
	[ParentId], 
	[Deleted]) 
VALUES ('current-client-billing',
	null, 
	'Current Client Billing', 
	0, 
	0, 
	0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'general-tab' AND [ControlName] =  'btnSaveGeneral') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('general-tab','btnSaveGeneral', 'Current Client Details - General', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'bank-details-tab' AND [ControlName] =  'btnSaveBankDetails') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('bank-details-tab','btnSaveBankDetails', 'Current Client Details - Bank Details', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'billing-details-tab' AND [ControlName] =  'btnSaveBillingDetails') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('billing-details-tab','btnSaveBillingDetails', 'Current Client Details - Billing Details', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'categories-tab' AND [ControlName] =  'btnSaveCategories') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('categories-tab','btnSaveCategories', 'Current Client Details - Categories', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'corporate-tab' AND [ControlName] =  'btnSaveCorporate') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('corporate-tab','btnSaveCorporate', 'Current Client Details - Corporate', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'cross-ref-tab' AND [ControlName] =  'btnSaveCrossRef') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('cross-ref-tab','btnSaveCrossRef', 'Current Client Details - Cross Reference', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'legal-details-tab' AND [ControlName] =  'btnSaveLegalDetails') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('legal-details-tab','btnSaveLegalDetails', 'Current Client Details - Legal Details', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'matters-tab' AND [ControlName] =  'btnSaveMatters') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('matters-tab','btnSaveMatters', 'Current Client Details - Matters', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'notes-tab' AND [ControlName] =  'btnSaveNotes') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('notes-tab','btnSaveNotes', 'Current Client Details - Notes', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'permission-tab' AND [ControlName] =  'btnSavePermission') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('permission-tab','btnSavePermission', 'Current Client Details - Permission', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'personal-tab' AND [ControlName] =  'btnSavePersonal') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('personal-tab','btnSavePersonal', 'Current Client Details - Personal', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'client-contact-tab' AND [ControlName] =  'btnClientContactInsert') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('client-contact-tab','btnClientContactInsert', 'Current Client Details - Client Contact', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'client-contact-tab' AND [ControlName] =  'btnClientContactChange') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('client-contact-tab','btnClientContactChange', 'Current Client Details - Client Contact', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'client-contact-tab' AND [ControlName] =  'btnClientContactDelete') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('client-contact-tab','btnClientContactDelete', 'Current Client Details - Client Contact', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'cross-ref-tab' AND [ControlName] =  'btnCrossRefInsert') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('cross-ref-tab','btnCrossRefInsert', 'Current Client Details - Cross Reference', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'cross-ref-tab' AND [ControlName] =  'btnCrossRefChange') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('cross-ref-tab','btnCrossRefChange', 'Current Client Details - Cross Reference', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'cross-ref-tab' AND [ControlName] =  'btnCrossRefDelete') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('cross-ref-tab','btnCrossRefDelete', 'Current Client Details - Cross Reference', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'categories-tab' AND [ControlName] =  'btnCategoriesInsert') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('categories-tab','btnCategoriesInsert', 'Current Client Details - Categories', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'categories-tab' AND [ControlName] =  'btnCategoriesChange') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('categories-tab','btnCategoriesChange', 'Current Client Details - Categories', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'categories-tab' AND [ControlName] =  'btnCategoriesDelete') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('categories-tab','btnCategoriesDelete', 'Current Client Details - Categories', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'corporate-tab' AND [ControlName] =  'btnCorporateOfficerInsert') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('corporate-tab','btnCorporateOfficerInsert', 'Current Client Details - Corporate', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'corporate-tab' AND [ControlName] =  'btnCorporateOfficerChange') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('corporate-tab','btnCorporateOfficerChange', 'Current Client Details - Corporate', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'corporate-tab' AND [ControlName] =  'btnCorporateOfficerDelete') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('corporate-tab','btnCorporateOfficerDelete', 'Current Client Details - Corporate', 0, 1, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'current-client-detail-permission-tab' AND [ControlName] =  'mat-tab-label-0-10') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('current-client-detail-permission-tab','mat-tab-label-0-10', 'Current Client Details - Permission Tab', 0, 2, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlMaster] WHERE [ComponentName] = 'current-client-detail-billing-tab' AND [ControlName] =  'dvCurrentClientDetailsManageBilling') 
BEGIN
INSERT INTO [KaaSCtlMaster]([ComponentName], [ControlName], [FriendlyName], [IsVisible], [ParentId], [Deleted]) VALUES ('current-client-detail-billing-tab','dvCurrentClientDetailsManageBilling', 'Current Client Details - Billing Tab', 0, 3, 0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlGroupControls] WHERE [GroupId] = '1000033' AND [MasterId] =  1) 
BEGIN
INSERT INTO [KaaSCtlGroupControls] ([GroupId], [MasterId]) VALUES ('1000033',1)
END
GO


IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlGroupControls] WHERE [GroupId] = '1000012' AND [MasterId] =  2) 
BEGIN
INSERT INTO [KaaSCtlGroupControls] ([GroupId], [MasterId]) VALUES ('1000012',2)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [KaaSCtlGroupControls] WHERE [GroupId] = '1000006' AND [MasterId] =  3) 
BEGIN
INSERT INTO [KaaSCtlGroupControls] ([GroupId], [MasterId]) VALUES ('1000006',3)
END
GO


IF NOT EXISTS(SELECT TOP 1 1 FROM Settings where [KeyName] = 'StatuteWarning')
BEGIN
	INSERT INTO Settings ([KeyName],[KeyValue]) VALUES ('StatuteWarning',0)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM Settings where [KeyName] = 'StatuteActionCode')
BEGIN
	INSERT INTO Settings ([KeyName],[KeyValue]) VALUES ('StatuteActionCode','')
END
GO

--Sprint 6 Scritps
IF EXISTS (SELECT TOP 1 1 FROM sys.objects WHERE [name] = 'Settings') AND NOT EXISTS (SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'ClientLabel')
BEGIN
	INSERT INTO
		[Settings]
		(
		 [KeyName],
		 [KeyValue]
		)
	VALUES
		(
		 'ClientLabel',
		 'Client'
		)
END
GO

IF EXISTS (SELECT TOP 1 1 FROM sys.objects WHERE [name] = 'Settings') AND NOT EXISTS (SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'MatterLabel')
BEGIN
	INSERT INTO
		[Settings]
		(
		 [KeyName],
		 [KeyValue]
		)
	VALUES
		(
		 'MatterLabel',
		 'Matter'
		)
END
GO

IF EXISTS (SELECT TOP 1 1 FROM sys.objects WHERE [name] = 'Settings') AND NOT EXISTS (SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'AssociateLabel')
BEGIN
	INSERT INTO
		[Settings]
		(
		 [KeyName],
		 [KeyValue]
		)
	VALUES
		(
		 'AssociateLabel',
		 'Associate'
		)
END
GO

IF EXISTS (SELECT TOP 1 1 FROM sys.objects WHERE [name] = 'Settings') AND NOT EXISTS (SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'CaseLabel')
BEGIN
	INSERT INTO
		[Settings]
		(
		 [KeyName],
		 [KeyValue]
		)
	VALUES
		(
		 'CaseLabel',
		 'Case'
		)
END
GO


IF EXISTS (SELECT TOP 1 1 FROM sys.objects WHERE [name] = 'Settings') AND NOT EXISTS (SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'DocumentNamingMethod')
BEGIN
	INSERT INTO
		[Settings]
		(
		 [KeyName],
		 [KeyValue]
		)
	VALUES
		(
		 'DocumentNamingMethod',
		 'D'
		)
END
GO

-- INSERT SCRIPTS FOR APP REDIRECTION
IF NOT EXISTS (SELECT 1 FROM AppRedirectionUrls WHERE [ShortCode] = 'TASK_DASHBOARD' AND [UrlLink] = '/tasks/task-dashboard')
BEGIN
	INSERT INTO AppRedirectionUrls ([Description],[UrlLink],[ShortCode]) VALUES ('Task Dashboard','/tasks/task-dashboard','TASK_DASHBOARD')
END
GO

IF NOT EXISTS (SELECT 1 FROM AppRedirectionUrls WHERE [ShortCode] = 'TASK_MY' AND [UrlLink] = '/tasks/main/my-tasks')
BEGIN
	INSERT INTO AppRedirectionUrls ([Description],[UrlLink],[ShortCode]) VALUES ('My Tasks','/tasks/main/my-tasks','TASK_MY')
END
GO

IF NOT EXISTS (SELECT 1 FROM AppRedirectionUrls WHERE [ShortCode] = 'TASK_TEAM' AND [UrlLink] = '/tasks/main/team-tasks')
BEGIN
	INSERT INTO AppRedirectionUrls ([Description],[UrlLink],[ShortCode]) VALUES ('Team Tasks','/tasks/main/team-tasks','TASK_TEAM')
END
GO

IF NOT EXISTS (SELECT 1 FROM AppRedirectionUrls WHERE [ShortCode] = 'TASK_OVERDUE' AND [UrlLink] = '/tasks/main/overdue-tasks')
BEGIN
	INSERT INTO AppRedirectionUrls ([Description],[UrlLink],[ShortCode]) VALUES ('Overdue Tasks','/tasks/main/overdue-tasks','TASK_OVERDUE')
END
GO

IF NOT EXISTS (SELECT 1 FROM AppRedirectionUrls WHERE [ShortCode] = 'TASK_DAY' AND [UrlLink] = '/tasks/main/days-tasks')
BEGIN
	INSERT INTO AppRedirectionUrls ([Description],[UrlLink],[ShortCode]) VALUES ('Days Tasks','/tasks/main/days-tasks','TASK_DAY')
END
GO

IF NOT EXISTS (SELECT 1 FROM AppRedirectionUrls WHERE [ShortCode] = 'TASK_NEXT_WEEK' AND [UrlLink] = '/tasks/main/next-weeks-tasks')
BEGIN
	INSERT INTO AppRedirectionUrls ([Description],[UrlLink],[ShortCode]) VALUES ('Next Week Tasks','/tasks/main/next-weeks-tasks','TASK_NEXT_WEEK')
END
GO

IF NOT EXISTS (SELECT 1 FROM AppRedirectionUrls WHERE [ShortCode] = 'TASK_NEXT_MONTH' AND [UrlLink] = '/tasks/main/next-months-tasks')
BEGIN
	INSERT INTO AppRedirectionUrls ([Description],[UrlLink],[ShortCode]) VALUES ('Next Month Tasks','/tasks/main/next-months-tasks','TASK_NEXT_MONTH')
END
GO

IF NOT EXISTS (SELECT 1 FROM AppRedirectionUrls WHERE [ShortCode] = 'TASK_OUTSTANDING' AND [UrlLink] = '/tasks/main/outstanding-tasks')
BEGIN
	INSERT INTO AppRedirectionUrls ([Description],[UrlLink],[ShortCode]) VALUES ('Outstanding Tasks','/tasks/main/outstanding-tasks','TASK_OUTSTANDING')
END
GO

IF NOT EXISTS (SELECT 1 FROM AppRedirectionUrls WHERE [ShortCode] = 'TASK_LAST_WEEK' AND [UrlLink] = '/tasks/main/last-weeks-tasks')
BEGIN
	INSERT INTO AppRedirectionUrls ([Description],[UrlLink],[ShortCode]) VALUES ('Last Weeks Tasks','/tasks/main/last-weeks-tasks','TASK_LAST_WEEK')
END
GO

IF NOT EXISTS (SELECT 1 FROM AppRedirectionUrls WHERE [ShortCode] = 'TASK_LAST_MONTH' AND [UrlLink] = '/tasks/main/last-months-tasks')
BEGIN
	INSERT INTO AppRedirectionUrls ([Description],[UrlLink],[ShortCode]) VALUES ('Last Month Tasks','/tasks/main/last-months-tasks','TASK_LAST_MONTH')
END
GO

IF NOT EXISTS (SELECT 1 FROM AppRedirectionUrls WHERE [ShortCode] = 'TASK_ALL' AND [UrlLink] = '/tasks/main/all-tasks')
BEGIN
	INSERT INTO AppRedirectionUrls ([Description],[UrlLink],[ShortCode]) VALUES ('All Tasks','/tasks/main/all-tasks','TASK_ALL')
END
GO

-- DATAPUMP FOR CUSTOM FILTER HEADER OPTIONS
-- FIRST REMOVE EXISTING RECORDS
IF OBJECT_ID(N'CustomFilterColumndetails',N'U') IS NOT NULL
BEGIN
TRUNCATE TABLE CustomFilterColumndetails
END
GO

-- INSERT WITH NEW DATA
IF OBJECT_ID(N'CustomFilterColumndetails',N'U') IS NOT NULL
BEGIN

INSERT INTO CustomFilterColumndetails
-- Action Type Case Diary
SELECT 'Action'					AS [name],	'A' AS [Code],1 AS [isSelected] ,0  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Critical'				AS [name],	'C' AS [Code],1 AS [isSelected] ,1  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Dictation'				AS [name],	'D' AS [Code],1 AS [isSelected] ,2  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Note'					AS [name],	'N' AS [Code],1 AS [isSelected] ,3  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Court'					AS [name],	'O' AS [Code],1 AS [isSelected] ,4  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Appointment'			AS [name],	'P' AS [Code],1 AS [isSelected] ,5  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Remainder'				AS [name],	'R' AS [Code],1 AS [isSelected] ,6  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Statute'				AS [name],	'S' AS [Code],1 AS [isSelected] ,7  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Phone'				    AS [name],	'T' AS [Code],1 AS [isSelected] ,8  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Undertaking'			AS [name],	'U' AS [Code],1 AS [isSelected] ,9  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Email'					AS [name],	'E' AS [Code],1 AS [isSelected] ,10 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Scanned'				AS [name],	'M' AS [Code],1 AS [isSelected] ,11 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Fixed Date'				AS [name],	'F' AS [Code],1 AS [isSelected] ,12 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Non PhotoId'			AS [name],	'I' AS [Code],1 AS [isSelected] ,13 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION
SELECT 'PhotoID'				AS [name],	'K' AS [Code],1 AS [isSelected] ,14 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION
SELECT 'Cheque'					AS [name],	'Q' AS [Code],1 AS [isSelected] ,15 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION  
SELECT 'Corporate'				AS [name],	'V' AS [Code],1 AS [isSelected] ,16 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Signing Document'		AS [name],	'G' AS [Code],1 AS [isSelected] ,17 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'SMS'					AS [name],	'W' AS [Code],1 AS [isSelected] ,18 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName] UNION
SELECT 'Requested Documents'	AS [name],	'L' AS [Code],1 AS [isSelected] ,19 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'CaseDiary' AS [PageName]


INSERT INTO CustomFilterColumndetails
-- Action Priority Case Diary
SELECT 'High'			AS [name],	'H' AS [Code],1 AS [isSelected] ,0 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Priority' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Low'			AS [name],	'L' AS [Code],1 AS [isSelected] ,1 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Priority' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Normal'			AS [name],	'N' AS [Code],1 AS [isSelected] ,2 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Priority' AS [ColumnName], 'CaseDiary' AS [PageName]


INSERT INTO CustomFilterColumndetails
-- Action Flag Case Diary
SELECT 'Clear Flag'		AS [name],	'0' AS [Code],1 AS [isSelected] ,0 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Blue Flag'		AS [name],	'1' AS [Code],1 AS [isSelected] ,1 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Orange Flag'	AS [name],	'2' AS [Code],1 AS [isSelected] ,2 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Red Flag'		AS [name],	'3' AS [Code],1 AS [isSelected] ,3 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Green Flag'		AS [name],	'4' AS [Code],1 AS [isSelected] ,4 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Black Flag'		AS [name],	'5' AS [Code],1 AS [isSelected] ,5 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'CaseDiary' AS [PageName] UNION 
SELECT 'Yellow Flag'	AS [name],	'6' AS [Code],1 AS [isSelected] ,6 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'CaseDiary' AS [PageName] 

INSERT INTO CustomFilterColumndetails
-- Released MyInvoice
SELECT 'Yes'			AS [name],	'Y' AS [Code],1 AS [isSelected] ,0 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Released' AS [ColumnName]   , 'MyInvoice' AS [PageName] UNION 
SELECT 'No'				AS [name],	'N' AS [Code],1 AS [isSelected] ,1 AS [FilterOrder]	,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Released' AS [ColumnName]   , 'MyInvoice' AS [PageName]

INSERT INTO CustomFilterColumndetails
-- Released MyInvoice
SELECT 'Equals 0'		AS [name],	'0' AS [Code],1 AS [isSelected] ,0 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'BillNo' AS [ColumnName]   , 'MyInvoice' AS [PageName] UNION 
SELECT 'Not equals 0'	AS [name],	'1' AS [Code],1 AS [isSelected],1 AS [FilterOrder]	,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'BillNo' AS [ColumnName]   , 'MyInvoice' AS [PageName] 

INSERT INTO CustomFilterColumndetails

SELECT 'Request'		AS [name],	'0' AS [Code],1 AS [isSelected] ,0 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Status' AS [ColumnName], 'MyCheque' AS [PageName] UNION 
SELECT 'Released'		AS [name],	'1' AS [Code],1 AS [isSelected] ,1 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Status' AS [ColumnName], 'MyCheque' AS [PageName] UNION
SELECT 'Approved'		AS [name],	'2' AS [Code],1 AS [isSelected] ,2 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Status' AS [ColumnName], 'MyCheque' AS [PageName] UNION
SELECT 'Returned'		AS [name],	'3' AS [Code],1 AS [isSelected] ,3 AS [FilterOrder]	,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Status' AS [ColumnName], 'MyCheque' AS [PageName] 

-- My Task Default Options starts here
INSERT INTO CustomFilterColumndetails
-- Action Type Tasks


SELECT 'Action'					AS [name],	'A' AS [Code],1 AS [isSelected] ,0  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Critical'				AS [name],	'C' AS [Code],1 AS [isSelected] ,1  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Dictation'				AS [name],	'D' AS [Code],1 AS [isSelected] ,2  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Note'					AS [name],	'N' AS [Code],1 AS [isSelected] ,3  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Court'					AS [name],	'O' AS [Code],1 AS [isSelected] ,4  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Appointment'			AS [name],	'P' AS [Code],1 AS [isSelected] ,5  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Remainder'				AS [name],	'R' AS [Code],1 AS [isSelected] ,6  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Statute'				AS [name],	'S' AS [Code],1 AS [isSelected] ,7  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Phone'				    AS [name],	'T' AS [Code],1 AS [isSelected] ,8  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Undertaking'			AS [name],	'U' AS [Code],1 AS [isSelected] ,9  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Email'					AS [name],	'E' AS [Code],1 AS [isSelected] ,10 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Scanned'				AS [name],	'M' AS [Code],1 AS [isSelected] ,11 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Fixed Date'				AS [name],	'F' AS [Code],1 AS [isSelected] ,12 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Non PhotoId'			AS [name],	'I' AS [Code],1 AS [isSelected] ,13 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION
SELECT 'PhotoID'				AS [name],	'K' AS [Code],1 AS [isSelected] ,14 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION
SELECT 'Cheque'					AS [name],	'Q' AS [Code],1 AS [isSelected] ,15 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION  
SELECT 'Corporate'				AS [name],	'V' AS [Code],1 AS [isSelected] ,16 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Signing Document'		AS [name],	'G' AS [Code],1 AS [isSelected] ,17 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'SMS'					AS [name],	'W' AS [Code],1 AS [isSelected] ,18 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName] UNION
SELECT 'Requested Documents'	AS [name],	'L' AS [Code],1 AS [isSelected] ,19 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'MyTask' AS [PageName]

INSERT INTO CustomFilterColumndetails
-- Action Priority Tasks
SELECT 'High'			AS [name],	'H' AS [Code],1 AS [isSelected] ,0 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Priority' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Low'			AS [name],	'L' AS [Code],1 AS [isSelected] ,1 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Priority' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Normal'			AS [name],	'N' AS [Code],1 AS [isSelected] ,2 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Priority' AS [ColumnName], 'MyTask' AS [PageName]


INSERT INTO CustomFilterColumndetails
-- Action Flag Tasks
SELECT 'Clear Flag'		AS [name],	'0' AS [Code],1 AS [isSelected] ,0 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Blue Flag'		AS [name],	'1' AS [Code],1 AS [isSelected] ,1 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Orange Flag'	AS [name],	'2' AS [Code],1 AS [isSelected] ,2 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Red Flag'		AS [name],	'3' AS [Code],1 AS [isSelected] ,3 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Green Flag'		AS [name],	'4' AS [Code],1 AS [isSelected] ,4 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Black Flag'		AS [name],	'5' AS [Code],1 AS [isSelected] ,5 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'MyTask' AS [PageName] UNION 
SELECT 'Yellow Flag'	AS [name],	'6' AS [Code],1 AS [isSelected] ,6 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'MyTask' AS [PageName] 

-- My Task Default Options ends here

-- Team Task Default Options starts here
INSERT INTO CustomFilterColumndetails
-- Action Type Tasks

SELECT 'Action'					AS [name],	'A' AS [Code],1 AS [isSelected] ,0  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Critical'				AS [name],	'C' AS [Code],1 AS [isSelected] ,1  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Dictation'				AS [name],	'D' AS [Code],1 AS [isSelected] ,2  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Note'					AS [name],	'N' AS [Code],1 AS [isSelected] ,3  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Court'					AS [name],	'O' AS [Code],1 AS [isSelected] ,4  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Appointment'			AS [name],	'P' AS [Code],1 AS [isSelected] ,5  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Remainder'				AS [name],	'R' AS [Code],1 AS [isSelected] ,6  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Statute'				AS [name],	'S' AS [Code],1 AS [isSelected] ,7  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Phone'				    AS [name],	'T' AS [Code],1 AS [isSelected] ,8  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Undertaking'			AS [name],	'U' AS [Code],1 AS [isSelected] ,9  AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Email'					AS [name],	'E' AS [Code],1 AS [isSelected] ,10 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Scanned'				AS [name],	'M' AS [Code],1 AS [isSelected] ,11 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Fixed Date'				AS [name],	'F' AS [Code],1 AS [isSelected] ,12 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Non PhotoId'			AS [name],	'I' AS [Code],1 AS [isSelected] ,13 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION
SELECT 'PhotoID'				AS [name],	'K' AS [Code],1 AS [isSelected] ,14 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION
SELECT 'Cheque'					AS [name],	'Q' AS [Code],1 AS [isSelected] ,15 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION  
SELECT 'Corporate'				AS [name],	'V' AS [Code],1 AS [isSelected] ,16 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Signing Document'		AS [name],	'G' AS [Code],1 AS [isSelected] ,17 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'SMS'					AS [name],	'W' AS [Code],1 AS [isSelected] ,18 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName] UNION
SELECT 'Requested Documents'	AS [name],	'L' AS [Code],1 AS [isSelected] ,19 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Type' AS [ColumnName], 'TeamTask' AS [PageName]

INSERT INTO CustomFilterColumndetails
-- Action Priority Tasks
SELECT 'High'			AS [name],	'H' AS [Code],1 AS [isSelected] ,0 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Priority' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Low'			AS [name],	'L' AS [Code],1 AS [isSelected] ,1 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Priority' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Normal'			AS [name],	'N' AS [Code],1 AS [isSelected] ,2 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Priority' AS [ColumnName], 'TeamTask' AS [PageName]


INSERT INTO CustomFilterColumndetails
-- Action Flag Tasks
SELECT 'Clear Flag'		AS [name],	'0' AS [Code],1 AS [isSelected] ,0 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Blue Flag'		AS [name],	'1' AS [Code],1 AS [isSelected] ,1 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Orange Flag'	AS [name],	'2' AS [Code],1 AS [isSelected] ,2 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Red Flag'		AS [name],	'3' AS [Code],1 AS [isSelected] ,3 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Green Flag'		AS [name],	'4' AS [Code],1 AS [isSelected] ,4 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Black Flag'		AS [name],	'5' AS [Code],1 AS [isSelected] ,5 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'TeamTask' AS [PageName] UNION 
SELECT 'Yellow Flag'	AS [name],	'6' AS [Code],1 AS [isSelected] ,6 AS [FilterOrder] ,0 AS [IsIconAvailable] , '' AS [Iconpath] , 'Action Flag' AS [ColumnName], 'TeamTask' AS [PageName] 

--Team Task Default Options ends here

INSERT INTO CustomFilterColumndetails

SELECT  'Email Files'				AS [name], '.eml,EML,MSG'									AS [Code] ,1 AS [isSelected] ,0  AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/outlook.png'	AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'Images Files'				AS [name], '.jpg,JPG,PNG,BMP,gif,tif,PSD,HEI,ICO,JPE'		AS [Code] ,1 AS [isSelected] ,1  AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/IMAGE.png'		AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'PDF Files'					AS [name], '.pdf,PDF'										AS [Code] ,1 AS [isSelected] ,2  AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/pdf.png'		AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'Text Files'				AS [name], '.txt,TXT,LOG,TEX,RTF'							AS [Code] ,1 AS [isSelected] ,3  AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/TEXT.png'		AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'Documents'					AS [name], 'docx,DOC,ODS,ODT'								AS [Code] ,1 AS [isSelected] ,4  AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/DOCUMENT.png'	AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'Excel Files'				AS [name], 'CSV,XLS,xlsx'									AS [Code] ,1 AS [isSelected] ,5  AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/excelv1.png'	AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'Audio Files'				AS [name], 'MP3,WAV,M4A'									AS [Code] ,1 AS [isSelected] ,6  AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/WAVIcon.jpg'	AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'Presentation Documents'	AS [name], 'pptx,PPT,ODP,PPS'								AS [Code] ,1 AS [isSelected] ,7  AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/PPT.png'		AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'Compressed Files'			AS [name], 'ZIP'											AS [Code] ,1 AS [isSelected] ,8  AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/Unknown.png'	AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'Video Files'				AS [name], 'MP4,MOV'										AS [Code] ,1 AS [isSelected] ,9  AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/Unknown.png'	AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'Android Apps'				AS [name], 'APK'											AS [Code] ,1 AS [isSelected] ,10 AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/Unknown.png'	AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'Web Files'					AS [name], 'htm,XML,MHT,SWF'								AS [Code] ,1 AS [isSelected] ,11 AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/Unknown.png'	AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'Graphics Documents'		AS [name], 'CGM,DWG,EPS,PS,SVG,VSD'							AS [Code] ,1 AS [isSelected] ,12 AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/Unknown.png'	AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'DB Files'					AS [name], 'FOL,SQL'										AS [Code] ,1 AS [isSelected] ,13 AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/Unknown.png'	AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] UNION
SELECT  'Calendar Files'			AS [name], 'ICS'											AS [Code] ,1 AS [isSelected] ,14 AS [FilterOrder] ,1 AS [IsIconAvailable] , 'assets/images/filetypes/Unknown.png'	AS [Iconpath] , 'Type' AS [ColumnName], 'DocumentManager' AS [PageName] 
																									   
END
GO	
--- Custom Filter Defined Script End


--Added for Default Partner in settings

IF NOT EXISTS (SELECT 1 FROM [dbo].[Settings] WHERE KeyName = 'TransactNewCaseDefaultPartner')
BEGIN
	insert into [dbo].[Settings] values('TransactNewCaseDefaultPartner','');
END
GO

-- MAIL TEMPLATE FOR INVITE NEW USERS TO CLIENT PORTAL
IF NOT EXISTS (SELECT 1 FROM [dbo].[PortalNotificationTemplate] WHERE [TemplateType] = 'Invite_New_Client_User')
BEGIN
	INSERT INTO [dbo].[PortalNotificationTemplate]
	([TemplateType],
	 [TemplateSubject],
	 [TemplateBody])
	VALUES(
	'Invite_New_Client_User',
	'Client Portal - Account Registration',
	'<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="x-apple-disable-message-reformatting"> <style>/ What it does: Remove spaces around the email design added by some email clients. / / Beware: It can remove the padding / margin and add a background color to the compose a reply window. / html, body{margin: 0 auto !important; padding: 0 !important; height: 100% !important; width: 100% !important;}h1, h2, h3{margin-top: 22px; margin-bottom: 22px;}/ What it does: Stops email clients resizing small text. /{-ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;}/ What it does: Centers email on Android 4.4 / div[style*="margin: 16px 0"]{margin: 0 !important;}/ What it does: Stops Outlook from adding extra spacing to tables. / table, td{mso-table-lspace: 0pt !important; mso-table-rspace: 0pt !important;}/ What it does: Fixes webkit padding issue. Fix for Yahoo mail table alignment bug. Applies table-layout to the first 2 tables then removes for anything nested deeper. / table{border-spacing: 0 !important; border-collapse: collapse !important; table-layout: fixed !important; margin: 0 auto !important;}table table table{table-layout: auto;}/ What it does: Uses a better rendering method when resizing images in IE. / img{-ms-interpolation-mode: bicubic;}/ What it does: Prevents Windows 10 Mail from underlining links despite inline CSS. Styles for underlined links should be inline. / a{text-decoration: none;}/ What it does: A work-around for email clients meddling in triggered links. / [x-apple-data-detectors], / iOS / .unstyle-auto-detected-links , .aBn{border-bottom: 0 !important; cursor: default !important; color: inherit !important; text-decoration: none !important; font-size: inherit !important; font-family: inherit !important; font-weight: inherit !important; line-height: inherit !important;}/ What it does: Prevents Gmail from displaying a download button on large, non-linked images. / .a6S{display: none !important; opacity: 0.01 !important;}/ If the above doesn"t work, add a .g-img class to any image in question. / img.g-img + div{display: none !important;}/ What it does: Removes right gutter in Gmail iOS app: https://github.com/TedGoas/Cerberus/issues/89 / / Create one of these media queries for each additional viewport size you"d like to fix / / iPhone 4, 4S, 5, 5S, 5C, and 5SE / @media only screen and (min-device-width: 320px) and (max-device-width: 374px){.email-container{min-width: 320px !important;}}/ iPhone 6, 6S, 7, 8, and X / @media only screen and (min-device-width: 375px) and (max-device-width: 413px){.email-container{min-width: 375px !important;}}/ iPhone 6+, 7+, and 8+ / @media only screen and (min-device-width: 414px){.email-container{min-width: 414px !important;}}</style> <style>/ What it does: Hover styles for buttons / .button-td, .button-a{transition: all 100ms ease-in;}.button-td-primary:hover, .button-a-primary:hover{background: #555555 !important; border-color: #555555 !important;}/ Media Queries / @media screen and (max-width: 600px){/ What it does: Adjust typography on small screens to improve readability */ .email-container p{font-size: 17px !important;}}</style> </head><body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly;"><center style="width: 100%;"> <table style="font-family: Helvetica,Arial,sans-serif; width: 100%; border-bottom-color: #681351; border-bottom-width: 5px; border-bottom-style: solid; margin: 0; padding: 0; background-color: #f3f1f1;" bgcolor="#f3f1f1"> <tbody> <tr style="font-family: Helvetica,Arial,sans-serif; margin: 0; padding: 0;"> <td align=""> <div style="max-width: 600px; margin: 0 auto; padding: 0 10px" class="email-container"> <h1>$TenantFirmName$</h1> </div></td></tr></tbody> </table> <table style="font-family: Helvetica,Arial,sans-serif; width: 100%; margin: 0; padding: 0;" bgcolor=""> <tbody> <tr style="font-family: Helvetica,Arial,sans-serif; margin: 0; padding: 0;"> <td style="" bgcolor="#FFFFFF" align=""> <div style="max-width: 600px; margin: 0 auto; padding: 0 10px" class="email-container"> <p style="text-align: left;"></p><h2 style="text-align: left;mso-line-height-rule:exactly;"><span style="font-size: 14px;">Hi,</span></h2> <p style="text-align: left;"> </p><p></p><p>You have been successfully registered on Client Portal</p><p>To complete your registration please use the below link.</p><p></p><p>You will be able to login to the portal after you enter all the required details.</p><div style="margin:30px 0"> <table align="center"> <tbody> <tr> <td style="background: #3e3274; padding: 15px 18px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;" bgcolor="#3e3274" align="center"> <div align="center"><a class="link2" style="color: #ffffff; text-decoration: none; font-size: 14px; font-weight: 100;" href="$LinkToRegisterClientUser$" target="_blank" rel="noopener">Activate your account</a></div></td></tr></tbody> </table> </div><p><br>Thanks, <br>The $TenantFirmName$ Team</p></div></td></tr></tbody> </table> </center> <p></p><p></p><hr> <p> </p><div style="font-size: 10px; padding: 0 10px"><br></div><p></p></body></html>'
	)
END
GO

-- OTP TEMPLATE FOR 2FA IN CLIENT PORTAL
IF NOT EXISTS (SELECT 1 FROM [dbo].[PortalNotificationTemplate] WHERE [TemplateType] = 'SMS_OTP_VERIFICATION')
BEGIN
	INSERT INTO [dbo].[PortalNotificationTemplate]
	([TemplateType],
     [TemplateBody])
	VALUES(
	'SMS_OTP_VERIFICATION',
	'OTP for Client Portal login is %token. This OTP will be valid for %time minutes.'
	)
END
GO

IF NOT EXISTS (SELECT 1 FROM [dbo].[PortalNotificationTemplate] WHERE [TemplateType] = 'SMS_OTP_RESET_PASSWORD')
BEGIN
	INSERT INTO [dbo].[PortalNotificationTemplate]
	([TemplateType],
     [TemplateBody])
	VALUES(
	'SMS_OTP_RESET_PASSWORD',
	'The OTP to reset your password for Client Portal is {0}'
	)
END
GO

-- Mail template to 2FA and Reset 
IF NOT EXISTS (SELECT 1 FROM [dbo].[PortalNotificationTemplate] WHERE [TemplateType] = 'MAIL_OTP_VERIFICATION')
BEGIN
	INSERT INTO [dbo].[PortalNotificationTemplate]
	([TemplateType],
	 [TemplateSubject],
	 [TemplateBody])
	VALUES(
	'MAIL_OTP_VERIFICATION',
	'Client Portal - OTP  for 2FA',
	'Hi $UserName$, <BR><BR> The OTP for Client Portal login is <h2> $PasswordResetOTP$</h2> This OTP will be valid for <b>$PasswordResetOTPExpirationTime$ minutes</b>. <BR> <BR> Thank You <BR>'
	)
END
GO

IF NOT EXISTS (SELECT 1 FROM [dbo].[PortalNotificationTemplate] WHERE [TemplateType] = 'MAIL_OTP_RESET_PASSWORD')
BEGIN
	INSERT INTO [dbo].[PortalNotificationTemplate]
	([TemplateType],
	 [TemplateSubject],
	 [TemplateBody])
	VALUES(
	'MAIL_OTP_RESET_PASSWORD',
	'Client Portal - OTP  for Password Reset',
	'Hi $UserName$, <BR><BR> The OTP to reset your password for Client Portal is <h2> $PasswordResetOTP$</h2> Generated at <b>$PasswordResetOTPCreationTime$ (UTC)</b>, and valid up to <b>$PasswordResetOTPExpirationTime$ (UTC)</b>. <BR> <BR> Thank You <BR>'
	)
END
GO


-- INSERT SCRIPT FOR SAM NOTIFICATIONS
IF NOT EXISTS(SELECT TOP 1 1 FROM Settings where [KeyName] = 'NoOfDaysNotificationFetch')
BEGIN
	INSERT INTO Settings ([KeyName],[KeyValue]) VALUES ('NoOfDaysNotificationFetch','7')
END
GO


--INSERT SCRIPT FOR DEFAULT CASE DIARY VIEW
IF NOT EXISTS (SELECT 1 FROM [dbo].[CustomFilterbyUserandPage]
	WHERE [FilterOrder] = -1 AND [PageName]='CaseDiary')
BEGIN
	INSERT INTO [dbo].[CustomFilterbyUserandPage]
	([HandlerCode]
	,[PageName]
	,[FilterName]
	,[CreatedDate]
	,[FilterOrder]
	,[GridViewState]
	)
	VALUES(
	'STANDARD'
	,'CaseDiary'
	,'Standard_View'
	,GETUTCDATE()
	,-1
	,'[{"ColumnName":"CompleteORGenerated","ShowColumn":true,"ColumnWidth":30},{"ColumnName":"ActionType","ShowColumn":true,"ColumnWidth":30},{"ColumnName":"PriorityValue","ShowColumn":true,"ColumnWidth":30},{"ColumnName":"DelegationStatus","ShowColumn":true,"ColumnWidth":30},{"ColumnName":"Attachments","ShowColumn":true,"ColumnWidth":30},{"ColumnName":"Date","ShowColumn":true,"ColumnWidth":85},{"ColumnName":"DueDate","ShowColumn":false,"ColumnWidth":85},{"ColumnName":"CreationDate","ShowColumn":false,"ColumnWidth":85},{"ColumnName":"Time","ShowColumn":true,"ColumnWidth":50},{"ColumnName":"FNCode","ShowColumn":true,"ColumnWidth":50},{"ColumnName":"TeamCode","ShowColumn":true,"ColumnWidth":50},{"ColumnName":"Synopsis","ShowColumn":true},{"ColumnName":"Subject","ShowColumn":false},{"ColumnName":"Text1","ShowColumn":false},{"ColumnName":"ActionCode","ShowColumn":true,"ColumnWidth":80},{"ColumnName":"ActionId","ShowColumn":false,"ColumnWidth":70},{"ColumnName":"Flag","ShowColumn":true,"ColumnWidth":30},{"ColumnName":"NeedsAttention","ShowColumn":true,"ColumnWidth":30}]'
	)
END
GO

IF EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'EmailAzureAppClientId')
BEGIN
	UPDATE [Settings] SET [KeyName] = 'AzureAppClientId' WHERE [KeyName] = 'EmailAzureAppClientId'

END
GO


IF EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'EmailAzureAppClientSecret')
BEGIN
	UPDATE [Settings] SET [KeyName] = 'AzureAppClientSecret' WHERE [KeyName] = 'EmailAzureAppClientSecret'

END
GO

-- INSERT SCRIPT FOR DEFAULT ACION CODE FOR TRANSACT NOTES
IF NOT EXISTS(SELECT TOP 1 1 FROM Settings where [KeyName] = 'TransactActionCode')
BEGIN
	INSERT INTO Settings ([KeyName],[KeyValue]) VALUES ('TransactActionCode','ADMNT')
END
GO

-- NEW ACTION TYPE FOR REQUESTED DOCUMENT - FRAMEWORK CHANGE BY PINO
INSERT
  INTO [dbo].[DiaryDelActionType]
      ([ActionType],
       [ActionTypeDescription])
SELECT [NEW].[ActionType],
       [NEW].[ActionTypeDescription]
  FROM (SELECT CONVERT(NCHAR(1),
                       'L')                   AS [ActionType],
               CONVERT(NVARCHAR(40),
                       'Requested Documents') AS [ActionTypeDescription]) [NEW]
       LEFT OUTER JOIN [dbo].[DiaryDelActionType] [DDAT]
                    ON [DDAT].[ActionType] = [NEW].[ActionType]
 WHERE [DDAT].[ActionType] IS NULL
GO

-- MY TASK - DEFAULT COLUMN LIST
IF NOT EXISTS (SELECT TOP 1 1
             FROM [CustomFilterbyUserandPage] AS [CF]
            WHERE [CF].[HandlerCode] = 'STANDARD'
              AND [CF].[PageName] = 'MyTask')
BEGIN
	INSERT INTO [CustomFilterbyUserandPage]
	([HandlerCode]
	,[PageName]
	,[FilterName]
	,[CreatedDate]
	,[FilterOrder]
	,[GridViewState]
	)
	VALUES (
	'STANDARD',
	'MyTask',
	'Standard_View',
	GETUTCDATE(),
	-1,
	'[{"ColumnName":"CompleteOrGeneratedD","ShowColumn":true,"ColumnWidth":30,"ColumnIndex":0},{"ColumnName":"ActionType","ShowColumn":true,"ColumnWidth":30,"ColumnIndex":1},
{"ColumnName":"DelegationStatus","ShowColumn":true,"ColumnWidth":30,"ColumnIndex":2},{"ColumnName":"PriorityValue","ShowColumn":true,"ColumnWidth":30,"ColumnIndex":3},
{"ColumnName":"Date1","ShowColumn":true,"ColumnWidth":90,"ColumnIndex":4},{"ColumnName":"Time","ShowColumn":true,"ColumnWidth":60,"ColumnIndex":5},
{"ColumnName":"CaseCode","ShowColumn":true,"ColumnWidth":100,"ColumnIndex":6},{"ColumnName":"Handler","ShowColumn":true,"ColumnWidth":70,"ColumnIndex":7},
{"ColumnName":"Team","ShowColumn":true,"ColumnWidth":70,"ColumnIndex":8},{"ColumnName":"ClientCase","ShowColumn":true,"ColumnIndex":9},
{"ColumnName":"Synopsis","ShowColumn":true,"ColumnIndex":10},{"ColumnName":"Flag","ShowColumn":true,"ColumnWidth":30,"ColumnIndex":11},
{"ColumnName":"ActionId","ShowColumn":true,"ColumnWidth":70,"ColumnIndex":12},{"ColumnName":"ActionCode","ShowColumn":true,"ColumnWidth":100,"ColumnIndex":13},
{"ColumnName":"Action","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":14},{"ColumnName":"ActionStatus","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":15},
{"ColumnName":"FileColour","ShowColumn":false,"ColumnWidth":80,"ColumnIndex":16},{"ColumnName":"CaseFe","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":17},
{"ColumnName":"ClientName","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":18},{"ColumnName":"CreationDate","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":19},
{"ColumnName":"DelegatedFE","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":20},{"ColumnName":"DelType","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":21},
{"ColumnName":"DelDate","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":22},{"ColumnName":"DDStatus","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":23},
{"ColumnName":"DStatus","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":24},{"ColumnName":"DraftBillNo","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":25},
{"ColumnName":"DueDate","ShowColumn":false,"ColumnWidth":80,"ColumnIndex":26},{"ColumnName":"DueTime","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":27},
{"ColumnName":"Duration","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":28},{"ColumnName":"FeeEarner","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":29},
{"ColumnName":"FNCode","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":30},{"ColumnName":"From","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":31},
{"ColumnName":"Highlighted","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":32},{"ColumnName":"MatterDescription","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":33},
{"ColumnName":"OldRef","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":34},{"ColumnName":"Owner","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":35},
{"ColumnName":"Partner","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":36},{"ColumnName":"ProcessStatus","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":37},
{"ColumnName":"ProcessType","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":38},{"ColumnName":"User1","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":39},
{"ColumnName":"User2","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":40},{"ColumnName":"Secretary","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":41},
{"ColumnName":"WorkFlow","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":42},{"ColumnName":"WorkProcess","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":43},
{"ColumnName":"YourRef","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":44}]')
END

IF NOT EXISTS (SELECT TOP 1 1
             FROM [CustomFilterColumndetails] AS [CF]
            WHERE [CF].[ColumnName] = 'Action Status'
              AND [CF].[PageName] = 'CaseDiary'
			  AND [CF].[Name] = 'Not Completed')
BEGIN
INSERT INTO CustomFilterColumndetails(Name,Code,isSelected,FilterOrder,IsIconAvailable,Iconpath,ColumnName,PageName)
VALUES('Not Completed','N',1,0,0,'','Action Status','CaseDiary')
END

IF NOT EXISTS (SELECT TOP 1 1
             FROM [CustomFilterColumndetails] AS [CF]
            WHERE [CF].[ColumnName] = 'Action Status'
              AND [CF].[PageName] = 'CaseDiary'
			  AND [CF].[Name] = 'Documents(s) Generated')
BEGIN
INSERT INTO CustomFilterColumndetails(Name,Code,isSelected,FilterOrder,IsIconAvailable,Iconpath,ColumnName,PageName)
VALUES('Documents(s) Generated','G',1,1,0,'','Action Status','CaseDiary')
END

IF NOT EXISTS (SELECT TOP 1 1
             FROM [CustomFilterColumndetails] AS [CF]
            WHERE [CF].[ColumnName] = 'Action Status'
              AND [CF].[PageName] = 'CaseDiary'
			  AND [CF].[Name] = 'Completed')
BEGIN
INSERT INTO CustomFilterColumndetails(Name,Code,isSelected,FilterOrder,IsIconAvailable,Iconpath,ColumnName,PageName)
VALUES('Completed','GC',1,2,0,'','Action Status','CaseDiary')
END

IF NOT EXISTS (SELECT TOP 1 1
             FROM [CustomFilterColumndetails] AS [CF]
            WHERE [CF].[ColumnName] = 'Action Status'
              AND [CF].[PageName] = 'MyTask'
			  AND [CF].[Name] = 'Not Completed')
BEGIN
INSERT INTO CustomFilterColumndetails(Name,Code,isSelected,FilterOrder,IsIconAvailable,Iconpath,ColumnName,PageName)
VALUES('Not Completed','N',1,0,0,'','Action Status','MyTask')
END

IF NOT EXISTS (SELECT TOP 1 1
             FROM [CustomFilterColumndetails] AS [CF]
            WHERE [CF].[ColumnName] = 'Action Status'
              AND [CF].[PageName] = 'MyTask'
			  AND [CF].[Name] = 'Documents(s) Generated')
BEGIN
INSERT INTO CustomFilterColumndetails(Name,Code,isSelected,FilterOrder,IsIconAvailable,Iconpath,ColumnName,PageName)
VALUES('Documents(s) Generated','G',1,1,0,'','Action Status','MyTask')
END

IF NOT EXISTS (SELECT TOP 1 1
             FROM [CustomFilterColumndetails] AS [CF]
            WHERE [CF].[ColumnName] = 'Action Status'
              AND [CF].[PageName] = 'MyTask'
			  AND [CF].[Name] = 'Completed')
BEGIN
INSERT INTO CustomFilterColumndetails(Name,Code,isSelected,FilterOrder,IsIconAvailable,Iconpath,ColumnName,PageName)
VALUES('Completed','C',1,0,0,'','Action Status','MyTask')
END

GO

--Insert Report Credential 
IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_accountreports_Credential_Count') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_accountreports_Credential_Count',
		3)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_accountreports_Credential_0') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'[REDACTED]',
		'[REDACTED]')
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_accountreports_Credential_1') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'[REDACTED]',
		'[REDACTED]')
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_accountreports_Credential_2') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_accountreports_Credential_2',
		'UuHNcgMS1mwQ=')
END
GO


IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_systemreports_Credential_Count') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_systemreports_Credential_Count',
		2)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_systemreports_Credential_0') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'[REDACTED]',
		'[REDACTED]')
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_systemreports_Credential_1') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_systemreports_Credential_1',
		'n0Dind23r_____eafPN0BvFd320jr0DrzXQT0o7ipKBbQCqS99NOFw6DvFksY9SP5YhafqDzs8M_____lIAf25GofgsJD8=')
END
GO


IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_sam4systemreports_Credential_Count') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_sam4systemreports_Credential_Count',
		2)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_sam4systemreports_Credential_0') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'[REDACTED]',
		'[REDACTED]')
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_sam4systemreports_Credential_1') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_sam4systemreports_Credential_1',
		'oVX1ou_____g5XwDXvLIECTrkWVmC0oYOBbrgpNDlgeXo47doQiwqD44Olpxc6qe6_____7OZI_____awgZH7whrNVk=')
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_partnerreports_Credential_Count') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_partnerreports_Credential_Count',
		2)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_partnerreports_Credential_0') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'[REDACTED]',
		'[REDACTED]')
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_partnerreports_Credential_1') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_partnerreports_Credential_1',
		'hKPaq53HJh3Yd03oYkzlGPPEJy-----YnfpLbXEKKp8HCbIgTSwybjBK-----iInIorPc_____sT0u65Q1TwRrMgmxN3cmQ=')
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_sam4partnerreports_Credential_Count') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_sam4partnerreports_Credential_Count',
		2)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_sam4partnerreports_Credential_0') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'[REDACTED]',
		'[REDACTED]')
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_sam4partnerreports_Credential_1') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_sam4partnerreports_Credential_1',
		'_____DiP45h59bBrFWXSK9v4B12chE3h9JhnrDIwpHrbLPpFCz9SaDkGd2kxtfvcDZcUKWCMATK-----6Qvq3B0=')
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_clientreports_Credential_Count') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_clientreports_Credential_Count',
		2)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_clientreports_Credential_0') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'[REDACTED]',
		'[REDACTED]')
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_clientreports_Credential_1') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_clientreports_Credential_1',
		'gGCfG08IXyKuXdMqv3P8rIvIOSnTn6cLvQGJSZjM1gDFem6OtxxLY4----------IfNA1OafodLdroLz5-----ylHyq0=')
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_billingreports_Credential_Count') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_billingreports_Credential_Count',
		2)
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_billingreports_Credential_0') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'[REDACTED]',
		'[REDACTED]')
END
GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [keyname] = 'KaaS_billingreports_Credential_1') 
BEGIN
	INSERT INTO [Settings](
		[keyname], 
		[keyvalue]) 
	VALUES (
		'KaaS_billingreports_Credential_1',
		'ykg_____1PbC1NTuu8S3McczeXHuzxdqwow95ErPTewVMos5Ze2PO_____Vxqw8tPf-----iYwTWLwIkUgHxQuZL2Ew=')
END
GO

IF NOT EXISTS
	(SELECT TOP 1 1
	   FROM [dbo].[CustomFilterColumndetails]
	  WHERE [name]='Black Flag' 
	    AND PageName = 'MyTask' 
		AND ColumnName = 'Action Flag') 
BEGIN
UPDATE [dbo].[CustomFilterColumndetails] 
   SET [Iconpath]='black-fg-svg', [IsIconAvailable]= 1 
 WHERE [name]='Black Flag'
   AND PageName = 'MyTask'
   AND ColumnName = 'Action Flag'
END
GO

IF NOT EXISTS
	(SELECT TOP 1 1
	   FROM [dbo].[CustomFilterColumndetails]
	  WHERE [name]='Blue Flag' 
	    AND PageName = 'MyTask' 
		AND ColumnName = 'Action Flag') 
BEGIN
UPDATE [dbo].[CustomFilterColumndetails] 
   SET [Iconpath]='blue-fg-svg', [IsIconAvailable]= 1 
 WHERE [name]='Blue Flag' 
   AND PageName = 'MyTask' 
   AND ColumnName = 'Action Flag'
END
GO

IF NOT EXISTS
	(SELECT TOP 1 1
	   FROM [dbo].[CustomFilterColumndetails]
	  WHERE [name]='Clear Flag' 
	    AND PageName = 'MyTask' 
		AND ColumnName = 'Action Flag') 
BEGIN
UPDATE [dbo].[CustomFilterColumndetails] 
   SET [Iconpath]='clear-fg-svg', [IsIconAvailable]= 1 
 WHERE [name]='Clear Flag' 
   AND PageName = 'MyTask' 
   AND ColumnName = 'Action Flag'
END
GO

IF NOT EXISTS
	(SELECT TOP 1 1
	   FROM [dbo].[CustomFilterColumndetails]
	  WHERE [name]='Green Flag' 
	    AND PageName = 'MyTask' 
		AND ColumnName = 'Action Flag')
BEGIN
UPDATE [dbo].[CustomFilterColumndetails] 
   SET [Iconpath]='green-fg-svg', [IsIconAvailable]= 1 
 WHERE [name]='Green Flag' 
   AND PageName = 'MyTask' 
   AND ColumnName = 'Action Flag'
END
GO

IF NOT EXISTS
	(SELECT TOP 1 1
	   FROM [dbo].[CustomFilterColumndetails]
	  WHERE [name]='Orange Flag'
	    AND PageName = 'MyTask' 
		AND ColumnName = 'Action Flag')
BEGIN
UPDATE [dbo].[CustomFilterColumndetails] 
   SET [Iconpath]='orange-fg-svg', [IsIconAvailable]= 1 
 WHERE [name]='Orange Flag' 
   AND PageName = 'MyTask' 
   AND ColumnName = 'Action Flag'
END
GO

IF NOT EXISTS
	(SELECT TOP 1 1
	   FROM [dbo].[CustomFilterColumndetails]
	  WHERE [name]='Red Flag'
	    AND PageName = 'MyTask' 
		AND ColumnName = 'Action Flag')
BEGIN
UPDATE [dbo].[CustomFilterColumndetails] 
   SET [Iconpath]='red-fg-svg', [IsIconAvailable]= 1 
 WHERE [name]='Red Flag' 
   AND PageName = 'MyTask' 
  	AND ColumnName = 'Action Flag'
END
GO

IF NOT EXISTS
	(SELECT TOP 1 1
	   FROM [dbo].[CustomFilterColumndetails]
	  WHERE [name]='Yellow Flag' 
	    AND PageName = 'MyTask' 
		AND ColumnName = 'Action Flag')
BEGIN
UPDATE [dbo].[CustomFilterColumndetails] 
   SET [Iconpath]='yellow-fg-svg', [IsIconAvailable]= 1 
 WHERE [name]='Yellow Flag' 
   AND PageName = 'MyTask' 
   AND ColumnName = 'Action Flag'
END
GO


-- DATAPUMP FOR CONTROL GROUPS AND PERMISSIONS
-- FIRST REMOVE EXISTING RECORDS
IF OBJECT_ID(N'KaasControlMaster',N'U') IS NOT NULL
BEGIN
TRUNCATE TABLE KaasControlMaster
END
GO

-- INSERT WITH NEW DATA
IF OBJECT_ID(N'KaasControlMaster',N'U') IS NOT NULL
BEGIN

INSERT INTO KaasControlMaster VALUES 
('Access change WF in Case Diary', 'Fuse', 'array', 'template-library', 1, 2),
('Access Firm Phone Log', 'Fuse', 'array', 'phone-log', 1, 2),
('Access to Know Your Client', 'Fuse', 'array', 'KYC', 1, 2),
('Accounts User', 'Ribbon', 'array', 'Draft Invoice', 1, 2),
('Accounts User', 'Ribbon', 'array', 'Request Payment', 1, 2),
('Accounts User', 'Fuse', 'array', 'account-ledger', 1, 2),
('Accounts User', 'Fuse', 'array', 'my-cheques', 1, 2),
('Accounts User', 'Fuse', 'array', 'my-invoice', 1, 2),
('Accounts User', 'KnowyourclientComponent', 'material', 'financial_tab', 1, 2),
('AML Approval', 'ClientGeneralTabComponent', 'material', 'check_money_laundering_current_client_details', 1, 0),
('AML Approval', 'AMLComponent', 'material', 'check_money_laundering_aml', 1, 2),
('AML Approval', 'AMLComponent', 'material', 'aml_approved_date', 1, 0),
('Approve Invoice', 'DraftinvoiceComponent', 'element', 'btn_approve', 1, 2),
('Bank Details', 'AddEditAssociatesComponent', 'material', 'bank_details_tab_case_associate', 1, 1),
('Bank Details', 'CurrentClientDetailsComponent', 'material', 'bank_details_tab_current_client_details', 1, 1),
('Bank Details', 'ClientGeneralComponent', 'material', 'bank_details_tab_case_associate_name', 1, 1),
('Change Client Charge Out Rates', 'ClientBillingDetailsTabComponent', 'material', 'client_charge_out_rate_indicator', 1, 0),
('Change Client Charge Out Rates', 'ClientBillingDetailsTabComponent', 'dev', 'client_charge_out_rate_grid', 1, 0),
('Change Client Charge Out Rates', 'ClientBillingDetailsTabComponent', 'toolbar', 'client_charge_out_rate_edit_btn_tool', 1, 2),
('Change Client Charge Out Rates', 'ClientBillingDetailsTabComponent', 'context', 'client_charge_out_rate_edit_btn_context', 1, 2),
('Change Client Charge Out Rates', 'ClientBillingDetailsTabComponent', 'material', 'client_charge_out_rate_retired_check', 1, 0),
('Change Client Charge Out Rates', 'ClientBillingDetailsTabComponent', 'material', 'matter_charge_out_rate_indicator', 1, 0),
('Change Client Charge Out Rates', 'ClientBillingDetailsTabComponent', 'dev', 'matter_charge_out_rate_grid', 1, 0),
('Change Client Charge Out Rates', 'ClientBillingDetailsTabComponent', 'toolbar', 'matter_charge_out_rate_edit_btn_tool', 1, 2),
('Change Client Charge Out Rates', 'ClientBillingDetailsTabComponent', 'context', 'matter_charge_out_rate_edit_btn_context', 1, 2),
('Change Client Charge Out Rates', 'ClientBillingDetailsTabComponent', 'material', 'matter_charge_out_rate_retired_check', 1, 0),
('Change Day Book Handler', 'MyDayBookTableComponent', 'customDropDown', 'select_day_book_handler', 1, 0),
('Change Matter Security Permissions', 'ClientPermissionTabComponent', 'material', 'client_permission_tab', 1, 2),
('Change Matter Security Permissions', 'MatterPermissionTabComponent', 'material', 'matter_permission_tab', 1, 2),
('Delete Phone Log', 'Ribbon', 'array', 'Phone_log_delete', 1, 2),
('Discharge Undertaking', 'Ribbon', 'array', 'dischartUndertakings', 1, 0),
('Document Assist', 'Ribbon', 'array', 'document_assists', 1, 0),
('Maintain Associate Types', 'AssociatesComponent', 'context', 'associates_type_context_menu', 1, 2),
('Maintain Client and Case details', 'CurrentClientDetailsComponent', 'element', 'client_btn_save', 1, 2),
('Maintain Client and Case details', 'CurrentCaseDetailsComponent', 'element', 'matter_btn_save', 1, 2),
('Maintain Undertakings', 'AddEditUndertakingsComponent', 'element', 'undertaking_save_btn', 1, 2),
('Maintain Undertakings', 'Ribbon', 'array', 'addUndertakings', 1, 0),
('Maintain Undertakings', 'Ribbon', 'array', 'editUndertakings', 1, 0),
('Matter Archiving', 'ArchiveTabComponent', 'material', 'archive_closed_check', 1, 0),
('Matter Archiving', 'ArchiveTabComponent', 'element', 'archive_actual_destroy_date', 1, 0),
('Matter Archiving', 'ArchiveTabComponent', 'element', 'archive_expected_destroy_date', 1, 0),
('Matter Archiving', 'ArchiveTabComponent', 'customSelect', 'archive_destroy_by', 1, 0),
('Matter Archiving', 'ArchiveTabComponent', 'element', 'archive_box_bar_code', 1, 0),
('Matter Archiving', 'ArchiveTabComponent', 'element', 'archive_date_file_closed', 1, 0),
('Matter Archiving', 'ArchiveTabComponent', 'element', 'archive_file_bar_code', 1, 0),
('Matter Archiving', 'ArchiveTabComponent', 'customSelect', 'archive_location_dropdown', 1, 0),
('Precedents', 'CaseDiaryMenuComponent', 'subMenu', 'precedent_id', 1, 0),
('Matter Archiving', 'ArchiveTabComponent', 'element', 'archive_location', 1, 0),
('Strong Room', 'Fuse', 'array', 'caseFileManager', 1, 2),
('Strong Room', 'Fuse', 'array', 'strongroom', 1, 2),
('Strong Room Maintenance', 'StrongRoomGridComponent', 'context', 'CF', 1, 2),
('Strong Room Maintenance', 'StrongRoomGridComponent', 'context', 'DF', 1, 2),
('Strong Room Maintenance', 'StrongRoomGridComponent', 'context', 'RPF', 1, 2),
('Strong Room Maintenance', 'StrongRoomGridComponent', 'context', 'WF', 1, 2),
('Strong Room Maintenance', 'StrongRoomGridComponent', 'context', 'AF', 1, 2),
('Strong Room Maintenance', 'Ribbon', 'array', 'addFile', 1, 2),
('Strong Room Maintenance', 'Ribbon', 'array', 'changeFile', 1, 2),
('Strong Room Maintenance', 'Ribbon', 'array', 'deleteFile', 1, 2),
('Strong Room Maintenance', 'Ribbon', 'array', 'replaceFile', 1, 2),
('Strong Room Maintenance', 'Ribbon', 'array', 'withdrawFile', 1, 2),
('System Reports', 'Fuse', 'array', 'system-reports', 1, 2),
('Uncomplete Actions', 'EditCasediaryComponent', 'dev', 'complete_Check_Id', 1, 0),
('Undertakings', 'Fuse', 'array', 'undertakings', 1, 2),
('Undertakings', 'Fuse', 'array', 'firm-undertaking ', 1, 2),
('User Defined Reports', 'Fuse', 'array', 'user-reports', 1, 2),
('Action Flow Setup', 'Fuse', 'array', 'Workflow', 1, 2);
END
GO

-- DATAPUMP FOR CONTROL GROUPS AND MASTER IDS
-- FIRST REMOVE EXISTING RECORDS
IF OBJECT_ID(N'KaasGroupControlsMap ',N'U') IS NOT NULL
BEGIN
TRUNCATE TABLE KaasGroupControlsMap 
END
GO

-- INSERT WITH NEW DATA
IF OBJECT_ID(N'KaasGroupControlsMap ',N'U') IS NOT NULL
BEGIN

INSERT INTO KaasGroupControlsMap  SELECT ctlGrp.id, ctlMaster.ControlMasterId FROM KHCtlGroups ctlGrp 
JOIN KaasControlMaster ctlMaster on ctlGrp.GroupName = ctlMaster.ControlGroupName;

END
GO

--Added for Document Upload retry count in Mobile

IF NOT EXISTS (SELECT 1 FROM [dbo].[Settings] WHERE KeyName = 'UploadRetryCount')
BEGIN
	insert into [dbo].[Settings] values('UploadRetryCount','3');
END
GO

IF NOT EXISTS
	(SELECT TOP 1 1
	   FROM [dbo].[CustomFilterColumndetails]
	  WHERE [ColumnName]='HasAttachment'
	    AND PageName = 'DocumentManager')
BEGIN
  INSERT INTO [dbo].[CustomFilterColumndetails] 
  	   VALUES ('Yes','Y',1,1,0,'','HasAttachment','DocumentManager')  
  INSERT INTO [dbo].[CustomFilterColumndetails] 
       VALUES ('No','N',1,2,0,'','HasAttachment','DocumentManager')
END 
GO

IF NOT EXISTS
	(SELECT TOP 1 1
	   FROM [dbo].[CustomFilterColumndetails]
	  WHERE [ColumnName]='Document Source'
	    AND PageName = 'DocumentManager')
BEGIN
  INSERT INTO [dbo].[CustomFilterColumndetails] 
  	   VALUES ('Capture','Capture',1,1,0,'','Document Source','DocumentManager')  
  INSERT INTO [dbo].[CustomFilterColumndetails] 
       VALUES ('Captured','Captured',1,2,0,'','Document Source','DocumentManager')
  INSERT INTO [dbo].[CustomFilterColumndetails] 
  	   VALUES ('Case','Case',1,3,0,'','Document Source','DocumentManager')  
  INSERT INTO [dbo].[CustomFilterColumndetails] 
       VALUES ('Dictation','Dictation',1,4,0,'','Document Source','DocumentManager')  
  INSERT INTO [dbo].[CustomFilterColumndetails] 
       VALUES ('IManage','IManage',1,5,0,'','Document Source','DocumentManager')
  INSERT INTO [dbo].[CustomFilterColumndetails] 
       VALUES ('Received E-mail','Received E-mail',1,5,0,'','Document Source','DocumentManager')  
  INSERT INTO [dbo].[CustomFilterColumndetails] 
       VALUES ('Sent E-mail','Sent E-mail',1,6,0,'','Document Source','DocumentManager')
END
GO

IF NOT EXISTS
	(SELECT TOP 1 1
	   FROM [dbo].[CustomFilterColumndetails]
	  WHERE [ColumnName]='DraftNo'
	    AND PageName = 'MyInvoice')
BEGIN
INSERT INTO [dbo].[CustomFilterColumndetails] 
	 VALUES ('Equals 0',0,1,0,0,'','DraftNo','MyInvoice')
INSERT INTO [dbo].[CustomFilterColumndetails] 
     VALUES ('Not equals 0',1,1,1,0,'','DraftNo','MyInvoice')
END
GO

IF NOT EXISTS
	(SELECT TOP 1 1
	   FROM [dbo].[CustomFilterColumndetails]
	  WHERE [ColumnName]='Type'
	    AND PageName = 'MyInvoice')
BEGIN
 INSERT INTO   [dbo].[CustomFilterColumndetails] 
 		VALUES ('C','C',1,0,0,'','Type','MyInvoice')
 INSERT INTO   [dbo].[CustomFilterColumndetails] 
 		VALUES ('I','I',1,1,0,'','Type','MyInvoice')
END
GO

IF NOT EXISTS
	(SELECT TOP 1 1
	   FROM [dbo].[CustomFilterColumndetails]
	  WHERE [ColumnName]='OpenInvoice'
	    AND PageName = 'MyInvoice')
BEGIN
INSERT INTO   [dbo].[CustomFilterColumndetails] 
	   VALUES ('Yes','Y',1,0,0,'','OpenInvoice','MyInvoice')
INSERT INTO   [dbo].[CustomFilterColumndetails] 
	   VALUES ('No','N',1,1,0,'','OpenInvoice','MyInvoice')
END
GO

IF NOT EXISTS (SELECT 1 FROM [dbo].[CustomFilterbyUserandPage]
	WHERE [FilterOrder] = -1 AND [PageName]='MyInvoice')
BEGIN
	INSERT INTO [dbo].[CustomFilterbyUserandPage]
	([HandlerCode]
	,[PageName]
	,[FilterName]
	,[CreatedDate]
	,[FilterOrder]
	,[GridViewState]
	)
	VALUES(
	'STANDARD'
	,'MyInvoice'
	,'Standard_View'
	,GETUTCDATE()
	,-1
	,'[{"ColumnName":"MATTER","ShowColumn":true,"ColumnWidth":95,"ColumnIndex":0},{"ColumnName":"BILLDATE","ShowColumn":true,"ColumnWidth":90,"ColumnIndex":1},{"ColumnName":"ADDRESSEE","ShowColumn":true,"ColumnWidth":250,"ColumnIndex":2},{"ColumnName":"ADDRESS","ShowColumn":true,"ColumnIndex":3},{"ColumnName":"FeCode","ShowColumn":false,"ColumnWidth":80,"ColumnIndex":4},{"ColumnName":"TYPE","ShowColumn":true,"ColumnWidth":50,"ColumnIndex":5},{"ColumnName":"TOTAL","ShowColumn":true,"ColumnWidth":80,"ColumnIndex":6},{"ColumnName":"DRAFTNO","ShowColumn":true,"ColumnWidth":80,"ColumnIndex":7},{"ColumnName":"INVOICENO","ShowColumn":true,"ColumnWidth":80,"ColumnIndex":8},{"ColumnName":"OpenInvoice","ShowColumn":true,"ColumnWidth":80,"ColumnIndex":9},{"ColumnName":"Released","ShowColumn":true,"ColumnWidth":70,"ColumnIndex":10}]'
	)
END
GO

IF NOT EXISTS (SELECT 1 FROM [dbo].[CustomFilterbyUserandPage]
	WHERE [FilterOrder] = -1 AND [PageName]='DocumentManager')
BEGIN
	INSERT INTO [dbo].[CustomFilterbyUserandPage]
	([HandlerCode]
	,[PageName]
	,[FilterName]
	,[CreatedDate]
	,[FilterOrder]
	,[GridViewState]
	)
	VALUES(
	'STANDARD'
	,'DocumentManager'
	,'Standard_View'
	,GETUTCDATE()
	,-1
	,'[{"ColumnName":"Type","ShowColumn":true,"ColumnWidth":30,"ColumnIndex":0},{"ColumnName":"Attachments","ShowColumn":true,"ColumnWidth":30,"ColumnIndex":1},{"ColumnName":"IsInDocFolder","ShowColumn":true,"ColumnWidth":30,"ColumnIndex":2},{"ColumnName":"Document","ShowColumn":true,"ColumnWidth":180,"ColumnIndex":3},{"ColumnName":"CurrentVersion","ShowColumn":true,"ColumnWidth":60,"ColumnIndex":4},{"ColumnName":"DiaryDate","ShowColumn":true,"ColumnWidth":100,"ColumnIndex":5},{"ColumnName":"DocumentDate","ShowColumn":true,"ColumnWidth":100,"ColumnIndex":6},{"ColumnName":"DocumentClassDescription","ShowColumn":true,"ColumnWidth":120,"ColumnIndex":7},{"ColumnName":"DocumentSource","ShowColumn":true,"ColumnWidth":80,"ColumnIndex":8},{"ColumnName":"EmailAddress","ShowColumn":true,"ColumnWidth":120,"ColumnIndex":9},{"ColumnName":"AddressTo","ShowColumn":true,"ColumnWidth":120,"ColumnIndex":10},{"ColumnName":"Subject","ShowColumn":true,"ColumnIndex":11},{"ColumnName":"FilePath","ShowColumn":true,"ColumnWidth":180,"ColumnIndex":12},{"ColumnName":"TrackReference","ShowColumn":true,"ColumnWidth":80,"ColumnIndex":13},{"ColumnName":"ActionId","ShowColumn":false,"ColumnWidth":80,"ColumnIndex":14},{"ColumnName":"DiaryTime","ShowColumn":false,"ColumnWidth":80,"ColumnIndex":15},{"ColumnName":"DocumentTime","ShowColumn":false,"ColumnWidth":80,"ColumnIndex":16},{"ColumnName":"SigningStatus","ShowColumn":true,"ColumnWidth":100,"ColumnIndex":17}]'
	)
END
GO

IF NOT EXISTS (SELECT 1 FROM [dbo].[CustomFilterbyUserandPage]
	WHERE [FilterOrder] = -1 AND [PageName]='Matter')
BEGIN
	INSERT INTO [dbo].[CustomFilterbyUserandPage]
	([HandlerCode]
	,[PageName]
	,[FilterName]
	,[CreatedDate]
	,[FilterOrder]
	,[GridViewState]
	)
	VALUES(
	'STANDARD'
	,'Matter'
	,'Standard_View'
	,GETUTCDATE()
	,-1
	,'[{"ColumnName":"Code","ShowColumn":true,"ColumnWidth":90,"ColumnIndex":0},{"ColumnName":"LastAccessed","ShowColumn":true,"ColumnWidth":90,"ColumnIndex":1},{"ColumnName":"FileColour","ShowColumn":true,"ColumnWidth":100,"ColumnIndex":2},{"ColumnName":"Name","ShowColumn":true,"ColumnWidth":150,"ColumnIndex":3},{"ColumnName":"Description","ShowColumn":true,"ColumnWidth":200,"ColumnIndex":4},{"ColumnName":"FeeEarner","ShowColumn":true,"ColumnWidth":90,"ColumnIndex":5},{"ColumnName":"Started","ShowColumn":true,"ColumnWidth":90,"ColumnIndex":6},{"ColumnName":"OldRef","ShowColumn":false,"ColumnWidth":70,"ColumnIndex":7},{"ColumnName":"YourRef","ShowColumn":true,"ColumnWidth":70,"ColumnIndex":8},{"ColumnName":"Dept","ShowColumn":false,"ColumnWidth":90,"ColumnIndex":9},{"ColumnName":"WorkType","ShowColumn":false,"ColumnWidth":90,"ColumnIndex":10},{"ColumnName":"Address","ShowColumn":false,"ColumnWidth":120,"ColumnIndex":11},{"ColumnName":"CaseStatusDesc","ShowColumn":false,"ColumnWidth":80,"ColumnIndex":12},{"ColumnName":"CloseDate","ShowColumn":false,"ColumnWidth":80,"ColumnIndex":13},{"ColumnName":"Closed","ShowColumn":false,"ColumnWidth":55,"ColumnIndex":14},{"ColumnName":"Email","ShowColumn":false,"ColumnWidth":150,"ColumnIndex":15},{"ColumnName":"FeeCode","ShowColumn":false,"ColumnWidth":70,"ColumnIndex":16},{"ColumnName":"FileNum","ShowColumn":false,"ColumnWidth":90,"ColumnIndex":17},{"ColumnName":"PhoneNumber","ShowColumn":false,"ColumnWidth":100,"ColumnIndex":18},{"ColumnName":"User1","ShowColumn":false,"ColumnWidth":70,"ColumnIndex":19},{"ColumnName":"User2","ShowColumn":false,"ColumnWidth":70,"ColumnIndex":20}]'
	)
END
GO


IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'DesktopAddinExpirationTime') 
BEGIN
	INSERT INTO [Settings](
		[KeyName], 
		[KeyValue]) 
	VALUES (
		'DesktopAddinExpirationTime',
		10)
END
GO

-- Legalsearch Folio No v4.5.0.x

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'UDF_ForFolio' ) 
BEGIN
	INSERT INTO [Settings](
		[KeyName], 
		[KeyValue]) 
	VALUES (
		'UDF_ForFolio',
		'u.folio;u.folio.no')
END
GO

----SAM Menu's Insert Script
IF OBJECT_ID(N'KeyhouseMenuList ',N'U') IS NOT NULL
	BEGIN
		TRUNCATE TABLE [dbo].[KeyhouseMenuList];
	END
GO

IF OBJECT_ID(N'KeyhouseMenuList ',N'U') IS NOT NULL
BEGIN
SET IDENTITY_INSERT [dbo].[KeyhouseMenuList] ON 

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (1, N'Dashboard', 0, N'sam/dashboard', N'Dashboard', N'DASHBOARD', 1, 1, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (2, N'Home', 1, N'sam/dashboard', N'HomeIcon', N'VIEW_DASHBOARD', 1, 1, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (3, N'Client/Case/Suppliers', 0, N'sam/common/clientContacts', N'ClientCaseSupplier', N'CLIENT_CASE', 1, 2, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (4, N'Clients', 3, N'sam/common/clientContacts', N'Client', N'CLIENTS', 1, 1, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (5, N'Matters', 3, N'sam/browsematter/matters', N'Matters', N'MATTERS', 1, 2, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (6, N'New Matter', 3, N'sam/new-case-wizard/new-case', N'NewMatter', N'NEW_MATTER', 1, 3, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (7, N'Payments', 0, N'sam/approve-cheque-requisitions/approveCheque', N'Payment', N'PAYMENTS', 1, 3, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (8, N'Maintenance', 0, N'sam/system-options/systemOptions', N'Maintenance', N'MAINTENANCE', 1, 8, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (9, N'System Options', 8, N'sam/system-options/systemOptions', N'SystemOptions', N'SYSTEM_OPTIONS', 1, 1, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (10, N'User Menu Access', 8, N'sam/user-menu-access/permissionList', N'UserAccess', N'USER_ACCESS', 1, 2, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (11, N'Close Matter', 3, N'sam/closematter/matters', N'Matters', N'SAM-CLOSE-MATTER', 0, 4, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (12, N'Move Matter', 3, N'sam/move-matter/mattersList', N'Matters', N'SAM-MOVE-MATTER', 0, 5, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (13, N'Mail Category', 3, N'sam/cateogory-mail/categoryMail', N'MailCategory', N'SAM-MAIL-CATEGORY', 1, 6, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (14, N'Suppliers', 3, N'sam/samCommon/browseSuppliers', N'Supplier', N'SAM-SUPPLIERS', 1, 7, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (15, N'Closed Matter Enquiry', 3, N'sam/archive-enquiry', N'ClosedEnquiry', N'SAM-ARCHIVE-ENQUIRY', 1, 10, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (16, N'File Manager', 3, N'strong-room/strong-room-list', N'FileManager', N'FILE_MANAGER', 1, 8, 1, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (17, N'Matter Interest Calculator', 3, N'error/under-construction', N'MatterInterestCalculator', N'MATTER_INT_CALC', 1, 9, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (18, N'KPI Parameters', 8, N'error/under-construction', N'Kpi', N'KPI_PARAMETERS', 1, 3, 0, 1, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (19, N'Code Maintenance', 8, N'sam/maintenance/code-maintenance', N'CodeMaintenance', N'CODE-MAINTENANCE', 1, 4, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (22, N'Approve Payment Requests', 7, N'sam/approve-cheque-requisitions/approveCheque', N'ApprovePaymentRequest', N'APPROVE_PAYMENT_REQ', 1, 1, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (24, N'Payments', 7, N'sam/payments/browsePayments', N'Payment', N'SAM_PAYMENTS', 1, 2, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (25, N'Multi Payments', 7, N'sam/multiple-cheque/multipleCheque', N'MultiPayments', N'MULTI_PAYMENTS', 1, 3, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (26, N'Transfer for Costs', 7, N'sam/transferForCost/transferForCostList', N'TransferForCost', N'TRANSFER_COST', 1, 4, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (27, N'Creditors Payment List', 7, N'sam/creditors-payment/creditorsPaymentList', N'CreditorsPaymentList', N'CREDITORS_PAYMENT', 1, 5, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (29, N'Pick-up Pre-Billed Outlay Transfers', 7, N'sam/pick-up-pre-billed-outlay-transfers/possibleOutlayTransfers', N'PickupPreBilledTransfer', N'PICKUP_PREBILLED', 1, 6, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (30, N'Postings', 0, N'sam/receipts/receiptList', N'Posting', N'POSTINGS', 1, 5, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (32, N'Receipts', 30, N'sam/receipts/receiptList', N'Receipt', N'RECEIPTS', 1, 1, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (33, N'Bank Transfers', 30, N'sam/bank-transfer/bankTransferList', N'BankTransfer', N'BANK-TRANSFERS', 1, 2, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (34, N'Purchase Bills', 30, N'sam/purchase-bills/purchaseBillList', N'PurchaseBill', N'PURCHASE-BILLS', 1, 3, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (35, N'Journals', 30, N'sam/journal/journalList', N'Journal', N'JOURNALS', 1, 4, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (40, N'Memorized Transactions', 30, N'sam/memorise/browseMemorise', N'MemorisedTransaction', N'MEMO-TRANSACTIONS', 1, 5, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (41, N'Accurals/Prepayments', 30, N'sam/accruals-prepayment/accruals', N'PrePayment', N'ACCURALSPREPAYMENTS', 1, 6, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (43, N'Unposted Batches', 30, N'sam/browseBatches/browseUnpostedBatches', N'UnpostedBatches', N'UNPOSTEDBATCHES', 1, 7, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (44, N'Query Batches', 30, N'sam/browsePostedBatches/browsePostedBatches', N'QueryBatches', N'POSTEDBATCHES', 1, 8, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (45, N'Period End', 30, N'sam/period-end/periodEnd', N'PeriodEnd', N'PERIODEND', 1, 9, 0, 1, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (46, N'Year End', 30, N'sam/year-end-proc/updateSysOpt', N'YearEnd', N'YEARRND', 1, 10, 0, 1, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (47, N'Update Debt Ledger Postings', 30, N'sam/DebtLodgement/Debt', N'UpdateDebtLedger', N'UPDATEDEBTLEDGER', 1, 11, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (48, N'Bank Reconciliation', 0, N'sam/bank-reconciliation/reconcile', N'BankReconciliation', N'BANKRECONCILIATION', 1, 9, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (49, N'Initiate Bank Reconciliation', 48, N'sam/bank-reconciliation/start-bank-reconciliation', N'InitateBankRecon', N'STARTBR', 1, 1, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (50, N'Reconcile', 48, N'sam/bank-reconciliation/reconcile', N'Reconcile', N'RECONCILE', 1, 2, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (51, N'Reconciliation Statements', 48, N'sam/bank-reconciliation/browse-bank-reconciliation-statement', N'ReconciliationStatement', N'RECONCILESTATEMENTS', 1, 3, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (52, N'Enquiry', 48, N'sam/bank-reconciliation/bank-reconciliation-enquiry', N'Enquiry', N'ENQUIRY', 1, 4, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (53, N'Undo Reconciliation', 48, N'sam/bank-reconciliation/undo-reconciliation', N'UndoReconciliation', N'UNDORECONCILIATION', 1, 5, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (54, N'Opening Position Set-up', 48, N'sam/bank-reconciliation/browse-previous-reconciliation-details', N'OpeningPositionSetup', N'OPENPOSITION', 1, 6, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (55, N'Clear Down Balances Transactions', 48, N'sam/bank-reconciliation/clear-bank-transaction', N'ClearDownTransaction', N'CLEARBANK', 1, 7, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (56, N'Invoices', 0, N'sam/issueInvoice/Invoice', N'Invoice', N'INVOICES', 1, 4, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (58, N'Invoice Approval', 56, N'sam/approve-billing/billing', N'InvoiceApproval', N'DRAFT_INVOICE', 1, 1, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (59, N'Invoices', 56, N'sam/issueInvoice/Invoice', N'Invoice', N'ISSUE_INVOICE', 1, 2, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (60, N'Ledgers', 0, N'sam/ledger/matterledger', N'Ledger', N'LEDGER', 1, 6, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (61, N'Matter Ledger', 60, N'sam/ledger/matterledger', N'MatterLedgerIcon', N'MATTER_LEDGER', 1, 1, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (62, N'Matter Debtors Ledger', 60, N'sam/ledger/debtorledgerbymatter', N'MatterLedger', N'MATTER_DEBT_LEDGER', 1, 2, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (63, N'Debtors Ledger', 60, N'sam/debtorsledger/debtors-ledger-by-client', N'DebtorsLedger', N'DEBTORS_LEDGER', 1, 3, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (64, N'Creditors Ledger', 60, N'sam/supplier/supplier-ledger', N'CreditorsLedgerIcon', N'CREDITORS_LEDGER', 1, 4, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (65, N'Nominal Ledger', 60, N'sam/nominal/nominalLedger', N'NominalAccounts', N'NOMINAL_LEDGER', 1, 5, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (66, N'Query Posting', 60, N'sam/query-posting/postedBatchList', N'MatterLedger', N'QUERY_POSTING', 1, 6, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (67, N'Outstanding Invoices', 60, N'sam/ledger/outstandingDebtors', N'OutstandingInvoices', N'OUTSTANDING_DEBTORS', 1, 7, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (68, N'Unallocated Payments', 60, N'sam/ledger/unallocatedPayments', N'UnallocatedPayments', N'UNALLOCATEDPAYMENTS', 1, 8, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (69, N'Unallocated Receipts', 60, N'sam/ledger/unallocatedReceipts', N'UnallocatedReceipts', N'UNALLOCATEDRECEIPTS', 1, 9, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (70, N'Debit Client A/C''s', 60, N'sam/ledger/debitClientAc', N'DebitAccount', N'DEBITCLIENTACC', 1, 10, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (71, N'Office Credit A/C''s', 60, N'sam/ledger/officeCreditAcc', N'CreditAccount', N'OFFICECREDITACC', 1, 11, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (72, N'Reports', 0, N'sam/accountreports/reports/accounts-reports', N'Reports', N'MY_REPORTS', 1, 7, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (73, N'Accounts Reports', 72, N'sam/accountreports/reports/accounts-reports', N'AccountReport', N'ACCOUNT_REPORTS', 1, 1, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (74, N'User Reports', 72, N'sam/accountreports/reports/user-reports', N'UserReport', N'USER_REPORTS', 1, 2, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (75, N'Billing Reports', 72, N'sam/accountreports/reports/billing-reports', N'BillingReport', N'BILLING_REPORTS', 1, 3, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (76, N'Nominal Accounts', 8, N'sam/nominal/browseNominalAccounts', N'NominalAccMaintenence', N'NOMINAL_ACCOUNTS', 1, 5, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (77, N'Nominal Reporting Sequence', 8, N'error/under-construction', N'NominalReportingSeq', N'NOMINAL_REP_SEQ', 1, 6, 0, 1, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (78, N'EFT Logs', 8, N'error/under-construction', N'EftLogs', N'EFT_LOGS', 1, 7, 1, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (79, N'Interest Rates', 8, N'error/under-construction', N'InterestRates', N'INTEREST_RATES', 1, 8, 1, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (80, N'Electronic Fund Transfer', 7, N'sam/eft/eftList', N'MyPaymentRequests', N'EFT', 1, 7, 0, 0, N'A')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (81, N'Tasks', 0, N'tasks/main/my-tasks', N'AllTasks', N'TASKS', 1, 1, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (82, N'Dashboard', 81, N'tasks/task-dashboard', N'Dashboard', N'TASKS_DASHBOARD', 1, 1, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (83, N'My Tasks', 81, N'tasks/main/my-tasks', N'MyTasks', N'MYTASKS', 1, 2, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (84, N'Team tasks', 81, N'tasks/main/team-tasks', N'TeamTasks', N'TEAM_TASKS', 1, 3, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (86, N'Maintenance', 0, N'maintenance/settings/generalsettings', N'Maintenance', N'CASE_MAINTENANCE', 1, 5, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (88, N'Client Portal', 86, N'maintenance/client-portal-setting', N'ClientPortal', N'CLIENT_PORTAL', 1, 7, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (89, N'Email', 86, N'maintenance/settings/emailsettings', N'EmailSettings', N'EMAIL_SETTINGS', 1, 1, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (90, N'General', 86, N'maintenance/settings/generalsettings', N'GeneralSettings', N'GENERAL_SETTINGS', 1, 2, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (91, N'User Menu Access', 86, N'maintenance/useraccess/permissionList', N'UserAccess', N'CASE_USER_ACCESS', 1, 3, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (92, N'Maintain User Security', 86, N'maintenance/maintain-user-security', N'CorporateEntities', N'USER_SECURITY', 1, 4, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (93, N'Case Workflow Setup', 86, N'maintenance/workflowsetup', N'CaseWorkflow', N'WORKFLOW_SETUP', 1, 5, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (94, N'Code Maintenance', 86, N'maintenance/codeMaintenance', N'DocumentManager', N'CASE_CODEMAINTENANCE', 1, 6, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (95, N'Day''s Tasks ', 81, N'tasks/main/days-tasks', N'DaysTasks', N'DAYS_TASKS', 1, 4, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (96, N'Next week''s tasks', 81, N'tasks/main/next-weeks-tasks', N'NextWeeksTasks', N'NEXT_WEEK_TASKS', 1, 5, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (97, N'Next month''s tasks', 81, N'tasks/main/next-months-tasks', N'NextMonthsTasks', N'NEXT_MONTH_TASKS', 1, 6, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (98, N'Overdue tasks', 81, N'tasks/main/overdue-tasks', N'OverdueTasks', N'OVERDUE_TASKS', 1, 7, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (99, N'Outstanding tasks', 81, N'tasks/main/outstanding-tasks', N'OutstandingTasks', N'OUTSTANDING_TASKS', 1, 8, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (100, N'Last Week''s tasks', 81, N'tasks/main/last-weeks-tasks', N'LastWeeksTasks', N'LAST_WEEK_TASKS', 1, 9, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (101, N'Last month''s tasks', 81, N'tasks/main/last-months-tasks', N'LastMonthsTasks', N'LAST_MONTH_TASKS', 1, 10, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (102, N'All Tasks', 81, N'tasks/main/all-tasks', N'AllTasks', N'ALL_TASKS', 1, 11, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (103, N'Search / Open', 0, N'search-or-open/matters/recent-matters', N'Search', N'SEARCH_OPEN', 1, 2, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (105, N'Time Costing', 0, N'my-day-books/home', N'TimeCosting', N'TIME_COSTING', 1, 4, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (106, N'Reports', 0, N'casemanagementreports/reports/system-reports', N'Reports', N'CASE_REPORTS', 1, 6, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (107, N'File Manager', 0, N'strong-room/strong-room-list', N'FileManager', N'FILE_MANANGER', 1, 7, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (108, N'Client / Case', 0, N'case/case-diary', N'ClientCase', N'CLIENT_CASEMANAGE', 1, 3, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (109, N'All Matters', 103, N'search-or-open/matters/all-matters', N'AllMatters', N'ALL_MATTERS', 1, 1, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (110, N'My Matters', 103, N'search-or-open/matters/my-matters', N'MyMatters', N'MY_MATTERS', 1, 2, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (111, N'Recent Matters', 103, N'search-or-open/matters/recent-matters', N'RecentMatters', N'RECENT_MATTERS', 1, 3, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (112, N'Associates', 103, N'search-or-open/associates/associates-list', N'Associates', N'ASSOCIATES', 1, 4, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (113, N'Contacts', 103, N'search-or-open/contacts/contacts-list', N'Contacts', N'CONTACTS', 1, 5, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (114, N'My Payments', 103, N'search-or-open/cheques/cheques-list', N'MyPaymentRequests', N'MY_PAYMENTS', 1, 6, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (115, N'Phone Log', 103, N'search-or-open/phone-log/phone-log-list', N'PhoneLog', N'PHONE_LOG', 1, 7, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (116, N'Template Library', 103, N'search-or-open/template-library/template-library-list', N'TemplateLibrary', N'TEMPLATE_LIBRARY', 1, 8, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (117, N'My Invoice', 103, N'search-or-open/myinvoice', N'MyInvoice', N'MY_INVOICE', 1, 9, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (118, N'Firm Undertaking', 103, N'search-or-open/firm-undertaking/firm-undertaking-list', N'FirmUndertaking', N'FIRM_UNDERTAKING', 1, 10, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (120, N'Case Diary', 108, N'case/case-diary', N'CaseDiary', N'CASE_DIARY', 1, 2, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (122, N'Current Client Details', 108, N'case/current-client', N'CurrentClientDetails', N'CUR_CLIENT_DETAILS', 1, 4, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (123, N'Current Case Details', 108, N'current-case/currentCase', N'CurrentCaseDetails', N'CUR_CASE_DETAILS', 1, 5, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (124, N'Extra Case Details', 108, N'case/extra-case-details/details', N'ExtraCaseDetails', N'EXTRA_CASE_DETAILS', 1, 6, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (125, N'Associates', 108, N'case/Case-Associates/home', N'Associates', N'CASE_ASSOCIATES', 1, 7, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (126, N'Undertakings', 108, N'case/undertakings', N'Undertakings', N'UNDERTAKINGS', 1, 9, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (127, N'File Manager', 108, N'file-manager/case-file-list', N'FileManager', N'CASE_FILE_MANAGER', 1, 10, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (128, N'A/c Ledger', 108, N'case/account-ledger', N'AcLedger', N'AC_LEDGER', 1, 11, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (130, N'Know Your Client', 108, N'case/know-your-client', N'KnowYourClient', N'KNOW_YOUR_CLIENT', 1, 13, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (131, N'Linked Cases', 108, N'case/linked-cases/linked-cases', N'LinkedCases', N'LINKED_CASES', 1, 14, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (133, N'Legal Searches', 108, N'', N'Search', N'LEGAL_SEARCHES', 0, 15, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (134, N'Dashboard', 108, N'case/dashboard', N'Dashboard', N'CLIENTCASEDASHBOARD', 1, 1, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (135, N'Document Manager', 108, N'document-manager/document', N'DocumentManager', N'DOCUMENT_MANAGER', 1, 3, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (136, N'My Day Book', 105, N'my-day-books/home', N'MyDayBook', N'MY_DAY_BOOK', 1, 1, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (137, N'System Reports', 106, N'casemanagementreports/reports/system-reports', N'Reports', N'CASE_SYS_REPORTS', 1, 1, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (138, N'User Reports', 106, N'casemanagementreports/reports/user-reports', N'UserReport', N'CASE_USER_REPORTS', 1, 2, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (139, N'Billing Reports', 106, N'casemanagementreports/reports/billing-reports', N'BillingReport', N'CASE_BILL_REPORTS', 1, 3, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (140, N'Accounts Reports', 106, N'casemanagementreports/reports/accounts-reports', N'AccountReport', N'CASE_ACC_REPORTS', 1, 4, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (141, N'File Manager List', 107, N'strong-room/strong-room-list', N'FileManagerList', N'C_FILE_MANAGER_LIST', 1, 1, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (142, N'Case Contacts', 108, N'case/case-Contacts', N'CaseContacts', N'CASE_CONTACTS', 1, 8, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (143, N'Time Ledger', 108, N'case/time-ledger', N'TimeLedger', N'TIME_LEDGER', 1, 12, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (144, N'Dictation Logs', 86, N'maintenance/dictation/dictation-logs', N'EftLogs', N'DICTATION_LOGS', 1, 8, 0, 0, N'C')

INSERT [dbo].[KeyhouseMenuList] ([MenuId], [MenuName], [MenuParentId], [MenuRoute], [MenuIconName], [MenuCode], [MenuIsActive], [MenuOrder], [MenuOpenNewTab], [MenuOpenDialogBox], [MenuApplicationType]) VALUES (145, N'Cheque Printing', 7, N'sam/awaitingcheques/browse-awaiting-cheques', N'PrintCheque', N'AWAITING_CHEQUE', 1, 8, 0, 0, N'A')

SET IDENTITY_INSERT [dbo].[KeyhouseMenuList] OFF
END
GO



 -- Setting Default Prebilled Outlay for draft invoice by default to true
 IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'DefaultPrebilledOutlay') 
 BEGIN
 	INSERT INTO [Settings](
 		[KeyName], 
 		[KeyValue]) 
 	VALUES (
 		'DefaultPrebilledOutlay',
 		'Y')
 END
 GO

IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'GraphAPIFromEmailName') 
BEGIN
	INSERT INTO [Settings](
		[KeyName], 
		[KeyValue]) 
	VALUES (
		'GraphAPIFromEmailName',
		'Keyhouse365 Admin')
END
GO

 -- Setting EFT Default On as true
 IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'EFTDefaultON') 
 BEGIN
 	INSERT INTO [Settings](
 		[KeyName], 
 		[KeyValue]) 
 	VALUES (
 		'EFTDefaultON',
 		'Y')
 END
 GO

  -- Setting EFT Email to Send as true by default
 IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'EFTEmailToSend') 
 BEGIN
 	INSERT INTO [Settings](
 		[KeyName], 
 		[KeyValue]) 
 	VALUES (
 		'EFTEmailToSend',
 		'Y')
 END
 GO

  -- Setting Default EFT Transaction Limit as 0.00
 IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'EFTTransactionLimit') 
 BEGIN
 	INSERT INTO [Settings](
 		[KeyName], 
 		[KeyValue]) 
 	VALUES (
 		'EFTTransactionLimit',
 		0.00)
 END
 GO

   -- Setting Default EFT Number Of Transaction Limit as 0
 IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'EFTNoOfTransactionLimit') 
 BEGIN
 	INSERT INTO [Settings](
 		[KeyName], 
 		[KeyValue]) 
 	VALUES (
 		'EFTNoOfTransactionLimit',
 		0)
 END
 GO


    -- Setting Default EFT Email Subject
 IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'EFTEmailSubject') 
 BEGIN
 	INSERT INTO [Settings](
 		[KeyName], 
 		[KeyValue]) 
 	VALUES (
 		'EFTEmailSubject',
 		'')
 END
 GO

    -- Setting Default EFT Email Message
 IF NOT EXISTS(SELECT TOP 1 1 FROM [Settings] WHERE [KeyName] = 'EFTEmailMessage') 
 BEGIN
 	INSERT INTO [Settings](
 		[KeyName], 
 		[KeyValue]) 
 	VALUES (
 		'EFTEmailMessage',
 		'')
 END
 GO

IF EXISTS 
	(SELECT TOP 1 1 
	   FROM sys.objects 
	  WHERE [name] = 'Settings') 
AND NOT EXISTS 
	(SELECT TOP 1 1 
	   FROM [Settings] 
	  WHERE [KeyName] = 'DocumentEditModeForWeb')
BEGIN
	INSERT INTO
		[Settings]
		([KeyName],
		 [KeyValue])
	VALUES
		('DocumentEditModeForWeb',
		 'WordDesktop')
END
GO


IF EXISTS 
	(SELECT TOP 1 1 
	   FROM sys.objects 
	  WHERE [name] = 'Settings') 
AND NOT EXISTS 
	(SELECT TOP 1 1 
	   FROM [Settings] 
	  WHERE [KeyName] = 'LS_DefautActionCode')
BEGIN
	INSERT INTO
		[Settings]
		([KeyName],
		 [KeyValue])
	VALUES
		('LS_DefautActionCode', 
		 'ADMAA')
END
GO

-- Insert timezone list in the TimeZones table
IF EXISTS 
	(SELECT TOP 1 1 
	   FROM sys.objects 
	  WHERE [name] = 'TimeZones')
AND NOT EXISTS 
	(SELECT  TOP 1 1 FROM [dbo].[TimeZones])
BEGIN
      INSERT INTO 
		 [dbo].[TimeZones] 
		 ([TimeZoneName]) 
	VALUES 
    ('Afghanistan Standard Time'),
    ('Alaskan Standard Time'),
    ('Aleutian Standard Time'),
    ('Altai Standard Time'),
    ('Arab Standard Time'),
    ('Arabian Standard Time'),
    ('Arabic Standard Time'),
    ('Argentina Standard Time'),
    ('Astrakhan Standard Time'),
    ('Atlantic Standard Time'),
    ('AUS Central Standard Time'),
    ('Aus Central W. Standard Time'),
    ('AUS Eastern Standard Time'),
    ('Azerbaijan Standard Time'),
    ('Azores Standard Time'),
    ('Bahia Standard Time'),
    ('Bangladesh Standard Time'),
    ('Belarus Standard Time'),
    ('Bougainville Standard Time'),
    ('Canada Central Standard Time'),
    ('Cape Verde Standard Time'),
    ('Caucasus Standard Time'),
    ('Cen. Australia Standard Time'),
    ('Central America Standard Time'),
    ('Central Asia Standard Time'),
    ('Central Brazilian Standard Time'),
    ('Central Europe Standard Time'),
    ('Central European Standard Time'),
    ('Central Pacific Standard Time'),
    ('Central Standard Time'),
    ('Central Standard Time (Mexico)'),
    ('Chatham Islands Standard Time'),
    ('China Standard Time'),
    ('Cuba Standard Time'),
    ('Dateline Standard Time'),
    ('E. Africa Standard Time'),
    ('E. Australia Standard Time'),
    ('E. Europe Standard Time'),
    ('E. South America Standard Time'),
    ('Easter Island Standard Time'),
    ('Eastern Standard Time'),
    ('Eastern Standard Time (Mexico)'),
    ('Egypt Standard Time'),
    ('Ekaterinburg Standard Time'),
    ('Fiji Standard Time'),
    ('FLE Standard Time'),
    ('Georgian Standard Time'),
    ('GMT Standard Time'),
    ('Greenland Standard Time'),
    ('Greenwich Standard Time'),
    ('GTB Standard Time'),
    ('Haiti Standard Time'),
    ('Hawaiian Standard Time'),
    ('India Standard Time'),
    ('Iran Standard Time'),
    ('Israel Standard Time'),
    ('Jordan Standard Time'),
    ('Kaliningrad Standard Time'),
    ('Kamchatka Standard Time'),
    ('Korea Standard Time'),
    ('Libya Standard Time'),
    ('Line Islands Standard Time'),
    ('Lord Howe Standard Time'),
    ('Magadan Standard Time'),
    ('Magallanes Standard Time'),
    ('Marquesas Standard Time'),
    ('Mauritius Standard Time'),
    ('Mid-Atlantic Standard Time'),
    ('Middle East Standard Time'),
    ('Montevideo Standard Time'),
    ('Morocco Standard Time'),
    ('Mountain Standard Time'),
    ('Mountain Standard Time (Mexico)'),
    ('Myanmar Standard Time'),
    ('N. Central Asia Standard Time'),
    ('Namibia Standard Time'),
    ('Nepal Standard Time'),
    ('New Zealand Standard Time'),
    ('Newfoundland Standard Time'),
    ('Norfolk Standard Time'),
    ('North Asia East Standard Time'),
    ('North Asia Standard Time'),
    ('North Korea Standard Time'),
    ('Omsk Standard Time'),
    ('Pacific SA Standard Time'),
    ('Pacific Standard Time'),
    ('Pacific Standard Time (Mexico)'),
    ('Pakistan Standard Time'),
    ('Paraguay Standard Time'),
    ('Qyzylorda Standard Time'),
    ('Romance Standard Time'),
    ('Russia Time Zone 10'),
    ('Russia Time Zone 11'),
    ('Russia Time Zone 3'),
    ('Russian Standard Time'),
    ('SA Eastern Standard Time'),
    ('SA Pacific Standard Time'),
    ('SA Western Standard Time'),
    ('Saint Pierre Standard Time'),
    ('Sakhalin Standard Time'),
    ('Samoa Standard Time'),
    ('Sao Tome Standard Time'),
    ('Saratov Standard Time'),
    ('SE Asia Standard Time'),
    ('Singapore Standard Time'),
    ('South Africa Standard Time'),
    ('South Sudan Standard Time'),
    ('Sri Lanka Standard Time'),
    ('Sudan Standard Time'),
    ('Syria Standard Time'),
    ('Taipei Standard Time'),
    ('Tasmania Standard Time'),
    ('Tocantins Standard Time'),
    ('Tokyo Standard Time'),
    ('Tomsk Standard Time'),
    ('Tonga Standard Time'),
    ('Transbaikal Standard Time'),
    ('Turkey Standard Time'),
    ('Turks And Caicos Standard Time'),
    ('Ulaanbaatar Standard Time'),
    ('US Eastern Standard Time'),
    ('US Mountain Standard Time'),
    ('UTC'),
    ('UTC+12'),
    ('UTC+13'),
    ('UTC-02'),
    ('UTC-08'),
    ('UTC-09'),
    ('UTC-11'),
    ('Venezuela Standard Time'),
    ('Vladivostok Standard Time'),
    ('Volgograd Standard Time'),
    ('W. Australia Standard Time'),
    ('W. Central Africa Standard Time'),
    ('W. Europe Standard Time'),
    ('W. Mongolia Standard Time'),
    ('West Asia Standard Time'),
    ('West Bank Standard Time'),
    ('West Pacific Standard Time'),
    ('Yakutsk Standard Time'),
    ('Yukon Standard Time');
END
GO



