/**Begin C:\PDM_UPGRADE\PDM1\SRM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRM_EVAPLAN') 
 CREATE TABLE T_SRM_EVAPLAN (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FFINISHDATE DATETIME,
FEVATYPEID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCATEGORYID BIGINT DEFAULT 0 NOT NULL,
FSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FGRADEID BIGINT DEFAULT 0 NOT NULL,
FPERIOD CHAR(1) DEFAULT ' ' NOT NULL,
FDATEFROM DATETIME,
FDATETO DATETIME,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FISTYPESCORER CHAR(1) DEFAULT '0' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME,
FDATETIMEFROM DATETIME,
FDATETIMETO DATETIME,
FEVAMETHOD CHAR(1) DEFAULT 'A' NOT NULL,
FGROUPEVAPLANNOID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRM_EVAPLAN_A') 
 CREATE TABLE T_SRM_EVAPLAN_A (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FTERMINATERID BIGINT DEFAULT 0 NOT NULL,
FTERMINATEDATE DATETIME,
FTERMINATION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FPUSHNOTICE CHAR(1) DEFAULT '0' NOT NULL,
FPUSHSCORE CHAR(1) DEFAULT '0' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRM_EVAPLAN_L') 
 CREATE TABLE T_SRM_EVAPLAN_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRM_EVASCORERENTRY') 
 CREATE TABLE T_SRM_EVASCORERENTRY (
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FINDEXCLASSID BIGINT DEFAULT 0 NOT NULL,
FSCORERID BIGINT DEFAULT 0 NOT NULL,
FSCORERWEIGHT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCORERNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRM_EVAPLANENTRY') 
 CREATE TABLE T_SRM_EVAPLANENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCATEGORYID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FWEIGHTSTRATEGY VARCHAR(2) DEFAULT ' ' NOT NULL,
FGRADEID BIGINT DEFAULT 0 NOT NULL
);



/**End C:\PDM_UPGRADE\PDM1\SRM_table.sql **/
