-- 入住申请单分录
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_APP_CheckInAE')
Create Table CT_APP_CheckInAE ( FParentID VARCHAR(44),CFPersonID VARCHAR(44),CFAdminOrgID VARCHAR(44),CFPositionID VARCHAR(44),CFCheckInRoomID VARCHAR(44),CFNotes VARCHAR(2000),CFCheckInDate DateTime,CFCheckoutDate DateTime,CFOccupantsID VARCHAR(44),FSeq INT,FID VARCHAR(44) DEFAULT '' NOT NULL ,CONSTRAINT PK_CheckInAppliES PRIMARY KEY (FID));

-- 入住申请单
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_APP_CheckInApplication')
Create Table CT_APP_CheckInApplication ( FFivouchered INT DEFAULT 0,CFManagementNotes VARCHAR(2000),FAdminOrgUnitId VARCHAR(44),FHROrgUnitID VARCHAR(44),FBillState INT,FApproveType INT,FIsMultiEntry INT,FNumber NVARCHAR(80),FBizDate DateTime,FHandlerID VARCHAR(44),FDescription VARCHAR(255),FHasEffected INT,FAuditorID VARCHAR(44),FSourceBillID VARCHAR(80),FSourceFunction VARCHAR(255),FCreatorID VARCHAR(44),FCreateTime DateTime,FLastUpdateUserID VARCHAR(44),FLastUpdateTime DateTime,FControlUnitID VARCHAR(44),FID VARCHAR(44) DEFAULT '' NOT NULL ,CFErrorMsg NCLOB(1000),CONSTRAINT PK_CheckInAppliadf PRIMARY KEY (FID));

-- 退宿申请单分录
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_APP_CheckoutAE')
Create Table CT_APP_CheckoutAE ( FParentID VARCHAR(44),CFPersonID VARCHAR(44),CFAdminOrgID VARCHAR(44),CFPositionID VARCHAR(44),CFCurrentRoomID VARCHAR(44),CFCheckInDate DateTime,CFCheckoutDate DateTime,CFNotes VARCHAR(2000),CFOccupantsID VARCHAR(44),FSeq INT,FID VARCHAR(44) DEFAULT '' NOT NULL ,CFOldCheckoutDate DateTime,CONSTRAINT PK_CheckoutApplESF PRIMARY KEY (FID));

-- 退宿申请单
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_APP_CheckoutApplication')
Create Table CT_APP_CheckoutApplication ( FFivouchered INT DEFAULT 0,FAdminOrgUnitId VARCHAR(44),FHROrgUnitID VARCHAR(44),FBillState INT,FApproveType INT,FIsMultiEntry INT,FNumber NVARCHAR(80),FBizDate DateTime,FHandlerID VARCHAR(44),FDescription VARCHAR(255),FHasEffected INT,FAuditorID VARCHAR(44),FSourceBillID VARCHAR(80),FSourceFunction VARCHAR(255),FCreatorID VARCHAR(44),FCreateTime DateTime,FLastUpdateUserID VARCHAR(44),FLastUpdateTime DateTime,FControlUnitID VARCHAR(44),FID VARCHAR(44) DEFAULT '' NOT NULL ,CFManagementNotes NVARCHAR(2000),CFErrorMsg NVARCHAR(1000),CONSTRAINT PK_CheckoutApplkje PRIMARY KEY (FID));

