/** 
		IMPORTANT!!!
	COMMENTING OUT THE TRUNCATE SCRIPTS TO AVOID DATA LOSS IN STAGING SITE.
	IT WILL BE UNCOMMENTED DURING PROD RELEASE
**/
 
IF EXISTS
  (SELECT TOP 1 1
     FROM SYS.[objects] SO
    WHERE SO.[name] = N'KaaS_CRReportUserPermission'
      AND SO.[type] = 'U')
BEGIN
	TRUNCATE TABLE [dbo].[KaaS_CRReportUserPermission]
END

GO

IF EXISTS
  (SELECT TOP 1 1
     FROM SYS.[objects] SO
    WHERE SO.[name] = N'KaaS_CRReportGroup'
      AND SO.[type] = 'U')
BEGIN
	TRUNCATE TABLE [dbo].[KaaS_CRReportGroup]
END

GO

IF EXISTS
  (SELECT TOP 1 1
     FROM SYS.[objects] SO
    WHERE SO.[name] = N'KaaS_CRParameter'
      AND SO.[type] = 'U')
BEGIN
	TRUNCATE TABLE [dbo].[KaaS_CRParameter]
END
GO

-- REMOVE FOREIGN KEY CONSTRAINT FOR PERMISSION TABLE TO AVOID ISSUES WITH CR_REPORT TABLE TRUNACATE STATEMENT
IF OBJECT_ID(N'FK_KaaS_CRReports_ReportId_KaaS_CRReportUserPermission_ReportId',N'F') IS NOT NULL
BEGIN
	ALTER TABLE 
		[dbo].[KaaS_CRReportUserPermission] 
	DROP CONSTRAINT
		[FK_KaaS_CRReports_ReportId_KaaS_CRReportUserPermission_ReportId]
END
GO

IF EXISTS
  (SELECT TOP 1 1
     FROM SYS.[objects] SO
    WHERE SO.[name] = N'KaaS_CRReport'
      AND SO.[type] = 'U')
BEGIN
	TRUNCATE TABLE [dbo].[KaaS_CRReport]
END
GO


IF OBJECT_ID(N'FK_KaaS_CRReports_ReportId_KaaS_CRReportUserPermission_ReportId',N'F') IS NULL
BEGIN
	ALTER TABLE 
		[dbo].[KaaS_CRReportUserPermission] 
	WITH CHECK ADD CONSTRAINT 
		[FK_KaaS_CRReports_ReportId_KaaS_CRReportUserPermission_ReportId]  
	FOREIGN KEY 
		([ReportId])
	REFERENCES 
		[dbo].[KaaS_CRReport] ([ReportId])
END
GO



IF EXISTS

  (SELECT TOP 1 1
     FROM SYS.[objects] SO
    WHERE SO.[name] = N'KaaS_CRGroup'
      AND SO.[type] = 'U')
BEGIN
	TRUNCATE TABLE [dbo].[KaaS_CRGroup]
END

GO

--Insert CRReport Data's from already exising table
INSERT INTO KaaS_CRReport
  ([name],
   [filename], 
   [lastrundate],
   [lastruntime], 
   [confrimparameter], 
   [created_on], 
   [modified_on], 
   [status], 
   [report_type], 
   [notes], 
   [synopsis])
SELECT 
   cr.[name],
   cr.[filename],
   cr.[lastrundate],
   cr.[lastruntime],
   cr.[confrimparameter],
   cr.[created_on],
   cr.[modified_on],
   cr.[status],
   cr.[report_type],
   cr.[notes],
   cr.[synopsis]
   FROM CRReport cr
   WHERE NOT EXISTS(
   select top 1 1 
   from KaaS_CRReport 
   where report_type = cr.report_type and name = cr.name)

--Insert CRGroup Data's from already exising table
INSERT INTO KaaS_CRGroup
  ([groupname], 
   [created_on], 
   [modified_on], 
   [status])
SELECT 
   crg.[groupname],
   crg.[created_on],
   crg.[modified_on],
   crg.[status]
   FROM CRGroup crg
   WHERE NOT EXISTS(
   select top 1 1 
   from KaaS_CRGroup 
   where groupname = crg.groupname)

--Insert CRParameter Data's from already exising table
INSERT INTO[dbo].[KaaS_CRParameter]
  ([reportid], 
   [userprompt], 
   [parametername], 
   [parametervalue], 
   [parameterformat], 
   [parametertype], 
   [parameterlength], 
   [defaultvalue], 
   [requiredfield], 
   [userrequest], 
   [infile], 
   [controltype], 
   [listoption], 
   [Seqno])
SELECT
  (select top 1 [Reportid] from KaaS_CRReport KCR where Exists(select Reportid from CRReport where Name = KCR.Name and report_type = KCR.report_type and Reportid = crp.ReportId)), 
  crp.[userprompt], 
  crp.[parametername], 
  crp.[parametervalue], 
  crp.[parameterformat], 
  crp.[parametertype], 
  crp.[parameterlength], 
  crp.[defaultvalue], 
  crp.[requiredfield], 
  crp.[userrequest], 
  crp.[infile],
  crp.[controltype], 
  crp.[listoption], 
  crp.[Seqno]
  FROM CRParameter crp
  WHERE 
  Exists ((select top 1 [Reportid] 
  from KaaS_CRReport KCR 
  where 
  Exists(select top 1 
  [Reportid] from CRReport 
  where Name = KCR.Name and report_type = KCR.report_type and Reportid = crp.ReportId))) AND 
  NOT EXISTS(
  select top 1 1
  from KaaS_CRParameter 
  WHERE [reportid] = (
  select top 1 [Reportid] 
  from KaaS_CRReport KCR 
  where Exists(
  select top 1 Reportid 
  from CRReport 
  where Name = KCR.Name and report_type = KCR.report_type and Reportid = crp.ReportId)) and 
  [userprompt] = crp.userprompt AND[parametername] = crp.parametername)

--Insert CRReportGroup Data's from already exising table
INSERT INTO KaaS_CRReportGroup
  ([Reportid],
   [Groupid])
