--Step 01 Add new colunm Inventory Stock Receive
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'

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','o_wo_special_order','Work Order - More - Special Order','M','MBL','(Default)',NULL,@f_menu_seq,'0','0','0','0','O','admin',getdate(),'Work Order',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 ,1 ,1 ,1 ,1 ,1 ,1 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 ,1 ,1 ,1 ,1 ,1 ,1 ,'admi' , GetDate() From cf_menu_template 



--Step 03 Update all cf_menu_seq
update cf_menu set cf_menu_seq = '1' where object_name ='m_ast_create_asset' 
update cf_menu set cf_menu_seq = '2' where object_name ='m_ast_asset_master' 
update cf_menu set cf_menu_seq = '3' where object_name ='m_ast_scan_Asset' 
update cf_menu set cf_menu_seq = '4' where object_name ='m_ast_asset_meter' 
update cf_menu set cf_menu_seq = '5' where object_name ='o_asset_spare_list' 
update cf_menu set cf_menu_seq = '6' where object_name ='o_asset_wo_hisotry' 
update cf_menu set cf_menu_seq = '7' where object_name ='m_wr_create_wr' 
update cf_menu set cf_menu_seq = '8' where object_name ='m_wr_wr_listing' 
update cf_menu set cf_menu_seq = '9' where object_name ='m_wr_wr_listing_all_grp' 
update cf_menu set cf_menu_seq = '10' where object_name ='m_wr_wr_listing_my_grp' 
update cf_menu set cf_menu_seq = '11' where object_name ='m_wr_my_wr' 
update cf_menu set cf_menu_seq = '12' where object_name ='m_wo_dashboard' 
update cf_menu set cf_menu_seq = '13' where object_name ='m_wo_create_wo'
update cf_menu set cf_menu_seq = '14' where object_name ='m_wo_wo_listing' 
update cf_menu set cf_menu_seq = '15' where object_name ='m_wo_my_wo' 
update cf_menu set cf_menu_seq = '16' where object_name ='o_wo_verify_asset' 
update cf_menu set cf_menu_seq = '17' where object_name ='o_wo_chargeable' 
update cf_menu set cf_menu_seq = '18' where object_name ='o_wo_acknowledgement' 
update cf_menu set cf_menu_seq = '19' where object_name ='o_wo_completion' 
update cf_menu set cf_menu_seq = '20' where object_name ='o_wo_contract_request' 
update cf_menu set cf_menu_seq = '21' where object_name ='o_wo_special_order' 
update cf_menu set cf_menu_seq = '22' where object_name ='o_wo_material_request' 
update cf_menu set cf_menu_seq = '23' where object_name ='o_wo_checklist' 
update cf_menu set cf_menu_seq = '24' where object_name ='o_wo_timecard'
update cf_menu set cf_menu_seq = '25' where object_name ='o_wo_downtime' 
update cf_menu set cf_menu_seq = '26' where object_name ='o_wo_comments' 
update cf_menu set cf_menu_seq = '27' where object_name ='o_wo_purchasing_info' 
update cf_menu set cf_menu_seq = '28' where object_name ='o_wo_sub_wo' 
update cf_menu set cf_menu_seq = '29' where object_name ='m_inv_dashboard' 
update cf_menu set cf_menu_seq = '30' where object_name ='m_inv_stock_master' 
update cf_menu set cf_menu_seq = '31' where object_name ='m_inv_stock_issue' 
update cf_menu set cf_menu_seq = '32' where object_name ='m_inv_stock_receive_misc' 
update cf_menu set cf_menu_seq = '33' where object_name ='m_inv_stock_receive_po' 
update cf_menu set cf_menu_seq = '34' where object_name ='m_inv_stock_return' 
update cf_menu set cf_menu_seq = '35' where object_name ='m_inv_stock_take'
update cf_menu set cf_menu_seq = '36' where object_name ='m_appr_mr_approval' 
update cf_menu set cf_menu_seq = '37' where object_name ='m_appr_pr_approval' 
update cf_menu set cf_menu_seq = '38' where object_name ='m_ntf_notification' 