// V7.0.1 2010.10.25  HiNet企業簡訊發送/查詢記錄
Create Table HiNetToAir
(
  SERIAL integer identity(1,1) not null,
  SMS_SERVER_IP varchar(16) null,
  SMS_SERVER_PORT Integer null,
  LOGIN varchar(10) null,
  FROM_IP varchar(16) null,
  MOBILE_TEL varchar(18) null,
  SEND_TIME_WISE varchar(19) null,
  SEND_MEMO_WISE varchar(60) null,
  GET_MEMO_WISE varchar(60) null,
  MSG_TYPE varchar(4) null,
  MSG_CODING varchar(1) null,
  MSG_PRIORITY varchar(1) null,
  SEND_TYPE varchar(2) null,
  SEND_ONTIME varchar(12) null,
  SEND_OFFTIME varchar(4) null,
  MSG_CONTENT Text null,
  MESSAGE_ID varchar(20) null,
  STAT varchar(3) null,
  STAT_MEMO varchar(60) null,
  KIND varchar(10) null
);

// V7.0.1 2010.10.25  HiNet企業簡訊設定
Create Table HiNetToAirSet
(
  SMS_SERVER_IP varchar(16) null,
  SMS_SERVER_PORT integer null,
  SMS_LOG_IN varchar(10) null,
  SMS_PW varchar(10) null,
  SMS_BODY_CHKOUT text null,
  SMS_BODY_ORDERCNF text null,
  SMS_BODY_ORDERCNF_FAX text null,
  SMS_BODY_ORDER text null,
  SMS_HOTEL_NAME varchar(50) null,
  SMS_HOTEL_TEL varchar(19) null,
  SMS_HOTEL_FAX varchar(19) null
);

// V7.0.1 2010.10.25  簡訊自動發送主檔:HiNetToAir_M
Create Table HiNetToAir_M
(
  SerialM integer null,
  Body text null,
  Desk varchar(10),
  SendStart varchar(19) null,
  SendEnd varchar(19) null
);

// V7.0.1 2010.10.25  簡訊自動發送明細檔:HiNetToAir_D
Create Table HiNetToAir_D
(
  SerialD integer identity(1,1) not null,
  SerialM Integer null,
  Name varchar(50) null,
  CA_SERIAL Integer null,
  CB_SERIAL Integer null,
  MOBILE_TEL varchar(19) null,
  SendTime varchar(19) null
);

// V7.0.1 2010.10.30 預約時間欄位 mm:nn:ss
alter table HiNetToAirSet Add SMS_SEND_TIME varchar(8) null;

// V7.0.2 2010.12.14
CREATE TABLE [dbo].[FDLOGT10](
	[TRANSDT] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TRANSTM] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TRANSSEQ] [numeric](9, 0) NULL,
	[RONO] [varchar](6) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TELNO] [varchar](20) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[CLDATE] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[CLTIME] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[DURTIME] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TYPE] [varchar](2) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[AMT] [varchar](7) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[STATUS] [varchar](1) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[MSGCODE] [varchar](5) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[MSG] [varchar](100) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[OPID] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[OPDATE] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[OPTIME] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[OLDSTATUS] [varchar](1) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[AREA] [varchar](20) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TEMP] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL
) ON [PRIMARY];

CREATE TABLE [dbo].[FDLOGT11](
	[TRANSDT] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TRANSTM] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TRANSSEQ] [numeric](9, 0) NULL,
	[RONO] [varchar](6) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TELNO] [varchar](20) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[CLDATE] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[CLTIME] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[DURTIME] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TYPE] [varchar](2) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[AMT] [varchar](7) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[STATUS] [varchar](1) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[MSGCODE] [varchar](5) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[MSG] [varchar](100) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[OPID] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[OPDATE] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[OPTIME] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[OLDSTATUS] [varchar](1) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[AREA] [varchar](20) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TEMP] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL
) ON [PRIMARY];

CREATE TABLE [dbo].[FDLOGT20](
	[TRANSSEQ] [numeric](9, 0) NULL,
	[ROMNO] [varchar](6) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[OPCODE] [varchar](4) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[ARRDAY] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[DEPDAY] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[MORTIME] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[CUSNAME] [varchar](30) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[ORIGIN] [varchar](2) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TRANSDT] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TRANSTM] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[MSGCODE] [varchar](5) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[MSG] [varchar](100) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TEMP] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL
) ON [PRIMARY];

CREATE TABLE [dbo].[FDLOGT21](
	[TRANSSEQ] [numeric](9, 0) NULL,
	[ROMNO] [varchar](6) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[OPCODE] [varchar](4) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[ARRDAY] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[DEPDAY] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[MORTIME] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[CUSNAME] [varchar](30) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[ORIGIN] [varchar](2) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TRANSDT] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TRANSTM] [varchar](8) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[MSGCODE] [varchar](5) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[MSG] [varchar](100) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL,
	[TEMP] [varchar](10) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL
) ON [PRIMARY];

// V7.0.6 2010.12.23
Create Table TEL_IN
(
  SERIAL integer identity(1,1) not null,
  DDATE varchar(19) null,
  ROOM varchar(5) null,
  KIND varchar(6) null,
  RING_TIME varchar(5) null,
  TALK_TIME varchar(8) null,  
  PHONE_NUM varchar(26) null
);

Create Table HiNetToAir_SMS_KIND
(
  KIND varchar(20) null,
  PSORT integer null
);
alter table HiNetToAir add CA_SERIAL integer null;
alter table HiNetToAir alter column KIND varchar(20) null;
alter table HiNetToAir add ORDER_NO varchar(14) null;
alter table HiNetToAir add SA_SERIAL integer null;
alter table HiNetToAir_M add KIND varchar(20) null;

// V7.0.14 2010.12.29
CREATE INDEX IX_Ofare_ORDER_NO ON Ofare (ORDER_NO);
CREATE INDEX IX_Or_Order2_ORDER_NO ON Or_Order2 (ORDER_NO);
CREATE INDEX IX_Or_Room_ODATE ON Or_Room (ODATE);
CREATE INDEX IX_Or_Fare_ORDER_NO ON Or_Fare (ORDER_NO);
CREATE INDEX IX_Or_Fare_DDATE ON Or_Fare (DDATE);
CREATE INDEX IX_Or_Fare_BEDDATE ON Or_Fare (BEDDATE);

// V7.0.19 2011.01.06
alter table Base_ba add NEWS2 varchar(4) null;
CREATE INDEX IX_TicketSource_PART ON TicketSource (PART);
CREATE INDEX IX_TicketSource_TICKET_KIND ON TicketSource (TICKET_KIND);

// V7.0.20 2011.01.07
CREATE INDEX IX_Or_Order_IN_DATE ON Or_Order (IN_DATE);

// V7.0.51 2011.01.18
Create Table Or_MoneySimulate
(
  SERIAL integer identity(1,1) not null,
  ORDER_NO varchar(12) null,
  DDATE varchar(19) null,
  TILL_DATE varchar(19) null,
  ACCOUNT varchar(14) null,
  TOTAL int null,
  OR_MNY_SERIAL int null,
  STATUS varchar(8) null,
  PAY_TOTAL int null,
  PAY_DATE varchar(19) null,
  DEAL_TIME varchar(19) null
);

CREATE INDEX IX_Or_Edit_ORDER_NO ON Or_Edit (ORDER_NO);
CREATE INDEX IX_Or_Edit_DDATE ON Or_Edit (DDATE);
CREATE INDEX IX_Event_DDATE ON Event (DDATE);

// V7.0.67 2011.03.08
CREATE TABLE [dbo].[LeadaiRECV](
	[RECV01] [varchar](10) NOT NULL,
	[RECV02] [varchar](1) NULL,
	[RECV03] [varchar](40) NULL,
	[RECV04] [varchar](50) NULL,
	[RECV05] [varchar](14) NULL,
	[RECV06] [varchar](14) NULL,
	[RECV07] [varchar](1) NULL,
	[RECV08] [varchar](14) NULL
);

CREATE TABLE [dbo].[LeadaiRECVControl](
	[RECV01] [varchar](10) NOT NULL,
	[RECV02] [varchar](2) NULL,
	[RECV03] [varchar](14) NULL,
	[RECV04] [varchar](40) NULL,
	[RECV05] [varchar](14) NULL
);

