Declare @f_menu_id numeric
Declare @f_menu_seq numeric

select @f_menu_seq = max(cf_menu_seq) + 1
From cf_menu
Where program_category = 'MBL'
and object_type = 'M'

-- Daily Linen Routine
INSERT INTO cf_menu ( language_cd, object_name, object_descs, object_type, program_category, ico_name, remarks, cf_menu_seq, audit_column, custom_flag, external_program, access_audit, mobile_object_type, audit_user, audit_date, column1, column2, column3, column4, column5 )
VALUES ('DEFAULT','m_lin_daily_linen_routine','Linen - Daily Linen Routine','M','MBL','(Default)',NULL,@f_menu_seq,'0','0','0','0','M','admin',getdate(),'Linen',NULL,NULL,NULL,NULL)
select TOP 1 @f_menu_id = RowID from cf_menu order by rowid desc
Insert cf_user_access (site_cd, empl_id, menuid, exe_flag, view_flag, new_flag, edit_flag, del_flag, print_flag)  Select cf_site_user.site_cd, cf_site_user.empl_id,@f_menu_id ,0 ,0 ,0 ,0 ,0 ,0 From cf_site_user 
Insert cf_menu_template_access (template_cd, menuid, exe_flag, view_flag, new_flag, edit_flag, del_flag, print_flag, audit_user, audit_date)  Select cf_menu_template.template_cd, @f_menu_id ,0 ,0 ,0 ,0 ,0 ,0 ,'admin' , GetDate() From cf_menu_template 

-- Daily Linen Issue
INSERT INTO cf_menu ( language_cd, object_name, object_descs, object_type, program_category, ico_name, remarks, cf_menu_seq, audit_column, custom_flag, external_program, access_audit, mobile_object_type, audit_user, audit_date, column1, column2, column3, column4, column5 )
VALUES ('DEFAULT','m_lin_daily_linen_issue','Linen - Daily Linen Issue','M','MBL','(Default)',NULL,@f_menu_seq,'0','0','0','0','M','admin',getdate(),'Linen',NULL,NULL,NULL,NULL)
select TOP 1 @f_menu_id = RowID from cf_menu order by rowid desc
Insert cf_user_access (site_cd, empl_id, menuid, exe_flag, view_flag, new_flag, edit_flag, del_flag, print_flag)  Select cf_site_user.site_cd, cf_site_user.empl_id,@f_menu_id ,0 ,0 ,0 ,0 ,0 ,0 From cf_site_user 
Insert cf_menu_template_access (template_cd, menuid, exe_flag, view_flag, new_flag, edit_flag, del_flag, print_flag, audit_user, audit_date)  Select cf_menu_template.template_cd, @f_menu_id ,0 ,0 ,0 ,0 ,0 ,0 ,'admin' , GetDate() From cf_menu_template 


--	New Linen Request Listing
INSERT INTO cf_menu ( language_cd, object_name, object_descs, object_type, program_category, ico_name, remarks, cf_menu_seq, audit_column, custom_flag, external_program, access_audit, mobile_object_type, audit_user, audit_date, column1, column2, column3, column4, column5 )
VALUES ('DEFAULT','m_lin_new_linen_rquest_listing','Linen - New Linen Request Listing','M','MBL','(Default)',NULL,@f_menu_seq,'0','0','0','0','M','admin',getdate(),'Linen',NULL,NULL,NULL,NULL)
select TOP 1 @f_menu_id = RowID from cf_menu order by rowid desc
Insert cf_user_access (site_cd, empl_id, menuid, exe_flag, view_flag, new_flag, edit_flag, del_flag, print_flag)  Select cf_site_user.site_cd, cf_site_user.empl_id,@f_menu_id ,0 ,0 ,0 ,0 ,0 ,0 From cf_site_user 
Insert cf_menu_template_access (template_cd, menuid, exe_flag, view_flag, new_flag, edit_flag, del_flag, print_flag, audit_user, audit_date)  Select cf_menu_template.template_cd, @f_menu_id ,0 ,0 ,0 ,0 ,0 ,0 ,'admin' , GetDate() From cf_menu_template 


--	Linen Reject & Replace
INSERT INTO cf_menu ( language_cd, object_name, object_descs, object_type, program_category, ico_name, remarks, cf_menu_seq, audit_column, custom_flag, external_program, access_audit, mobile_object_type, audit_user, audit_date, column1, column2, column3, column4, column5 )
VALUES ('DEFAULT','m_lin_linen_reject_replace','Linen - Linen Reject & Replace','M','MBL','(Default)',NULL,@f_menu_seq,'0','0','0','0','M','admin',getdate(),'Linen',NULL,NULL,NULL,NULL)
select TOP 1 @f_menu_id = RowID from cf_menu order by rowid desc
Insert cf_user_access (site_cd, empl_id, menuid, exe_flag, view_flag, new_flag, edit_flag, del_flag, print_flag)  Select cf_site_user.site_cd, cf_site_user.empl_id,@f_menu_id ,0 ,0 ,0 ,0 ,0 ,0 From cf_site_user 
Insert cf_menu_template_access (template_cd, menuid, exe_flag, view_flag, new_flag, edit_flag, del_flag, print_flag, audit_user, audit_date)  Select cf_menu_template.template_cd, @f_menu_id ,0 ,0 ,0 ,0 ,0 ,0 ,'admin' , GetDate() From cf_menu_template 