// V7.3.1 2013.11.22
Create Table BF_Out
(
  SERIAL int Identity(1,1) not null,
  DDATE varchar(19) null,
  USE_DATE varchar(10) null,
  USE_TIME varchar(5) null,
  QTY int null,
  SA_SERIAL int null,
  ROOM varchar(5) null,
  REMARK varchar(20) null,
  DESK varchar(10) null,
  MDESK varchar(10) null,
  MDATE varchar(19) null
);

// V7.3.16 2013.12.19
CREATE TABLE ECU_PreCard
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 ORDER_NO varchar(12) NULL,
 ROOM varchar(5) NULL,
 CARDNO varchar(10) NULL,
 TILLDATE varchar(16) NULL,
 PRIMARY KEY(SERIAL)
);

CREATE TABLE ECUCard
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 ROOM varchar(5) NULL,
 CARDNO varchar(10) NULL,
 SEND varchar(1) NULL,
 SENDDEL varchar(1) NULL,
 TILLDATE varchar(16) NULL,
 PRIMARY KEY(SERIAL)
);

CREATE TABLE ECUMan
(
 SERIAL int IDENTITY (1,1) NOT NULL,
 CARDNO varchar(10) NULL,
 GUARDKIND varchar(4) NULL,
 GUARDNAME varchar(8) NULL,
 PRIMARY KEY(SERIAL)
);

// V7.3.20 2013.12.23
Create Table CustComplainKind
(
  PSort int null,
  Kind varchar(20) null
);

Create Table CustComplain
(
  CC_SERIAL int identity(1,1) not null,
  QDate varchar(16) null,
  Kind varchar(20) null,
  QPart varchar(20) null,
  QDesk varchar(14) null,
  QDetail Text null,                    // 被客訴內容
  Serial varchar(11) null,              // 被客訴單號(yyyymmdd001)
  CA_SERIAL int null,                   // 客訴人-客戶序號
  CUST_NAME varchar(30) null,           // 客訴人-姓名
  CUST_TEL varchar(18) null,            // 客訴人-電話
  CUST_MOBILE_TEL varchar(18) null,     // 客訴人-手機
  ROOM varchar(5) null,                 // 房號
  SA_SERIAL int null,                   // 住房序號
  ORDER_NO varchar(14) null,            // 訂房序號
  CDate varchar(16) null,               // 處理完畢時間
  CDesk varchar(14) null,               // 處理人
  CDetail Text null,                    // 處理內容
  ADesk varchar(14) null,               // 建立者
  ADate varchar(19) null,               // 建立時間
  ASQLTime DateTime null,               // 建立時間SQL Time
  MDesk varchar(14) null,               // 修改者
  MDate varchar(19) null,               // 修改時間
  MSQLTime DateTime null                // 修改時間SQL Time
);

// 客訴-處理過程
Create Table CustComplainAttend
(
  Serial int identity(1,1) not null, // 序號
  CC_SERIAL int null,                // 客訴主檔序號
  DDATE varchar(19) null,            // 處理時間
  Attend text null,                  // 處理過程
  ADesk varchar(14) null,            // 建立者
  ADate varchar(19) null,            // 建立時間
  MDesk varchar(14) null,            // 修改者
  MDate varchar(19) null             // 修改時間
);

// 客訴-事件
Create Table CustComplainEvent
(
  Serial int identity(1,1) not null, // 序號
  CC_SERIAL int null,                // 客訴主檔序號
  DDATE varchar(19) null,            // 日期
  Msg text null,                     // 事件
  Desk varchar(14) null,             // 經手人
  SQLTime DateTime null              // 資料庫時間
);

// 客訴-內容歷史記錄
Create Table CustComplainDetailLog
(
  DDATE varchar(19) null,  // 日期
  CC_SERIAL int null,      // 客訴主檔序號
  CAttend_SERIAL int null, // 處理過程記錄檔序號
  DetailKind int null,     // 修改內容種類(1:客訴內容修改,2:處理內容修改,3:處理過程內容修改)
  Desk varchar(20) null,   // 修改者
  OldDetail Text null,     // 原始內容
  SQLTime DateTime null    // 資料庫時間
);

// V7.3.24 2013.12.26
alter table Base_ba add ORDER_MEMO varchar(20) null;