CREATE TABLE [dbo].[LeadaiSEND](
	[SEND01] [varchar](10) NOT NULL,
	[SEND02] [varchar](1) NULL,
	[SEND03] [varchar](1) NULL,
	[SEND04] [varchar](14) NULL,
	[SEND05] [varchar](1) NULL,
	[SEND06] [varchar](1) NULL,
	[SEND07] [varchar](1) NULL,
	[SEND08] [varchar](1) NULL,
	[SEND09] [varchar](1) NULL,
	[SEND10] [varchar](1) NULL,
	[SEND11] [varchar](1) NULL,
	[SEND12] [varchar](1) NULL,
	[SEND13] [varchar](1) NULL,
	[SEND14] [varchar](1) NULL,
	[SEND15] [varchar](1) NULL,
	[SEND16] [varchar](14) NULL,
	[SEND17] [varchar](1) NULL,
	[SEND18] [varchar](1) NULL,
	[SEND19] [varchar](1) NULL,
	[SEND20] [varchar](4) NULL,
	[SEND21] [varchar](40) NULL,
	[SEND22] [varchar](20) NULL
);


CREATE TABLE [dbo].[LeadaiInitRoomInfo](
	[Init01] [varchar](10) NOT NULL,
	[Init02] [varchar](20) NULL,
	[Init03] [varchar](20) NULL
);

alter table Base_ba add SERVICE_STAT varchar(1) null;
alter table Base_ba add SERVICE_CONFIRM varchar(1) null;
alter table Base_ba add OVERHOT_STAT varchar(1) null;
alter table Base_ba add OVERHOT_CONFIRM varchar(1) null;
alter table Base_ba add ALARMTV_STAT varchar(1) null;
alter table Base_ba add ALARMTV_CONFIRM varchar(1) null;
alter table Base_ba add ROOM_RING varchar(4) null;
alter table Gcs_I_O add DESK varchar(10) null;
alter table Gcs_I_OBak add DESK varchar(10) null;
alter table Gcs_I_O add HHMM varchar(4) null;
alter table Gcs_I_OBak add HHMM varchar(4) null;

// V7.0.74 2011.03.11
Update Invoice Set STAT='' Where STAT is null;

// V7.0.75 2011.03.13
alter table UserRight ALTER COLUMN R2 int null;
alter table UserRight ALTER COLUMN R3 int null;
alter table UserRight ALTER COLUMN R4 int null;
alter table UserRight ALTER COLUMN R5 int null;
alter table UserRight ALTER COLUMN R6 int null;
alter table UserRight ALTER COLUMN R7 int null;
alter table UserRight ALTER COLUMN R8 int null;
alter table UserRight ALTER COLUMN R9 int null;
alter table UserRight ALTER COLUMN R10 int null;
Update UserRight Set R1='消費刪除限制?分鐘內(設9999不受限制)' Where R0=269;
Update UserRight Set R1='消費修改限制?分鐘內(設9999不受限制)' Where R0=271;

// V7.0.80 2011.03.17
alter table Show ALTER COLUMN KIND varchar(16) null;
alter table ShowAll ALTER COLUMN KIND varchar(16) null;

// V7.0.84 2011.03.19
alter table Base_ba add MORN_MSG varchar(20) null;

// V7.0.86 2011.03.21
alter table Base_ba ALTER COLUMN RM_CLASS varchar(4) null;
alter table Or_Arrange ALTER COLUMN RM_CLASS varchar(4) null;
alter table Or_RoomType ALTER COLUMN RM_CLASS varchar(4) null;
alter table Or_Order2 ALTER COLUMN RM_CLASS varchar(4) null;
alter table Or_Order2 ALTER COLUMN RM_CLASSCHG varchar(4) null;
alter table Or_Order2 ALTER COLUMN RM_CLASS_BEFORE varchar(4) null;
alter table Or_Room ALTER COLUMN RM_CLASS varchar(4) null;
alter table Or_RoomTmp ALTER COLUMN RM_CLASS varchar(4) null;
alter table Out_Or_Order2 ALTER COLUMN RM_CLASS varchar(4) null;
alter table LvCost ALTER COLUMN RM_CLASS varchar(4) null;
alter table SuiteHD ALTER COLUMN RM_CLASS varchar(4) null;
alter table Cust_cb_Rate ALTER COLUMN RM_CLASS varchar(4) null;
alter table OOOPlan ALTER COLUMN RM_CLASS varchar(4) null;
alter table Lock_Room ALTER COLUMN RM_CLASS varchar(4) null;
alter table MISTORC ALTER COLUMN RM_CLASS varchar(4) null;

// V7.0.87 2011.03.21
alter table RoomMemo add ROOMMEMO_SHOW varchar(1) null;
alter table RoomMemo add MORN_SHOW varchar(1) null;
Update RoomMemo Set ROOMMEMO_SHOW='Y' Where ROOMMEMO_SHOW is null;

// V7.0.90 2011.03.24
alter table Cust_ca add PICTURE_C varchar(1) null;

// V7.0.99 2011.04.08
CREATE INDEX IX_Scroll_S_TIME ON Scroll (S_TIME desc);

// V7.0.106 2011.04.14
alter table Event alter column MSG varchar(160) null;

// V7.0.126 2011.05.05
alter table Cust_ca add PREPAYUSE_PASS varchar(8) null;

// V7.0.132 2011.05.10
CREATE TABLE VingCardLog
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 DDATE varchar(19),
 ORDER_NO varchar(12),
 SA_SERIAL int, 
 ROOM varchar(5),
 CHECKIN varchar(16),
 CHECKOUT varchar(16),
 DESK varchar(10),
 KIND varchar(4),
 BAD varchar(1),
 PRIMARY KEY(SERIAL)
);

// V7.0.136 2011.05.12
alter table FareOutTmp add BARCODE varchar(16) null;

// V7.0.137 2011.05.15
CREATE TABLE Or_RoomHint
(
 DDATE varchar(10) NOT NULL,
 HINT varchar(70),
 PRIMARY KEY(DDATE)
);

// V7.0.140 2011.05.20
alter table Base_ba add GCSID2 int null;
CREATE TABLE SoyalCard
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 ROOM varchar(5) NULL,
 MEMORYL INTEGER NULL,
 CARDNO varchar(8) NULL,
 SEND varchar(1) NULL,
 SENDDEL varchar(1) NULL,
 PRIMARY KEY(SERIAL)
);
CREATE TABLE SoyalMan
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 CARDNO varchar(8) NULL,
 GUARDKIND varchar(4) NULL,
 GUARDNAME varchar(8) NULL,
 PRIMARY KEY(SERIAL)
);

// V7.0.142 2011.05.23
alter table PclShift add GUARDKIND varchar(4) NULL;

// V7.0.144 2011.05.25
CREATE TABLE CreditPre
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 DDATE varchar(19) NULL,
 SA_SERIAL INTEGER NULL,
 ORDER_NO varchar(14) NULL,
 CARDNO varchar(19) NULL,
 CREDITTHRU varchar(5) NULL,
 TOTAL INTEGER NULL,
 CREDITAUTH varchar(6) NULL,
 CREDITKIND varchar(40) NULL,
 DESK varchar(10) NULL,
 PRIMARY KEY(SERIAL)
);

// V7.0.161 2011.06.14
alter table Onduty add AUSTRALIA int null;

// V7.0.164 2011.06.16
alter table Item_Kind add DESK_NO varchar(10) NULL;

// V7.0.166 2011.06.17
UpDate UserRight Set R1='月報表' Where R0=62;

// V7.0.170 2011.06.21
alter table SuiteHM add BARCODE varchar(16) NULL;

// V7.0.174 2011.06.24
alter table Or_MoneySimulate alter column ACCOUNT varchar(16) null;

// V7.0.179 2011.06.29
alter table InvTmp add PRN_NAME varchar(30) NULL;
alter table InvDetail add PRN_NAME varchar(30) NULL;

// V7.0.190 2011.07.10
alter table Fare_fa Add CONTRACT_RATE Integer null;
alter table Fare_fa Add CONTRACT_SERV Integer null;
alter table Or_Fare Add CONTRACT_RATE Integer null;
alter table Or_Fare Add CONTRACT_SERV Integer null;

// V7.0.197 2011.07.19
alter table Item_ia add ARTICLE varchar(20) NULL;
Create Table DayListJoinSet
(
  SERIAL integer identity(1,1) not null,
  DESK_NO varchar(1) not null,
  SHOWNAME varchar(8) null
);

// V7.0.200 2011.07.20
alter table Base_ba add TEMPER_STR varchar(2) null;
alter table Base_ba add AIR_SEND varchar(1) null;

// V7.0.205 2011.07.26
alter table Dayrpt add DESK_NO varchar(1) null;
alter table DayListJoinSet add STKNO varchar(5) null;

