CREATE TABLE [dbo].[lri_sts](
	[site_cd] [varchar](4) NOT NULL,
	[lri_sts_cat_cd] [varchar](20) NOT NULL,
	[lri_sts_typ_cd] [varchar](25) NOT NULL,
	[lri_sts_status] [varchar](3) NOT NULL,
	[lri_sts_desc] [varchar](255) NULL,
	[lri_sts_disable_flag] [varchar](1) NULL,
	[scn_sts_email_flag] [varchar](1) NULL,
	[audit_user] [varchar](50) NULL,
	[audit_date] [datetime] NOT NULL,
	[column1] [varchar](60) NULL,
	[column2] [varchar](60) NULL,
	[column3] [varchar](60) NULL,
	[column4] [varchar](60) NULL,
	[column5] [varchar](60) NULL,
	[RowID] [numeric](12, 0) IDENTITY(1,1) NOT NULL
) ON [PRIMARY]
GO


DELETE	cf_table
WHERE	table_name = 'lri_sts'
GO

INSERT	cf_table (	table_name,           
					table_desc,
					custom_report,
					audit_user,
					audit_date )
VALUES (			'lri_sts',
					'Linen Request and Issue Status Record',
					'0',
					'admin',
					GETDATE())
GO

DELETE	cf_label
WHERE	table_name = 'lri_sts'
AND 	column_name = 'lri_sts_cat_cd'
GO

INSERT 	cf_label (language_cd, table_name, column_name, 
		default_label,
		customize_label, 
		default_header, 
		customize_header, 
		cfr_flag, cf_label_required, audit_user, audit_date ) 
SELECT 	language_cd, 'lri_sts', 'lri_sts_cat_cd', 
		'Category:', 
		'Category:', 
		'Category', 
		'Category', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO

DELETE	cf_label
WHERE	table_name = 'lri_sts'
AND 	column_name = 'lri_sts_typ_cd'
GO

INSERT 	cf_label (language_cd, table_name, column_name, 
		default_label,
		customize_label, 
		default_header, 
		customize_header, 
		cfr_flag, cf_label_required, audit_user, audit_date ) 
SELECT 	language_cd, 'lri_sts', 'lri_sts_typ_cd', 
		'Type:', 
		'Type:', 
		'Type', 
		'Type', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO

DELETE	cf_label
WHERE	table_name = 'lri_sts'
AND 	column_name = 'lri_sts_status'
GO

INSERT 	cf_label (language_cd, table_name, column_name, 
		default_label,
		customize_label, 
		default_header, 
		customize_header, 
		cfr_flag, cf_label_required, audit_user, audit_date ) 
SELECT 	language_cd, 'lri_sts', 'lri_sts_status', 
		'Status:', 
		'Status:', 
		'Status', 
		'Status', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO



DELETE	cf_label
WHERE	table_name = 'lri_sts'
AND 	column_name = 'lri_sts_desc'
GO

INSERT 	cf_label (language_cd, table_name, column_name, 
		default_label,
		customize_label, 
		default_header, 
		customize_header, 
		cfr_flag, cf_label_required, audit_user, audit_date ) 
SELECT 	language_cd, 'lri_sts', 'lri_sts_desc', 
		'Description:', 
		'Description:', 
		'Description', 
		'Description', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO


DELETE	cf_label
WHERE	table_name = 'lri_sts'
AND 	column_name = 'lri_sts_disable_flag'
GO

INSERT 	cf_label (language_cd, table_name, column_name, 
		default_label,
		customize_label, 
		default_header, 
		customize_header, 
		cfr_flag, cf_label_required, audit_user, audit_date ) 
SELECT 	language_cd, 'lri_sts', 'lri_sts_disable_flag', 
		'Disable?:', 
		'Disable?:', 
		'Disable?', 
		'Disable?', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO


DELETE	cf_label
WHERE	table_name = 'lri_sts'
AND 	column_name = 'lri_sts_email_flag'
GO

INSERT 	cf_label (language_cd, table_name, column_name, 
		default_label,
		customize_label, 
		default_header, 
		customize_header, 
		cfr_flag, cf_label_required, audit_user, audit_date ) 
SELECT 	language_cd, 'lri_sts', 'lri_sts_email_flag', 
		'Email:', 
		'Email:', 
		'Email', 
		'Email', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO


Insert into sts_cat (site_cd, sts_cat_cat_cd, sts_cat_desc, audit_user, audit_date)
Select cf_site.site_cd, 'LINEN', 'Linen Request And Issue Status', 'admin', getdate() From cf_site
GO

Insert into sts_typ (site_cd, sts_typ_cat_cd, sts_typ_typ_cd, sts_typ_desc, audit_user, audit_date)
Select cf_site.site_cd, 'LINEN', 'OPEN', 'Open Status', 'admin', getdate() from cf_site
GO

Insert into sts_typ (site_cd, sts_typ_cat_cd, sts_typ_typ_cd, sts_typ_desc, audit_user, audit_date)
Select cf_site.site_cd, 'LINEN', 'COMPLETE', 'Complete Status', 'admin', getdate() from cf_site
GO

Insert into sts_typ (site_cd, sts_typ_cat_cd, sts_typ_typ_cd, sts_typ_desc, audit_user, audit_date)
Select cf_site.site_cd, 'LINEN', 'CLOSE', 'Close Status', 'admin', getdate() from cf_site
GO

Insert into sts_typ (site_cd, sts_typ_cat_cd, sts_typ_typ_cd, sts_typ_desc, audit_user, audit_date)
Select cf_site.site_cd, 'LINEN', 'CANCEL', 'Cancel Status', 'admin', getdate() from cf_site
GO

Insert into lri_sts (site_cd, lri_sts_cat_cd, lri_sts_typ_cd, lri_sts_status, lri_sts_disable_flag, lri_sts_desc, audit_user, audit_date)
Select cf_site.site_cd, 'LINEN', 'OPEN', 'OPN', '0', 'Open', 'admin',  getdate() from cf_site
GO

Insert into lri_sts (site_cd, lri_sts_cat_cd, lri_sts_typ_cd, lri_sts_status, lri_sts_disable_flag, lri_sts_desc, audit_user, audit_date)
Select cf_site.site_cd, 'LINEN', 'COMPLETE', 'CNT', '0', 'Count Completed', 'admin',  getdate() from cf_site
GO

Insert into lri_sts (site_cd, lri_sts_cat_cd, lri_sts_typ_cd, lri_sts_status, lri_sts_disable_flag, lri_sts_desc, audit_user, audit_date)
Select cf_site.site_cd, 'LINEN', 'CLOSE', 'ISU', '0', 'Issue Complete Status', 'admin',  getdate() from cf_site
GO

Insert into lri_sts (site_cd, lri_sts_cat_cd, lri_sts_typ_cd, lri_sts_status, lri_sts_disable_flag, lri_sts_desc, audit_user, audit_date)
Select cf_site.site_cd, 'LINEN', 'CANCEL', 'CNX', '0', 'Cancel', 'admin',  getdate() from cf_site
GO