// V7.3.27 2013.12.27
alter Table Or_Order Add GUIDE_NAME varchar(14) null;
alter Table Or_Order Add GUIDE_MOBILE varchar(18) null;
alter Table Or_Order Add GUIDE_ROOM varchar(5) null;
alter Table Or_Order Add LEADER_NAME varchar(14) null;
alter Table Or_Order Add LEADER_MOBILE varchar(18) null;
alter Table Or_Order Add LEADER_ROOM varchar(5) null;
alter Table Or_Order Add DRIVER_NAME varchar(14) null;
alter Table Or_Order Add DRIVER_MOBILE varchar(18) null;
alter Table Or_Order Add DRIVER_ROOM varchar(5) null;

// V7.3.35 2014.01.14
alter Table Or_Room Add WEB_ISORDER int null;
Update Or_Room Set WEB_ISORDER=0 Where WEB_ISORDER is null;
alter Table Or_RoomBak Add WEB_ISORDER int null;
alter Table Or_RoomTmp Add WEB_ISORDER int null;

// V7.3.37 2014.01.16
alter Table Or_RoomType Add WEB_MAX_ROOM int null;
alter Table Or_RoomType Add WEB_SEND varchar(1) null;
alter Table Or_Room Add WEB_WAIT int null;
Update Or_Room Set WEB_WAIT=0 Where WEB_WAIT is null;
alter Table Or_RoomBak Add WEB_WAIT int null;
alter Table Or_RoomTmp Add WEB_WAIT int null;

// V7.3.41 2014.01.21
Create Table AuthorizeName
(
  SERIAL int identity(1,1) not null,
  NAME varchar(14) null,
  E_MAIL varchar(40) null,
  EmailNotice varchar(1) null,
  PRIMARY KEY(SERIAL)
);

alter Table Fare_fa Add AUTHORIZE varchar(14) null;
alter Table Or_Fare Add AUTHORIZE varchar(14) null;
alter Table Or_Money Add AUTHORIZE varchar(14) null;

// V7.3.42 2014.01.27
Create Table EmailAuthorize
(
  SMTPHOST varchar(40) NULL,
  FROMNAME varchar(50) NULL,
  FROMADDRESS varchar(50) NULL,
  MAILSUBJECT varchar(50) NULL,
  MAILMUSTSENDPASS varchar(1) NULL,
  USERNAME varchar(30) NULL,
  PASSWORD varchar(30) NULL,
  CARBONCOPY varchar(50) NULL
);

// V7.3.45 2014.02.05
alter Table Or_Room Add WEB_CANCEL int null;
Update Or_Room Set WEB_CANCEL=0 Where WEB_CANCEL is null;
alter Table Or_RoomBak Add WEB_CANCEL int null;
alter Table Or_RoomTmp Add WEB_CANCEL int null;

// V7.3.48 2014.02.06
alter Table Or_Room Add MINREMAIN int null;
Update Or_Room Set MINREMAIN=-1 Where MINREMAIN is null;
alter Table Or_RoomBak Add MINREMAIN int null;
alter Table Or_RoomTmp Add MINREMAIN int null;

// V7.3.51 2014.02.12
alter Table Base_ba Add GUIDE_LEADER varchar(6) null;

// V7.3.58 2014.02.21
alter Table Event Add SA_SERIAL int null;