// V7.0.213 2011.08.04
Create Table Item_Spare
(
  ITEM_NO varchar(8) null,    // 科目
  ARTNO varchar(20) null,     // 商品代號
  ART_NAME varchar(60) null,  // 商品名稱
  ART_TMP1 varchar(10) null,  // 商品條碼
  ART_UNIT varchar(6) null,   // 商品單位
  ART_QTY Float null          // 數量
);
Create Table DaySpareSale
(
  DDATE varchar(10) null,       // 日期
  DESK_NO varchar(1) null,      // 櫃檯號碼
  SHOWNAME varchar(8) null,     // 日報表顯示名稱
  STKNO varchar(5) null,        // 備品分倉代號
  ACC_START varchar(19) null,   // 過帳開始
  ACC_END  varchar(19) null,    // 過帳結束
  SALNO varchar(20) null,       // 銷貨單號
  TRAN_TIME varchar(19) null    // 拋銷貨單時間
);

// V7.0.217 2011.08.09
alter table Cust_cb add CREDIT Integer null;
alter table Cust_cb add CREDIT_KIND varchar(1) null;
alter table Cust_ca add CREDIT_KIND varchar(1) null;

// V7.0.220 2011.08.15
Alter Table Or_RoomType Add FRM_INTRO varchar(200) null;
Alter Table Or_Order Add GROUPNAME varchar(50) null;

// V7.0.222 2011.08.17
CREATE TABLE SaflokCardLog
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 DDATE varchar(19),
 ORDER_NO varchar(12),
 SA_SERIAL int, 
 ROOM varchar(5),
 CHECKIN varchar(16),
 CHECKOUT varchar(16),
 DESK varchar(10),
 KIND varchar(4),
 BAD varchar(1),
 PRIMARY KEY(SERIAL)
);

// V7.0.223 2011.08.17
alter table ChgSale add BAD varchar(1) null;

// V7.0.229 2011.08.30
alter table Or_Order alter column GROUPNRecycleO varchar(18) null;
CREATE INDEX IX_RestaTicket_DDATE ON RestaTicket (DDATE);

// V7.0.230 2011.08.31
Alter Table WaferOffLineCardLog Add Recycle varchar(19) null;
Alter Table WaferOffLineCardLog Add Recycle_Desk varchar(10) null;
Alter Table BeTechCardLog Add Recycle varchar(19) null;
Alter Table BeTechCardLog Add Recycle_Desk varchar(10) null;
Alter Table BeTechCardLog Add ID_STR varchar(42) null;
Alter Table EStoneCardLog Add Recycle varchar(19) null;
Alter Table EStoneCardLog Add Recycle_Desk varchar(10) null;
Alter Table SunCastleCardLog Add Recycle varchar(19) null;
Alter Table SunCastleCardLog Add Recycle_Desk varchar(10) null;

// V7.0.234 2011.09.07
alter table Invoice add SAME_SERIAL int null;

// V7.0.246 2011.09.26
alter table FareOutTmp add BUYER char(10) null;
alter table FareOutTmp add TRUST_BANK char(10) null;
alter table FareOutTmp add TRUST_END char(10) null;
alter table FareOutTmp add TRUST_REMARK char(20) null;
Create Table NorthernTrunk
(
  TRUNK char(4) not null,
  DIAL char(26) null
  PRIMARY KEY(TRUNK)
);
alter table WebToRC alter column USERID varchar(20) null;
alter table WebToRC alter column USERNAME varchar(20) null;

// V7.0.251 2011.10.01
alter table Or_Order alter column MOBILE_TEL varchar(18) null;

// V7.0.252 2011.10.03
Create Table CleanSet
(
  DDATE varchar(10) null,
  ROOM varchar(5) null,
  KIND varchar(4) null,
  CNAME1 varchar(10) null,
  CNAME2 varchar(10) null,
  CDATE varchar(19) null
);
Create Table CleanDayDetail
(
  DDATE varchar(10) not null,
  Detail Text null,
  PRIMARY KEY(DDATE)
);
Create Table CleanPhrase
(
  Name varchar(20) null,
  Detail varchar(254) null
);
Create Table CleanFlaw
(
  DDATE varchar(10) null,
  CNAME varchar(10) null,
  ROOM varchar(5) null,
  Detail Text null,
  P Float null,
  R Float null,
  I Float null,
  Desk varchar(8) null
);
CREATE TABLE StayTwelveHoliday
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 DATES varchar(19) NULL,
 WEEKS varchar(2) NULL,
 DATEE varchar(19) NULL, 
 WEEKE varchar(2) NULL,
 PRIMARY KEY(SERIAL)
);

// V7.0.254 2011.10.05
alter table Base_ba alter column WCONFIRM varchar(19) null;

// V7.0.258 2011.10.07
Create Table Maintain_MustDoName
(
  SERIAL int IDENTITY (1,1) NOT NULL,
  NAME varchar(10) null,
  PRIMARY KEY(SERIAL)
);
Create Table Maintain_OrderName
(
  SERIAL int IDENTITY (1,1) NOT NULL,
  NAME varchar(10) null,
  PRIMARY KEY(SERIAL)
);

// V7.0.265 2011.10.20
Alter Table CleanDayDetail Add WEEK varchar(2) null;

// V7.0.270 2011.10.29
Alter Table CleanSet Add OUT_DATE varchar(10) null;

// V7.0.276 2011.11.09
Create Table AirLineSet
(
  Serial Integer null,
  Name varchar(50) null
);

Create Table AirFromPlaceSet
(
  Serial Integer null,
  Name varchar(50) null
);
Alter Table Pickup Add AirLine varchar(50) null;
Alter Table Pickup Add FromPlace varchar(50) null;
Alter Table Pickup Add TakeOffTime varchar(19) null;
Alter Table Pickup Add ArrivalTime varchar(19) null;
Alter Table CleanFlaw Add MDESK varchar(10) null;
Alter Table CleanFlaw Add KIND varchar(4) null;
Alter Table CleanFlaw Alter Column Desk varchar(10) null;
Create Table CleanCheckMan
(
  SERIAL int IDENTITY (1,1) NOT NULL,
  NAME varchar(10) null
);

//2011.11.12
alter table GuardLog alter column CARDNO varchar(20) null;
Create Table CreditTrans
(
  SERIAL int IDENTITY (1,1) NOT NULL,
  DDATE varchar(19) null,
  KIND varchar(4) null,
  SA_SERIAL integer null,
  ORDER_NO varchar(14) null,
  FA_SERIAL integer null,
  TOTAL integer null,
  CARD_NO varchar(20) null,  
  REC_ROC varchar(12) null,
  APPROVAL_NO varchar(9) null,
  REFERENCE_NO varchar(12) null,
  STORE_ID varchar(18) null
);

// V7.0.285 2011.11.18
Create Table GuardReth
(
  SERIAL int IDENTITY (1,1) NOT NULL,
  KIND_CODE varchar(1) null,
  KIND varchar(6) null,
  SERIAL_CODE varchar(2) null,
  GUARDNAME varchar(8) null
);
Alter Table HiNetToAirSet Add SMS_BODY_SIMULATE Text null;
Alter Table HiNetToAirSet Add SMS_BODY_SIMULATE_Eng Text null;

// V7.0.289 2011.11.21
Alter Table CleanFlaw Add MDATE varchar(19) null;

// V7.0.291 2011.11.23
Create Table SqlLog
(
  SERIAL int IDENTITY (1,1) NOT NULL,
  SQLTIME DateTime, 
  DDATE varchar(19) null,
  DESK varchar(10) null,
  MSG varchar(800) null
);

// V7.0.292 2011.11.23
Create Table Or_EditRoom
(
  ORDER_NO varchar(12) null,
  DDATE varchar(19) null,
  RM_CLASS varchar(5) null,
  ROOM_S integer null,
  ROOM_E integer null,
  ROOM_D integer null,
  REMARK varchar(90) null,
  DESK varchar(10) null,
  STAT varchar(8) null
);
Alter Table Or_Order Add SINGLE_ACC varchar(1) null;

// V7.0.319 2011.12.22
alter Table Pbx_I_O Add LANG varchar(1) null;

// V7.0.325 2012.01.01
Create Table MohistTicketRec
(
  TransNo varchar(25) null,
  TransDate varchar(10) null,
  TransTime varchar(8) null,
  TicketNo varchar(20) not null,
  Buyer varchar(50) null,
  TicketName varchar(40) null,
  TicketMny int null,
  TillDate varchar(10) null,
  TrustBank varchar(10) null,
  TrustEnd varchar(10) null,
  SaleMan varchar(10) null,
  InvNo varchar(10) null,
  InvMny int null,
  InvTax int null,
  InvMnyTot int null,
  CompanyNo varchar(8) null,
  RecKind varchar(1) null,
  CreditCard varchar(16) null,
  CreditAuthCode varchar(6) null,
  RecTime varchar(19) null,
  ProcessTime varchar(19) null,
  PRIMARY KEY(TicketNo)
);
Alter Table TicketM alter Column TICKIND varchar(40) null;
Alter Table TicketM add TicketLinkKind varchar(20) null;
Alter Table TicketD add TicketLinkKind varchar(20) null;
Alter Table TicketD add TicketLinkCancel varchar(19) null;