SELECT 
  (select top 1 [Reportid] from KaaS_CRReport KCR where Exists(select top 1 Reportid from CRReport where Reportid = crg.reportid and  name = KCR.name and report_type = KCR.report_type)),
  (select top 1 [groupid] from KaaS_CRGroup KCG where Exists(select top 1 groupid from CRGroup where groupid = crg.groupid and groupname = KCG.groupname))
  FROM CRReportGroup crg
  WHERE
  EXISTS(select top 1 [Reportid] 
  from KaaS_CRReport KCR 
  where EXISTS(select top 1 Reportid 
  from CRReport where Reportid = crg.reportid and  name = KCR.name and report_type = KCR.report_type)) AND
  EXISTS(select top 1 [groupid] from KaaS_CRGroup KCG where Exists(select top 1 groupid from CRGroup where groupid = crg.groupid and groupname = KCG.groupname))
  AND
  NOT EXISTS(
  select top 1 1 
  from KaaS_CRReportGroup 
  WHERE [reportid] = (
  select top 1 [Reportid] 
  from KaaS_CRReport KCR 
  where Exists(
  select top 1 [Reportid]
  from CRReport 
  where [Reportid] = crg.reportid and [name] = KCR.[name] and [report_type] = KCR.[report_type]))
  and
  [groupid] = (
  select top 1 [groupid] 
  from KaaS_CRGroup KCG 
  where Exists(
  select top 1 [groupid] 
  from CRGroup 
  where [groupid] = crg.[groupid] and [groupname] = KCG.[groupname])))