// V7.3.63 2014.03.04
Create Table DayTotOut
(
  DDATE varchar(10) null,
  STAY_TOTAL int null,
  REST_TOTAL int null,
  STAY_ROOM int null,
  REST_ROOM int null,
  SERVICE int null,
  TEL int null,
  ITEM4202 int null,
  ITEM4203 int null,
  ITEM4204 int null,
  ITEM4205 int null,
  ITEM4206 int null,
  ITEM4207 int null,
  ITEM4208 int null,
  ITEM4209 int null,
  REST_ADD int null,
  LAST_NOPAY int null,
  ACC_BACK int null,
  FOC int null,
  CASH int null,
  CREDIT int null,
  MUST_PAY int null,
  TOTAL_ROOM int null,
  OR_MNY_RECEIVE int null,
  OR_MNY_REVERSE int null,
  BANK_CHECK int null,
  ELEC_PAY int null,
  POST_PAY int null,
  POST_CHECK int null,
  PRESENT_PAY int null,
  FAX int null,
  GROUP_ROOM int null,
  GROUP_INCOME int null,
  ACC_START varchar(19) null,
  ACC_END varchar(19) null,
  TRAN_TIME varchar(19) null,
  ACC_NO varchar(15) null,
  STAYALLRMCNT int null,
  RESTALLRMCNT int null,
  ITEM1103 int null,
  ITEM2102 int null,
  PERSON_S int null,
  PERSON_R int null,
  RV_ROOM int null,
  DRIVER_ROOM int null,
  FOC_ROOM int null,
  CAR float null,
  EXTRABED int null,
  SROOM int null,
  SROOMADD int null,
  SROOMTICKET int null,
  SEXTRABED int null,
  SRESTADD int null,
  STEL int null,
  SFAX int null,
  SITEM4202 int null,
  SITEM4203 int null,
  SITEM4204 int null,
  SITEM4209 int null,
  PR_MNY_RECEIVE int null,
  PR_MNY_REVERSE int null,
  OTHER_SOURCE int null,
  OTHER_COLLECT int null,
  PAY_FOR_HOTEL int null,
  REWORD int null,
  TRANTOVIP varchar(1) null,
  DCOST int null,
  BREAKFAST int null,
  LUNCH int null,
  WOOD_ROOM int null,
  REDUCE int null,
  COMMISSION int null,
  ACC_IN int null,
  ACC_OUT int null,
  OOO int null,
  INCOME_CORP int null,
  INCOME_GROUP int null,
  INCOME_FIT int null,
  INCOME_WI int null,
  GUEST_CORP int null,
  GUEST_GROUP int null,
  GUEST_FIT int null,
  GUEST_WI int null,
  ROOM_CORP int null,
  ROOM_GROUP int null,
  ROOM_FIT int null,
  ROOM_WI int null,
  TODAYRECBACK int null,
  TODAYMUSTPAYADD int null,
  TODAYTMPBACK int null,
  TODAYTMPADD int null,
  ATM int null,
  EXTRABEDQTY int null,
  SUITEROOM int null,
  SUITEPERSON int null,
  GROUPPERSON int null,
  SPRING_ROOM int null,
  SPRING_TOTAL int null,
  PERSON_SPRING int null,
  SERVICE_SPRING int null,
  BREAKFASTSUITEMNY int null,
  BREAKFASTSUITEMNY_YEST int null,
  ITEM1105 int null,
  PREPAYADD int null,
  PREPAYUSE int null,
  MONTH_TOTAL int null,
  MONTH_ROOM int null,
  TIP int null,
  STAY_ROOM_BED numeric(10,4) null,
  SUITEROOM_BED numeric(10,4) null,
  FOC_ROOM_BED numeric(10,4) null,
  RV_ROOM_BED numeric(10,4) null,
  GROUP_ROOM_BED numeric(10,4) null,
  DRIVER_ROOM_BED numeric(10,4) null,
  ROOM_CORP_BED numeric(10,4) null,
  ROOM_GROUP_BED numeric(10,4) null,
  ROOM_WI_BED numeric(10,4) null,
  ROOM_FIT_BED numeric(10,4) null,
  MONTH_ROOM_BED numeric(10,4) null,
  STAYALLRMCNT_BED numeric(10,4) null,
  OOO_BED numeric(10,4) null
);