// V7.0.328 2012.01.04
CREATE TABLE Or_RoomBak
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 SQLTIME DateTime, 
 ODATE varchar(10) NULL,
 RM_CLASS varchar(4) NULL,
 TOTAL int NULL,
 ISORDER int NULL,
 REMAIN int NULL,
 RASSIGN int NULL,
 WEBREMAIN int NULL,
 WAITING int NULL,
 RESERVERROOM int NULL,
 OOO int NULL
);

Alter Table MohistTicketRec Add SA_SERIAL Integer null;
Alter Table MohistTicketRec Add RealTicketNo varchar(20) null;

// V7.0.337 2012.01.16
Create Table RestaTicket_lk 
(
  Computer varchar(100) null,
  DDATE varchar(19) null
);
Alter Table RestaTicket Add TicketSerial varchar(12) null;

// V7.0.339 2012.01.18
alter table LeadaiSEND add SEND23 varchar(20) null;
alter table LeadaiSEND add SEND24 varchar(2) null;
alter table LeadaiSEND add SEND25 varchar(14) null;
alter table LeadaiSEND add SEND26 varchar(1) null;
alter table LeadaiSEND add SEND27 varchar(1) null;
alter table LeadaiSEND add SEND28 varchar(3) null;
alter table LeadaiSEND add SEND29 varchar(1) null;
alter table LeadaiSEND add SEND30 varchar(1) null;
alter table LeadaiSEND add SEND31 varchar(1) null;
Update LeadaiSEND Set SEND23='' Where SEND23 is null;
Update LeadaiSEND Set SEND24='0' Where SEND24 is null;
Update LeadaiSEND Set SEND25='' Where SEND25 is null;
Update LeadaiSEND Set SEND26='0' Where SEND26 is null;
Update LeadaiSEND Set SEND27='0' Where SEND27 is null;
Update LeadaiSEND Set SEND28='0' Where SEND28 is null;
Update LeadaiSEND Set SEND29='0' Where SEND29 is null;
Update LeadaiSEND Set SEND30='0' Where SEND30 is null;
Update LeadaiSEND Set SEND31='0' Where SEND31 is null;

alter table Base_ba add SEND25 varchar(14) null;
alter table Base_ba add TEMPER_SPEED int null;
alter table Gcs_I_O Add TEMPER_SET int null;
alter table Gcs_I_O Add TEMPER_SPEED int null;
alter table Gcs_I_OBak Add TEMPER_SET int null;
alter table Gcs_I_OBak Add TEMPER_SPEED int null;

// V7.0.
Create Table RestSuiteHM
(
  SSERIAL varchar(5) not null,
  SNAME varchar(40) null,
  NORDATE varchar(1) null,
  HOLIDAY varchar(1) null,
  SALESTART varchar(10) null,
  SALEEND varchar(10) null,
  INV_NO int null,
  NAME_ENG varchar(40) null,
  BARCODE varchar(16) null,
  RESTMIN_N int null,
  ALLOWMIN_N int null,
  RESTMIN_H int null,
  ALLOWMIN_H int null,  
  DESK varchar(10) null,
  MDATE varchar(10) null,
  PRIMARY KEY(SSERIAL)
);

Create Table RestSuiteHD
(
  SSERIAL varchar(5) null,
  RM_CLASS varchar(4) null,
  NRATE int null,
  HRATE int null
);

Create Table RestSuiteFD
(
  SSERIAL varchar(5) null,
  ITEM varchar(8) null,
  ITEM_NAME varchar(40) null,
  UNIT_PRICE int null,
  QTY int null,
  DISCOUNT int null,
  TOTAL int null,
  ISPERSON varchar(1) null,
  HHOLIDAY int null,
  A_DESK varchar(10) null,
  M_DESK varchar(10) null,
  M_DATE varchar(19) null
);

// V7.0.347 2012.02.04
Alter Table TicketM Add TicketLinkBarcode varchar(20) null;
Alter Table TicketD Add TicketLinkBarcode varchar(20) null;

// V7.0.354 2012.02.22
alter table PclShift alter column GUARDKIND varchar(8) null;

// V7.0.360 2012.03.01
Alter Table InvId Add KIND varchar(2) null;

// V7.0.369 2012.03.16
Create Table E8D_SMSHttpSet
(
  E8D_HTTP_UID varchar(20) null,                // 帳號
  E8D_HTTP_PWD varchar(20) null,                // 密碼
  E8D_HTTP_SendSMS varchar(250) null,           // 簡訊傳送連結位址
  E8D_HTTP_GetDeliveryStatus varchar(250) null, // 發送狀態查詢連結位址
  E8D_HTTP_GetCredit varchar(250) null,         // 餘額查詢連結位址
  E8D_HTTP_EraseBooking varchar(250) null,      // 刪除預約簡訊連結位址
  E8D_HTTP_BookTime varchar(19),                // 簡訊預約發送時間yyyy/mm/dd hh:nn:ss
  E8D_BODY_CHKOUT Text null,                    // 退房傳送簡訊內容
  E8D_BODY_ORDERCNF Text null,                  // 訂房確認單Email傳送簡訊內容
  E8D_BODY_ORDERCNF_FAX Text null,              // 訂房確認單Fax傳送簡訊內容
  E8D_BODY_ORDER Text null,                     // 訂房通知傳送簡訊內容
  E8D_BODY_SIMULATE Text null,                  // 虛擬帳號匯款簡訊內容(中文)
  E8D_BODY_SIMULATE_Eng Text null,              // 虛擬帳號匯款簡訊內容(英文)
  E8D_HOTEL_NAME varchar(50) null,              // 飯店名稱
  E8D_HOTEL_TEL varchar(19) null,               // 飯店電話
  E8D_HOTEL_FAX varchar(19) null                // 飯店傳真
);

Create Table E8D_SMSHttp_Wait
(
  // 退房、訂房通知、訂房確認單mail、訂房確認單fax
  SERIAL int IDENTITY(1,1) not null, // 序號
  MOBILE_TEL varchar(19) null,       // 手機
  BODY Text null,                    // 簡訊內容  
  BookTime varchar(19) null,         // 預約發送時間hh:nn:ss
  KIND varchar(20) null,             // 簡訊種類(退房、訂房通知、、、)
  CA_SERIAL int null,                // 客戶序號
  ORDER_NO varchar(14) null,         // 訂房序號
  SA_SERIAL int null,                // 住房序號
  BATCH_ID varchar(50) null,         // 發送批號(發送後需存下來)發送後回填
  SEND_TIME_WISE varchar(19) null,   // 發送時間(靈知)發送後回填
  ProcessTime varchar(19) null       // 處理時間(Copy至E8D_SMSHttp的處理時間)Copy後回填
);

Create Table E8D_SMSHttp
(
  SERIAL int IDENTITY(1,1) not null, // 序號
  Wait_SERIAL int null,              // 關聯E8D_SMSHttp_Wait用
  MOBILE_TEL varchar(19) null,       // 手機
  BODY Text null,                    // 簡訊內容
  BATCH_ID varchar(50) null,         // 發送批號(發送後需存下來)  
  BookTime varchar(19) null,         // 預約發送時間hh:nn:ss
  KIND varchar(20) null,             // 簡訊種類(退房、訂房通知、、、)
  COST Float null,                   // 發送扣點
  STATUS varchar(6) null,            // 簡訊發送狀態代碼
  STATUS_MEMO varchar(80) null,      // 簡訊發送狀態中文解釋
  CA_SERIAL int null,                // 客戶序號
  ORDER_NO varchar(14) null,         // 訂房序號
  SA_SERIAL int null,                // 住房序號
  SEND_TIME_WISE varchar(19) null,   // 發送時間(靈知)
  SEND_TIME_E8D varchar(19) null     // 發送時間(Every8D)
);

Create Table E8D_SMSHttp_M
(
  SerialM int null,
  Body Text null,
  Desk varchar(10) null,
  SendStart varchar(19) null,
  SendEnd varchar(19) null,
  KIND varchar(20) null
);

Create Table E8D_SMSHttp_D
(
  SerialD int IDENTITY(1,1) not null,
  SerialM int null,
  Name varchar(50) null,
  CA_SERIAL int null,
  CB_SERIAL int null,
  MOBILE_TEL varchar(19) null,
  SendTime varchar(19) null
);

// V7.0.370 2012.03.17
CREATE TABLE Soyal_PreCard
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 ORDER_NO varchar(12) NULL,
 ROOM varchar(5) NULL,
 CARDNO varchar(10) NULL,
 PRIMARY KEY(SERIAL)
);

