/** 新增部门额度表 **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_DEPT_REIMCTL') 
 CREATE TABLE T_ER_DEPT_REIMCTL (
FID BIGINT DEFAULT 0 NOT NULL,
FAMOUNTTYPE CHAR(1) DEFAULT '2' NOT NULL,
FCOMPANY BIGINT DEFAULT 0 NOT NULL,
FDEPT BIGINT DEFAULT 0 NOT NULL,
FEMPLOYEE BIGINT DEFAULT 0 NOT NULL,
FEXPENSEITEM BIGINT DEFAULT 0 NOT NULL,
FCURRENCY BIGINT DEFAULT 0 NOT NULL,
FDATEYEAR VARCHAR(4) DEFAULT ' ' NOT NULL,
FAMOUNTCHANGEFLAG CHAR(1) DEFAULT '0' NOT NULL,
FTOTALAMOUNT DECIMAL(23,10) DEFAULT 0.000000 NOT NULL,
FJANUARYAMOUNT DECIMAL(23,10) DEFAULT 0.000000 NOT NULL,
FFEBRUARYAMOUNT DECIMAL(23,10) DEFAULT 0.000000 NOT NULL,
FMARCHAMOUNT DECIMAL(23,10) DEFAULT 0.000000 NOT NULL,
FAPRILAMOUNT DECIMAL(23,10) DEFAULT 0.000000 NOT NULL,
FMAYAMOUNT DECIMAL(23,10) DEFAULT 0.000000 NOT NULL,
FJUNEAMOUNT DECIMAL(23,10) DEFAULT 0.000000 NOT NULL,
FJULYAMOUNT DECIMAL(23,10) DEFAULT 0.000000 NOT NULL,
FAUGUSTAMOUNT DECIMAL(23,10) DEFAULT 0.000000 NOT NULL,
FSEPTEMBERAMOUNT DECIMAL(23,10) DEFAULT 0.000000 NOT NULL,
FOCTOBERAMOUNT DECIMAL(23,10) DEFAULT 0.000000 NOT NULL,
FNOVEMBERAMOUNT DECIMAL(23,10) DEFAULT 0.000000 NOT NULL,
FDECEMBERAMOUNT DECIMAL(23,10) DEFAULT 0.000000 NOT NULL,
FAUDITSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FAUDITOR BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FCREATETIME DATETIME,
FCREATOR BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FMODIFIER BIGINT DEFAULT 0 NOT NULL
);


/**增加主键和索引*/
 EXEC P_ALTERPK 'PK_T_ER_DEPT_REIMCTL', 'T_ER_DEPT_REIMCTL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_DEPT_REIMCTLT_EMP') CREATE INDEX IDX_ER_DEPT_REIMCTLT_EMP ON T_ER_DEPT_REIMCTL ( FEMPLOYEE ,FEXPENSEITEM ,FDATEYEAR );

