-- 同步事务日志表
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_LOG_SyncLog')
Create Table CT_LOG_SyncLog ( FCreatorID VARCHAR(44),FCreateTime DateTime,FLastUpdateUserID VARCHAR(44),FLastUpdateTime DateTime,FControlUnitID VARCHAR(44),FNumber NVARCHAR(80),FBizDate DateTime,FHandlerID VARCHAR(44),FDescription NVARCHAR(80),FHasEffected INT,FAuditorID VARCHAR(44),FSourceBillID NVARCHAR(80),FSourceFunction NVARCHAR(80),FID VARCHAR(44) DEFAULT '' NOT NULL ,FFivouchered INT,CFEntityName VARCHAR(100),CFDataDirection VARCHAR(100),CFDockingSystem VARCHAR(100),CFSyncStatus VARCHAR(100),CFSyncResult NCLOB(1000),CFSynctime DateTime,CFSyncCount INT,CFSuccessNum INT,CFFailNum INT,CFRequestParams NCLOB(1000),CONSTRAINT CPK_LOG_SyncLog1h1 PRIMARY KEY (FID));

-- 面谈记录表
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_PER_InterviewRecord')
Create Table CT_PER_InterviewRecord ( FCreatorID VARCHAR(44),FCreateTime DateTime,FLastUpdateUserID VARCHAR(44),FLastUpdateTime DateTime,FControlUnitID VARCHAR(44),FNumber NVARCHAR(80),FBizDate DateTime,FHandlerID VARCHAR(44),FDescription NVARCHAR(80),FHasEffected INT,FAuditorID VARCHAR(44),FSourceBillID NVARCHAR(80),FSourceFunction NVARCHAR(80),FID VARCHAR(44) DEFAULT '' NOT NULL ,CFInterviewTime DateTime,CFInterviewResult NCLOB(2000),CFInterviewerID VARCHAR(44),CFGradeLevel NVARCHAR(100),CFEvaResultID VARCHAR(44),CONSTRAINT CPK_PER_IntrvRIrht PRIMARY KEY (FID));

-- 累计考勤异常提醒记录
CREATE TABLE T_Remind_Record (
    ID INT IDENTITY(1,1) PRIMARY KEY,  -- 自增主键
    yearMonth VARCHAR(10) NOT NULL,
    personNumber VARCHAR(50) NOT NULL
);

-- 考勤异常提醒记录表
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_ATT_AttendanceExceptionLog')
Create Table CT_ATT_AttendanceExceptionLog ( FFivouchered INT DEFAULT 0,CFPushResult VARCHAR(2000),CFPushType VARCHAR(100),CFMessageResponse CLOB(2000),CFMessageRequest CLOB(2000),CFDataPushResponse CLOB(2000),CFDataPushRequest CLOB(2000),CFPushStatus INT DEFAULT 1,FNumber NVARCHAR(80),FBizDate DateTime,FHandlerID VARCHAR(44),FDescription VARCHAR(255),FHasEffected INT,FAuditorID VARCHAR(44),FSourceBillID VARCHAR(80),FSourceFunction VARCHAR(80),FCreatorID VARCHAR(44),FCreateTime DateTime,FLastUpdateUserID VARCHAR(44),FLastUpdateTime DateTime,FControlUnitID VARCHAR(44),FID VARCHAR(44) DEFAULT '' NOT NULL ,CFMessageId NVARCHAR(255),CONSTRAINT PK_AttendanceExcep PRIMARY KEY (FID));

-- 中心负责人关系表分录
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_ATT_CenterLRE')
Create Table CT_ATT_CenterLRE ( FID VARCHAR(44) DEFAULT '' NOT NULL ,FSeq INT DEFAULT 0 NOT NULL ,FParentID VARCHAR(44) DEFAULT '' NOT NULL ,CFSeq INT,CFPersonID VARCHAR(44),CONSTRAINT CPK_ATT_CenterLg0n PRIMARY KEY (FID));

-- 中心负责人关系表主表
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_ATT_CenterLeaderRelation')
Create Table CT_ATT_CenterLeaderRelation ( FCreatorID VARCHAR(44),FCreateTime DateTime,FLastUpdateUserID VARCHAR(44),FLastUpdateTime DateTime,FControlUnitID VARCHAR(44),FNumber NVARCHAR(80),FBizDate DateTime,FHandlerID VARCHAR(44),FDescription NVARCHAR(80),FHasEffected INT,FAuditorID VARCHAR(44),FSourceBillID NVARCHAR(80),FSourceFunction NVARCHAR(80),FID VARCHAR(44) DEFAULT '' NOT NULL ,CFDepartmentID VARCHAR(44),CFNotifyOrgLeader INT,CFPersonIds NVARCHAR(2000),CFPersonNames NVARCHAR(2000),CFPersonNumbers NVARCHAR(2000),CONSTRAINT CPK_ATT_CenterLrce PRIMARY KEY (FID));

-- 工作交接单
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_HAN_WorkHandover')
Create Table CT_HAN_WorkHandover ( 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(80),FCreatorID VARCHAR(44),FCreateTime DateTime,FLastUpdateUserID VARCHAR(44),FLastUpdateTime DateTime,FControlUnitID VARCHAR(44),FID VARCHAR(44) DEFAULT '' NOT NULL ,CONSTRAINT PK_WorkHandover PRIMARY KEY (FID));

-- 工作交接单分录
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_HAN_WorkHandoverEntry')
Create Table CT_HAN_WorkHandoverEntry ( FParentID VARCHAR(44),CFPersonID VARCHAR(44),CFAdminOrgID VARCHAR(44),CFWorkReceiver1ID VARCHAR(44),CFWorkReceiver2ID VARCHAR(44),CFWorkReceiver3ID VARCHAR(44),CFApproverHandover VARCHAR(44),CFCFHandoverChecklist VARCHAR(255),CFCFPaperFileList VARCHAR(255),CFCFDigitalFileList VARCHAR(255),CFCFWorkHourFilling VARCHAR(255),CFCFWarehouseItems VARCHAR(255),CFCFAdminItemsHandover VARCHAR(255),CFCFUtilities VARCHAR(255),CFCFBonus VARCHAR(255),CFCFPenalty VARCHAR(255),CFCFSalary VARCHAR(255),CFCFLoan VARCHAR(255),CFCFExpense VARCHAR(255),CFCFOther VARCHAR(255),CFCFMealSettlement VARCHAR(255),CFResignBizBillEntryId VARCHAR(100),FSeq INT,FID VARCHAR(44) DEFAULT '' NOT NULL ,CFResignYear INT,CFResignMonth INT,CFResignDay INT,CFResignBizBillID VARCHAR(44),CONSTRAINT PK_WorkHandoverEnt PRIMARY KEY (FID));