alter table WebToRC alter column USERID varchar(100) null;
alter table Or_Order alter column USERID varchar(100) null;

// V7.0.382 2012.04.03
alter table Base_ba add LU_DEVICE_ID int null;
alter table Base_ba add LU_ADDRESS int null;
alter table Base_ba alter column TEMPER_STR varchar(4) null;
alter table Base_ba add TEMPER_SET_STR varchar(4) null;
CREATE TABLE AirTemperSet
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 ROOM varchar(5),
 GSTAT varchar(1) NULL,
 GDTIME varchar(19) NULL,
 TEMPER_SET_STR varchar(4) NULL,
 TEMPER_SPEED int NULL,
 LU_DEVICE_ID int NULL,
 LU_ADDRESS int NULL, 
 PRIMARY KEY(SERIAL)
);

// V7.0.401 2012.04.23
alter table ChgSale alter column CUST_NAME varchar(30) null;

// V7.0.414 2012.05.09
CREATE TABLE Tsm_IpPort
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 TSM_ID int,
 IP varchar(18) NULL,
 PORT INTEGER NULL,
 PRIMARY KEY(SERIAL)
);
CREATE TABLE Tsm_ba
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 ROOM varchar(5),
 TSM_ID int NULL,
 READER_ID int NULL,
 PRIMARY KEY(SERIAL)
);
CREATE TABLE TsmMan
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 CARDNO varchar(8) NULL,
 GUARDKIND varchar(4) NULL,
 GUARDNAME varchar(8) NULL,
 USERCODE int NULL,
 PRIMARY KEY(SERIAL)
);
CREATE TABLE TsmCard
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 ROOM varchar(5) NULL,
 CARDNO varchar(8) NULL,
 USERCODE int NULL,
 SEND varchar(1) NULL,
 SENDDEL varchar(1) NULL,
 PRIMARY KEY(SERIAL)
);

// V7.0.422 2012.05.23
CREATE TABLE RestaTicketSave 
(
 ROOM varchar(5) null,
 ORDER_NO varchar(12) null,
 USEDATE varchar(10) null,
 CUST_NAME varchar(30) null,
 TIC_KIND varchar(20) null,
 TIC_USETIME varchar(24) null,
 QTY INTEGER null,
 EXTRABEDQTY INTEGER null,
 PQTY INTEGER null,
 COMP_NAME varchar(50) null
);

// V7.0.424 2012.05.24
alter table Or_Order2 alter column DISCOUNT varchar(12) null;
alter table Sale_sa alter column DISCOUNT varchar(12) null;
alter table Or_Arrange alter column DISCOUNT varchar(12) null;

// V7.0.433 2012.06.04
Alter Table Sale_sa Add VIP_POINT_ADD int null;
Alter Table Sale_sa Add VIP_POINT_USE int null;

// V7.0.443 2012.06.14
alter table Base_ba add DOORCRDTIME varchar(14) null;

// V7.0.448 2012.06.21
alter table Base_ba add SOYALID int null;
alter table Base_ba add SOYALID2 int null;
Update Base_ba Set SOYALID=GCSID where GCSID is not null;
Update Base_ba Set SOYALID2=GCSID2 where GCSID2 is not null;

// V7.0.468 2012.07.24
alter table SoyalCard add PUBLIC_DOOR_NAME varchar(16) null;
alter table PublicDoor add SOYALID int null;
alter table PublicDoor add CUST_OPEN varchar(1) null;
alter table GuardLog alter column ROOM varchar(16) null;

// V7.0.473 2012.08.03
alter table UserRight add R11 int null;
alter table UserRight add R12 int null;
alter table UserRight add R13 int null;
alter table UserRight add R14 int null;
alter table UserRight add R15 int null;
alter table UserRight add R16 int null;
alter table UserRight add R17 int null;
alter table UserRight add R18 int null;
alter table UserRight add R19 int null;
alter table UserRight add R20 int null;
alter table UserRight add R21 int null;
alter table HotelUser ALTER COLUMN RRIGHT int null;

UpDate UserRight set R11='0' Where R11 is null or R11='';
UpDate UserRight set R12='0' Where R12 is null or R12='';
UpDate UserRight set R13='0' Where R13 is null or R13='';
UpDate UserRight set R14='0' Where R14 is null or R14='';
UpDate UserRight set R15='0' Where R15 is null or R15='';
UpDate UserRight set R16='0' Where R16 is null or R16='';
UpDate UserRight set R17='0' Where R17 is null or R17='';
UpDate UserRight set R18='0' Where R18 is null or R18='';
UpDate UserRight set R19='0' Where R19 is null or R19='';
UpDate UserRight set R20='0' Where R20 is null or R20='';
UpDate UserRight set R21='0' Where R21 is null or R21='';

alter table Item_ia add ADD_POINT varchar(1) NULL;
alter table Item_ia add CAN_DISC varchar(1) NULL;
Update Item_ia Set CAN_DISC='Y' Where CAN_DISC is null;

// V7.0.476 2012.08.06
alter table Or_Fare add FORDER_NO varchar(14) NULL;
alter table Or_Order add TRAN_ACC varchar(1) NULL;

// V7.0.485 2012.08.20
alter table TmpFare add FAROOM varchar(5) NULL;
alter table TmpFare add DAYS int NULL;

// V7.0.493 2012.08.31
CREATE TABLE BF_RfidCard
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 ROOM varchar(5) NOT NULL,
 CARDNO varchar(8) NULL,
 ORDER_NO varchar(14) NULL,
 PRIMARY KEY(SERIAL)
);

// V7.0.498 2012.09.12
Alter Table Or_MoneySimulate Add ConfirmTime varchar(19) null;
Alter Table Or_MoneySimulate Add ConfirmDesk varchar(10) null;
Update Or_MoneySimulate 
  Set ConfirmTime=''+Convert(varchar(10),getdate(),111)+' '+Convert(varchar(10),getdate(),108)+'' 
  Where PAY_DATE is not null AND PAY_DATE <> '' AND DEAL_TIME is not null AND DEAL_TIME <> '';
Alter Table E8D_SMSHttpSet Add E8D_BODY_SIMULATE_IN Text null;
Alter Table E8D_SMSHttpSet Add E8D_BODY_SIMULATE_IN_Eng Text null;
Alter Table HiNetToAirSet Add SMS_BODY_SIMULATE_In Text null;
Alter Table HiNetToAirSet Add SMS_BODY_SIMULATE_In_Eng Text null;

// V7.0.501 2012.09.15
alter Table OOOPlan Add REASON varchar(40) null;

// V7.0.504 2012.09.19
CREATE INDEX IX_Or_Fare_SERIAL ON Or_Fare (SERIAL);

// V7.0.524 2012.10.12
Create Table EStoneCardV2008Log
(
  SERIAL int Identity(1,1) not null,
  DDATE varchar(19) null,
  ORDER_NO varchar(14) null,
  SA_SERIAL int null,
  ROOM varchar(5) null,
  CHECKIN varchar(16) null,
  CHECKOUT varchar(16) null,
  CARDNO int null,
  CardType int null,
  DESK varchar(10) null,
  KIND varchar(4) null,
  BAD varchar(1) null,
  REAL_CARDNO varchar(16) null,
  Recycle varchar(19) null,
  Recycle_Desk varchar(10) null
);

// V7.0.526 2012.10.20
Create Table BF_TableSet
(
  SERIAL int Identity(1,1) not null,
  TABLE_NO varchar(3),
  QTY int null
);
Create Table BF_TableUsing
(
  SERIAL int Identity(1,1) not null,
  TABLE_NO varchar(3) null,
  SDATE varchar(19) null,
  ROOM varchar(5) null
);
Create Table BF_TableUsed
(
  SERIAL int Identity(1,1) not null,
  DDATE varchar(10) null,
  STIME varchar(8) null,
  ETIME varchar(8) null,
  TABLE_NO varchar(3),
  ROOM varchar(5)
);
alter Table Sale_sa Add BF_SPECIAL varchar(30) null;

// V7.0.531 2012.10.24
alter table Or_Sale alter column DISCOUNT varchar(12) null;


//V7.0.535 2012.10.31
Create Table BF_Reason
(
  SERIAL int Identity(1,1) not null,
  REASON varchar(30) null
);
Create Table BF_Event
(
  SERIAL int Identity(1,1) not null,
  DDATE varchar(19) null,
  DESK varchar(10) null,
  MSG varchar(120) null,
  REASON varchar(30) null
);

alter table BF_RfidCard alter column CARDNO varchar(16) null;

