/**Begin D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_RESASSESSBILL') 
 CREATE TABLE T_MRP_RESASSESSBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FLOG BIGINT DEFAULT 0 NOT NULL,
FSCHEME BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_RESASSESSBILLENTRY') 
 CREATE TABLE T_MRP_RESASSESSBILLENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSUPSTIME DATETIME,
FSUPETIME DATETIME,
FMATERIAL BIGINT DEFAULT 0 NOT NULL,
FUNIT BIGINT DEFAULT 0 NOT NULL,
FALLOWANCEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSHORTAGEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREQSTIME DATETIME,
FREQETIME DATETIME,
FREQBILLNO VARCHAR(200) DEFAULT ' ' NOT NULL,
FPROJECT BIGINT DEFAULT 0 NOT NULL,
FREQORG BIGINT DEFAULT 0 NOT NULL,
FPTYPE VARCHAR(5) DEFAULT ' ' NOT NULL,
FCARDID BIGINT DEFAULT 0 NOT NULL,
FREQBILLTAGNAME NVARCHAR(80) DEFAULT ' ' NOT NULL,
FREQBILLTAG VARCHAR(80) DEFAULT ' ' NOT NULL,
FREQQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREQUSETIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUPBILLNO VARCHAR(200) DEFAULT ' ' NOT NULL,
FSUPBILLTAGNAME NVARCHAR(80) DEFAULT ' ' NOT NULL,
FSUPBILLTAG VARCHAR(80) DEFAULT ' ' NOT NULL,
FSUPQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUPUSETIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISSAME CHAR(1) DEFAULT '0' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_TLNEEDPLANENTRY' AND KSQL_COL_NAME ='FUSETIME') 
 ALTER TABLE T_MSPLAN_TLNEEDPLANENTRY ADD (FUSETIME DECIMAL(23,10) DEFAULT 0 NOT NULL );


/**End D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_table.sql **/