Create Table DayRptOut
(
  SERIAL int null,
  DDATE varchar(19) null,
  SA_SERIAL int null,
  SORT varchar(10) null,
  ROOM varchar(5) null,
  IN_DATE varchar(19) null,
  OUT_DATE varchar(19) null,
  KIND varchar(4) null,
  DISCOUNT varchar(10) null,
  NAME varchar(30) null,
  ROOM_RATE int null,
  SERVICE int null,
  TEL int null,
  ITEM4202 int null,
  ITEM4203 int null,
  ITEM4204 int null,
  ITEM4205 int null,
  ITEM4206 int null,
  ITEM4207 int null,
  ITEM4208 int null,
  ITEM4209 int null,
  LAST_NOPAY int null,
  FOC int null,
  CASH int null,
  CREDIT int null,
  MUST_PAY int null,
  REST_ADD int null,
  BU_TOTAL int null,
  CB_NAME varchar(50) null,
  ACC_BACK int null,
  OR_MNY_RECEIVE int null,
  OR_MNY_REVERSE int null,
  BANK_CHECK int null,
  ELEC_PAY int null,
  POST_PAY int null,
  POST_CHECK int null,
  PRESENT_PAY int null,
  FAX int null,
  ITEM1103 int null,
  ITEM2102 int null,
  EXTRABED int null,
  PR_MNY_RECEIVE int null,
  PR_MNY_REVERSE int null,
  PR_MNY_TOT int null,
  OTHER_SOURCE int null,
  OTHER_COLLECT int null,
  PAY_FOR_HOTEL int null,
  REWORD int null,
  INV_NO1 varchar(10) null,
  INV_NO2 varchar(10) null,
  ORDER_NO varchar(12) null,
  OUT_SERIAL int null,
  ACC_IN int null,
  ACC_OUT int null,
  SALEREMARK varchar(40) null,
  REDUCE int null,
  COMMISSION int null,
  INV_TAX1 int null,
  INV_TAX2 int null,
  ORMNYSERIAL int null,
  INV_SALE1 int null,
  INV_SALE2 int null,
  TODAYRECBACK int null,
  TODAYMUSTPAYADD int null,
  TODAYTMPBACK int null,
  TODAYTMPADD int null,
  ATM int null,
  PERSON_S int null,
  SUITEPERSON int null,
  ITEM1105 int null,
  PREPAYUSE int null,
  PREPAYADD int null,
  TIMES int null,
  TIP int null,
  DESK_NO varchar(1) null,
  OUT_TOTAL int null
);

Create Table DayTotDOut
(
  DDATE varchar(10) null,
  ITEM varchar(8) null,
  TOTAL int null,
  UNPAYSERIAL int null,
  ORMNYSERIAL int null,
  FOUTSERIAL int null,
  ORDER_NO varchar(12) null,
  DEPNAME varchar(20) null,
  REMARK varchar(40) null,
  OSORT varchar(10) null
);

// V7.3.64 2014.03.05
alter Table Or_Order Add WEB_REC varchar(1) null;

// V7.3.72 2014.03.14
alter Table Fare_fa Add OUT_ADD varchar(1) null;

// V7.3.74 2014.03.17
Create Table LogBook_M
(
  Serial int not null,
  DDATE varchar(16) null,
  Detail Text null,
  CheckDate varchar(16) null,
  Desk varchar(14) null,
  MDate varchar(16) null
);

Create Table LogBook_D
(
  Serial int Identity(1,1) not null,
  SerialM int null,
  ODesk varchar(14) null,
  RDate varchar(16) null,
  CDate varchar(16) null
);

Create Table LogBook_Attend
(
  Serial int Identity(1,1) not null,
  SerialD int null,
  DDATE varchar(16) null,
  PDetail Text null,
  ADesk varchar(10) null,
  ADate varchar(16) null,
  MDesk varchar(10) null,
  MDate varchar(16) null
);

// V7.3.77 2014.03.21
alter Table Base_ba Add TEL_CAN_DIAL varchar(1) null;

// V7.3.83 2014.03.31
alter Table HotelUser Add DEPNAME varchar(20) null;

// V7.3.93 2014.04.15
Create Table MiasCardLog
(
  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,
  DESK varchar(14) null,
  KIND varchar(4) null,
  BAD varchar(1) null,
);

// V7.3.94 2014.04.16
Create Table QArrangeShowSet 
(
  Serial int identity(1,1) not null,
  Kind varchar(16) not null,
  Show varchar(1) null,
  Size int null,
  Length int null,
  X int null,
  Y int null,
  Primary Key(Kind)
);
Create Table QArrangeShowAllSet 
(
  Serial int identity(1,1) not null,
  Kind varchar(16) not null,
  Show varchar(1) null,
  Size int null,
  Length int null,
  X int null,
  Y int null,
  Primary Key(Kind)
);
Create Table QArrangeSet
(
  PName varchar(30) null,
  PValue varchar(400) null
);

// V7.3.101 2014.04.22
alter Table Nation Add NAGROUP varchar(20) null;
Create Table NationGroup
(
  SERIAL int identity(1,1) not null,
  NAME varchar(20) null 
);