Create Table VingCard2Log
(
  Serial int identity(1,1) not null,
  DDATE varchar(19) null,
  ORDER_NO varchar(12) null,
  SA_SERIAL int null,
  ROOM varchar(5) null,
  CHECKIN varchar(16) null,
  CHECKOUT varchar(16) null,
  CARDNO varchar(16) null,
  DESK varchar(10) null,
  KIND varchar(4) null,
  BAD varchar(1) null,
  Recycle varchar(19) null,
  Recycle_Desk varchar(10) null
);

// V7.0.545 2012.11.16
alter table Breakfast add ROOM varchar(5) NULL;

// V7.0.547 2012.11.19
Create Table SunLitLog
(
  Serial int Identity(1,1) not null,
  DDATE varchar(19) null,
  ORDER_NO varchar(12) null,
  SA_SERIAL int null,
  ROOM varchar(5) null,
  CHECKIN varchar(16) null,
  CHECKOUT varchar(16) null,
  CARDNO varchar(16) null,
  DESK varchar(10) null,
  KIND varchar(4) null,
  BAD varchar(1) null,
  Recycle varchar(19) null,
  Recycle_Desk varchar(10) null
);

// V7.0.558 2012.11.26
alter Table Pickup Add ADESK varchar(10) null;
alter Table Pickup Add ADATE varchar(19) null;
alter Table Pickup Add MDESK varchar(10) null;
alter Table Pickup Add MDATE varchar(19) null;

// V7.0.569 2012.12.14
Create Table HuaYanBuSource
(
  SERIAL int Identity(1,1) not null,
  NNAME varchar(8),
  GGROUP varchar(1) null
  PRIMARY KEY(SERIAL)
);
alter Table Or_Order Add HuaYanBuSource varchar(8) null;

// V7.0.571 2012.12.17
alter Table Cust_cb Add ADESK varchar(10) null;
alter Table Cust_cb Add ADATE varchar(19) null;
alter Table Cust_cb Add MDESK varchar(10) null;
alter Table Cust_cb Add MDATE varchar(19) null;

// V7.0.578 2012.12.26
alter Table Base_ba Add VingCard2_UserGroup varchar(30) null;
Create Table BF_Menu
(
  SERIAL int Identity(1,1) not null,
  ITEM varchar(10) null,
  MENU_NAME varchar(40),
  OVERDUE varchar(1) null,
  HasPic varchar(1) null,
  ArtPic image null
  PRIMARY KEY(SERIAL)
);

//V7.1.1 2012.01.17
alter table Cust_ca add BONUS_VIP varchar(40) null;
alter table Cust_ca add BONUS_KIND varchar(4) null;
alter table BuSource Add NOBONUS varchar(1) null;
alter table Sale_sa Add BONUS_ADD varchar(1) null;

//V7.1.
alter table BF_Menu Add KIND varchar(12) null;
Create Table BF_MenuKind
(
  SERIAL int Identity(1,1) not null,
  KIND varchar(12) null
  PRIMARY KEY(SERIAL)
);
Create Table BF_DayMenu
(
  SERIAL int Identity(1,1) not null,
  DDATE varchar(10) null,
  MENU_NAME varchar(40) null,
  QTY int
  PRIMARY KEY(SERIAL)
);

alter table Dayrpt add OUT_TOTAL int null;

// V7.1.28 2013.03.08
Create Table BF_WAIT
(
  ROOM varchar(5) not null,
  DDATE varchar(19) null
  PRIMARY KEY(ROOM)
);
//將舊旅客資料預設為超過信用額度控制無法賒帳SQL語法(必須時才下)
//Update Cust_ca set CREDIT_KIND='Y'
//將舊公司資料預設為超過信用額度控制無法賒帳SQL語法(必須時才下)
//Update Cust_cb set CREDIT_KIND='Y'

// V7.1.37 2013.03.20
alter table HotelUser add ACCOUNT varchar(12) null;

// V7.1.40 2013.03.26
alter table Or_Order2 add PERSON int null;

// V7.1.57 2013.04.15
alter table Base_ba add GCS_COM int null;

// V7.1.59 2013.04.15
alter table Onduty add RMB int null;

// V7.1.61 2013.04.16
alter table Base_ba add PERSON_IN_POINT int null;
alter table Base_ba add PERSON_IN_STAT varchar(19) null;

// V7.1.62 2013.04.17
Create Table PassNation
(
  PASSCODE int not null,
  NATION varchar(12) null
  PRIMARY KEY(PASSCODE)
);

// V7.1.65 2013.04.19
UpDate UserRight Set R1='自定房價(NET)輸入-住宿' Where R0=81;
UpDate UserRight Set PSORT='D302' Where R0=306;

// V7.1.69 2013.04.24
alter Table Cust_ca add OCR_Nation varchar(3) null;

// V7.1.70 2013.04.26
alter table Base_ba add SEND_CONTROL int null;

// V7.1.73 2013.04.30
Create Table Internet_I_O
(
  SERIAL int Identity(1,1) not null,
  ROOM varchar(5) not null,
  I_O varchar(1),
  PASS varchar(18) null,
  WTIME DateTime,
  DEALTIME varchar(19) null,  
  PRIMARY KEY(SERIAL)
);

// V7.1.83 2013.05.13
alter table Base_ba add EMPTY_TIME varchar(19) null;

// V7.1.95 2013.05.27
alter Table E8D_SMSHttpSet Add E8D_BODY_BONUS_VIP_TILL Text null;

// V7.1.98 2013.05.29
alter Table Sale_sa Add COM_VIP varchar(18) null;

// V7.1.108 2013.06.11
Create Table RestSecItem
(
  SERIAL int Identity(1,1) not null,
  NAME varchar(5) not null,
  RESTMIN int null,
  PSORT int null,
  PRIMARY KEY(SERIAL)
);

Create Table RestSecCost
(
  SERIAL int Identity(1,1) not null,
  RM_CLASS varchar(4) not null,
  NAME varchar(5) not null,
  RESTMIN int null,
  PSORT int null,
  NORMAL_PRICE int null,
  HOLIDAY_PRICE int null,    
  PRIMARY KEY(SERIAL)
);

alter Table Base_ba Add RESTSEC_MIN int null;
alter Table Sale_sa Add RESTSEC_MIN int null;

// V7.1.109 2013.06.15
alter Table Base_ba Add RESTSEC_NAME varchar(5) null;
alter Table Sale_sa Add RESTSEC_NAME varchar(5) null;

// V7.1.112 2013.06.19
alter Table Base_ba Add CO_POINT int null;

// V7.1.114 2013.06.24
// 派工人(主管)Email
Alter Table Maintain_OrderName Add E_MAIL varchar(40) null;
Alter Table Maintain_OrderName Add EmailNotice varchar(1) null;
// 派工人(主管)手機
Alter Table Maintain_OrderName Add MOBILE_TEL varchar(18) null;
Alter Table Maintain_OrderName Add SMSNotice varchar(1) null;

// 請修類別=>增加負責修繕主管(連結派工人)
Alter Table MtKind Add OrderName varchar(10) null;

// 指定維修人Email
Alter Table Maintain_MustDoName Add E_MAIL varchar(40) null;
Alter Table Maintain_MustDoName Add EmailNotice varchar(1) null;
// 指定維修人手機
Alter Table Maintain_MustDoName Add MOBILE_TEL varchar(18) null;
Alter Table Maintain_MustDoName Add SMSNotice varchar(1) null;

// 加大申請人欄位(與HotelUser:NAME一樣大):gaUserName
Alter Table Maintain Alter Column QNAME varchar(14) null;

// 零件名稱設定
Create Table Maintain_SparePart
(
  Serial int identity(1,1) not null,
  Name varchar(40) null
);

// 簡訊檔增加MT_SERIAL
Alter Table E8D_SMSHttp Add MT_SERIAL int null;
Alter Table E8D_SMSHttp_Wait Add MT_SERIAL int null;
Alter Table HiNetToAir Add MT_SERIAL int null;

// 增加覆核欄位
Alter Table Maintain Add ReCheck varchar(19) null;
Alter Table Maintain Add ReCheckName varchar(14) null;

// 設備維修通知記錄
Create Table MaintainNotice
(
  MT_SERIAL int null,
  QNotice varchar(19) null,     // 申請通知
  FixNotice varchar(19) null,   // 維修通知
  NoFixNotice varchar(19) null  // 超過?天未完修通知
);

// Email通知記錄檔
Create Table Email
(
  Serial int identity(1,1) not null, // 序號
  RecMail varchar(40) null,          // 收件者
  RecName varchar(10) null,          // 收件者姓名
  CarbonCopy varchar(40) null,       // 副本
  Body text null,                    // 內容
  Kind varchar(20) null,             // 種類
  SendTime varchar(19) null,         // 發送時間
  Status varchar(10) null,           // 發送狀態
  StatusMsg varchar(100) null,       // 錯誤碼
  CA_SERIAL int null,                // 客戶序號
  ORDER_NO varchar(14) null,         // 訂房序號
  SA_SERIAL int null,                // 住房序號
  MT_SERIAL int null                 // 設備維修序號
);

