USE [HotelPms]
GO

--®^Cv
INSERT INTO [dbo].[M_RoomType]
           ([ID]
           ,[Name]
           ,[ShortName]
           ,[Kind]
           ,[SortID]
           ,[Visible]
           ,[TypeListVisible]
           ,[TypeListAlertCount]
           ,[TypeListAlertColor]
           ,[WebType]
           ,[SendRate]
           ,[SendLimit]
           ,[Memo]
           ,[UpdateDate]
           ,[UpdateLoginID]
           ,[UpdatePcName]
           ,[UpdateID])
SELECT [RoomTypeNo]
      ,[RoomTypeName]
      ,[RoomTypeShortName]
      ,case when [RoomKind] = 5 then 3 else [RoomKind] - 1 end
      ,[RoomTypeDispNo]
      ,[RoomTypeDispFlg]
      ,[TypeListDispFlg]
      ,[TypeListRemainCount]
      ,[TypeListRemainColor]
      ,[NetGroupCode]
      ,[SendRate]
      ,[SendLimit]
      ,[Memo]
      ,[UpdateDate]
      ,[UpdatePerson]
	  ,''
	  ,0
  FROM [BHotelHW].[dbo].[M_RoomType]


  INSERT INTO [dbo].[M_Room]
           ([ID]
           ,[TypeID]
           ,[SortID]
           ,[Floor]
           ,[Name]
           ,[Capacity]
           ,[PBXID]
           ,[RfgID]
           ,[PTVID]
           ,[Visible]
           ,[OpeFlg]
           ,[SignID]
           ,[GradeID]
           ,[BuildingID]
           ,[HallType1]
           ,[HallType2]
           ,[Memo]
           ,[UpdateDate]
           ,[UpdateLoginID]
           ,[UpdatePcName]
           ,[UpdateID])
SELECT [RoomNo]
      ,[RoomTypeNo]
	  ,[DispSort]
	  ,[Floor]
      ,[RoomName]
      ,[Capacity]
      ,[PBXNo]
      ,[RefrigeratorNo]
      ,[PTVNo]
	  ,[RoomDispFlg]
      ,[OpeFlg]     
      ,[SignCode]
	  ,[GradeNo]
	  ,[BuildingNo]
      ,[HallType]
      ,[HallType2]
      ,[Memo]
      ,[UpdateDate]
      ,[UpdatePerson]
      ,''
	  ,0
  FROM [BHotelHW].[dbo].[M_Room]
  go


  INSERT INTO [dbo].[M_RoomViewLayout]
           ([TabID]
           ,[Row]
           ,[Col]
           ,[RoomID]
           ,[DisplayName]
           ,[RowHeight]
           ,[ColWidth]
           ,[BackColor]
           ,[ForeColor]
           ,[Floor]
           ,[FontName]
           ,[FontSize]
           ,[FontBold]
           ,[FontItalic]
           ,[FontUnderline]
           ,[TextAlign]
           ,[UpdateDate]
           ,[UpdateLoginID]
           ,[UpdatePcName]
           ,[UpdateID])
		   select 
		   [TabNo]
      ,[Row]
      ,[Col]
      ,[RoomNo]
      ,[DisplayName]
      ,[RowHeight]
      ,[ColWidth]
      ,[BackColor]
      ,[ForeColor]      
      ,[Floor]
      ,[FontName]
      ,[FontSize]
      ,[FontBold]
      ,[FontItalic]
      ,[FontUnderline]
      ,[TextAlign]
      ,[UpdateDate]
      ,[UpdatePerson]
      ,''
	  ,0
  FROM [BHotelHW].[dbo].[M_GuestRoomDisplay]
  GO

  --AJ}A#Jn

  update [M_RoomViewLayout] set ForeColor = '#FFFFFF' where ForeColor='16777215'
  update [M_RoomViewLayout] set BackColor = '#FFFFFF' where BackColor='16777215'

  update [M_RoomViewLayout] set ForeColor = '#FFFF00' where ForeColor='16776960'
  update [M_RoomViewLayout] set BackColor = '#FFFF00' where BackColor='16776960'

    update [M_RoomViewLayout] set ForeColor = '#00FF00' where ForeColor='65280'
  update [M_RoomViewLayout] set BackColor = '#00FF00' where BackColor='65280'

  INSERT INTO [dbo].[M_RoomViewTab]
           ([ID]
           ,[Name]
           ,[UpdateDate]
           ,[UpdateLoginID]
           ,[UpdatePcName]
           ,[UpdateID])
select TabNo,TabName,UpdateDate,UpdatePerson,'',0
	FROM [BHotelHW].[dbo].M_GuestRoomTab
GO