--INSERT SCRIPT FOR CRReports
IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Bill Layout' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Bill Layout', 'billlayout.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Bill Breakdown' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Bill Breakdown', 'FEBreakdown.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'TimeDayBook' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('TimeDayBook', 'TimeDayBook.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Handler Diary Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Handler Diary Report', 'Handler Diary Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter Balances as at a Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter Balances as at a Date', 'Matter Balances as at a Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List by Fee Earner Summary' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List by Fee Earner Summary', 'Matter List by Fee Earner Summary.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List by Fee Earner' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List by Fee Earner', 'Matter List by Fee Earner.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Client by Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Client by Period', 'Fees Issued by Client by Period.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Worktype by Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Worktype by Period', 'FeesIssWTPeriod.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Department by Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Department by Period', 'FeesIssDeptPeriod.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Department by Worktype by Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Department by Worktype by Period', 'FeesIssDeptWTPeriod.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Worktype by Fe by Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Worktype by Fe by Period', 'FeesIssWTFEPeriod.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Fe by Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Fe by Date', 'FeesIssFEDate.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Fe by Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Fe by Period', 'FeesIssFEPeriod.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Client by Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Client by Date', 'Fees Issued by Client by Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Department by Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Department by Date', 'FeesIssDeptDate.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Worktype by Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Worktype by Date', 'FeesIssWTDate.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Department by Worktype by Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Department by Worktype by Date', 'FeesIssDeptWTDate.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Worktype by Fee Earner by Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Worktype by Fee Earner by Date', 'FeesIssWTFEDate.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Aged Debt by Fee Earner' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Aged Debt by Fee Earner', 'AgedDebtByFe.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Aged Debt by Client' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Aged Debt by Client', 'AgedDebtbyClient.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Aged Debt by Client (Show Dates)' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Aged Debt by Client (Show Dates)', 'AgedDebtbyClient(ShowDates).rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Case Diary Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Case Diary Report', 'Case Diary Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter Balances as at Entry Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter Balances as at Entry Date', 'Matter Balances as at Entry Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Aged Debt by Client (ShowDates) Client Summary' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Aged Debt by Client (ShowDates) Client Summary', 'AgedDebtbyClient(ShowDates) Client Summary.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'WIP By FE' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('WIP By FE', 'WIP By FE.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'WIP by F/e Last Billed' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('WIP by F/e Last Billed', 'WIP Report by FE.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Billing Guide' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Billing Guide', 'Billing Guide Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Client Statements' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Client Statements', 'Client Statments.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Time Recorder Utilisation' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Time Recorder Utilisation', 'TimeRecorderUtilisation.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'SupplierRemittance' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('SupplierRemittance', 'SupplierRemittance.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'KPI By Fee Earner' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('KPI By Fee Earner', 'FE KPI Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'KPI By Department' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('KPI By Department', 'KPI Report Dept.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'KPI By Team' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('KPI By Team', 'KPI Report Team.RPT', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'KPI by Firm' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('KPI by Firm', 'KPI Report Firm.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued By Work type by Team by Fee for Month' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued By Work type by Team by Fee for Month', 'Fees Issued by Wtype by Team by Fee for Month.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Department by Team by Fee for Month.' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Department by Team by Fee for Month.', 'Fees Issued by Dept by Team by Fee for Month.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'All Cases' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('All Cases', 'ALL Cases.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List by Work Type' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List by Work Type', 'Matter List by WorkType.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Firm Case Analysis Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Firm Case Analysis Report', 'Firm Case Analysis.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Statute Of Limitations Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Statute Of Limitations Report', 'StatuteLimitationsDates.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Undertaking List Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Undertaking List Report', 'Undertakings List.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Undertakings by UndertakingTo' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Undertakings by UndertakingTo', 'Undertakings by UndertakingTo.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Undertakings by Client' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Undertakings by Client', 'Undertakings by Client.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Undertakings by Dept' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Undertakings by Dept', 'Undertakings by Dept.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Undertakings by Dept by Work Type' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Undertakings by Dept by Work Type', 'Undertakings by Dept by WType.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Undertakings by FE' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Undertakings by FE', 'Undertakings by Fe.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Undertakings by Matter' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Undertakings by Matter', 'Undertakings by Matter.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Undertakings by Work Type' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Undertakings by Work Type', 'Undertakings by WType.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Dormant Matters Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Dormant Matters Report', 'DormantMatters.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Statute Of Limitations By FE By Client' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Statute Of Limitations By FE By Client', 'StatuteOfLimitations By Fe By Client.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Statute Of Limitations By Dept' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Statute Of Limitations By Dept', 'StatuteOfLimitations By Dept.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go


IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Statute Of Limitations By Work Type' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Statute Of Limitations By Work Type', 'StatuteOfLimitations By WType.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Diary Time Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Diary Time Report', 'DiaryTimeReport.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Case Summary Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Case Summary Report', 'Case Summary By Matter.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Undertakings Authorised By' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Undertakings Authorised By', 'Undertakings by AuthBy.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Undertakings By Status' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Undertakings By Status', 'Undertakings by Status.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued By Department By FE By Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued By Department By FE By Date', 'FeesIssDeptFEDate.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Department By FE By Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Department By FE By Period', 'FeesIssDeptFEPeriod.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Time Ledger' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Time Ledger', 'Time Ledger by Matter.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Time Ledger No Money' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Time Ledger No Money', 'Time Ledger by Matter No Money.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go


IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Time Ledger WIP' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Time Ledger WIP', 'Time Ledger by Matter WIP.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Activity List WIP' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Activity List WIP', 'WIP Activity List.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Time Entry' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Time Entry', 'Time Entry.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go


IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Time Task by FE' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Time Task by FE', 'TimeTasks Tasks By FE.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Negotiation Letter By FE (FNL)' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Negotiation Letter By FE (FNL)', 'FNL Letters By FE.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued By FE By Period Summary' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued By FE By Period Summary', 'FeesIssFEPeriodSummary.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Estimated Fees By Est fees Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Estimated Fees By Est fees Date', 'EstFeesByEstFeeDate.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Time Ledger for Fe between dates' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Time Ledger for Fe between dates', 'Time Ledger for Fe between dates.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Time Ledger by Matter by Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Time Ledger by Matter by Date', 'Time Ledger by Matter by Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Time Ledger By Matter By FE By Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Time Ledger By Matter By FE By Date', 'Time Ledger By Matter By Fe By Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Billed Time for an Individual Handler' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Billed Time for an Individual Handler', 'Billed Time By FE.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Billed Time By Client' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Billed Time By Client', 'Billed Time By Client.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Billed Time' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Billed Time', 'Billed Time.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Client by Worktype By Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Client by Worktype By Date', 'Fees Issued by Client By WType by Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Client by Worktype By Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Client by Worktype By Period', 'Fees Issued by Client By WType by Period.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Top WIP For Fe' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Top WIP For Fe', 'Top WIP Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Client Category Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Client Category Report', 'ClientCategories.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matters ReOpened' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matters ReOpened', 'Matters Reopened.RPT', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Client Current Balance Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Client Current Balance Report', 'Client Current Balance Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Client Balances By Matter Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Client Balances By Matter Report', 'Client Balances By Matter Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'CaseDiary - Daily' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('CaseDiary - Daily', 'CaseDiary - Daily.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'CaseDiary - Weekly' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('CaseDiary - Weekly', 'CaseDiary - Weekly.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Aged Creditors Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Aged Creditors Report', 'Aged Creditors Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Aged Debt Breakdown' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Aged Debt Breakdown', 'Aged Debt Breakdown.RPT', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Aged Debt Weekly' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Aged Debt Weekly', 'Aged Debt Weekly.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Aged Debt By Dept' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Aged Debt By Dept', 'AgedDebtByDept.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Aged Debt By Work Type' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Aged Debt By Work Type', 'AgedDebtByWType.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Allocated Receipts' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Allocated Receipts', 'AllocatedReceipts.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter Summary Report By Fee Earner' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter Summary Report By Fee Earner', 'Matter Summary Report By Fe.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List by FE By Work Type' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List by FE By Work Type', 'Matter List by FE By WType.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Charge Rates By FE By Matter' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Charge Rates By FE By Matter', 'Charge Rates By FE By Matter.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Client List' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Client List', 'Client List.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Client Statement By Matter' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Client Statement By Matter', 'Client Statement By Matter.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Client Outlay' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Client Outlay', 'Client Outlay.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Digital Dictations By Author' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Digital Dictations By Author', 'DigitalDictations By Author.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Digital Dictations By Handler' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Digital Dictations By Handler', 'DigitalDictations By Handler.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Digital Dictations By Typist' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Digital Dictations By Typist', 'DigitalDictations By Typist.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List by Est Fees Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List by Est Fees Date', 'Matter List by Est Fees Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'File Manager Report By Client' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('File Manager Report By Client', 'File Manager Report By Client.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'File Manager Report by ItemCode' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('File Manager Report by ItemCode', 'File Manager Report by ItemCode.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'File Manager Report by ItemType' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('File Manager Report by ItemType', 'File Manager Report by ItemType.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Rec By FE By Client By Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Rec By FE By Client By Period', 'Fees Rec By FE By Client By Period.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Profit and Loss Budget By Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Profit and Loss Budget By Period', 'Profit and Loss Budget By Period.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Profit and Loss By Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Profit and Loss By Date', 'Profit and Loss By Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Profit and Loss Ledger' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Profit and Loss Ledger', 'Profit and Loss Ledger.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Profit and Loss Summary' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Profit and Loss Summary', 'Profit and Loss Summary.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Bills Profitibility Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Bills Profitibility Report', 'Bills Profitibility Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Profitibility By Client' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Profitibility By Client', 'Profitibility By Client.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Profitibility By Dept' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Profitibility By Dept', 'Profitibility By Dept.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Debtors Ledger Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Debtors Ledger Report', 'Debtors Ledger Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Draft Bills By Matter FE' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Draft Bills By Matter FE', 'Draft Bills By Matter FE.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Draft Bills By Billing FE' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Draft Bills By Billing FE', 'Draft Bills By Billing FE.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Expense Payments' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Expense Payments', 'Expense Payments.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Invoiced OS Fees' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Invoiced OS Fees', 'Invoiced OS Fees.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter Summary Report By Work Type' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter Summary Report By Work Type', 'Matter Summary Report By WType.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matters With No Transactions' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matters With No Transactions', 'Matters NoTranactions.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Transfer Costs By Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Transfer Costs By Date', 'Transfer Costs By Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Transfer Costs By Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Transfer Costs By Period', 'Transfer Costs By Period.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Trial Balance' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Trial Balance', 'Trial Balance.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Time Write Off By Dept' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Time Write Off By Dept', 'Time Write Off By Dept.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'UnBilled Outlay Days' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('UnBilled Outlay Days', 'UnBilled Outlay Days.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'UnBilled Outlay Years' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('UnBilled Outlay Years', 'UnBilled Outlay Years.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Undertakings By Undertaking Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Undertakings By Undertaking Date', 'Undertakings By UDate.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Rec By Matter By Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Rec By Matter By Date', 'Fees Rec By Matter By Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Rec By Matter By Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Rec By Matter By Period', 'Fees Rec By Matter By Period.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List with No Account Values' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List with No Account Values', 'Matter List with No Account Values.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Case Analysis By FE' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Case Analysis By FE', 'Case Analysis By FE.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Case Analysis By Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Case Analysis By Date', 'Case Analysis By Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'List of Client Category' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('List of Client Category', 'List of Category.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'List of Departments' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('List of Departments', 'List of Dept.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'List of Fee Earners' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('List of Fee Earners', 'List of Fee Earners.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'List of Handlers' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('List of Handlers', 'List of Handlers.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'List of Nominal Ac Type' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('List of Nominal Ac Type', 'List of Nominal Ac Types.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'List of Teams' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('List of Teams', 'List of Teams.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'List of VAT Codes' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('List of VAT Codes', 'List of VAT Codes.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'List of Work Types' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('List of Work Types', 'List of Work Types.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Supplier List' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Supplier List', 'Supplier List.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List by Partner' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List by Partner', 'Matter List by Partner.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List by Your Ref' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List by Your Ref', 'Matter List by Your Ref.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List Effectively Complete' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List Effectively Complete', 'Matter List Effectively Complete.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Outstanding Bills' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Outstanding Bills', 'OS Bills.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Client Acc Debit Bal Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Client Acc Debit Bal Report', 'Client Acc Debt Bal Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Client Balance 90 Days Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Client Balance 90 Days Report', 'Client Balance 90 Days Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Client Deposit Balances Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Client Deposit Balances Report', 'Client Deposit Balances Report .rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Client Outlay Balances as at a Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Client Outlay Balances as at a Date', 'Client Outlay Balances as at a Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Office Account Credit Balances by Client' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Office Account Credit Balances by Client', 'Office Credit Bal by Client.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Office Account Credit Balances' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Office Account Credit Balances', 'Office Credit Bal.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter Ledger' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter Ledger', 'Matter Ledger.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter Ledger By FE' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter Ledger By FE', 'Matter Ledger By FE.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Income Projection Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Income Projection Report', 'Income Projection Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter Summary Report By Dept' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter Summary Report By Dept', 'Matter Summary Report By Dept.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Outstanding Cases By ActionCode' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Outstanding Cases By ActionCode', 'Outstanding Cases By ActionCode.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Case Analysis By Client' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Case Analysis By Client', 'Case Analysis By Client.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Case Analysis By Dept' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Case Analysis By Dept', 'Case Analysis By Dept.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Case Analysis By Dept By Work Type' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Case Analysis By Dept By Work Type', 'Case Analysis By Dept By WType.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Case Analysis By Work Type' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Case Analysis By Work Type', 'Case Analysis By WType.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Billing Guide Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Billing Guide Report', 'Billing Guide Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Unbilled Time Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Unbilled Time Report', 'Unbilled Time Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matters Not Billed' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matters Not Billed', 'MattersNotBilled.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Nominal Ledger by Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Nominal Ledger by Date', 'Nominal Ledger by Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Nominal Ledger by Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Nominal Ledger by Period', 'Nominal Ledger by Period.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter Ledger by Client' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter Ledger by Client', 'Matter Ledger by Client.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Action Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Action Report', 'diaryactionreport.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Debt Costing Ledger' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Debt Costing Ledger', 'debtcosting.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List by Client' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List by Client', 'Matter List by Client.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List by Dept' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List by Dept', 'Matter List by Dept.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List By Closed / Archived Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List By Closed / Archived Date', 'Matter List By Closed Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'BillingReport' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('BillingReport', 'BillingReport.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'New Cases Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('New Cases Report', 'New Cases Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Case Associates By Matter' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Case Associates By Matter', 'Case Associates By Matter.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Case Associates By Type' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Case Associates By Type', 'Case Associates By Type.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Phone Log Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Phone Log Report', 'Phone Log Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Client Balances Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Client Balances Report', 'Client Balances Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Strong Room Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Strong Room Report', 'StrongRoomReport.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List By Destroy Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List By Destroy Date', 'Matter List By Destroy Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Cheque Requisition' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Cheque Requisition', 'Cheque Requisition.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'File Manager Report By Destroy Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('File Manager Report By Destroy Date', 'File Manager Report By Destroy Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Workflow Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Workflow Report', 'Workflow Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Bank Acc Register' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Bank Acc Register', 'Bank Acc Register.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'EFT Case Assoc Bank Acc Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('EFT Case Assoc Bank Acc Report', 'EFT Case Assoc Bank Acc Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'EFT Client Bank Acc Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('EFT Client Bank Acc Report', 'EFT Client Bank Acc Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'EFT Completed Transactions Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('EFT Completed Transactions Report', 'EFT Completed Transactions Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'EFT Nominal Bank Acc Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('EFT Nominal Bank Acc Report', 'EFT Nominal Bank Acc Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'EFT OS Transactions Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('EFT OS Transactions Report', 'EFT OS Transactions Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'EFT Supplier Bank Acc Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('EFT Supplier Bank Acc Report', 'EFT Supplier Bank Acc Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List', 'Matter List.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Cheque Requisitions List' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Cheque Requisitions List', 'Cheque Requisitions List.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'EFT Remittance' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('EFT Remittance', 'EFTRemittance.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List By Team' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List By Team', 'Matter List by Team.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'EFT Audit Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('EFT Audit Report', 'J:\Case61xpBuild83\ReportsCR\EFT Audit Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'System Reconciliation Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('System Reconciliation Report', 'System Reconciliation Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Trial Balance by Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Trial Balance by Date', 'Trial Balance by Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Trial Balance by Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Trial Balance by Period', 'Trial Balance by Period.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Balance Sheet by Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Balance Sheet by Date', 'Balance Sheet By Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Balance Sheet by Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Balance Sheet by Period', 'Balance Sheet By Period.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Date' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Date', 'Fees Issued by Date.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Issued by Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Issued by Period', 'Fees Issued by Period.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Matter List by Branch' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Matter List by Branch', 'Matter List by Branch.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Nominal Account List' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Nominal Account List', 'Nominal Account List.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'VAT CashReceipts Branch' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('VAT CashReceipts Branch', 'VAT_CashReceiptsBranch.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'VAT CashReceipts Branch Summary' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('VAT CashReceipts Branch Summary', 'VAT_CashReceiptsBranch_Summary.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'VAT InvoiceBasis Branch' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('VAT InvoiceBasis Branch', 'VAT_InvoiceBasisBranch.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'VAT InvoiceBasis Branch Summary' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('VAT InvoiceBasis Branch Summary', 'VAT_InvoiceBasisBranch_Summary.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Balance Sheet' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Balance Sheet', 'Balance Sheet.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Profit and Loss By Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Profit and Loss By Period', 'Profit and Loss By Period.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Fees Book By Period' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Fees Book By Period', 'Fees Book By Period.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'UD Billing Report' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('UD Billing Report', 'UD Billing Report.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [name] = 'Third Party Ledger' AND[report_type] = 'A')
Begin
INSERT INTO[dbo].[KaaS_CRReport]([name], [filename], [lastrundate], [lastruntime], [confrimparameter], [created_on], [modified_on], [status], [report_type], [notes], [synopsis]) VALUES('Third Party Ledger', 'Third Party Ledger.rpt', null, null, 0, GETDATE(), null, null, 'A', null, '')
End
Go

IF NOT EXISTS
   (
   SELECT TOP 1 1 FROM[KaaS_CRReport] 
           WHERE [name] = 'UD Billing Report' 
		   AND   [report_type] = 'B'
	)
Begin
INSERT INTO[dbo].[KaaS_CRReport]
       (
	   [name], 
	   [filename], 
	   [lastrundate], 
	   [lastruntime], 
	   [confrimparameter], 
	   [created_on], 
	   [modified_on], 
	   [status], 
	   [report_type], 
	   [notes], 
	   [synopsis]
	   ) 
	   VALUES
	   (
	   'UD Billing Report', 
	   'UD Billing Report.rpt', 
	   null, 
	   null, 
	   0, 
	   GETDATE(), 
	   null, 
	   null, 
	   'B', 
	   null, 
	   ''
	   )
End
Go

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] = 'AllocatedReceipts.rpt'  AND  [ReportNameKey] <> 'RECEIPTS')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'RECEIPTS' WHERE [filename] = 'AllocatedReceipts.rpt' AND  [ReportNameKey] <> 'RECEIPTS'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] = 'Matter Ledger.rpt' AND  [ReportNameKey] <> 'MATTERLEDGER')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'MATTERLEDGER' WHERE [filename] = 'Matter Ledger.rpt' AND  [ReportNameKey] <> 'MATTERLEDGER'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] = 'PaymentReceipt.rpt' AND  [ReportNameKey] <> 'PAYMENT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'PAYMENT' WHERE [filename] = 'PaymentReceipt.rpt' AND  [ReportNameKey] <> 'PAYMENT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] = 'Debtors Ledger Report.rpt' AND  [ReportNameKey] <>  'DEBTORSLEDGERBYMATTER')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'DEBTORSLEDGERBYMATTER' WHERE [filename] = 'Debtors Ledger Report.rpt' AND  [ReportNameKey] <>  'DEBTORSLEDGERBYMATTER'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] ='Nominal Ledger by Date.rpt' AND  [ReportNameKey] <> 'NOMINALLEDGER')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'NOMINALLEDGER' WHERE [filename] ='Nominal Ledger by Date.rpt' AND  [ReportNameKey] <> 'NOMINALLEDGER'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] ='Profit and Loss By Period.rpt' AND  [ReportNameKey] <> 'PLSUMMARY')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'PLSUMMARY' WHERE [filename] ='Profit and Loss By Period.rpt' AND  [ReportNameKey] <> 'PLSUMMARY'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] ='Profit and Loss Budget By Period.rpt' AND  [ReportNameKey] <> 'PLBUDGET')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'PLBUDGET' WHERE [filename] ='Profit and Loss Budget By Period.rpt' AND  [ReportNameKey] <> 'PLBUDGET'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] ='Profit and Loss Summary By Period.rpt' AND  [ReportNameKey] <> 'PLBYPERIOD')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'PLBYPERIOD' WHERE [filename] ='Profit and Loss Summary By Period.rpt' AND  [ReportNameKey] <> 'PLBYPERIOD'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] ='Profit and Loss By Date.rpt' AND  [ReportNameKey] <> 'PLBYDATE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'PLBYDATE' WHERE [filename] ='Profit and Loss By Date.rpt' AND  [ReportNameKey] <> 'PLBYDATE' 
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] = 'Balance Sheet.rpt' AND  [ReportNameKey] <> 'BSCURRENT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'BSCURRENT' WHERE [filename] = 'Balance Sheet.rpt' AND  [ReportNameKey] <> 'BSCURRENT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] = 'Balance Sheet By Period.rpt' AND  [ReportNameKey] <> 'BSBYPERIOD')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'BSBYPERIOD' WHERE [filename] = 'Balance Sheet By Period.rpt' AND  [ReportNameKey] <> 'BSBYPERIOD' 
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] = 'Balance Sheet By Date.rpt' AND  [ReportNameKey] <>  'BSBYDATE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'BSBYDATE' WHERE [filename] = 'Balance Sheet By Date.rpt' AND  [ReportNameKey] <>  'BSBYDATE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] = 'Trial Balance.rpt' AND  [ReportNameKey] <> 'TRIALBALANCE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'TRIALBALANCE' WHERE [filename] = 'Trial Balance.rpt' AND  [ReportNameKey] <> 'TRIALBALANCE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Trial Balance by Period.rpt' AND  [ReportNameKey] <>  'TBBYPERIOD')
BEGIN 
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'TBBYPERIOD' WHERE [filename] =  'Trial Balance by Period.rpt' AND  [ReportNameKey] <>  'TBBYPERIOD'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Trial Balance by Date.rpt' AND  [ReportNameKey] <> 'TBBYDATE')
BEGIN 
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'TBBYDATE' WHERE [filename] =  'Trial Balance by Date.rpt' AND  [ReportNameKey] <> 'TBBYDATE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'List of Category.rpt' AND  [ReportNameKey] <> 'CATEGORIES')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'CATEGORIES' WHERE [filename] =  'List of Category.rpt' AND  [ReportNameKey] <> 'CATEGORIES'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'List of Fee Earners.rpt' AND  [ReportNameKey] <> 'FEEEARNERS')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FEEEARNERS' WHERE [filename] =  'List of Fee Earners.rpt' AND  [ReportNameKey] <> 'FEEEARNERS'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'List of Dept.rpt' AND  [ReportNameKey] <> 'DEPARTMENTS')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'DEPARTMENTS' WHERE [filename] =  'List of Dept.rpt' AND  [ReportNameKey] <> 'DEPARTMENTS'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'List of Work Types.rpt' AND  [ReportNameKey] <> 'WORKTYPES')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'WORKTYPES' WHERE [filename] =  'List of Work Types.rpt' AND  [ReportNameKey] <> 'WORKTYPES'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'List of VAT Codes.rpt' AND  [ReportNameKey] <> 'VATCODES')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'VATCODES' WHERE [filename] =  'List of VAT Codes.rpt' AND  [ReportNameKey] <> 'VATCODES'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'List of Nominal Ac Types.rpt' AND  [ReportNameKey] <> 'NOMINAL_AC_TYPES')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'NOMINAL_AC_TYPES' WHERE [filename] =  'List of Nominal Ac Types.rpt' AND  [ReportNameKey] <> 'NOMINAL_AC_TYPES'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Matter List.rpt' AND  [ReportNameKey] <> 'MATTERSLIST')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'MATTERSLIST' WHERE [filename] =  'Matter List.rpt' AND  [ReportNameKey] <> 'MATTERSLIST'  
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Matter List by Fee Earner.rpt' AND  [ReportNameKey] <> 'MATTERS_BY_FEE_EARNER')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'MATTERS_BY_FEE_EARNER' WHERE [filename] =  'Matter List by Fee Earner.rpt' AND  [ReportNameKey] <> 'MATTERS_BY_FEE_EARNER'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Matter List by Your Ref.rpt' AND  [ReportNameKey] <> 'MATTERS_BY_OLD_REF')
BEGIN 
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'MATTERS_BY_OLD_REF' WHERE [filename] =  'Matter List by Your Ref.rpt' AND  [ReportNameKey] <> 'MATTERS_BY_OLD_REF'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Matter List by Client.rpt' AND  [ReportNameKey] <> 'MATTERS_BY_CLIENT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'MATTERS_BY_CLIENT' WHERE [filename] =  'Matter List by Client.rpt' AND  [ReportNameKey] <> 'MATTERS_BY_CLIENT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Matter Summary Report By Fe.rpt' AND  [ReportNameKey] <> 'MATTERS_BY_CLIENT_BY_FEE_EARNER')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'MATTERS_BY_CLIENT_BY_FEE_EARNER' WHERE [filename] =  'Matter Summary Report By Fe.rpt' AND  [ReportNameKey] <> 'MATTERS_BY_CLIENT_BY_FEE_EARNER'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Matter List by Dept.rpt' AND  [ReportNameKey] <> 'MATTERS_BY_DEPARTMENT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'MATTERS_BY_DEPARTMENT' WHERE [filename] =  'Matter List by Dept.rpt' AND  [ReportNameKey] <> 'MATTERS_BY_DEPARTMENT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Matter List by WorkType.rpt' AND  [ReportNameKey] <> 'MATTERS_BY_WORKTYPE' )
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'MATTERS_BY_WORKTYPE' WHERE [filename] =  'Matter List by WorkType.rpt' AND  [ReportNameKey] <> 'MATTERS_BY_WORKTYPE' 
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Matter Balances as at a Date.rpt' AND  [ReportNameKey] <> 'MATTERS_BALANCES_AS_AT_DATE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'MATTERS_BALANCES_AS_AT_DATE' WHERE [filename] =  'Matter Balances as at a Date.rpt' AND  [ReportNameKey] <> 'MATTERS_BALANCES_AS_AT_DATE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Client List.rpt' AND  [ReportNameKey] <> 'CLIENT_LIST')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'CLIENT_LIST' WHERE [filename] =  'Client List.rpt' AND  [ReportNameKey] <> 'CLIENT_LIST'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Client Outlay Balances as at a Date.rpt' AND  [ReportNameKey] <> 'CLIENT_BALANCES_AS_AT_DATE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'CLIENT_BALANCES_AS_AT_DATE' WHERE [filename] =  'Client Outlay Balances as at a Date.rpt' AND  [ReportNameKey] <> 'CLIENT_BALANCES_AS_AT_DATE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Supplier List.rpt' AND  [ReportNameKey] <> 'SUPPLIER_BALANCES')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'SUPPLIER_BALANCES' WHERE [filename] =  'Supplier List.rpt' AND  [ReportNameKey] <> 'SUPPLIER_BALANCES'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Case Analysis By FE.rpt' AND  [ReportNameKey] <> 'ARCHIVED_MATTERS_BY_FEE_EARNER')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'ARCHIVED_MATTERS_BY_FEE_EARNER' WHERE [filename] =  'Case Analysis By FE.rpt' AND  [ReportNameKey] <> 'ARCHIVED_MATTERS_BY_FEE_EARNER' 
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE  [filename] =  'Case Analysis By Client.rpt' AND  [ReportNameKey] <> 'ARCHIVED_MATTERS_BY_CLIENT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'ARCHIVED_MATTERS_BY_CLIENT' WHERE [filename] =  'Case Analysis By Client.rpt' AND  [ReportNameKey] <> 'ARCHIVED_MATTERS_BY_CLIENT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Case Analysis By Dept.rpt' AND  [ReportNameKey] <> 'ARCHIVED_MATTERS_BY_DEPARTMENT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'ARCHIVED_MATTERS_BY_DEPARTMENT' WHERE [filename] =  'Case Analysis By Dept.rpt' AND  [ReportNameKey] <> 'ARCHIVED_MATTERS_BY_DEPARTMENT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'FeesIssDeptDate.rpt' AND  [ReportNameKey] <> 'FI_BY_DEPARTMENT_BY_DATE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FI_BY_DEPARTMENT_BY_DATE' WHERE [filename] =  'FeesIssDeptDate.rpt' AND  [ReportNameKey] <> 'FI_BY_DEPARTMENT_BY_DATE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'FeesIssDeptPeriod.rpt' AND  [ReportNameKey] <> 'FI_BY_DEPARTMENT_BY_PERIOD')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FI_BY_DEPARTMENT_BY_PERIOD' WHERE [filename] =  'FeesIssDeptPeriod.rpt' AND  [ReportNameKey] <> 'FI_BY_DEPARTMENT_BY_PERIOD'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'FeesIssWTDate.rpt' AND  [ReportNameKey] <> 'FI_BY_WORK_TYPE_BY_DATE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FI_BY_WORK_TYPE_BY_DATE' WHERE [filename] =  'FeesIssWTDate.rpt' AND  [ReportNameKey] <> 'FI_BY_WORK_TYPE_BY_DATE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'FeesIssWTPeriod.rpt' AND  [ReportNameKey] <> 'FI_BY_WORK_TYPE_BY_PERIOD')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FI_BY_WORK_TYPE_BY_PERIOD' WHERE [filename] =  'FeesIssWTPeriod.rpt' AND  [ReportNameKey] <> 'FI_BY_WORK_TYPE_BY_PERIOD'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'FeesIssWTFEDate.rpt' AND  [ReportNameKey] <> 'FI_BY_WORK_TYPE_BY_FEE_EARNER_BY_DATE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FI_BY_WORK_TYPE_BY_FEE_EARNER_BY_DATE' WHERE [filename] =  'FeesIssWTFEDate.rpt' AND  [ReportNameKey] <> 'FI_BY_WORK_TYPE_BY_FEE_EARNER_BY_DATE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'FeesIssWTFEPeriod.rpt' AND  [ReportNameKey] <> 'FI_BY_WORK_TYPE_BY_FEE_EARNER_BY_PERIOD')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FI_BY_WORK_TYPE_BY_FEE_EARNER_BY_PERIOD' WHERE [filename] =  'FeesIssWTFEPeriod.rpt' AND  [ReportNameKey] <> 'FI_BY_WORK_TYPE_BY_FEE_EARNER_BY_PERIOD'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'FeesIssDeptWTDate.rpt' AND  [ReportNameKey] <> 'FI_BY_DEPARTMENT_BY_WORK_TYPE_BY_DATE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FI_BY_DEPARTMENT_BY_WORK_TYPE_BY_DATE' WHERE [filename] =  'FeesIssDeptWTDate.rpt' AND  [ReportNameKey] <> 'FI_BY_DEPARTMENT_BY_WORK_TYPE_BY_DATE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'FeesIssDeptWTPeriod.rpt' AND  [ReportNameKey] <> 'FI_BY_DEPARTMENT_BY_WORK_TYPE_BY_PERIOD')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FI_BY_DEPARTMENT_BY_WORK_TYPE_BY_PERIOD' WHERE [filename] =  'FeesIssDeptWTPeriod.rpt' AND  [ReportNameKey] <> 'FI_BY_DEPARTMENT_BY_WORK_TYPE_BY_PERIOD'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'FeesIssFEDate.rpt' AND  [ReportNameKey] <> 'FI_BY_FEE_EARNER_BY_DATE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FI_BY_FEE_EARNER_BY_DATE' WHERE [filename] =  'FeesIssFEDate.rpt' AND  [ReportNameKey] <> 'FI_BY_FEE_EARNER_BY_DATE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'FeesIssFEPeriod.rpt' AND  [ReportNameKey] <> 'FI_BY_FEE_EARNER_BY_PERIOD')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FI_BY_FEE_EARNER_BY_PERIOD' WHERE [filename] =  'FeesIssFEPeriod.rpt' AND  [ReportNameKey] <> 'FI_BY_FEE_EARNER_BY_PERIOD'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Fees Issued by Client by Date.rpt' AND  [ReportNameKey] <> 'FI_BY_CLIENT_BY_DATE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FI_BY_CLIENT_BY_DATE' WHERE [filename] =  'Fees Issued by Client by Date.rpt' AND  [ReportNameKey] <> 'FI_BY_CLIENT_BY_DATE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Fees Issued by Client by Period.rpt' AND  [ReportNameKey] <> 'FI_BY_CLIENT_BY_PERIOD')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FI_BY_CLIENT_BY_PERIOD' WHERE [filename] =  'Fees Issued by Client by Period.rpt' AND  [ReportNameKey] <> 'FI_BY_CLIENT_BY_PERIOD' 
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Fees Rec By Matter By Date.rpt' AND  [ReportNameKey] <> 'FR_BY_FEE_EARNER_BY_DATE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FR_BY_FEE_EARNER_BY_DATE' WHERE [filename] =  'Fees Rec By Matter By Date.rpt' AND  [ReportNameKey] <> 'FR_BY_FEE_EARNER_BY_DATE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Fees Rec By Matter By Period.rpt' AND  [ReportNameKey] <> 'FR_BY_FEE_EARNER_BY_PERIOD')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FR_BY_FEE_EARNER_BY_PERIOD' WHERE [filename] =  'Fees Rec By Matter By Period.rpt' AND  [ReportNameKey] <> 'FR_BY_FEE_EARNER_BY_PERIOD'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Time Write Off By Dept.rpt' AND  [ReportNameKey] <> 'WO_TIME_BY_DEPARTMENT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'WO_TIME_BY_DEPARTMENT' WHERE [filename] =  'Time Write Off By Dept.rpt' AND  [ReportNameKey] <> 'WO_TIME_BY_DEPARTMENT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'DormantMatters.rpt' AND  [ReportNameKey] <> 'DORMANT_MATTERS')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'DORMANT_MATTERS' WHERE [filename] =  'DormantMatters.rpt' AND  [ReportNameKey] <> 'DORMANT_MATTERS' 
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Client Acc Debt Bal Report.rpt' AND  [ReportNameKey] <> 'CLIENT_AC_DEBIT_BALANCES')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'CLIENT_AC_DEBIT_BALANCES' WHERE [filename] =  'Client Acc Debt Bal Report.rpt' AND  [ReportNameKey] <> 'CLIENT_AC_DEBIT_BALANCES'  
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Office Credit Bal.rpt' AND  [ReportNameKey] <> 'OFFICE_AC_CREDIT_BALANCES')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'OFFICE_AC_CREDIT_BALANCES' WHERE [filename] =  'Office Credit Bal.rpt' AND  [ReportNameKey] <> 'OFFICE_AC_CREDIT_BALANCES'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Office Credit Bal by Client.rpt' AND  [ReportNameKey] <> 'OFFICE_AC_CREDIT_BALANCES_BY_CLIENT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'OFFICE_AC_CREDIT_BALANCES_BY_CLIENT' WHERE [filename] =  'Office Credit Bal by Client.rpt' AND  [ReportNameKey] <> 'OFFICE_AC_CREDIT_BALANCES_BY_CLIENT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Outlay v Budget Report.rpt' AND  [ReportNameKey] <> 'OUTLAY_EXCEEDING_BUDGET')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'OUTLAY_EXCEEDING_BUDGET' WHERE [filename] =  'Outlay v Budget Report.rpt' AND  [ReportNameKey] <> 'OUTLAY_EXCEEDING_BUDGET'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'StatuteLimitationsDates.rpt' AND  [ReportNameKey] <> 'STATUE_OF_LIMITATIONS_REPORT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'STATUE_OF_LIMITATIONS_REPORT' WHERE [filename] =  'StatuteLimitationsDates.rpt' AND  [ReportNameKey] <> 'STATUE_OF_LIMITATIONS_REPORT'  
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'OS Bills.rpt' AND  [ReportNameKey] <> 'DR_OUTSTANDING_BILLS')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'DR_OUTSTANDING_BILLS' WHERE [filename] =  'OS Bills.rpt' AND  [ReportNameKey] <> 'DR_OUTSTANDING_BILLS'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Client Statments.rpt' AND  [ReportNameKey] <> 'DR_STATEMENTS_BY_CLIENT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'DR_STATEMENTS_BY_CLIENT' WHERE [filename] =  'Client Statments.rpt' AND  [ReportNameKey] <> 'DR_STATEMENTS_BY_CLIENT' 
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Client Statement By Matter.rpt' AND  [ReportNameKey] <> 'DR_STATEMENTS_BY_MATTER')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'DR_STATEMENTS_BY_MATTER' WHERE [filename] =  'Client Statement By Matter.rpt' AND  [ReportNameKey] <> 'DR_STATEMENTS_BY_MATTER'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'AgedDebtbyClient.rpt' AND  [ReportNameKey] <> 'ADR_BY_CLIENT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'ADR_BY_CLIENT' WHERE [filename] =  'AgedDebtbyClient.rpt' AND  [ReportNameKey] <> 'ADR_BY_CLIENT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'AgedDebtByFe.rpt' AND  [ReportNameKey] <> 'ADR_BY_FEE_EARNER_BY_DATE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'ADR_BY_FEE_EARNER_BY_DATE' WHERE [filename] =  'AgedDebtByFe.rpt' AND  [ReportNameKey] <> 'ADR_BY_FEE_EARNER_BY_DATE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'AgedDebtByDept.rpt' AND  [ReportNameKey] <> 'ADR_BY_DEPARTMENT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'ADR_BY_DEPARTMENT' WHERE [filename] =  'AgedDebtByDept.rpt' AND  [ReportNameKey] <> 'ADR_BY_DEPARTMENT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'AgedDebtByWType.rpt' AND  [ReportNameKey] <> 'ADR_BY_WORK_TYPE')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'ADR_BY_WORK_TYPE' WHERE [filename] =  'AgedDebtByWType.rpt' AND  [ReportNameKey] <> 'ADR_BY_WORK_TYPE'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Aged Creditors Report.rpt' AND  [ReportNameKey] <> 'AGED_CREDITORS_REPORT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'AGED_CREDITORS_REPORT' WHERE [filename] =  'Aged Creditors Report.rpt' AND  [ReportNameKey] <> 'AGED_CREDITORS_REPORT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE  [filename] =  'VAT_InvoiceBasisBranch.rpt' AND  [ReportNameKey] <> 'VAT_REPORT_INVOICE_BASIS')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'VAT_REPORT_INVOICE_BASIS' WHERE [filename] =  'VAT_InvoiceBasisBranch.rpt' AND  [ReportNameKey] <> 'VAT_REPORT_INVOICE_BASIS'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'VAT_CashReceiptsBranch.rpt' AND  [ReportNameKey] <> 'VAT_REPORT_CASH_RECEIPTS')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'VAT_REPORT_CASH_RECEIPTS' WHERE [filename] =  'VAT_CashReceiptsBranch.rpt' AND  [ReportNameKey] <> 'VAT_REPORT_CASH_RECEIPTS'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Bank Acc Register.rpt' AND  [ReportNameKey] <> 'BANK_ACCOUNT_REGISTER')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'BANK_ACCOUNT_REGISTER' WHERE [filename] =  'Bank Acc Register.rpt' AND  [ReportNameKey] <> 'BANK_ACCOUNT_REGISTER'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'System Reconciliation Report.rpt' AND  [ReportNameKey] <> 'SYSTEM_RECONCILIATION_REPORT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'SYSTEM_RECONCILIATION_REPORT' WHERE [filename] =  'System Reconciliation Report.rpt' AND  [ReportNameKey] <> 'SYSTEM_RECONCILIATION_REPORT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Transfer Costs By Date.rpt' AND  [ReportNameKey] <> 'TRANSFERS_FOR_COSTS_REPORT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'TRANSFERS_FOR_COSTS_REPORT' WHERE [filename] =  'Transfer Costs By Date.rpt' AND  [ReportNameKey] <> 'TRANSFERS_FOR_COSTS_REPORT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Nominal Ledger by Period.rpt' AND  [ReportNameKey] <> 'BANK/NOMINAL_ACCOUNT_(BY PERIOD)')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'BANK/NOMINAL_ACCOUNT_(BY PERIOD)' WHERE [filename] =  'Nominal Ledger by Period.rpt' AND  [ReportNameKey] <> 'BANK/NOMINAL_ACCOUNT_(BY PERIOD)'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Fees Book By Period.rpt' AND  [ReportNameKey] <> 'FEES_BOOK_(PERIOD)')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'FEES_BOOK_(PERIOD)' WHERE [filename] =  'Fees Book By Period.rpt' AND  [ReportNameKey] <> 'FEES_BOOK_(PERIOD)'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Matter List By Closed Date.rpt' AND  [ReportNameKey] <> 'CLOSED_MATTER_REPORT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'CLOSED_MATTER_REPORT' WHERE [filename] =  'Matter List By Closed Date.rpt' AND  [ReportNameKey] <> 'CLOSED_MATTER_REPORT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Matter List By Destroy Date.rpt' AND  [ReportNameKey] <> 'DESTROY_DATE_REPORT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'DESTROY_DATE_REPORT' WHERE [filename] =  'Matter List By Destroy Date.rpt' AND  [ReportNameKey] <> 'DESTROY_DATE_REPORT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Undertakings by Client.rpt' AND  [ReportNameKey] <> 'UNDERTAKINGSBYCLIENT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'UNDERTAKINGSBYCLIENT' WHERE [filename] =  'Undertakings by Client.rpt' AND  [ReportNameKey] <> 'UNDERTAKINGSBYCLIENT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Undertakings by Matter.rpt' AND  [ReportNameKey] <> 'UNDERTAKINGSBYMATTER')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'UNDERTAKINGSBYMATTER' WHERE [filename] =  'Undertakings by Matter.rpt' AND  [ReportNameKey] <> 'UNDERTAKINGSBYMATTER'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Cheque Requisitions List.rpt' AND  [ReportNameKey] <> 'CHEQUEREQUISITIONLIST')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'CHEQUEREQUISITIONLIST' WHERE [filename] =  'Cheque Requisitions List.rpt' AND  [ReportNameKey] <> 'CHEQUEREQUISITIONLIST'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Cheque Requisition.rpt' AND  [ReportNameKey] <> 'CHEQUEREQUISITION')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'CHEQUEREQUISITION' WHERE [filename] =  'Cheque Requisition.rpt' AND  [ReportNameKey] <> 'CHEQUEREQUISITION'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'UD Billing Report.rpt' AND  [ReportNameKey] <> 'UDBILLINGREPORT')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'UDBILLINGREPORT' WHERE [filename] =  'UD Billing Report.rpt' AND  [ReportNameKey] <> 'UDBILLINGREPORT'
END 
GO

IF EXISTS(SELECT TOP 1 1 FROM[KaaS_CRReport] WHERE [filename] =  'Supplier Ledger.rpt' AND  [ReportNameKey] <> 'SUPPLIERLEDGER')
BEGIN
UPDATE [Kaas_CRReport] SET [ReportNameKey] = 'SUPPLIERLEDGER' WHERE [filename] =  'Supplier Ledger.rpt' AND  [ReportNameKey] <> 'SUPPLIERLEDGER'
END
GO