// V7.1.115 2013.06.26
Alter Table Maintain_Attend Add SQLTime DateTime null;
Alter Table Maintain_Attend Add SysAdd varchar(1) null;

// V7.1.123 2013.07.04
Create Table Maintain_Claimer
(
  SERIAL int identity(1,1) not null,
  NAME varchar(14) null,
  E_MAIL varchar(40) null,
  MOBILE_TEL varchar(18) null,
  EmailNotice varchar(1) null,
  SMSNotice varchar(1) null
);
Alter Table Maintain Add Claimer varchar(14) null;
Alter Table Maintain Add NotDo varchar(19) null;
Alter Table Maintain Add NotDoDesk varchar(14) null;
Alter Table Maintain Alter Column ORDERNAME varchar(14) null;
Alter Table Maintain Alter Column MUSTDONAME varchar(14) null;
Alter Table Maintain_Attend Add NotDo varchar(1) null;
Alter Table Maintain_MustDoName Alter Column NAME varchar(14) null;
Alter Table Maintain_OrderName Alter Column NAME varchar(14) null;
Alter Table MaintainNotice Add CNotice varchar(19) null;

// V7.1.124 2013.07.05
alter Table PbxClean Add CLEANING varchar(19) null;
// 簡訊王-設定
Create Table Kot_SMSHttpSet
(
  Kot_Http_UserName varchar(20) null,         // 帳號
  Kot_Http_PassWord varchar(20) null,         // 密碼
  Kot_Http_SendSMS varchar(250) null,         // 傳送網址
  Kot_Http_MemberPoint varchar(250) null,     // 剩餘點數查詢網址
  Kot_Http_Response varchar(250) null,        // 狀態回傳網址
  Kot_Http_BookTime varchar(19) null,         // 預約時間
  Kot_Http_ChkOut Text null,                  // 退房簡訊內容
  Kot_Http_OrderCnf Text null,                // 訂房確認單簡訊內容
  Kot_Http_OrderCng_Fax Text null,            // 訂房確認單傳真簡訊內容
  Kot_Http_Order Text null,                   // 訂房通知簡訊內容
  Kot_Http_Simulate Text null,                // 虛擬帳號簡訊內容
  Kot_Http_Simulate_Eng Text null,            // 虛擬帳號簡訊內容-英文
  Kot_Http_Simulate_In Text null,             // 收到虛帳號匯款簡訊內容
  Kot_Http_Simulate_In_Eng Text null,         // 收到虛帳號匯款簡訊內容-英文
  Kot_Http_Bonus_Vip_Till Text null,          // 會員到期通知簡訊內容(會員紅利積點) 
  Kot_Hotel_Name varchar(50) null,            // 飯店名稱
  Kot_Hotel_Tel varchar(19) null,             // 飯店電話
  Kot_Hotel_Fax varchar(19) null              // 飯店傳真
);

// 簡訊王-等待發送簡訊
Create Table Kot_SMSHttp_Wait
(
  Serial int identity(1,1) not null, // 序號
  MOBILE_TEL varchar(19) null,       // 手機
  BODY Text null,                    // 簡訊內容
  BookTime varchar(19) null,         // 預約時間
  KIND varchar(20) null,             // 退房、訂房通知、訂房Mail、訂房Fax、虛帳號匯款、退款審核、設備維修、、
  CA_SERIAL int null,                // 客戶序號
  ORDER_NO varchar(14) null,         // 訂房序號
  SA_SERIAL int null,                // 住房序號
  MT_SERIAL int null,                // 設備維修管理序號(Maintain:MT_SERIAL)
  kmsgid varchar(50) null,           // 簡訊發送編號
  ProcessTime varchar(19) null       // 處理時間
);

// 簡訊王-發送記錄
Create Table Kot_SMSHttp
(
  Serial int identity(1,1) not null, // 序號
  Wait_Serial int null,              // 等待序號
  MOBILE_TEL varchar(19) null,       // 手機
  BODY Text null,                    // 簡訊內容
  kmsgid varchar(50) null,           // 簡訊發送編號
  BookTime varchar(19) null,         // 預約時間
  KIND varchar(20) null,             // 退房、訂房通知、訂房Mail、訂房Fax、虛帳號匯款、退款審核、設備維修、、
  CA_SERIAL int null,                // 客戶序號
  ORDER_NO varchar(14) null,         // 訂房序號
  SA_SERIAL int null,                // 住房序號
  MT_SERIAL int null,                // 設備維修管理序號(Maintain:MT_SERIAL)
  SendTimeWise varchar(19) null,     // Wise傳送處理時間
  DlvTime varchar(19) null,          // 電信系統發出時間
  DoneTime varchar(19) null,         // 手機用戶端回報狀態間
  Status varchar(20) null,           // 發送狀態
  StatusMemo varchar(250) null       // 發送狀態-中文解釋
);

// 簡訊王-個人旅客簡訊發送-主檔
Create Table Kot_SMSHttp_M
(
  SerialM int null,
  Body Text null,
  Desk varchar(10) null,
  SendStart varchar(19) null,
  SendEnd varchar(19) null,
  Kind varchar(20) null
);

// 簡訊王-個人旅客簡訊發送-明細檔
Create Table Kot_SMSHttp_D
(
  SerialD int identity(1,1) not null,
  SerialM int null,
  Name varchar(50) null,
  CA_SERIAL int null,
  CB_SERIAL int null,
  MOBILE_TEL varchar(19) null,
  SendTime varchar(19) null
);

// V7.1.129 2013.07.10
Alter Table Maintain_OrderName add E_MAIL_CC varchar(40) null;  // 派工人副本(代理人)
Alter Table Maintain_MustDoName add E_MAIL_CC varchar(40) null; // 維修人副本(代理人)
Alter Table Maintain_Claimer add E_MAIL_CC varchar(40) null;    // 申請人副本(代理人)

// V7.1.130 2013.07.12
Alter Table Maintain_OrderName add EmailNotice_CC varchar(1) null;  // 派工人副本(代理人)
Alter Table Maintain_MustDoName add EmailNotice_CC varchar(1) null; // 維修人副本(代理人)
Alter Table Maintain_Claimer add EmailNotice_CC varchar(1) null;    // 申請人副本(代理人)
Alter Table Maintain_OrderName add MOBILE_TEL_CC varchar(18) null;  // 派工人副本(代理人)
Alter Table Maintain_OrderName add SMSNotice_CC varchar(1) null;
Alter Table Maintain_MustDoName add MOBILE_TEL_CC varchar(18) null;// 維修人副本(代理人)
Alter Table Maintain_MustDoName add SMSNotice_CC varchar(1) null;
Alter Table Maintain_Claimer add MOBILE_TEL_CC varchar(18) null;     // 申請人副本(代理人)
Alter Table Maintain_Claimer add SMSNotice_CC varchar(1) null;

