/**Begin D:\PDM\pdm_upgrade\pdm1\ER2_table.sql **/
/** 一键报销流程服务配置表 **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_REIMSERVICEPG')
CREATE TABLE T_ER_REIMSERVICEPG (
                                    FID BIGINT DEFAULT 0 NOT NULL,
                                    FNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
                                    FNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
                                    FSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
                                    FCREATORID BIGINT DEFAULT 0 NOT NULL,
                                    FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
                                    FENABLE VARCHAR(50) DEFAULT ' ' NOT NULL,
                                    FCREATETIME DATETIME,
                                    FMODIFYTIME DATETIME,
                                    FMASTERID BIGINT DEFAULT 0 NOT NULL,
                                    FCLIENTTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
                                    FCLASSNAME VARCHAR(255) DEFAULT ' ' NOT NULL,
                                    FFORMID VARCHAR(255) DEFAULT ' ' NOT NULL,
                                    FBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL
);

/** 一键报销流程服务配置表多语言表 **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_REIMSERVICEPG_L')
CREATE TABLE T_ER_REIMSERVICEPG_L (
                                    FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
                                    FID BIGINT DEFAULT 0 NOT NULL,
                                    FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
                                    FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL
);


EXEC P_ALTERPK 'PK_T_ER_REIMSERVICEPG', 'T_ER_REIMSERVICEPG', 'FID', '0';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_NUMBER') CREATE INDEX INDEX_NUMBER ON T_ER_REIMSERVICEPG ( FNUMBER );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_CLUSTER') CREATE  CLUSTERED INDEX INDEX_CLUSTER ON T_ER_REIMSERVICEPG ( FCLIENTTYPE ,FNAME );

EXEC P_ALTERPK 'PK_T_ER_REIMSERVICEPG_L', 'T_ER_REIMSERVICEPG_L', 'FPKID', '0';
/**End D:\PDM\pdm_upgrade\pdm1\ER2_table.sql **/
