-- 项目奖金核算_奖金周期表
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_PB_BonusCycle')
Create Table CT_PB_BonusCycle ( FFivouchered INT DEFAULT 0,CFName_l1 NVARCHAR(255),CFName_l2 NVARCHAR(255),CFName_l3 NVARCHAR(255),CFCycleName VARCHAR(100),CFState INT DEFAULT 0 NOT NULL ,CFReminderContent VARCHAR(2000),FNumber NVARCHAR(80),FBizDate DateTime,FHandlerID VARCHAR(44),FDescription VARCHAR(512),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_BonusCycle PRIMARY KEY (FID));

-- 项目奖金核算_事业部项目表
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_PB_BonusCycleBusDepProject')
Create Table CT_PB_BonusCycleBusDepProject ( FParentID VARCHAR(44),CFBusDepID VARCHAR(44),CFSecondcenterID VARCHAR(44),CFType VARCHAR(100),CFProjectID VARCHAR(44),CFState INT DEFAULT 0,CFPrincipalID VARCHAR(44),CFBonusAmount NUMERIC(28,10),CFNotPrincipalPropor NUMERIC(28,10),CFPrincipalPropor NUMERIC(28,10),CFTotalBonusHalf NUMERIC(28,10),CFDirectManProjBonus NUMERIC(28,10),CFContraManProjBonus NUMERIC(28,10),CFCondManProjectBonus NUMERIC(28,10),CFStraManProjectBonus NUMERIC(28,10),CFBonusAdjustment NUMERIC(28,10),CFBonusAdjustmentDesc VARCHAR(255),CFTotalBonusReal NUMERIC(28,10),CFInitialAllocationRatio1 NUMERIC(28,10),CFInitialAllocationRatio2 NUMERIC(28,10),CFInitialAllocationRatio3 NUMERIC(28,10),FSeq INT,FID VARCHAR(44) DEFAULT '' NOT NULL ,CFProjectPrincipal VARCHAR(44),CONSTRAINT PK_BonusCycleBusDe PRIMARY KEY (FID));

-- 项目奖金核算_分配人员明细表
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_PB_BonusCAPD')
Create Table CT_PB_BonusCAPD ( FParentID VARCHAR(44) DEFAULT '',CFPersonID VARCHAR(44),CFPositionID VARCHAR(44),CFGradeID VARCHAR(44),CFInitialProportion NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFFunctionCoefficient NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFEnergyInputCoeff NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFPerformanceGradeQ1 VARCHAR(100),CFPerformanceCoeffQ1 NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFPerformanceGradeQ2 VARCHAR(100),CFPerformanceCoeffQ2 NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFAssessmentCoeff NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFBonusStartingDate DateTime,CFBonusDueDate DateTime,CFAttendanceRate NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFCumulative NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFBonusProportion NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFIndivBonusAmount NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFOpinionAmount NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFAdjustmentDesc VARCHAR(1000),CFApprovalAmount NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFRemarks VARCHAR(1000),FSeq INT,FID VARCHAR(44) DEFAULT '' NOT NULL ,CONSTRAINT PK_BonusCycleBusDe PRIMARY KEY (FID));