// V7.2.1 2013.07.20
alter table Base_ba add BED_QTY int null;
Update Base_ba Set BED_QTY=1 Where BED_QTY is null;
alter table DayTot add STAY_ROOM_BED numeric(10,4) null;
alter table DayTot add SUITEROOM_BED numeric(10,4) null;
alter table DayTot add FOC_ROOM_BED numeric(10,4) null;
alter table DayTot add RV_ROOM_BED numeric(10,4) null;
alter table DayTot add GROUP_ROOM_BED numeric(10,4) null;
alter table DayTot add DRIVER_ROOM_BED numeric(10,4) null;
alter table DayTot add ROOM_CORP_BED numeric(10,4) null;
alter table DayTot add ROOM_GROUP_BED numeric(10,4) null;
alter table DayTot add ROOM_WI_BED numeric(10,4) null;
alter table DayTot add ROOM_FIT_BED numeric(10,4) null;
alter table DayTot add MONTH_ROOM_BED numeric(10,4) null;
alter table DayTot add STAYALLRMCNT_BED numeric(10,4) null;
alter table DayTot add OOO_BED numeric(10,4) null;
Update DayTot Set STAY_ROOM_BED=STAY_ROOM where STAY_ROOM_BED is null;
Update DayTot Set SUITEROOM_BED=SUITEROOM where SUITEROOM_BED is null;
Update DayTot Set FOC_ROOM_BED=FOC_ROOM   where FOC_ROOM_BED is null;
Update DayTot Set RV_ROOM_BED=RV_ROOM     where RV_ROOM_BED is null;
Update DayTot Set GROUP_ROOM_BED=GROUP_ROOM where GROUP_ROOM_BED is null;
Update DayTot Set DRIVER_ROOM_BED=DRIVER_ROOM where DRIVER_ROOM_BED is null;
Update DayTot Set ROOM_CORP_BED=ROOM_CORP where ROOM_CORP_BED is null;
Update DayTot Set ROOM_GROUP_BED=ROOM_GROUP where ROOM_GROUP_BED is null;
Update DayTot Set ROOM_WI_BED=ROOM_WI     where ROOM_WI_BED is null;
Update DayTot Set ROOM_FIT_BED=ROOM_FIT   where ROOM_FIT_BED is null;
Update DayTot Set MONTH_ROOM_BED=MONTH_ROOM where MONTH_ROOM_BED is null;
Update DayTot Set STAYALLRMCNT_BED=STAYALLRMCNT where STAYALLRMCNT_BED is null;
Update DayTot Set OOO_BED=OOO where OOO_BED is null;
alter table DayTot1 add STAY_ROOM_BED numeric(10,4) null;
alter table DayTot1 add SUITEROOM_BED numeric(10,4) null;
alter table DayTot1 add FOC_ROOM_BED numeric(10,4) null;
alter table DayTot1 add RV_ROOM_BED numeric(10,4) null;
alter table DayTot1 add GROUP_ROOM_BED numeric(10,4) null;
alter table DayTot1 add DRIVER_ROOM_BED numeric(10,4) null;
alter table DayTot1 add ROOM_CORP_BED numeric(10,4) null;
alter table DayTot1 add ROOM_GROUP_BED numeric(10,4) null;
alter table DayTot1 add ROOM_WI_BED numeric(10,4) null;
alter table DayTot1 add ROOM_FIT_BED numeric(10,4) null;
alter table DayTot1 add MONTH_ROOM_BED numeric(10,4) null;
alter table DayTot1 add STAYALLRMCNT_BED numeric(10,4) null;
alter table DayTot1 add OOO_BED numeric(10,4) null;
Update DayTot1 Set STAY_ROOM_BED=STAY_ROOM where STAY_ROOM_BED is null;
Update DayTot1 Set SUITEROOM_BED=SUITEROOM where SUITEROOM_BED is null;
Update DayTot1 Set FOC_ROOM_BED=FOC_ROOM   where FOC_ROOM_BED is null;
Update DayTot1 Set RV_ROOM_BED=RV_ROOM     where RV_ROOM_BED is null;
Update DayTot1 Set GROUP_ROOM_BED=GROUP_ROOM where GROUP_ROOM_BED is null;
Update DayTot1 Set DRIVER_ROOM_BED=DRIVER_ROOM where DRIVER_ROOM_BED is null;
Update DayTot1 Set MONTH_ROOM_BED=MONTH_ROOM where MONTH_ROOM_BED is null;
Update DayTot1 Set STAYALLRMCNT_BED=STAYALLRMCNT where STAYALLRMCNT_BED is null;
Update DayTot1 Set OOO_BED=OOO where OOO_BED is null;
Alter Table MaintainNotice Add NotDoNotice varchar(19) null;

// V7.2.10 2013.08.01
alter table Cust_ca add BONUS_VIP_ADD_DATE varchar(19) null;

// V7.2.12 2013.08.02
alter table Cust_ca add ENAME_F varchar(20) null;
alter table Cust_ca add ENAME_L varchar(20) null;

// V7.2.13 2013.08.03
alter Table RestSecCost Add SPECIAL_PRICE int null;
alter Table RestHoliday Add SPECIAL_DAY int null;
Update RestHoliday Set SPECIAL_DAY=1 Where SPECIAL_DAY is null;

// V7.2.15 2013.08.05
alter Table DaytotD Add OSORT varchar(10) null;
alter Table DaytotD1 Add OSORT varchar(10) null;

// V7.2.22 2013.08.09
Alter Table VingCardLog Add Recycle varchar(19) null;
Alter Table VingCardLog Add Recycle_Desk varchar(10) null;
Alter Table SaflokCardLog Add Recycle varchar(19) null;
Alter Table SaflokCardLog Add Recycle_Desk varchar(10) null;

// V7.2.28 2013.08.17
alter table Base_ba add GCS_IP varchar(15) null;

// V7.2.29 2013.08.23
alter table TsmCard add BAD_SEND int null;

// V7.2.33 2013.08.28
Create Table Maintain_NotDoNotice
(
  SERIAL int identity(1,1) not null,
  NAME varchar(14) null,
  E_MAIL varchar(40) null,
  MOBILE_TEL varchar(18) null,
  EmailNotice varchar(1) null,
  SMSNotice varchar(1) null,
  E_MAIL_CC varchar(40) null,
  EmailNotice_CC varchar(1) null,
  MOBILE_TEL_CC varchar(18) null,
  SMSNotice_CC varchar(1) null
);
Alter Table Maintain Add NotDoMemo varchar(19) null;
Alter Table Maintain Add NotDoMemoDesk varchar(14) null;
Alter Table Maintain_Attend Add NotDoMemo varchar(1) null;
Alter Table Maintain Add SDATE varchar(16) null;
Alter Table MaintainNotice Add NotDoMemoNotice varchar(19) null;

// V7.2.37 2013.09.07
alter table Cust_cb add PREPAY varchar(1) null;
alter table PrePayAdd add CB_SERIAL int null;
alter table PrePayUse add CB_SERIAL int null;

Alter Table Meet_ba Add PSORT int null;
Alter Table Meet_ba Add PERSON int null;
Alter Table MeetTime Add MKIND varchar(10) null;
Create Table MeetReserve
(
  DDATE varchar(10) null,
  MNAME varchar(10) null,
  MTIME varchar(11) null,
  ReserveName varchar(10) null,
  PERSON int null,
  UNIT varchar(4) null,
  Desk varchar(14) null,
  MDATE varchar(19) null
);
Alter Table ReserveName Add ORDER_SHOW varchar(1) null;
Alter Table ReserveName Add MEET_SHOW varchar(1) null;
Update ReserveName Set ORDER_SHOW='Y';
Alter Table Meet_ba Add OutMNAME varchar(10) null;
alter table WebToRC alter column USERNAME varchar(40) null;

// V7.2.41 2013.09.16
Create Table Cust_cbLog 
(
  DDATE varchar(19) null,
  CB_SERIAL int,
  DESK varchar(10) null,
  MEMO Text null
);

// V7.2.45 2013.09.23
alter Table Fare_fa Add MDESK varchar(10) null;
alter Table Fare_fa Add RPTIME varchar(19) null;
alter Table Or_Fare Add MDESK varchar(10) null;
alter Table Or_Fare Add RPTIME varchar(19) null;

// V7.2.48 2013.09.26
alter Table Sale_sa Add ORDER_GROUPNO varchar(18) null;
alter Table Base_ba Add ORDER_GROUPNO varchar(18) null;
Update Base_ba Set ORDER_GROUPNO=GROUP_NO where GROUP_NO>0 and ORDER_GROUPNO is null;
Update Sale_sa Set ORDER_GROUPNO=SAME_GROUP where SAME_GROUP>0 and ORDER_GROUPNO is null;

// V7.2.49 2013.09.26
Create Table GroupColor
(
  SERIAL int identity(1,1) not null,
  GCOLOR int null,
  NOWCOLOR varchar(1) null,
  PRIMARY KEY(SERIAL)
);

// V7.2.64 2013.10.22
Update UserRight Set R1='訂房率統計表' Where R0=170;

// V7.2.66 2013.10.25
alter Table Event Add SQLTIME DateTime null;

// V7.2.77 2013.11.13
alter Table Base_ba Add KeyLockNum varchar(8) null;
Create Table PackerLog
(
  SERIAL int IDENTITY (1,1) NOT NULL,
  DDATE varchar(19),
  ORDER_NO varchar(14),
  SA_SERIAL int, 
  ROOM varchar(5),
  KeyLockNum varchar(8) null,
  CardNo varchar(8) null,
  DlsCoID int null,
  CHECKIN varchar(16),
  CHECKOUT varchar(16),
  DESK varchar(10),
  KIND varchar(4),
  BAD varchar(1),
  PRIMARY KEY(SERIAL)
);

// V7.2.80 2013.11.18
alter table PrePayUse add ORMNY_SERIAL int null;
alter table Maintain add LOCATION varchar(20) null;
Update Base_ba Set FLOOR='' Where FLOOR is null;

// V7.2.83 2013.11.20
Create Table BF_NoRoom
(
  SERIAL int Identity(1,1) not null,
  DSERIAL int null,  
  DDATE varchar(19) null,
  REMARK varchar(20) null,
  QTY int null
);
