-- 项目奖金核算_奖金周期表
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_PB_BonusCycle')
Create Table CT_PB_BonusCycle ( 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,CFCycleName NVARCHAR(100),CFState INT,CONSTRAINT CPK_PB_BonusCycmjs 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),CFPrincipalID VARCHAR(44),CFNotPrincipalPropor NUMERIC(28,10),CFPrincipalPropor NUMERIC(28,10),CFBonusAmount NUMERIC(28,10),CFTotalBonusHalf NUMERIC(28,10),CFTotalBonusReal 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),CFInitialAllocationRatio1 NUMERIC(28,10),CFInitialAllocationRatio2 NUMERIC(28,10),CFInitialAllocationRatio3 NUMERIC(28,10),CFBusDepID VARCHAR(44),CFType VARCHAR(100),CFProjectID VARCHAR(44),FSeq INT,FID VARCHAR(44) DEFAULT '' NOT NULL ,CFState INT,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),CFIndivBonusAmount NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFBonusProportion NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFAttendanceRate NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFFunctionCoefficient NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFEnergyInputCoeff NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFGradeID VARCHAR(44),CFRankCoefficient NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFPerformanceGradeQ1 VARCHAR(100),CFPerformanceGradeQ2 VARCHAR(100),CFPerformanceCoeffQ1 NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFPerformanceCoeffQ2 NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFAssessmentCoeff NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFCumulative NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFRemarks VARCHAR(255),CFBonusDueDate DateTime,CFBonusStartingDate DateTime,CFInitialProportion NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFBonusSubcontract NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFApprovalAmount NUMERIC(28,10) DEFAULT 0 NOT NULL ,CFAdjustmentDesc VARCHAR(255),CFOpinionAmount NUMERIC(28,10) DEFAULT 0 NOT NULL ,FSeq INT,FID VARCHAR(44) DEFAULT '' NOT NULL ,CONSTRAINT PK_BonusCycleBusDe PRIMARY KEY (FID));

